Unpack nested array instead of using temp var

This commit is contained in:
Diego Saint Esteben 2015-08-11 01:26:47 -03:00 committed by Fabien Potencier
parent 11de7b3996
commit 20e9ed6506
7 changed files with 8 additions and 19 deletions

View File

@ -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;
}

View File

@ -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]));

View File

@ -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';

View File

@ -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;
}

View File

@ -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);

View File

@ -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');

View File

@ -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;