8000 [HttpKernel] Support typehint to deprecated FlattenException in contr… · symfony/symfony@26b4e37 · GitHub
[go: up one dir, main page]

Skip to content

Commit 26b4e37

Browse files
andrew-dembnicolas-grekas
authored andcommitted
[HttpKernel] Support typehint to deprecated FlattenException in controller
1 parent cde2538 commit 26b4e37

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