File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
src/Symfony/Bridge/Monolog
Tests/Handler/FingersCrossed Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1414use Monolog \Handler \FingersCrossed \ActivationStrategyInterface ;
1515use Monolog \LogRecord ;
1616use Symfony \Component \HttpFoundation \RequestStack ;
17- use Symfony \Component \HttpKernel \Exception \HttpException ;
17+ use Symfony \Component \HttpKernel \Exception \HttpExceptionInterface ;
1818
1919/**
2020 * Activation strategy that ignores certain HTTP codes.
@@ -49,7 +49,7 @@ public function isHandlerActivated(array|LogRecord $record): bool
4949 if (
5050 $ isActivated
5151 && isset ($ record ['context ' ]['exception ' ])
52- && $ record ['context ' ]['exception ' ] instanceof HttpException
52+ && $ record ['context ' ]['exception ' ] instanceof HttpExceptionInterface
5353 && ($ request = $ this ->requestStack ->getMainRequest ())
5454 ) {
5555 foreach ($ this ->exclusions as $ exclusion ) {
Original file line number Diff line number Diff line change 1818use Symfony \Bridge \Monolog \Tests \RecordFactory ;
1919use Symfony \Component \HttpFoundation \Request ;
2020use Symfony \Component \HttpFoundation \RequestStack ;
21- use Symfony \Component \HttpKernel \Exception \HttpException ;
21+ use Symfony \Component \HttpKernel \Exception \HttpExceptionInterface ;
2222
2323class HttpCodeActivationStrategyTest extends TestCase
2424{
@@ -74,6 +74,23 @@ public static function isActivatedProvider(): array
7474
7575 private static function getContextException (int $ code ): array
7676 {
77- return ['exception ' => new HttpException ($ code )];
77+ return ['exception ' => new class ($ code ) extends \RuntimeException implements HttpExceptionInterface {
78+ private int $ statusCode ;
79+
80+ public function __construct (int $ statusCode )
81+ {
82+ $ this ->statusCode = $ statusCode ;
83+ }
84+
85+ public function getStatusCode (): int
86+ {
87+ return $ this ->statusCode ;
88+ }
89+
90+ public function getHeaders (): array
91+ {
92+ return [];
93+ }
94+ }];
7895 }
7996}
You can’t perform that action at this time.
0 commit comments