minor #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 #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
This commit is contained in:
commit
321fd382bd
@ -27,7 +27,7 @@ final class DefaultValueResolver implements ArgumentValueResolverInterface
|
||||
*/
|
||||
public function supports(Request $request, ArgumentMetadata $argument)
|
||||
{
|
||||
return $argument->hasDefaultValue() && !$request->attributes->has($argument->getName());
|
||||
return $argument->hasDefaultValue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user