From a0985c7a22014ac1b354f95195d26fd002bf1374 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 21 May 2014 23:09:25 +0200 Subject: [ticket/12575] Move service_collection_iterator to its own file PHPBB3-12575 --- phpBB/phpbb/di/service_collection_iterator.php | 65 ++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 phpBB/phpbb/di/service_collection_iterator.php (limited to 'phpBB/phpbb/di/service_collection_iterator.php') diff --git a/phpBB/phpbb/di/service_collection_iterator.php b/phpBB/phpbb/di/service_collection_iterator.php new file mode 100644 index 0000000000..ace66d1906 --- /dev/null +++ b/phpBB/phpbb/di/service_collection_iterator.php @@ -0,0 +1,65 @@ +container = $container; + } + + /** + * {@inheritdoc} + */ + public function offsetGet($index) + { + if (($task = parent::offsetGet($index)) == null) + { + $task = $this->container->get($index); + $this->offsetSet($index, $task); + } + + return $task; + } + + /** + * {@inheritdoc} + */ + public function current() + { + if (($task = parent::current()) == null) + { + $name = $this->key(); + $task = $this->container->get($name); + $this->offsetSet($name, $task); + } + + return $task; + } +} -- cgit v1.2.1 From bea9372efa650bd97f5b63c23f392bacd56de219 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 22 May 2014 01:09:41 +0200 Subject: [ticket/12575] Fix the tests PHPBB3-12575 --- phpBB/phpbb/di/service_collection_iterator.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/phpbb/di/service_collection_iterator.php') diff --git a/phpBB/phpbb/di/service_collection_iterator.php b/phpBB/phpbb/di/service_collection_iterator.php index ace66d1906..93f74adca9 100644 --- a/phpBB/phpbb/di/service_collection_iterator.php +++ b/phpBB/phpbb/di/service_collection_iterator.php @@ -48,6 +48,14 @@ class service_collection_iterator extends \ArrayIterator return $task; } + /** + * {@inheritdoc} + */ + public function offsetExists($index) + { + parent::offsetExists($index); + } + /** * {@inheritdoc} */ -- cgit v1.2.1 From 6e478862273946a2088ff3b672ef64034473bcf3 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 22 May 2014 01:24:11 +0200 Subject: [ticket/12575] Remove inline assignments PHPBB3-12575 --- phpBB/phpbb/di/service_collection_iterator.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/di/service_collection_iterator.php') diff --git a/phpBB/phpbb/di/service_collection_iterator.php b/phpBB/phpbb/di/service_collection_iterator.php index 93f74adca9..a6cb0e6c3e 100644 --- a/phpBB/phpbb/di/service_collection_iterator.php +++ b/phpBB/phpbb/di/service_collection_iterator.php @@ -39,7 +39,8 @@ class service_collection_iterator extends \ArrayIterator */ public function offsetGet($index) { - if (($task = parent::offsetGet($index)) == null) + $task = parent::offsetGet($index); + if ($task == null) { $task = $this->container->get($index); $this->offsetSet($index, $task); @@ -61,7 +62,8 @@ class service_collection_iterator extends \ArrayIterator */ public function current() { - if (($task = parent::current()) == null) + $task = parent::current(); + if ($task == null) { $name = $this->key(); $task = $this->container->get($name); -- cgit v1.2.1 From d4cc6990e48ca4f98e16c717dcdbdf37473312fd Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 22 May 2014 03:02:25 +0200 Subject: [ticket/12575] Skip sniffer issue triggered by the solution of a php bug https://bugs.php.net/bug.php?id=66834 https://bugs.php.net/bug.php?id=67067 PHPBB3-12575 --- phpBB/phpbb/di/service_collection_iterator.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'phpBB/phpbb/di/service_collection_iterator.php') diff --git a/phpBB/phpbb/di/service_collection_iterator.php b/phpBB/phpbb/di/service_collection_iterator.php index a6cb0e6c3e..7870174c08 100644 --- a/phpBB/phpbb/di/service_collection_iterator.php +++ b/phpBB/phpbb/di/service_collection_iterator.php @@ -49,6 +49,12 @@ class service_collection_iterator extends \ArrayIterator return $task; } + // Because of a PHP issue we have to redefine offsetExists + // (even Date: Thu, 22 May 2014 11:34:19 +0200 Subject: [ticket/12575] Fix typos in comments PHPBB3-12575 --- phpBB/phpbb/di/service_collection_iterator.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/di/service_collection_iterator.php') diff --git a/phpBB/phpbb/di/service_collection_iterator.php b/phpBB/phpbb/di/service_collection_iterator.php index 7870174c08..efea2cd956 100644 --- a/phpBB/phpbb/di/service_collection_iterator.php +++ b/phpBB/phpbb/di/service_collection_iterator.php @@ -2,7 +2,7 @@ /** * * @package phpBB3 -* @copyright (c) 2011 phpBB Group +* @copyright (c) 2014 phpBB Group * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ @@ -12,7 +12,7 @@ namespace phpbb\di; use Symfony\Component\DependencyInjection\ContainerInterface; /** -* Iterator which load the services when they are requested +* Iterator which loads the services when they are requested * * @package phpBB3 */ @@ -50,7 +50,7 @@ class service_collection_iterator extends \ArrayIterator } // Because of a PHP issue we have to redefine offsetExists - // (even Date: Thu, 22 May 2014 13:27:12 +0200 Subject: [ticket/12575] Fix 2 typos in comments PHPBB3-12575 --- phpBB/phpbb/di/service_collection_iterator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/di/service_collection_iterator.php') diff --git a/phpBB/phpbb/di/service_collection_iterator.php b/phpBB/phpbb/di/service_collection_iterator.php index efea2cd956..8f4abbc6e8 100644 --- a/phpBB/phpbb/di/service_collection_iterator.php +++ b/phpBB/phpbb/di/service_collection_iterator.php @@ -50,7 +50,7 @@ class service_collection_iterator extends \ArrayIterator } // Because of a PHP issue we have to redefine offsetExists - // (even Date: Sat, 14 Jun 2014 01:52:12 +0200 Subject: [ticket/12575] Usethe new header PHPBB3-12575 --- phpBB/phpbb/di/service_collection_iterator.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb/di/service_collection_iterator.php') diff --git a/phpBB/phpbb/di/service_collection_iterator.php b/phpBB/phpbb/di/service_collection_iterator.php index 8f4abbc6e8..6e8e1de7a4 100644 --- a/phpBB/phpbb/di/service_collection_iterator.php +++ b/phpBB/phpbb/di/service_collection_iterator.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -13,11 +17,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** * Iterator which loads the services when they are requested -* -* @package phpBB3 */ class service_collection_iterator extends \ArrayIterator { + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ protected $container; /** -- cgit v1.2.1 From 482f60f1bd45580fe7010a5687a66dd9b0695d29 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 14 Jun 2014 12:04:25 +0200 Subject: [ticket/12575] Use strict comparison PHPBB3-12575 --- phpBB/phpbb/di/service_collection_iterator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/di/service_collection_iterator.php') diff --git a/phpBB/phpbb/di/service_collection_iterator.php b/phpBB/phpbb/di/service_collection_iterator.php index 6e8e1de7a4..54aefca1f7 100644 --- a/phpBB/phpbb/di/service_collection_iterator.php +++ b/phpBB/phpbb/di/service_collection_iterator.php @@ -45,7 +45,7 @@ class service_collection_iterator extends \ArrayIterator public function offsetGet($index) { $task = parent::offsetGet($index); - if ($task == null) + if ($task === null) { $task = $this->container->get($index); $this->offsetSet($index, $task); @@ -75,7 +75,7 @@ class service_collection_iterator extends \ArrayIterator public function current() { $task = parent::current(); - if ($task == null) + if ($task === null) { $name = $this->key(); $task = $this->container->get($name); -- cgit v1.2.1