Unpack nested array instead of using temp var
This commit is contained in:
parent
11de7b3996
commit
20e9ed6506
@ -159,8 +159,7 @@ class RegisterEventListenersAndSubscribersPassTest extends \PHPUnit_Framework_Te
|
|||||||
private function getServiceOrder(ContainerBuilder $container, $method)
|
private function getServiceOrder(ContainerBuilder $container, $method)
|
||||||
{
|
{
|
||||||
$order = array();
|
$order = array();
|
||||||
foreach ($container->getDefinition('doctrine.dbal.default_connection.event_manager')->getMethodCalls() as $call) {
|
foreach ($container->getDefinition('doctrine.dbal.default_connection.event_manager')->getMethodCalls() as list($name, $arguments)) {
|
||||||
list($name, $arguments) = $call;
|
|
||||||
if ($method !== $name) {
|
if ($method !== $name) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;
|
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\Parameter;
|
|
||||||
use Symfony\Bundle\SecurityBundle\SecurityBundle;
|
use Symfony\Bundle\SecurityBundle\SecurityBundle;
|
||||||
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
|
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
@ -134,8 +133,7 @@ abstract class CompleteConfigurationTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
$matcherIds = array();
|
$matcherIds = array();
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as list($matcherId, $attributes, $channel)) {
|
||||||
list($matcherId, $attributes, $channel) = $rule;
|
|
||||||
$requestMatcher = $container->getDefinition($matcherId);
|
$requestMatcher = $container->getDefinition($matcherId);
|
||||||
|
|
||||||
$this->assertFalse(isset($matcherIds[$matcherId]));
|
$this->assertFalse(isset($matcherIds[$matcherId]));
|
||||||
|
@ -45,8 +45,7 @@ class Psr4ClassLoader
|
|||||||
{
|
{
|
||||||
$class = ltrim($class, '\\');
|
$class = ltrim($class, '\\');
|
||||||
|
|
||||||
foreach ($this->prefixes as $current) {
|
foreach ($this->prefixes as list($currentPrefix, $currentBaseDir)) {
|
||||||
list($currentPrefix, $currentBaseDir) = $current;
|
|
||||||
if (0 === strpos($class, $currentPrefix)) {
|
if (0 === strpos($class, $currentPrefix)) {
|
||||||
$classWithoutPrefix = substr($class, strlen($currentPrefix));
|
$classWithoutPrefix = substr($class, strlen($currentPrefix));
|
||||||
$file = $currentBaseDir.str_replace('\\', DIRECTORY_SEPARATOR, $classWithoutPrefix).'.php';
|
$file = $currentBaseDir.str_replace('\\', DIRECTORY_SEPARATOR, $classWithoutPrefix).'.php';
|
||||||
|
@ -330,9 +330,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||||||
*/
|
*/
|
||||||
protected function remapXml($value)
|
protected function remapXml($value)
|
||||||
{
|
{
|
||||||
foreach ($this->xmlRemappings as $transformation) {
|
foreach ($this->xmlRemappings as list($singular, $plural)) {
|
||||||
list($singular, $plural) = $transformation;
|
|
||||||
|
|
||||||
if (!isset($value[$singular])) {
|
if (!isset($value[$singular])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,7 @@ class DecoratorServicePass implements CompilerPassInterface
|
|||||||
$definitions->insert(array($id, $definition), array($decorated[2], --$order));
|
$definitions->insert(array($id, $definition), array($decorated[2], --$order));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($definitions as $arr) {
|
foreach ($definitions as list($id, $definition)) {
|
||||||
list($id, $definition) = $arr;
|
|
||||||
list($inner, $renamedId) = $definition->getDecoratedService();
|
list($inner, $renamedId) = $definition->getDecoratedService();
|
||||||
|
|
||||||
$definition->setDecoratedService(null);
|
$definition->setDecoratedService(null);
|
||||||
|
@ -295,9 +295,7 @@ class XmlFileLoader extends FileLoader
|
|||||||
|
|
||||||
// resolve definitions
|
// resolve definitions
|
||||||
krsort($definitions);
|
krsort($definitions);
|
||||||
foreach ($definitions as $id => $def) {
|
foreach ($definitions as $id => list($domElement, $file, $wild)) {
|
||||||
list($domElement, $file, $wild) = $def;
|
|
||||||
|
|
||||||
// anonymous services are always private
|
// anonymous services are always private
|
||||||
// we could not use the constant false here, because of XML parsing
|
// we could not use the constant false here, because of XML parsing
|
||||||
$domElement->setAttribute('public', 'false');
|
$domElement->setAttribute('public', 'false');
|
||||||
|
@ -80,8 +80,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
|||||||
$this->lazyLoad($eventName);
|
$this->lazyLoad($eventName);
|
||||||
|
|
||||||
if (isset($this->listenerIds[$eventName])) {
|
if (isset($this->listenerIds[$eventName])) {
|
||||||
foreach ($this->listenerIds[$eventName] as $i => $args) {
|
foreach ($this->listenerIds[$eventName] as $i => list($serviceId, $method, $priority)) {
|
||||||
list($serviceId, $method, $priority) = $args;
|
|
||||||
$key = $serviceId.'.'.$method;
|
$key = $serviceId.'.'.$method;
|
||||||
if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) {
|
if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) {
|
||||||
unset($this->listeners[$eventName][$key]);
|
unset($this->listeners[$eventName][$key]);
|
||||||
@ -183,8 +182,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
|||||||
protected function lazyLoad($eventName)
|
protected function lazyLoad($eventName)
|
||||||
{
|
{
|
||||||
if (isset($this->listenerIds[$eventName])) {
|
if (isset($this->listenerIds[$eventName])) {
|
||||||
foreach ($this->listenerIds[$eventName] as $args) {
|
foreach ($this->listenerIds[$eventName] as list($serviceId, $method, $priority)) {
|
||||||
list($serviceId, $method, $priority) = $args;
|
|
||||||
$listener = $this->container->get($serviceId);
|
$listener = $this->container->get($serviceId);
|
||||||
|
|
||||||
$key = $serviceId.'.'.$method;
|
$key = $serviceId.'.'.$method;
|
||||||
|
Reference in New Issue
Block a user