Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Better zend-servicemanager <-> zend-di integration deprecation #159

Merged

Conversation

weierophinney
Copy link
Member

Per #125, requiring zend-servicemanager-di with zend-servicemanager v2 causes conflicts when creating an optimized autoloader with Composer. Unfortunately, the issue we're left with is:

  • zend-servicemanager v3 removes the Zend\ServiceManager\Di namespace, which makes the various DI-related factories in zend-mvc result in fatal errors due to missing classes.
  • unfortunately, there's no ability to do conditional requires in Composer, so we cannot specify a rule like "if zend-servicemanager v3 is installed with zend-mvc v2, install zend-servicemanager-di as well".

The only viable solution is to re-instate the code removed in 2.7.9, but with the following changes:

  • the DiAbstractServiceFactoryFactory now checks to see if Zend\ServiceManager\Di\DiAbstractServiceFactory exists, and, if not, raises an exception indicating the developer should install zend-servicemanager-di.
  • the DiServiceInitializerFactory now checks to see if Zend\ServiceManager\Di\DiServiceInitializer exists, and, if not, raises an exception indicating the developer should install zend-servicemanager-di.

Both of the above changes have unit tests for the new behavior introduced.

Additionally, all classes changed in 2.7.9 retain their deprecation annotations, signaling the change to come with zend-mvc v3.

- Per zendframework#125
- Also replaces fabpot/php-cs-fixer with friendsofphp/php-cs-fixer, per warnings
  during update (former is abandoned in favor of latter).
… v3 usage

This patch reinstates the code removed in 2.7.9, and updates the docblocks to
remove narrative indicating that they extend counterparts in
zend-servicemanager-di.

Additionally, the DiAbstractServiceFactoryFactory and
DiServiceInitializerFactory were updated to raise exceptions if they detect that
the relevant `Zend\ServiceManager\Di` artifacts are not present.
@weierophinney weierophinney added this to the 2.7.10 milestone Jun 13, 2016
@akrabat
Copy link
Contributor

akrabat commented Jun 13, 2016

Visual inspection of code changes look good to me.

@weierophinney weierophinney merged commit 5ba7039 into zendframework:release-2.7 Jun 13, 2016
weierophinney added a commit that referenced this pull request Jun 13, 2016
weierophinney added a commit that referenced this pull request Jun 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants