Conversation
… to an unresolvable entry Optional parameters that are type-hinted with interfaces should use the default parameter value if the interface is not mapped to a concrete class. Else that makes autowiring pretty much useless if a class takes optionally a parameter that we don't want to specify (use default value).
Member
Author
|
This is needed, for example: koubas/PHP-DI-ZF2@4512352 |
Member
Author
|
Pull request: PHP-DI/ZF2-Bridge#6 |
mnapoli
added a commit
that referenced
this pull request
Jul 12, 2014
Container::has() should return false for un-mapped interfaces/abstract classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a fix for #168 and PHP-DI/ZF2-Bridge#6.
Container::has()currently returns true for any interface or abstract class. It should return false.For example, if PHP-DI work with another container X:
FooInterfacebecause the interface was mapped to an implementationFooInterfaceif container X is called after PHP-DI, then PHP-DI will return true for
Container::has()andContainer::get()will be called, resulting in an exception. By returning false, that ensures that container X gets called instead.