8000 bug #34662 [HttpKernel] Support typehint to deprecated FlattenExcepti… · symfony/symfony@f9e6f11 · GitHub
[go: up one dir, main page]

Skip to content

Commit f9e6f11

Browse files
bug #34662 [HttpKernel] Support typehint to deprecated FlattenException in controller (andrew-demb)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [HttpKernel] Support typehint to deprecated FlattenException in controller | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #34661 | License | MIT | Doc PR | We should support converting throwable to `FlattenException` with typehint to deprecated class also Commits ------- 26b4e37 [HttpKernel] Support typehint to deprecated FlattenException in controller
2 parents d72133e + 26b4e37 commit f9e6f11

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\HttpKernel\EventListener;
1313

1414
use Psr\Log\LoggerInterface;
15+
use Symfony\Component\Debug\Exception\FlattenException as LegacyFlattenException;
1516
use Symfony\Component\ErrorHandler\Exception\FlattenException;
1617
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
1718
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -98,7 +99,7 @@ public function onControllerArguments(ControllerArgumentsEvent $event)
9899
$r = new \ReflectionFunction(\Closure::fromCallable($event->getController()));
99100
$r = $r->getParameters()[$k] ?? null;
100101

101-
if ($r && (!$r->hasType() || FlattenException::class === $r->getType()->getName())) {
102+
if ($r && (!$r->hasType() || \in_array($r->getType()->getName(), [FlattenException::class, LegacyFlattenException::class], true])) {
102103
$arguments = $event->getArguments();
103104
$arguments[$k] = FlattenException::createFromThrowable($e);
104105
$event->setArguments($arguments);

0 commit comments

Comments
 (0)
0