yiisoft / injector

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

Make container optional #86

Closed vjik closed 10 months ago

vjik commented 10 months ago
Q A
Is bugfix?
New feature? ✔️
Breaks BC?
what-the-diff[bot] commented 10 months ago

PR Summary

codecov[bot] commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (1f7239d) 100.00% compared to head (a267d94) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #86 +/- ## =========================================== Coverage 100.00% 100.00% - Complexity 88 89 +1 =========================================== Files 3 3 Lines 211 211 =========================================== Hits 211 211 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

roxblnfk 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"