-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Fix nullable types handling #20152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8b5e97f
to
bdcceea
Compare
The current code builds on top of a non existing semantical difference between |
bdcceea
to
e78f58c
Compare
Fixes the current failures on 3.1 for HHVM. |
@@ -27,7 +27,7 @@ | |||
*/ | |||
public function supports(Request $request, ArgumentMetadata $argument) | |||
{ | |||
return $argument->hasDefaultValue() || $argument->isNullable(); | |||
return $argument->hasDefaultValue() || ($argument->isNullable() && !$argument->isVariadic()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think variadic works here either way (php 7.0 and 7.1):
php > function (...$foo = []) {};
PHP Fatal error: Variadic parameter cannot have a default value in php shell code on line 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but variadics allow null: function foo(...$bar) {};
=> foo(null)
is allowed, that's the point here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah the previous case wouldn't even reach here, fair enough
e78f58c
to
97e43ac
Compare
97e43ac
to
0884518
Compare
Thank you @nicolas-grekas. |
This PR was merged into the 3.1 branch. Discussion ---------- [HttpKernel] Fix nullable types handling | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #19784 | License | MIT | Doc PR | - Commits ------- 0884518 [HttpKernel] Fix nullable types handling
Uh oh!
There was an error while loading. Please reload this page.