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

Commit c9a8660

Browse files
committed
Remove conflicting imports and resolve relative to root namespace
- No need to import Zend\ServiceManager\Initializer; it's a subnamespace of the current namespace already. - Resolve AbstractFactoryInterface and DelegatorFactoryInterface relative to `Factory` subnamespace to prevent naming collisions. These only affect docblocks anyways. (Fixes issues observed in two separate, 3rd party packages when testing against the class.)
1 parent 24c6895 commit c9a8660

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/ServiceManager.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
use Zend\ServiceManager\Exception\InvalidArgumentException;
2323
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
2424
use Zend\ServiceManager\Exception\ServiceNotFoundException;
25-
use Zend\ServiceManager\Factory\AbstractFactoryInterface;
26-
use Zend\ServiceManager\Factory\DelegatorFactoryInterface;
27-
use Zend\ServiceManager\Initializer;
2825

2926
/**
3027
* Service Manager.
@@ -44,7 +41,7 @@
4441
class ServiceManager implements ServiceLocatorInterface
4542
{
4643
/**
47-
* @var AbstractFactoryInterface[]
44+
* @var Factory\AbstractFactoryInterface[]
4845
*/
4946
protected $abstractFactories = [];
5047

@@ -70,7 +67,7 @@ class ServiceManager implements ServiceLocatorInterface
7067
protected $creationContext;
7168

7269
/**
73-
* @var string[][]|DelegatorFactoryInterface[][]
70+
* @var string[][]|Factory\DelegatorFactoryInterface[][]
7471
*/
7572
protected $delegators = [];
7673

@@ -507,7 +504,7 @@ public function setShared($name, $flag)
507504
/**
508505
* Instantiate abstract factories for to avoid checks during service construction.
509506
*
510-
* @param string[]|AbstractFactoryInterface[] $abstractFactories
507+
* @param string[]|Factory\AbstractFactoryInterface[] $abstractFactories
511508
*
512509
* @return void
513510
*/
@@ -518,7 +515,7 @@ private function resolveAbstractFactories(array $abstractFactories)
518515
$abstractFactory = new $abstractFactory();
519516
}
520517

521-
if ($abstractFactory instanceof AbstractFactoryInterface) {
518+
if ($abstractFactory instanceof Factory\AbstractFactoryInterface) {
522519
$this->abstractFactories[] = $abstractFactory;
523520
continue;
524521
}

0 commit comments

Comments
 (0)