yiisoft/di

Behavior of has() method

samdark opened this issue · 1 comments

Currently has() returns true only if there's a definition or there's a class requrested and all its dependencies could be resolved. That, in case of composite container and similar cases, results in hard to debug issues i.e. when one of the sub-sub-dependencies could not be resolved, composite container treats that situation as has=false silently while, in fact, it's a config error. Such errors are really hard to detect (fixing these is easy by calling get() and looking at the error though).

The proposal is to return true if either definition exists or class requested exists without checking sub-dependencies.

Discussed once again. Currently in majority of cases full error is thrown. Specific cases should be solved specifically.