-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[5.5] [Concept] PSR-11 compliant container #19822
Conversation
fc00f73
to
6de2138
Compare
Does the spec explicitly prevent If so then this implementation looks fine to me. If not, I wonder if it might be worth checking to see if an object is buildable (idk try to create it?) by catching the |
*/ | ||
public function has($id) | ||
{ | ||
return $this->getConcrete($id) != $id; |
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.
This should probably call ->bound
instead.
@thecrypticace from the PSR
I'm interpreting this as: If you want to build something concrete, just build it yourself. The container will throw exception if the given identifier is unknown to itself. I'm not sure if my interpretation is correct. |
Yeah, based on that, your interpretation seems sensible. 👍 |
Thanks! |
Following up on laravel/ideas#550 I drafted up this commit to draw traction to the debate of whether Laravel container should be PSR-11 compliant or not.
Given that Laravel container already offers a complete set of features, the compliance would probably warrant just the exposure of
has
andget
method. I'm not convinced that the benefits of being compliant out-weight the necessity of maintaining the dependency.I know it may sound weird to open a PR and discredit it, but like I said my goal is to bring traction to the subject now that PSR-11 was accepted.