-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
allow containing 0 or similar values except null. #26095
New issue
8000Have 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
otherwise, doc maybe add words like ' 0, false, [] are not be used with $containter->set()'.
Setting anything else than an object should be forbidden anyway and very likely to break (they should be stored as parameters) |
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.
Looks legit to me, does no harm, for 3.4
@@ -542,7 +542,7 @@ private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_ | |||
if (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior) { | |||
return parent::get($id, $invalidBehavior); | |||
} | |||
if ($service = parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)) { | |||
if (!is_null($service = parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE))) { |
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.
if (null !== $service = parent::g...
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.
wonderful
I'm develping with swoole, such as LaravelFly, WebSocketFly. In WebSocketFly, I use symfony/dependency-injection and make a containter for each worker process.
|
@stof while I agree with you for Symfony < 4.1 this would break the new |
|
@xabbuh that's not true, |
Oh, I thought you where speaking of the PSR-11 So #25288 doesn't breaks the |
@xabbuh actually that's only a non-enforced docblock; nothing anywhere prevents returning anything else in practice. And it is also trivial to use regular configuration to return a non object: just use a factory (I used this recently :) ) |
otherwise, ' 0, false, [] are not be allowed with $containter->set()'.