Skip to content
This repository has been archived by the owner on Feb 6, 2020. It is now read-only.

Little improvements #266

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

snapshotpl
Copy link
Contributor

No description provided.

@@ -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])) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a BC

Copy link
Member

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])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a BC

Copy link
Member

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.

@weierophinney weierophinney added this to the 3.4.0 milestone Dec 17, 2018
@Xerkus Xerkus modified the milestones: 3.4.0, 4.0.0 Dec 20, 2018
@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-servicemanager; a new issue has been opened at laminas/laminas-servicemanager#9.

@weierophinney
Copy link
Member

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:

  • Squash all commits in your branch (git rebase -i origin/{branch})
  • Make a note of all changed files (`git diff --name-only origin/{branch}...HEAD
  • Run the laminas/laminas-migration tool on the code.
  • Clone laminas/laminas-servicemanager to another directory.
  • Copy the files from the second bullet point to the clone of laminas/laminas-servicemanager.
  • In your clone of laminas/laminas-servicemanager, commit the files, push to your fork, and open the new PR.
    We will be providing tooling via laminas/laminas-migration soon to help automate the process.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants