From ee439e3be3fa2544e5435adaa339957d86d789e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Gallego?= Date: Fri, 26 Apr 2013 22:27:58 +0200 Subject: [PATCH] Feedbacks --- library/Zend/InputFilter/BaseInputFilter.php | 2 +- .../Zend/InputFilter/InputFilterPluginManager.php | 13 +++++++------ .../ZendTest/InputFilter/InputFilterManagerTest.php | 4 +--- .../Stdlib/Hydrator/HydratorManagerTest.php | 4 +--- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/library/Zend/InputFilter/BaseInputFilter.php b/library/Zend/InputFilter/BaseInputFilter.php index 470b844c550..50757c36707 100644 --- a/library/Zend/InputFilter/BaseInputFilter.php +++ b/library/Zend/InputFilter/BaseInputFilter.php @@ -35,7 +35,7 @@ class BaseInputFilter implements InputFilterInterface, UnknownInputsCapableInter public function init() { } - + /** * Countable: number of inputs in this input filter * diff --git a/library/Zend/InputFilter/InputFilterPluginManager.php b/library/Zend/InputFilter/InputFilterPluginManager.php index e4b03673390..63e2b878e3e 100644 --- a/library/Zend/InputFilter/InputFilterPluginManager.php +++ b/library/Zend/InputFilter/InputFilterPluginManager.php @@ -12,6 +12,7 @@ use Zend\InputFilter\Exception; use Zend\ServiceManager\AbstractPluginManager; use Zend\ServiceManager\ConfigInterface; +use Zend\ServiceManager\ServiceLocatorInterface; use Zend\Stdlib\InitializableInterface; /** @@ -36,7 +37,7 @@ public function __construct(ConfigInterface $configuration = null) */ public function populateFactory($element) { - if ($element instanceof InputFilter) { + if ($element instanceof InputFilter && $this->serviceLocator instanceof ServiceLocatorInterface) { $factory = $element->getFactory(); $factory->getDefaultFilterChain()->setPluginManager($this->serviceLocator->get('FilterManager')); $factory->getDefaultValidatorChain()->setPluginManager($this->serviceLocator->get('ValidatorManager')); @@ -48,12 +49,12 @@ public function populateFactory($element) */ public function validatePlugin($plugin) { - // Hook to perform various initialization, when the element is not created through the factory - if ($plugin instanceof InitializableInterface) { - $plugin->init(); - } - if ($plugin instanceof InputFilterInterface) { + // Hook to perform various initialization, when the element is not created through the factory + if ($plugin instanceof InitializableInterface) { + $plugin->init(); + } + // we're okay return; } diff --git a/tests/ZendTest/InputFilter/InputFilterManagerTest.php b/tests/ZendTest/InputFilter/InputFilterManagerTest.php index db424971b35..5993bc6cf7c 100644 --- a/tests/ZendTest/InputFilter/InputFilterManagerTest.php +++ b/tests/ZendTest/InputFilter/InputFilterManagerTest.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_Form */ namespace ZendTest\InputFilter; @@ -14,8 +13,7 @@ use Zend\InputFilter\InputFilterPluginManager; /** - * @category Zend - * @group Zend_Stdlib + * @group Zend_Stdlib */ class InputFilterManagerTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/ZendTest/Stdlib/Hydrator/HydratorManagerTest.php b/tests/ZendTest/Stdlib/Hydrator/HydratorManagerTest.php index f5f74cb7d37..a2272ed3f7f 100644 --- a/tests/ZendTest/Stdlib/Hydrator/HydratorManagerTest.php +++ b/tests/ZendTest/Stdlib/Hydrator/HydratorManagerTest.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_Form */ namespace ZendTest\Stdlib\Hydrator; @@ -14,8 +13,7 @@ use Zend\Stdlib\Hydrator\HydratorPluginManager; /** - * @category Zend - * @group Zend_Stdlib + * @group Zend_Stdlib */ class HydratorManagerTest extends \PHPUnit_Framework_TestCase {