diff --git a/composer.json b/composer.json index 707eadf3..12b0e530 100644 --- a/composer.json +++ b/composer.json @@ -28,8 +28,8 @@ }, "extra": { "branch-alias": { - "dev-master": "2.4-dev", - "dev-develop": "2.5-dev" + "dev-master": "2.1-dev", + "dev-develop": "2.2-dev" } }, "autoload-dev": { diff --git a/src/Config.php b/src/Config.php index 2f94a903..180ef81b 100644 --- a/src/Config.php +++ b/src/Config.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di; @@ -17,9 +16,6 @@ /** * Configures Di instances - * - * @category Zend - * @package Zend_Di */ class Config { diff --git a/src/Definition/Annotation/Inject.php b/src/Definition/Annotation/Inject.php index 41798abf..369e0132 100644 --- a/src/Definition/Annotation/Inject.php +++ b/src/Definition/Annotation/Inject.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Definition\Annotation; @@ -14,9 +13,6 @@ /** * Annotation for injection endpoints for dependencies - * - * @category Zend - * @package Zend_Di */ class Inject implements AnnotationInterface { diff --git a/src/Definition/Annotation/Instantiator.php b/src/Definition/Annotation/Instantiator.php index d20c394c..a4cf9259 100644 --- a/src/Definition/Annotation/Instantiator.php +++ b/src/Definition/Annotation/Instantiator.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Definition\Annotation; @@ -14,9 +13,6 @@ /** * Annotation for instantiator - * - * @category Zend - * @package Zend_Di */ class Instantiator implements AnnotationInterface { diff --git a/src/Definition/ArrayDefinition.php b/src/Definition/ArrayDefinition.php index 541c8e8f..b1cd14b8 100644 --- a/src/Definition/ArrayDefinition.php +++ b/src/Definition/ArrayDefinition.php @@ -5,16 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Definition; /** * Class definitions based on a given array - * - * @category Zend - * @package Zend_Di */ class ArrayDefinition implements DefinitionInterface { diff --git a/src/Definition/Builder/InjectionMethod.php b/src/Definition/Builder/InjectionMethod.php index 79e0de9a..a19cb617 100644 --- a/src/Definition/Builder/InjectionMethod.php +++ b/src/Definition/Builder/InjectionMethod.php @@ -5,16 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Definition\Builder; /** * Definitions for an injection endpoint method - * - * @category Zend - * @package Zend_Di */ class InjectionMethod { diff --git a/src/Definition/Builder/PhpClass.php b/src/Definition/Builder/PhpClass.php index 2c4e7360..9cc669e8 100644 --- a/src/Definition/Builder/PhpClass.php +++ b/src/Definition/Builder/PhpClass.php @@ -5,16 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Definition\Builder; /** * Object containing definitions for a single class - * - * @category Zend - * @package Zend_Di */ class PhpClass { diff --git a/src/Definition/BuilderDefinition.php b/src/Definition/BuilderDefinition.php index de2b1ece..8191e96d 100644 --- a/src/Definition/BuilderDefinition.php +++ b/src/Definition/BuilderDefinition.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Definition; @@ -14,9 +13,6 @@ /** * Class definitions based on a configuration array - * - * @category Zend - * @package Zend_Di */ class BuilderDefinition implements DefinitionInterface { diff --git a/src/Definition/ClassDefinition.php b/src/Definition/ClassDefinition.php index e2e32983..e9e929ed 100644 --- a/src/Definition/ClassDefinition.php +++ b/src/Definition/ClassDefinition.php @@ -5,16 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Definition; /** * Class definitions for a single class - * - * @category Zend - * @package Zend_Di */ class ClassDefinition implements DefinitionInterface, PartialMarker { diff --git a/src/Definition/CompilerDefinition.php b/src/Definition/CompilerDefinition.php index 76821fd7..fac3d43f 100644 --- a/src/Definition/CompilerDefinition.php +++ b/src/Definition/CompilerDefinition.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Definition; @@ -20,9 +19,6 @@ /** * Class definitions based on a set of directories to be scanned - * - * @category Zend - * @package Zend_Di */ class CompilerDefinition implements DefinitionInterface { diff --git a/src/Definition/DefinitionInterface.php b/src/Definition/DefinitionInterface.php index 703fa17d..135e2bde 100644 --- a/src/Definition/DefinitionInterface.php +++ b/src/Definition/DefinitionInterface.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Definition; -/** - * @category Zend - * @package Zend_Di - */ interface DefinitionInterface { /** diff --git a/src/Definition/IntrospectionStrategy.php b/src/Definition/IntrospectionStrategy.php index 5cd80410..e7c487f9 100644 --- a/src/Definition/IntrospectionStrategy.php +++ b/src/Definition/IntrospectionStrategy.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Definition; @@ -16,9 +15,6 @@ /** * Strategy used to discover methods to be considered as endpoints for dependency injection based on implemented * interfaces, annotations and method names - * - * @category Zend - * @package Zend_Di */ class IntrospectionStrategy { diff --git a/src/Definition/PartialMarker.php b/src/Definition/PartialMarker.php index 353aa970..7e8b91c4 100644 --- a/src/Definition/PartialMarker.php +++ b/src/Definition/PartialMarker.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Definition; -/** - * @category Zend - * @package Zend_Di - */ interface PartialMarker { } diff --git a/src/Definition/RuntimeDefinition.php b/src/Definition/RuntimeDefinition.php index e90bd2ca..011313ed 100644 --- a/src/Definition/RuntimeDefinition.php +++ b/src/Definition/RuntimeDefinition.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Definition; @@ -16,9 +15,6 @@ /** * Class definitions based on runtime reflection - * - * @category Zend - * @package Zend_Di */ class RuntimeDefinition implements DefinitionInterface { diff --git a/src/DefinitionList.php b/src/DefinitionList.php index 5ed37415..55534874 100644 --- a/src/DefinitionList.php +++ b/src/DefinitionList.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di; @@ -14,9 +13,6 @@ /** * Class definition based on multiple definitions - * - * @category Zend - * @package Zend_Di */ class DefinitionList extends SplDoublyLinkedList implements Definition\DefinitionInterface { diff --git a/src/DependencyInjectionInterface.php b/src/DependencyInjectionInterface.php index ed2c50a1..dd12a369 100644 --- a/src/DependencyInjectionInterface.php +++ b/src/DependencyInjectionInterface.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di; -/** - * @category Zend - * @package Zend_Di - */ interface DependencyInjectionInterface extends LocatorInterface { /** diff --git a/src/Di.php b/src/Di.php index 2770ba67..b2404b27 100644 --- a/src/Di.php +++ b/src/Di.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di; @@ -15,9 +14,6 @@ /** * Dependency injector that can generate instances using class definitions and configured instance parameters - * - * @category Zend - * @package Zend_Di */ class Di implements DependencyInjectionInterface { @@ -167,13 +163,14 @@ public function get($name, array $params = array()) array_pop($this->instanceContext); return $im->getSharedInstanceWithParameters(null, array(), $fastHash); } - } else { - if ($im->hasSharedInstance($name, $callParameters)) { - array_pop($this->instanceContext); - return $im->getSharedInstance($name, $callParameters); - } } + if ($im->hasSharedInstance($name, $callParameters)) { + array_pop($this->instanceContext); + return $im->getSharedInstance($name, $callParameters); + } + + $config = $im->getConfig($name); $instance = $this->newInstance($name, $params, $config['shared']); array_pop($this->instanceContext); diff --git a/src/Display/Console.php b/src/Display/Console.php index 22af7a92..26b06253 100644 --- a/src/Display/Console.php +++ b/src/Display/Console.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Display; @@ -14,9 +13,6 @@ /** * Exporter for class definitions - * - * @category Zend - * @package Zend_Di */ class Console { diff --git a/src/Exception/CircularDependencyException.php b/src/Exception/CircularDependencyException.php index 35de9cba..84012f9f 100644 --- a/src/Exception/CircularDependencyException.php +++ b/src/Exception/CircularDependencyException.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Exception; use DomainException; -/** - * @category Zend - * @package Zend_Di - */ class CircularDependencyException extends DomainException implements ExceptionInterface { } diff --git a/src/Exception/ClassNotFoundException.php b/src/Exception/ClassNotFoundException.php index 1cbd1d3e..b6b380ea 100644 --- a/src/Exception/ClassNotFoundException.php +++ b/src/Exception/ClassNotFoundException.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Exception; use DomainException; -/** - * @category Zend - * @package Zend_Di - */ class ClassNotFoundException extends DomainException implements ExceptionInterface { } diff --git a/src/Exception/ExceptionInterface.php b/src/Exception/ExceptionInterface.php index 6d0ca42f..02cf66d4 100644 --- a/src/Exception/ExceptionInterface.php +++ b/src/Exception/ExceptionInterface.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Exception; -/** - * @category Zend - * @package Zend_Di - */ interface ExceptionInterface { } diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index f614aa51..ae7c0aba 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Exception; -/** - * @category Zend - * @package Zend_Di - */ class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface { } diff --git a/src/Exception/InvalidCallbackException.php b/src/Exception/InvalidCallbackException.php index 8a468082..d80f06e9 100644 --- a/src/Exception/InvalidCallbackException.php +++ b/src/Exception/InvalidCallbackException.php @@ -5,16 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Exception; /** * Exception to be thrown when an invalid php callback is provided - * - * @category Zend - * @package Zend_Di */ class InvalidCallbackException extends InvalidArgumentException { diff --git a/src/Exception/InvalidParamNameException.php b/src/Exception/InvalidParamNameException.php index 8a2b14b4..bcb1e3f5 100644 --- a/src/Exception/InvalidParamNameException.php +++ b/src/Exception/InvalidParamNameException.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Exception; -/** - * @category Zend - * @package Zend_Di - */ class InvalidParamNameException extends InvalidArgumentException { } diff --git a/src/Exception/InvalidPositionException.php b/src/Exception/InvalidPositionException.php index b95c8663..8a0ad80e 100644 --- a/src/Exception/InvalidPositionException.php +++ b/src/Exception/InvalidPositionException.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Exception; -/** - * @category Zend - * @package Zend_Di - */ class InvalidPositionException extends InvalidArgumentException { } diff --git a/src/Exception/MissingPropertyException.php b/src/Exception/MissingPropertyException.php index 1239bfb8..d2656ab9 100644 --- a/src/Exception/MissingPropertyException.php +++ b/src/Exception/MissingPropertyException.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Exception; use DomainException; -/** - * @category Zend - * @package Zend_Di - */ class MissingPropertyException extends DomainException implements ExceptionInterface { } diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php index a9a5b870..c33f1d55 100644 --- a/src/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Exception; -/** - * @category Zend - * @package Zend_Di - */ class RuntimeException extends \RuntimeException implements ExceptionInterface { } diff --git a/src/Exception/UndefinedReferenceException.php b/src/Exception/UndefinedReferenceException.php index fd175933..3d314a20 100644 --- a/src/Exception/UndefinedReferenceException.php +++ b/src/Exception/UndefinedReferenceException.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\Exception; use DomainException; -/** - * @category Zend - * @package Zend_Di - */ class UndefinedReferenceException extends DomainException implements ExceptionInterface { } diff --git a/src/InstanceManager.php b/src/InstanceManager.php index 6b9baac8..e204090b 100644 --- a/src/InstanceManager.php +++ b/src/InstanceManager.php @@ -5,16 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di; /** * Registry of instantiated objects, their names and the parameters used to build them - * - * @category Zend - * @package Zend_Di */ class InstanceManager /* implements InstanceManagerInterface */ { diff --git a/src/LocatorInterface.php b/src/LocatorInterface.php index 94eec5e7..b4758d45 100644 --- a/src/LocatorInterface.php +++ b/src/LocatorInterface.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di; -/** - * @category Zend - * @package Zend_Di - */ interface LocatorInterface { /** diff --git a/src/ServiceLocator.php b/src/ServiceLocator.php index ed9402b5..fd7d097b 100644 --- a/src/ServiceLocator.php +++ b/src/ServiceLocator.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di; @@ -14,9 +13,6 @@ /** * Simple service locator implementation capable of using closures to generate instances - * - * @category Zend - * @package Zend_Di */ class ServiceLocator implements ServiceLocatorInterface { diff --git a/src/ServiceLocator/DependencyInjectorProxy.php b/src/ServiceLocator/DependencyInjectorProxy.php index 5daea965..97bb4df6 100644 --- a/src/ServiceLocator/DependencyInjectorProxy.php +++ b/src/ServiceLocator/DependencyInjectorProxy.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\ServiceLocator; @@ -16,9 +15,6 @@ /** * Proxy used to analyze how instances are created by a given Di. Overrides Zend\Di\Di to produce artifacts that * represent the process used to instantiate a particular instance - * - * @category Zend - * @package Zend_Di */ class DependencyInjectorProxy extends Di { diff --git a/src/ServiceLocator/Generator.php b/src/ServiceLocator/Generator.php index 7d2c9c96..a7182590 100644 --- a/src/ServiceLocator/Generator.php +++ b/src/ServiceLocator/Generator.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\ServiceLocator; @@ -20,9 +19,6 @@ /** * Generator that creates the body of a service locator that can emulate the logic of the given Zend\Di\Di instance * without class definitions - * - * @category Zend - * @package Zend_Di */ class Generator { diff --git a/src/ServiceLocator/GeneratorInstance.php b/src/ServiceLocator/GeneratorInstance.php index de0d4838..10e3c20a 100644 --- a/src/ServiceLocator/GeneratorInstance.php +++ b/src/ServiceLocator/GeneratorInstance.php @@ -5,16 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di\ServiceLocator; /** * Container for methods and parameters used by by Di to create a particular instance - * - * @category Zend - * @package Zend_Di */ class GeneratorInstance { diff --git a/src/ServiceLocatorInterface.php b/src/ServiceLocatorInterface.php index 755bf519..32e2370b 100644 --- a/src/ServiceLocatorInterface.php +++ b/src/ServiceLocatorInterface.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Di */ namespace Zend\Di; -/** - * @category Zend - * @package Zend_Di - */ interface ServiceLocatorInterface extends LocatorInterface { /** diff --git a/test/DiTest.php b/test/DiTest.php index 64255bc0..cf019f5a 100644 --- a/test/DiTest.php +++ b/test/DiTest.php @@ -779,4 +779,33 @@ public function testDiWillInjectDefaultParameters() $this->assertSame('defaultConstruct', $optionalParams->b); $this->assertSame(array(), $optionalParams->c); } + + /** + * @group SharedInstance + */ + public function testGetWithParamsWillUseSharedInstance() + { + $di = new Di; + + $sharedInstanceClass = 'ZendTest\Di\TestAsset\ConstructorInjection\A'; + $retrievedInstanceClass = 'ZendTest\Di\TestAsset\ConstructorInjection\C'; + + // Provide definitions for $retrievedInstanceClass, but not for $sharedInstanceClass. + $arrayDefinition = array($retrievedInstanceClass => array ( + 'supertypes' => array ( ), + 'instantiator' => '__construct', + 'methods' => array ('__construct' => true), + 'parameters' => array ( '__construct' => array ( + "$retrievedInstanceClass::__construct:0" => array ('a', $sharedInstanceClass, true, NULL), + "$retrievedInstanceClass::__construct:1" => array ('params', NULL, false, array()), + )), + )); + + // This also disables scanning of class A. + $di->setDefinitionList(new DefinitionList(new Definition\ArrayDefinition($arrayDefinition))); + + $di->instanceManager()->addSharedInstance(new $sharedInstanceClass, $sharedInstanceClass); + $returnedC = $di->get($retrievedInstanceClass, array('params' => array('test'))); + $this->assertInstanceOf($retrievedInstanceClass, $returnedC); + } } diff --git a/test/TestAsset/BasicClassWithParent.php b/test/TestAsset/BasicClassWithParent.php index 0020eac3..4f890a2d 100644 --- a/test/TestAsset/BasicClassWithParent.php +++ b/test/TestAsset/BasicClassWithParent.php @@ -3,7 +3,7 @@ * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @package Zend_Di */ diff --git a/test/TestAsset/ConstructorInjection/C.php b/test/TestAsset/ConstructorInjection/C.php new file mode 100644 index 00000000..751efa1b --- /dev/null +++ b/test/TestAsset/ConstructorInjection/C.php @@ -0,0 +1,22 @@ +a = $a; + $this->params = $params; + } +}