8000 Unpack nested array instead of using temp var by dosten · Pull Request #15506 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Unpack nested array instead of using temp var #15506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Unpack nested array instead of using temp var
  • Loading branch information
dosten committed Aug 11, 2015
commit c21119fd634adeca04560c68f9d114087af24fdb
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ private function process(ContainerBuilder $container)
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ public function testAccess()
}

$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]));
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/ClassLoader/Psr4ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public function findFile($class)
{
$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';
Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Component/Config/Definition/ArrayNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,7 @@ protected function normalizeValue($value)
*/
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public function process(ContainerBuilder $container)
$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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,7 @@ private function processAnonymousServices(\DOMDocument $xml, $file)

// 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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ public function removeListener($eventName, $listener)
$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]);
Expand Down Expand Up @@ -183,8 +182,7 @@ public function getContainer()
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;
Expand Down
0