Remove list() usage in code

This commit is contained in:
Fabien Potencier
2024-01-05 12:46:24 +01:00
parent 9c0897fa2c
commit af8ec178b6
8 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -704,7 +704,7 @@ class ExpressionParser
private function parseTestExpression(Node $node): TestExpression private function parseTestExpression(Node $node): TestExpression
{ {
$stream = $this->parser->getStream(); $stream = $this->parser->getStream();
list($name, $test) = $this->getTest($node->getTemplateLine()); [$name, $test] = $this->getTest($node->getTemplateLine());
$class = $this->getTestNodeClass($test); $class = $this->getTestNodeClass($test);
$arguments = null; $arguments = null;
+3 -3
View File
@@ -210,7 +210,7 @@ class Lexer
$this->pushToken(/* Token::EOF_TYPE */ -1); $this->pushToken(/* Token::EOF_TYPE */ -1);
if (!empty($this->brackets)) { if (!empty($this->brackets)) {
list($expect, $lineno) = array_pop($this->brackets); [$expect, $lineno] = array_pop($this->brackets);
throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
} }
@@ -356,7 +356,7 @@ class Lexer
throw new SyntaxError(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); throw new SyntaxError(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source);
} }
list($expect, $lineno) = array_pop($this->brackets); [$expect, $lineno] = array_pop($this->brackets);
if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) { if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) {
throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
} }
@@ -426,7 +426,7 @@ class Lexer
$this->pushToken(/* Token::STRING_TYPE */ 7, stripcslashes($match[0])); $this->pushToken(/* Token::STRING_TYPE */ 7, stripcslashes($match[0]));
$this->moveCursor($match[0]); $this->moveCursor($match[0]);
} elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) {
list($expect, $lineno) = array_pop($this->brackets); [$expect, $lineno] = array_pop($this->brackets);
if ('"' != $this->code[$this->cursor]) { if ('"' != $this->code[$this->cursor]) {
throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source);
} }
+1 -1
View File
@@ -183,7 +183,7 @@ class FilesystemLoader implements LoaderInterface
} }
try { try {
list($namespace, $shortname) = $this->parseName($name); [$namespace, $shortname] = $this->parseName($name);
$this->validateName($shortname); $this->validateName($shortname);
} catch (LoaderError $e) { } catch (LoaderError $e) {
+1 -1
View File
@@ -140,7 +140,7 @@ abstract class CallExpression extends AbstractExpression
throw new \LogicException($message); throw new \LogicException($message);
} }
list($callableParameters, $isPhpVariadic) = $this->getCallableParameters($callable, $isVariadic); [$callableParameters, $isPhpVariadic] = $this->getCallableParameters($callable, $isVariadic);
$arguments = []; $arguments = [];
$names = []; $names = [];
$missingArguments = []; $missingArguments = [];
+1 -1
View File
@@ -176,6 +176,6 @@ final class Profile implements \IteratorAggregate, \Serializable
*/ */
public function __unserialize(array $data): void public function __unserialize(array $data): void
{ {
list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = $data; [$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles] = $data;
} }
} }
+1 -1
View File
@@ -234,7 +234,7 @@ abstract class IntegrationTestCase extends TestCase
} }
if (false !== $exception) { if (false !== $exception) {
list($class) = explode(':', $exception); [$class] = explode(':', $exception);
$constraintClass = class_exists('PHPUnit\Framework\Constraint\Exception') ? 'PHPUnit\Framework\Constraint\Exception' : 'PHPUnit_Framework_Constraint_Exception'; $constraintClass = class_exists('PHPUnit\Framework\Constraint\Exception') ? 'PHPUnit\Framework\Constraint\Exception' : 'PHPUnit_Framework_Constraint_Exception';
$this->assertThat(null, new $constraintClass($class)); $this->assertThat(null, new $constraintClass($class));
} }
+1 -1
View File
@@ -30,7 +30,7 @@ final class EmbedTokenParser extends IncludeTokenParser
$parent = $this->parser->getExpressionParser()->parseExpression(); $parent = $this->parser->getExpressionParser()->parseExpression();
list($variables, $only, $ignoreMissing) = $this->parseArguments(); [$variables, $only, $ignoreMissing] = $this->parseArguments();
$parentToken = $fakeParentToken = new Token(/* Token::STRING_TYPE */ 7, '__parent__', $token->getLine()); $parentToken = $fakeParentToken = new Token(/* Token::STRING_TYPE */ 7, '__parent__', $token->getLine());
if ($parent instanceof ConstantExpression) { if ($parent instanceof ConstantExpression) {
+1 -1
View File
@@ -31,7 +31,7 @@ class IncludeTokenParser extends AbstractTokenParser
{ {
$expr = $this->parser->getExpressionParser()->parseExpression(); $expr = $this->parser->getExpressionParser()->parseExpression();
list($variables, $only, $ignoreMissing) = $this->parseArguments(); [$variables, $only, $ignoreMissing] = $this->parseArguments();
return new IncludeNode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); return new IncludeNode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
} }