-
Notifications
You must be signed in to change notification settings - Fork 89
Little improvements #266
base: develop
Are you sure you want to change the base?
Little improvements #266
Conversation
@@ -50,14 +57,14 @@ public function __invoke(\Psr\Container\ContainerInterface $container, $requeste | |||
throw new ServiceNotCreatedException('Config must be an array or an instance of ArrayObject'); | |||
} | |||
|
|||
if (! array_key_exists(self::class, $config)) { | |||
if (! isset($config[self::class])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a BC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not. The value MUST be an array to be usable. As such, isset()
is all that's required to test for usable configuration.
throw new ServiceNotCreatedException('Cannot find a `' . self::class . '` key in the config array'); | ||
} | ||
|
||
$dependencies = $config[self::class]; | ||
|
||
if (! is_array($dependencies) | ||
|| ! array_key_exists($requestedName, $dependencies) | ||
|| ! isset($dependencies[$requestedName]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a BC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, it's not. In this case, we're looking to see if configuration exists for the given service name. There are essentially no cases where that configuration would be a non-array/array-like value. As such, isset()
is sufficient here.
This repository has been closed and moved to laminas/laminas-servicemanager; a new issue has been opened at laminas/laminas-servicemanager#9. |
This repository has been moved to laminas/laminas-servicemanager. If you feel that this patch is still relevant, please re-open against that repository, and reference this issue. To re-open, we suggest the following workflow:
|
No description provided.