Skip to content

Commit eb6eec1

Browse files
authored
Add Laravel 10 support (#630)
1 parent 18c8ca5 commit eb6eec1

File tree

4 files changed

+27
-24
lines changed

4 files changed

+27
-24
lines changed

.github/workflows/ci.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
matrix:
2121
php: [ "8.2", "8.1", "8.0", "7.4", "7.3", "7.2" ]
2222
packages:
23-
# All versions below should be test on PHP ^7.1 (Sentry SDK requirement)
23+
# All versions below should be test on PHP ^7.1 (Sentry SDK requirement) and PHP < 8.0 (PHPUnit requirement)
2424
- { laravel: ^6.0, testbench: 4.7.*, phpunit: 8.4.* }
2525
- { laravel: ^7.0, testbench: 5.1.*, phpunit: 8.4.* }
2626

@@ -29,21 +29,33 @@ jobs:
2929

3030
# All versions below only support PHP ^8.0 (Laravel requirement)
3131
- { laravel: ^9.0, testbench: ^7.0, phpunit: 9.5.* }
32+
33+
# All versions below only support PHP ^8.1 (Laravel requirement)
34+
- { laravel: ^10.0, testbench: ^8.0, phpunit: 9.5.* }
3235
exclude:
36+
- php: "7.2"
37+
packages: { laravel: ^8.0, testbench: ^6.0, phpunit: 9.3.* }
3338
- php: "7.2"
3439
packages: { laravel: ^9.0, testbench: ^7.0, phpunit: 9.5.* }
40+
- php: "7.2"
41+
packages: { laravel: ^10.0, testbench: ^8.0, phpunit: 9.5.* }
42+
3543
- php: "7.3"
3644
packages: { laravel: ^9.0, testbench: ^7.0, phpunit: 9.5.* }
45+
- php: "7.3"
46+
packages: { laravel: ^10.0, testbench: ^8.0, phpunit: 9.5.* }
47+
3748
- php: "7.4"
3849
packages: { laravel: ^9.0, testbench: ^7.0, phpunit: 9.5.* }
39-
40-
- php: "7.2"
41-
packages: { laravel: ^8.0, testbench: ^6.0, phpunit: 9.3.* }
50+
- php: "7.4"
51+
packages: { laravel: ^10.0, testbench: ^8.0, phpunit: 9.5.* }
4252

4353
- php: "8.0"
4454
packages: { laravel: ^6.0, testbench: 4.7.*, phpunit: 8.4.* }
4555
- php: "8.0"
4656
packages: { laravel: ^7.0, testbench: 5.1.*, phpunit: 8.4.* }
57+
- php: "8.0"
58+
packages: { laravel: ^10.0, testbench: ^8.0, phpunit: 9.5.* }
4759

4860
- php: "8.1"
4961
packages: { laravel: ^6.0, testbench: 4.7.*, phpunit: 8.4.* }

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Add Laravel 10 support (#630)
6+
57
## 3.1.3
68

79
- Increase debug trace limit count to 20 in `Integration::makeAnEducatedGuessIfTheExceptionMaybeWasHandled()` (#622)

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
],
2323
"require": {
2424
"php": "^7.2 | ^8.0",
25-
"illuminate/support": "^6.0 | ^7.0 | ^8.0 | ^9.0",
25+
"illuminate/support": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0",
2626
"sentry/sentry": "^3.12",
2727
"sentry/sdk": "^3.3",
2828
"symfony/psr-http-message-bridge": "^1.0 | ^2.0",
@@ -38,8 +38,8 @@
3838
},
3939
"require-dev": {
4040
"phpunit/phpunit": "^8.4 | ^9.3",
41-
"laravel/framework": "^6.0 | ^7.0 | ^8.0 | ^9.0",
42-
"orchestra/testbench": "^4.7 | ^5.1 | ^6.0 | ^7.0",
41+
"laravel/framework": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0",
42+
"orchestra/testbench": "^4.7 | ^5.1 | ^6.0 | ^7.0 | ^8.0",
4343
"friendsofphp/php-cs-fixer": "^3.11",
4444
"mockery/mockery": "^1.3"
4545
},

src/Sentry/Laravel/SentryHandler.php

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,22 @@
44

55
use Monolog\DateTimeImmutable;
66
use Monolog\Logger;
7+
use Monolog\LogRecord;
78
use Monolog\Formatter\LineFormatter;
89
use Monolog\Formatter\FormatterInterface;
910
use Monolog\Handler\AbstractProcessingHandler;
1011
use Sentry\Breadcrumb;
1112
use Sentry\Event;
13+
use Sentry\Monolog\CompatibilityProcessingHandlerTrait;
1214
use Sentry\Severity;
1315
use Sentry\State\HubInterface;
1416
use Sentry\State\Scope;
1517
use Throwable;
1618

1719
class SentryHandler extends AbstractProcessingHandler
1820
{
21+
use CompatibilityProcessingHandlerTrait;
22+
1923
/**
2024
* @var string the current application environment (staging|preprod|prod)
2125
*/
@@ -146,29 +150,14 @@ public function getBatchFormatter(): FormatterInterface
146150
*/
147151
protected function getLogLevel(int $logLevel): Severity
148152
{
149-
switch ($logLevel) {
150-
case Logger::DEBUG:
151-
return Severity::debug();
152-
case Logger::NOTICE:
153-
case Logger::INFO:
154-
return Severity::info();
155-
case Logger::WARNING:
156-
return Severity::warning();
157-
case Logger::ALERT:
158-
case Logger::EMERGENCY:
159-
case Logger::CRITICAL:
160-
return Severity::fatal();
161-
case Logger::ERROR:
162-
default:
163-
return Severity::error();
164-
}
153+
return $this->getSeverityFromLevel($logLevel);
165154
}
166155

167156
/**
168157
* {@inheritdoc}
169158
* @suppress PhanTypeMismatchArgument
170159
*/
171-
protected function write(array $record): void
160+
protected function doWrite($record): void
172161
{
173162
$exception = $record['context']['exception'] ?? null;
174163
$isException = $exception instanceof Throwable;

0 commit comments

Comments
 (0)