Skip to content

Commit

Permalink
meta: Update readme, remove upgrade guide for now (getsentry#735)
Browse files Browse the repository at this point in the history
* meta: Update readme, remove upgrade guide for now

* fix: CS

* fix: Restore upgrade.md

* fix: CR
  • Loading branch information
HazAT authored Jan 11, 2019
1 parent adc312f commit e7fb87f
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 163 deletions.
121 changes: 11 additions & 110 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,7 @@

The Sentry PHP error reporter tracks errors and exceptions that happen during the
execution of your application and provides instant notification with detailed
informations needed to prioritize, identify, reproduce and fix each issue. Learn
more about [automatic PHP error reporting with Sentry](https://sentry.io/for/php/).

## Features

- Automatically report (un)handled exceptions and errors
- Send customized diagnostic data
- Process and sanitize data before sending it over the network
information needed to prioritize, identify, reproduce and fix each issue.

## Install

Expand Down Expand Up @@ -51,30 +44,18 @@ and [`http-message-implementation`](https://packagist.org/providers/psr/http-mes
## Usage

```php
namespace XXX;

use Sentry\ClientBuilder;

require 'vendor/autoload.php';
use function Sentry\init;
use function Sentry\captureException;

// Instantiate the SDK with your DSN
$client = ClientBuilder::create(['server' => 'http://[email protected]/1'])->getClient();
init(['dsn' => '___PUBLIC_DSN___' ]);

// Capture an exception
$eventId = $client->captureException(new \RuntimeException('Hello World!'));

// Give the user feedback
echo 'Sorry, there was an error!';
echo 'Your reference ID is ' . $eventId;
try {
thisFunctionThrows(); // -> throw new \Exception('foo bar');
} catch (\Exception $exception) {
captureException($exception);
}
```

For more information, see our [documentation](https://docs.getsentry.com/hosted/clients/php/).


## Integration with frameworks

Other packages exists to integrate this SDK into the most common frameworks.

### Official integrations

The following integrations are fully supported and maintained by the Sentry team.
Expand All @@ -95,15 +76,11 @@ The following integrations are available and maintained by members of the Sentry

## Community

- [Documentation](https://docs.getsentry.com/hosted/clients/php/)
- [Documentation](https://docs.sentry.io/error-reporting/quickstart/?platform=php)
- [Bug Tracker](http://github.com/getsentry/sentry-php/issues)
- [Code](http://github.com/getsentry/sentry-php)
- [Mailing List](https://groups.google.com/group/getsentry)
- [IRC](irc://irc.freenode.net/sentry) (irc.freenode.net, #sentry)


Contributing
------------
## Contributing

Dependencies are managed through composer:

Expand All @@ -116,79 +93,3 @@ Tests can then be run via phpunit:
```
$ vendor/bin/phpunit
```


Tagging a Release
-----------------

1. Make sure ``CHANGES`` is up to date (add the release date) and ``master`` is green.

2. Create a new branch for the minor version (if not present):

```
$ git checkout -b releases/2.1.x
```

3. Update the hardcoded version tag in ``Client.php``:

```php
namespace Sentry;

class Client
{
const VERSION = '2.1.0';
}
```

4. Commit the change:

```
$ git commit -a -m "2.1.0"
```

5. Tag the branch:

```
git tag 2.1.0
```

6. Push the tag:

```
git push --tags
```

7. Switch back to ``master``:

```
git checkout master
```

8. Add the next minor release to the ``CHANGES`` file:

```
## 2.1.0 (unreleased)
```

9. Update the version in ``Client.php``:

```php
namespace Sentry;

class Client implements ClientInterface
{
const VERSION = '2.1.x-dev';
}
```

10. Lastly, update the composer version in ``composer.json``:

```json
"extra": {
"branch-alias": {
"dev-master": "2.1.x-dev"
}
}
```

All done! Composer will pick up the tag and configuration automatically.
4 changes: 2 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ public function getIntegration(string $className): ?IntegrationInterface
* Assembles an event and prepares it to be sent of to Sentry.
*
* @param array $payload the payload that will be converted to an Event
* @param null|Scope $scope optional scope which enriches the Event
* @param Scope|null $scope optional scope which enriches the Event
* @param bool $withStacktrace True if the event should have and attached stacktrace
*
* @return null|Event returns ready to send Event, however depending on options it can be discarded
* @return Event|null returns ready to send Event, however depending on options it can be discarded
*/
private function prepareEvent(array $payload, ?Scope $scope = null, bool $withStacktrace = false): ?Event
{
Expand Down
2 changes: 1 addition & 1 deletion src/ClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function __construct(Options $options = null)
$this->options = $options ?? new Options();

if ($this->options->hasDefaultIntegrations()) {
$this->options->setIntegrations(\array_merge([
$this->options->setIntegrations(array_merge([
new ErrorHandlerIntegration(),
new RequestIntegration($this->options),
], $this->options->getIntegrations()));
Expand Down
10 changes: 5 additions & 5 deletions src/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function getOptions(): Options;
* @param Severity $level The level of the message to be sent
* @param Scope|null $scope An optional scope keeping the state
*
* @return null|string
* @return string|null
*/
public function captureMessage(string $message, ?Severity $level = null, ?Scope $scope = null): ?string;

Expand All @@ -38,7 +38,7 @@ public function captureMessage(string $message, ?Severity $level = null, ?Scope
* @param \Throwable $exception The exception object
* @param Scope|null $scope An optional scope keeping the state
*
* @return null|string
* @return string|null
*/
public function captureException(\Throwable $exception, ?Scope $scope = null): ?string;

Expand All @@ -47,7 +47,7 @@ public function captureException(\Throwable $exception, ?Scope $scope = null): ?
*
* @param Scope|null $scope An optional scope keeping the state
*
* @return null|string
* @return string|null
*/
public function captureLastError(?Scope $scope = null): ?string;

Expand All @@ -57,7 +57,7 @@ public function captureLastError(?Scope $scope = null): ?string;
* @param array $payload The data of the event being captured
* @param Scope|null $scope An optional scope keeping the state
*
* @return null|string
* @return string|null
*/
public function captureEvent(array $payload, ?Scope $scope = null): ?string;

Expand All @@ -66,7 +66,7 @@ public function captureEvent(array $payload, ?Scope $scope = null): ?string;
*
* @param string $className the classname of the integration
*
* @return null|IntegrationInterface
* @return IntegrationInterface|null
*/
public function getIntegration(string $className): ?IntegrationInterface;
}
16 changes: 8 additions & 8 deletions src/Context/UserContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class UserContext extends Context
/**
* Gets the ID of the user.
*
* @return null|string
* @return string|null
*/
public function getId(): ?string
{
Expand All @@ -23,7 +23,7 @@ public function getId(): ?string
/**
* Sets the ID of the user.
*
* @param null|string $id The ID
* @param string|null $id The ID
*/
public function setId(?string $id): void
{
Expand All @@ -33,7 +33,7 @@ public function setId(?string $id): void
/**
* Gets the username of the user.
*
* @return null|string
* @return string|null
*/
public function getUsername(): ?string
{
Expand All @@ -43,7 +43,7 @@ public function getUsername(): ?string
/**
* Sets the username of the user.
*
* @param null|string $username The username
* @param string|null $username The username
*/
public function setUsername(?string $username): void
{
Expand All @@ -53,7 +53,7 @@ public function setUsername(?string $username): void
/**
* Gets the email of the user.
*
* @return null|string
* @return string|null
*/
public function getEmail(): ?string
{
Expand All @@ -63,7 +63,7 @@ public function getEmail(): ?string
/**
* Sets the email of the user.
*
* @param null|string $email The email
* @param string|null $email The email
*/
public function setEmail(?string $email): void
{
Expand All @@ -73,7 +73,7 @@ public function setEmail(?string $email): void
/**
* Gets the ip address of the user.
*
* @return null|string
* @return string|null
*/
public function getIpAddress(): ?string
{
Expand All @@ -83,7 +83,7 @@ public function getIpAddress(): ?string
/**
* Sets the ip address of the user.
*
* @param null|string $ipAddress The ip address
* @param string|null $ipAddress The ip address
*/
public function setIpAddress(?string $ipAddress): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/EventFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function createWithStacktrace(array $payload): Event
$event = $this->create($payload);

if (!$event->getStacktrace()) {
$stacktrace = Stacktrace::createFromBacktrace($this->options, $this->serializer, $this->representationSerializer, \debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), __FILE__, __LINE__);
$stacktrace = Stacktrace::createFromBacktrace($this->options, $this->serializer, $this->representationSerializer, debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), __FILE__, __LINE__);

$event->setStacktrace($stacktrace);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Integration/RequestIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function setupOnce(): void
*
* @param self $self The current instance of RequestIntegration
* @param Event $event The event that will be enriched with a request
* @param null|ServerRequestInterface $request The Request that will be processed and added to the event
* @param ServerRequestInterface|null $request The Request that will be processed and added to the event
*/
public static function applyToEvent(self $self, Event $event, ?ServerRequestInterface $request = null): void
{
Expand Down Expand Up @@ -110,7 +110,7 @@ private function removePiiFromHeaders(array $headers): array
$keysToRemove = ['authorization', 'cookie', 'set-cookie', 'remote_addr'];

return array_filter($headers, function ($key) use ($keysToRemove) {
return !\in_array(\strtolower($key), $keysToRemove, true);
return !\in_array(strtolower($key), $keysToRemove, true);
}, ARRAY_FILTER_USE_KEY);
}
}
4 changes: 2 additions & 2 deletions src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function setEnableCompression(bool $enabled): void
/**
* Gets the environment.
*
* @return null|string
* @return string|null
*/
public function getEnvironment(): ?string
{
Expand Down Expand Up @@ -718,7 +718,7 @@ private function normalizeAbsolutePath($value)
* @param SymfonyOptions $options The configuration options
* @param mixed $dsn The actual value of the option to normalize
*
* @return null|string
* @return string|null
*/
private function normalizeDsnOption(SymfonyOptions $options, $dsn): ?string
{
Expand Down
8 changes: 4 additions & 4 deletions src/Sdk.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function init(array $options = []): void
* @param string $message The message
* @param Severity $level The severity level of the message
*
* @return null|string
* @return string|null
*/
function captureMessage(string $message, ?Severity $level = null): ?string
{
Expand All @@ -35,7 +35,7 @@ function captureMessage(string $message, ?Severity $level = null): ?string
*
* @param \Throwable $exception The exception
*
* @return null|string
* @return string|null
*/
function captureException(\Throwable $exception): ?string
{
Expand All @@ -47,7 +47,7 @@ function captureException(\Throwable $exception): ?string
*
* @param array $payload The data of the event being captured
*
* @return null|string
* @return string|null
*/
function captureEvent(array $payload): ?string
{
Expand All @@ -57,7 +57,7 @@ function captureEvent(array $payload): ?string
/**
* Logs the most recent error (obtained with {@link error_get_last}).
*
* @return null|string
* @return string|null
*/
function captureLastError(): ?string
{
Expand Down
Loading

0 comments on commit e7fb87f

Please sign in to comment.