Support for php 8.0
Internal refactoring to pass phpstan.
Support for php 7.4
All singletons are now by default weak refs and can by the definition config set to be kept by the container lifetime.
- Rewrite to use native php arrays.
- Fix DefinitionSource requirement to be Map, not array.
- Change all usage of arrays to use php-ds collection objects. The container project therefor now requires the php-ds package.
- Fix unable to compile optional interface arguments and runtime defined definitions.
- Fix unable to compile optional arguments
- Fix unable to compile any function that had interface type-hinted in its arguments.
- Add definition
value
, it can hold any value you provide it. - Change definition
reference
to reference any definition entry, not just classes.
- Implement compiling container with all defined definitions
- Rename helper function
\HbLib\Container\get
to\HbLib\Container\resolve
- Add new definition
Reference
, use it to reference other definitions. A helper function has been added for it:\HbLib\Container\reference
- Add new
DefinitionSource
object to hold all definitions. - Add new
ContainerBuilder
. It allows you to enable compiling. - Implement circular dependency resolving checking
- Add method
Container::set()
, it is not part of any interface.
- Fix resolving builtin types with default values.
- Refactor the logic for resolving parameters
Container::has()
will no longer call make()
. This is not seen as a breaking change because the has
method is documented to not always predict if get
can return something.
- Bug: Argument resolver did not resolve Definitions
DefinitionClass
now does not require a class name. When not specified, the container will find the class being resolved with the definition and use it. This allows us to write (in definition array):MyClass::class => get()
and notMyClass::class => get(MyClass::class)
- Add interface
InvokerInterface
for methodcall
- Add interface
ArgumentResolverInterface
for the methodresolveArguments()
- Internal refactoring and code splitting.
- Bug: Fix container not resolving parameters without a specific type that has default values.
- Allow to declare parameters with the
get()
definition helper.
- Internal resolving of dependencies now call
get()
and will then use singletons. - Added function to create a defintion factory:
factory()
- Added function to create an alias to resolve a function:
getClass()
- Change method usages for
get
andmake
.make
will now always provide a new instance,get
will always provide a singleton instance. - Added
FactoryInterface
- Project now has 100% test coverage and is verified to work on php 7.1 and 7.2
- Make
Container
resolvable. - Make
Container::resolveParameters
public. - Support anonymous functions in the Container.
- Implement
Container::call()
- Added an base Exception class:
ContainerException
- Use Relflection API when invoking definition factories.
- fix: Added missing class
UnresolvedContainerException
- Initial release.