mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 12:26:30 +00:00
minor #4381 Fix getting nodes with int names (fabpot)
This PR was merged into the 4.x branch.
Discussion
----------
Fix getting nodes with int names
Commits
-------
14b5de7e54 Fix getting nodes with int names
This commit is contained in:
@@ -14,7 +14,7 @@ class EnumCasesFunction extends FunctionExpression
|
||||
$arguments = $this->getNode('arguments');
|
||||
if ($arguments->hasNode('enum')) {
|
||||
$firstArgument = $arguments->getNode('enum');
|
||||
} elseif ($arguments->hasNode('0')) {
|
||||
} elseif ($arguments->hasNode(0)) {
|
||||
$firstArgument = $arguments->getNode(0);
|
||||
} else {
|
||||
$firstArgument = null;
|
||||
|
||||
@@ -14,8 +14,8 @@ class EnumFunction extends FunctionExpression
|
||||
$arguments = $this->getNode('arguments');
|
||||
if ($arguments->hasNode('enum')) {
|
||||
$firstArgument = $arguments->getNode('enum');
|
||||
} elseif ($arguments->hasNode('0')) {
|
||||
$firstArgument = $arguments->getNode('0');
|
||||
} elseif ($arguments->hasNode(0)) {
|
||||
$firstArgument = $arguments->getNode(0);
|
||||
} else {
|
||||
$firstArgument = null;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class ConstantTest extends TestExpression
|
||||
->raw(' === constant(')
|
||||
;
|
||||
|
||||
if ($this->getNode('arguments')->hasNode('1')) {
|
||||
if ($this->getNode('arguments')->hasNode(1)) {
|
||||
$compiler
|
||||
->subcompile($this->getNode('arguments')->getNode(1))
|
||||
->raw('::class."::".')
|
||||
|
||||
@@ -18,7 +18,7 @@ class TypesTokenParserTest extends TestCase
|
||||
$stream = $env->tokenize(new Source($template, ''));
|
||||
$parser = new Parser($env);
|
||||
|
||||
$typesNode = $parser->parse($stream)->getNode('body')->getNode('0');
|
||||
$typesNode = $parser->parse($stream)->getNode('body')->getNode(0);
|
||||
|
||||
self::assertEquals($expected, $typesNode->getAttribute('mapping'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user