Skip to content

Container::has() should return false for un-mapped interfaces/abstract classes#169

Merged
mnapoli merged 5 commits into4.2from
bug/168
Jul 12, 2014
Merged

Container::has() should return false for un-mapped interfaces/abstract classes#169
mnapoli merged 5 commits into4.2from
bug/168

Conversation

@mnapoli
Copy link
Copy Markdown
Member

@mnapoli mnapoli commented Jun 17, 2014

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:

  • container X can create FooInterface because the interface was mapped to an implementation
  • PHP-DI has no configuration for FooInterface

if container X is called after PHP-DI, then PHP-DI will return true for Container::has() and Container::get() will be called, resulting in an exception. By returning false, that ensures that container X gets called instead.

mnapoli and others added 5 commits June 3, 2014 19:34
… 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).
@mnapoli
Copy link
Copy Markdown
Member Author

mnapoli commented Jun 30, 2014

This is needed, for example: koubas/PHP-DI-ZF2@4512352

@mnapoli
Copy link
Copy Markdown
Member Author

mnapoli commented Jun 30, 2014

Pull request: PHP-DI/ZF2-Bridge#6

@mnapoli mnapoli changed the title Fix for #168 Container::has() should return false for un-mapped interfaces/abstract classes (fix for #168) Jul 12, 2014
@mnapoli mnapoli changed the title Container::has() should return false for un-mapped interfaces/abstract classes (fix for #168) Container::has() should return false for un-mapped interfaces/abstract classes Jul 12, 2014
mnapoli added a commit that referenced this pull request Jul 12, 2014
Container::has() should return false for un-mapped interfaces/abstract classes
@mnapoli mnapoli merged commit 1150b45 into 4.2 Jul 12, 2014
@mnapoli mnapoli deleted the bug/168 branch July 12, 2014 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants