It was not possible to check whether a type T of instance or builder was registered in the kiwi global or scoped providers. This limited the ability to register instances only if they were not registered.
What has changed?
It is now possible to check if a provider is registered by its type and/or name.
Since previously there couldn't be two instances with the same registered type unless the second one had a name, it's safe to create this method that uses what was in _setProvider.
As mentioned in the comment of method, if an instance is defined with a name and you use the isRegistered method and do not pass its name, false will be returned if no instance was created with a name.
Since what was checked within _setProvider was reused, it was changed to use the isRegistered method to avoid unnecessary code repetition.
Description
T
of instance or builder was registered in the kiwi global or scoped providers. This limited the ability to register instances only if they were not registered.What has changed?
name
, it's safe to create this method that uses what was in_setProvider
.As mentioned in the comment of method, if an instance is defined with a
name
and you use theisRegistered
method and do not pass itsname
, false will be returned if no instance was created with aname
.Since what was checked within
_setProvider
was reused, it was changed to use theisRegistered
method to avoid unnecessary code repetition.All 16 tests are passed correctly.