Skip to content

Commit ed92c99

Browse files
committed
bug symfony#41275 Fixes Undefined method call (faizanakram99)
This PR was submitted for the 5.x branch but it was merged into the 5.2 branch instead. Discussion ---------- 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; ``` | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Never break backward compatibility (see https://symfony.com/bc). - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too.) - Features and deprecations must be submitted against branch 5.x. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry --> Commits ------- 6dba988 Fixes Undefined method call
2 parents d1d83c2 + 6dba988 commit ed92c99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php

+1-1
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)