Skip to content

Commit 0333f0c

Browse files
committed
[Routing] Fix BC break in AnnotationClassLoader defaults attributes handling
1 parent bcb28f6 commit 0333f0c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Loader/AnnotationClassLoader.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl
138138
}
139139

140140
$defaults = array_replace($globals['defaults'], $annot->getDefaults());
141+
foreach ($method->getParameters() as $param) {
142+
if (false !== strpos($globals['path'].$annot->getPath(), sprintf('{%s}', $param->getName())) && !isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) {
143+
$defaults[$param->getName()] = $param->getDefaultValue();
144+
}
145+
}
141146
$requirements = array_replace($globals['requirements'], $annot->getRequirements());
142147
$options = array_replace($globals['options'], $annot->getOptions());
143148
$schemes = array_merge($globals['schemes'], $annot->getSchemes());

0 commit comments

Comments
 (0)