Skip to content

Commit 81720c6

Browse files
faizanakram99fabpot
authored andcommitted
Fixes Undefined method call
Psalm reported this ``` ERROR: UndefinedMethod - vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:185:148 - Method ReflectionType::isBuiltin does not exist (see https://psalm.dev/022) $configuratorClass = $configureRoutes->getNumberOfParameters() > 0 && ($type = $configureRoutes->getParameters()[0]->getType()) && !$type->isBuiltin() ? $type->getName() : null; ```
1 parent 38c5999 commit 81720c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Kernel/MicroKernelTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function loadRoutes(LoaderInterface $loader)
182182
throw new \LogicException(sprintf('"%s" uses "%s", but does not implement the required method "protected function configureRoutes(RoutingConfigurator $routes): void".', get_debug_type($this), MicroKernelTrait::class), 0, $e);
183183
}
184184

185-
$configuratorClass = $configureRoutes->getNumberOfParameters() > 0 && ($type = $configureRoutes->getParameters()[0]->getType()) && !$type->isBuiltin() ? $type->getName() : null;
185+
$configuratorClass = $configureRoutes->getNumberOfParameters() > 0 && ($type = $configureRoutes->getParameters()[0]->getType()) instanceof \ReflectionNamedType && !$type->isBuiltin() ? $type->getName() : null;
186186

187187
if ($configuratorClass && !is_a(RoutingConfigurator::class, $configuratorClass, true)) {
188188
trigger_deprecation('symfony/framework-bundle', '5.1', 'Using type "%s" for argument 1 of method "%s:configureRoutes()" is deprecated, use "%s" instead.', RouteCollectionBuilder::class, self::class, RoutingConfigurator::class);

0 commit comments

Comments
 (0)