Closed vjik closed 10 months ago
Q | A |
---|---|
Is bugfix? | ❌ |
New feature? | ✔️ |
Breaks BC? | ❌ |
Introduction of a Custom Exception Class
A new file ContainerNotSetException.php
has been added. This file introduces a new custom exception class. An 'exception' is just a term to indicate an unusual or exceptional condition that needs handling.
Changes to the 'Injector' File
Several changes have been made to the Injector.php
file:
$container
property type has been changed to ?ContainerInterface
, which essentially means that it can now also accept 'null' as a value, giving it more flexibility.$container
parameter does not always need to be specified. This makes the project easier to work with.ContainerNotSetException
if there is no container set while trying to establish an object parameter.Tests for the 'Injector' Behavior
New test cases have been added to the InjectorTest.php
file:
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
1f7239d
) 100.00% compared to head (a267d94
) 100.00%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
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"