From 20e9ed6506e169ff0b4518f744e0e737b81fa8e6 Mon Sep 17 00:00:00 2001 From: Diego Saint Esteben Date: Tue, 11 Aug 2015 01:26:47 -0300 Subject: [PATCH] Unpack nested array instead of using temp var --- .../RegisterEventListenersAndSubscribersPassTest.php | 3 +-- .../Tests/DependencyInjection/CompleteConfigurationTest.php | 4 +--- src/Symfony/Component/ClassLoader/Psr4ClassLoader.php | 3 +-- src/Symfony/Component/Config/Definition/ArrayNode.php | 4 +--- .../DependencyInjection/Compiler/DecoratorServicePass.php | 3 +-- .../Component/DependencyInjection/Loader/XmlFileLoader.php | 4 +--- .../EventDispatcher/ContainerAwareEventDispatcher.php | 6 ++---- 7 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php index 5e53fae965..d724f680d8 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php @@ -159,8 +159,7 @@ class RegisterEventListenersAndSubscribersPassTest extends \PHPUnit_Framework_Te private function getServiceOrder(ContainerBuilder $container, $method) { $order = array(); - foreach ($container->getDefinition('doctrine.dbal.default_connection.event_manager')->getMethodCalls() as $call) { - list($name, $arguments) = $call; + foreach ($container->getDefinition('doctrine.dbal.default_connection.event_manager')->getMethodCalls() as list($name, $arguments)) { if ($method !== $name) { continue; } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index a34df33b7d..5a40f191d0 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -12,7 +12,6 @@ namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\Parameter; use Symfony\Bundle\SecurityBundle\SecurityBundle; use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -134,8 +133,7 @@ abstract class CompleteConfigurationTest extends \PHPUnit_Framework_TestCase } $matcherIds = array(); - foreach ($rules as $rule) { - list($matcherId, $attributes, $channel) = $rule; + foreach ($rules as list($matcherId, $attributes, $channel)) { $requestMatcher = $container->getDefinition($matcherId); $this->assertFalse(isset($matcherIds[$matcherId])); diff --git a/src/Symfony/Component/ClassLoader/Psr4ClassLoader.php b/src/Symfony/Component/ClassLoader/Psr4ClassLoader.php index a00cf7b83c..84647b758d 100644 --- a/src/Symfony/Component/ClassLoader/Psr4ClassLoader.php +++ b/src/Symfony/Component/ClassLoader/Psr4ClassLoader.php @@ -45,8 +45,7 @@ class Psr4ClassLoader { $class = ltrim($class, '\\'); - foreach ($this->prefixes as $current) { - list($currentPrefix, $currentBaseDir) = $current; + foreach ($this->prefixes as list($currentPrefix, $currentBaseDir)) { if (0 === strpos($class, $currentPrefix)) { $classWithoutPrefix = substr($class, strlen($currentPrefix)); $file = $currentBaseDir.str_replace('\\', DIRECTORY_SEPARATOR, $classWithoutPrefix).'.php'; diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index 7c9c145943..743ca73f59 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -330,9 +330,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface */ protected function remapXml($value) { - foreach ($this->xmlRemappings as $transformation) { - list($singular, $plural) = $transformation; - + foreach ($this->xmlRemappings as list($singular, $plural)) { if (!isset($value[$singular])) { continue; } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php b/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php index f80d705a9b..24008ca75d 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php @@ -35,8 +35,7 @@ class DecoratorServicePass implements CompilerPassInterface $definitions->insert(array($id, $definition), array($decorated[2], --$order)); } - foreach ($definitions as $arr) { - list($id, $definition) = $arr; + foreach ($definitions as list($id, $definition)) { list($inner, $renamedId) = $definition->getDecoratedService(); $definition->setDecoratedService(null); diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 8e2a544adf..3f8fcd82c1 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -295,9 +295,7 @@ class XmlFileLoader extends FileLoader // resolve definitions krsort($definitions); - foreach ($definitions as $id => $def) { - list($domElement, $file, $wild) = $def; - + foreach ($definitions as $id => list($domElement, $file, $wild)) { // anonymous services are always private // we could not use the constant false here, because of XML parsing $domElement->setAttribute('public', 'false'); diff --git a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php index e71da1fb67..c654b0fa0c 100644 --- a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php @@ -80,8 +80,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher $this->lazyLoad($eventName); if (isset($this->listenerIds[$eventName])) { - foreach ($this->listenerIds[$eventName] as $i => $args) { - list($serviceId, $method, $priority) = $args; + foreach ($this->listenerIds[$eventName] as $i => list($serviceId, $method, $priority)) { $key = $serviceId.'.'.$method; if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) { unset($this->listeners[$eventName][$key]); @@ -183,8 +182,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher protected function lazyLoad($eventName) { if (isset($this->listenerIds[$eventName])) { - foreach ($this->listenerIds[$eventName] as $args) { - list($serviceId, $method, $priority) = $args; + foreach ($this->listenerIds[$eventName] as list($serviceId, $method, $priority)) { $listener = $this->container->get($serviceId); $key = $serviceId.'.'.$method;