yiisoft / injector

PSR-11 compatible injector
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
43 stars 18 forks source link

Make `MissingRequiredArgumentException` more friendly #87

Open vjik opened 10 months ago

vjik commented 10 months ago

It would be nice to improve the MissingRequiredArgumentException - add a flag whether the Container is passed to the Injector.

And if the Container is not passed, and the argument being resolved is a class, then output a friendly message (FriendlyException) will be like "pass an object of the required type as an argument to invoke()/make() or pass a Container when creating the Injector"

If the Container parameter was set, then the friendly message will be like "add an object of the required type to the argument list or make sure that the configured Container can resolve it"

Originally posted by @roxblnfk in https://github.com/yiisoft/injector/issues/86#issuecomment-1864146016