Skip to content

Commit 321fd38

Browse files
committed
minor symfony#18575 Fixed a redundant check in DefaultValueResolver (iltar)
This PR was merged into the 3.1-dev branch. Discussion ---------- Fixed a redundant check in DefaultValueResolver | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ In symfony#18308 I have introduced a `DefaultValueResolver`. When writing documentation, I was planning on adding the code as an example and I noticed it did a check in the request attributes. A default value value should always be injected, whether the request has it or not. In case the request _does_ have the value, it would've already been added and thus never reach the default resolver. Thus as this is never called in the default and configured flows and should not change the default value behavior, I'm removing this. Commits ------- e54c1a6 Fixed a redundant check in DefaultValueResolver
2 parents 90e577c + e54c1a6 commit 321fd38

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class DefaultValueResolver implements ArgumentValueResolverInterface
2727
*/
2828
public function supports(Request $request, ArgumentMetadata $argument)
2929
{
30-
return $argument->hasDefaultValue() && !$request->attributes->has($argument->getName());
30+
return $argument->hasDefaultValue();
3131
}
3232

3333
/**

0 commit comments

Comments
 (0)