diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index 148663ba..123cb83a 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -75,6 +75,7 @@ used. A number of AST nodes have been renamed or moved in the AST hierarchy: + * `Node\Scalar\LNumber` is now `Node\Scalar\Int_`. * `Node\Scalar\DNumber` is now `Node\Scalar\Float_`. * `Node\Expr\ClosureUse` is now `Node\ClosureUse` and no longer extends `Node\Expr`. * `Node\Expr\ArrayItem` is now `Node\ArrayItem` and no longer extends `Node\Expr`. diff --git a/doc/component/Constant_expression_evaluation.markdown b/doc/component/Constant_expression_evaluation.markdown index 9ab4f5c3..45f576c5 100644 --- a/doc/component/Constant_expression_evaluation.markdown +++ b/doc/component/Constant_expression_evaluation.markdown @@ -45,7 +45,7 @@ use PhpParser\Node\{Expr, Scalar}; $evaluator = new ConstExprEvaluator(); // 10 / 0 -$expr = new Expr\BinaryOp\Div(new Scalar\LNumber(10), new Scalar\LNumber(0)); +$expr = new Expr\BinaryOp\Div(new Scalar\Int_(10), new Scalar\Int_(0)); var_dump($evaluator->evaluateDirectly($expr)); // float(INF) // Warning: Division by zero @@ -112,4 +112,4 @@ class Test { const A = self::B; const B = self::A; } -``` \ No newline at end of file +``` diff --git a/doc/component/Walking_the_AST.markdown b/doc/component/Walking_the_AST.markdown index e4d95609..25e7c324 100644 --- a/doc/component/Walking_the_AST.markdown +++ b/doc/component/Walking_the_AST.markdown @@ -11,7 +11,7 @@ use PhpParser\{Node, NodeTraverser, NodeVisitorAbstract}; $traverser = new NodeTraverser; $traverser->addVisitor(new class extends NodeVisitorAbstract { public function leaveNode(Node $node) { - if ($node instanceof Node\Scalar\LNumber) { + if ($node instanceof Node\Scalar\Int_) { return new Node\Scalar\String_((string) $node->value); } } diff --git a/lib/PhpParser/BuilderHelpers.php b/lib/PhpParser/BuilderHelpers.php index ac9b775b..fe7f923d 100644 --- a/lib/PhpParser/BuilderHelpers.php +++ b/lib/PhpParser/BuilderHelpers.php @@ -236,7 +236,7 @@ final class BuilderHelpers { } if (is_int($value)) { - return new Scalar\LNumber($value); + return new Scalar\Int_($value); } if (is_float($value)) { diff --git a/lib/PhpParser/ConstExprEvaluator.php b/lib/PhpParser/ConstExprEvaluator.php index 713c3e89..1ad43968 100644 --- a/lib/PhpParser/ConstExprEvaluator.php +++ b/lib/PhpParser/ConstExprEvaluator.php @@ -102,7 +102,7 @@ class ConstExprEvaluator { } private function evaluate(Expr $expr) { - if ($expr instanceof Scalar\LNumber + if ($expr instanceof Scalar\Int_ || $expr instanceof Scalar\Float_ || $expr instanceof Scalar\String_ ) { diff --git a/lib/PhpParser/Node/Scalar/Int_.php b/lib/PhpParser/Node/Scalar/Int_.php new file mode 100644 index 00000000..a0187b21 --- /dev/null +++ b/lib/PhpParser/Node/Scalar/Int_.php @@ -0,0 +1,82 @@ +attributes = $attributes; + $this->value = $value; + } + + public function getSubNodeNames(): array { + return ['value']; + } + + /** + * Constructs an Int node from a string number literal. + * + * @param string $str String number literal (decimal, octal, hex or binary) + * @param array $attributes Additional attributes + * @param bool $allowInvalidOctal Whether to allow invalid octal numbers (PHP 5) + * + * @return Int_ The constructed LNumber, including kind attribute + */ + public static function fromString(string $str, array $attributes = [], bool $allowInvalidOctal = false): Int_ { + $attributes['rawValue'] = $str; + + $str = str_replace('_', '', $str); + + if ('0' !== $str[0] || '0' === $str) { + $attributes['kind'] = Int_::KIND_DEC; + return new Int_((int) $str, $attributes); + } + + if ('x' === $str[1] || 'X' === $str[1]) { + $attributes['kind'] = Int_::KIND_HEX; + return new Int_(hexdec($str), $attributes); + } + + if ('b' === $str[1] || 'B' === $str[1]) { + $attributes['kind'] = Int_::KIND_BIN; + return new Int_(bindec($str), $attributes); + } + + if (!$allowInvalidOctal && strpbrk($str, '89')) { + throw new Error('Invalid numeric literal', $attributes); + } + + // Strip optional explicit octal prefix. + if ('o' === $str[1] || 'O' === $str[1]) { + $str = substr($str, 2); + } + + // use intval instead of octdec to get proper cutting behavior with malformed numbers + $attributes['kind'] = Int_::KIND_OCT; + return new Int_(intval($str, 8), $attributes); + } + + public function getType(): string { + return 'Scalar_Int'; + } +} + +// @deprecated compatibility alias +class_alias(Int_::class, LNumber::class); diff --git a/lib/PhpParser/Node/Scalar/LNumber.php b/lib/PhpParser/Node/Scalar/LNumber.php index 0991a536..cfe8c8c1 100644 --- a/lib/PhpParser/Node/Scalar/LNumber.php +++ b/lib/PhpParser/Node/Scalar/LNumber.php @@ -1,79 +1,3 @@ attributes = $attributes; - $this->value = $value; - } - - public function getSubNodeNames(): array { - return ['value']; - } - - /** - * Constructs an LNumber node from a string number literal. - * - * @param string $str String number literal (decimal, octal, hex or binary) - * @param array $attributes Additional attributes - * @param bool $allowInvalidOctal Whether to allow invalid octal numbers (PHP 5) - * - * @return LNumber The constructed LNumber, including kind attribute - */ - public static function fromString(string $str, array $attributes = [], bool $allowInvalidOctal = false): LNumber { - $attributes['rawValue'] = $str; - - $str = str_replace('_', '', $str); - - if ('0' !== $str[0] || '0' === $str) { - $attributes['kind'] = LNumber::KIND_DEC; - return new LNumber((int) $str, $attributes); - } - - if ('x' === $str[1] || 'X' === $str[1]) { - $attributes['kind'] = LNumber::KIND_HEX; - return new LNumber(hexdec($str), $attributes); - } - - if ('b' === $str[1] || 'B' === $str[1]) { - $attributes['kind'] = LNumber::KIND_BIN; - return new LNumber(bindec($str), $attributes); - } - - if (!$allowInvalidOctal && strpbrk($str, '89')) { - throw new Error('Invalid numeric literal', $attributes); - } - - // Strip optional explicit octal prefix. - if ('o' === $str[1] || 'O' === $str[1]) { - $str = substr($str, 2); - } - - // use intval instead of octdec to get proper cutting behavior with malformed numbers - $attributes['kind'] = LNumber::KIND_OCT; - return new LNumber(intval($str, 8), $attributes); - } - - public function getType(): string { - return 'Scalar_LNumber'; - } -} +require __DIR__ . '/Int_.php'; diff --git a/lib/PhpParser/ParserAbstract.php b/lib/PhpParser/ParserAbstract.php index f1cc8d0e..eeb06406 100644 --- a/lib/PhpParser/ParserAbstract.php +++ b/lib/PhpParser/ParserAbstract.php @@ -14,7 +14,7 @@ use PhpParser\Node\Expr\Cast\Double; use PhpParser\Node\Name; use PhpParser\Node\Param; use PhpParser\Node\Scalar\Encapsed; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassConst; @@ -664,11 +664,11 @@ abstract class ParserAbstract implements Parser { protected function parseLNumber($str, $attributes, $allowInvalidOctal = false) { try { - return LNumber::fromString($str, $attributes, $allowInvalidOctal); + return Int_::fromString($str, $attributes, $allowInvalidOctal); } catch (Error $error) { $this->emitError($error); // Use dummy value - return new LNumber(0, $attributes); + return new Int_(0, $attributes); } } @@ -678,7 +678,7 @@ abstract class ParserAbstract implements Parser { * @param string $str Number string * @param array $attributes Attributes * - * @return LNumber|String_ Integer or string node. + * @return Int_|String_ Integer or string node. */ protected function parseNumString(string $str, array $attributes) { if (!preg_match('/^(?:0|-?[1-9][0-9]*)$/', $str)) { @@ -690,7 +690,7 @@ abstract class ParserAbstract implements Parser { return new String_($str, $attributes); } - return new LNumber($num, $attributes); + return new Int_($num, $attributes); } protected function stripIndentation( diff --git a/lib/PhpParser/PrettyPrinter/Standard.php b/lib/PhpParser/PrettyPrinter/Standard.php index 9069dd6b..f704d264 100644 --- a/lib/PhpParser/PrettyPrinter/Standard.php +++ b/lib/PhpParser/PrettyPrinter/Standard.php @@ -181,15 +181,15 @@ class Standard extends PrettyPrinterAbstract { return '"' . $this->pEncapsList($node->parts, '"') . '"'; } - protected function pScalar_LNumber(Scalar\LNumber $node) { + protected function pScalar_Int(Scalar\Int_ $node) { if ($node->value === -\PHP_INT_MAX-1) { // PHP_INT_MIN cannot be represented as a literal, // because the sign is not part of the literal return '(-' . \PHP_INT_MAX . '-1)'; } - $kind = $node->getAttribute('kind', Scalar\LNumber::KIND_DEC); - if (Scalar\LNumber::KIND_DEC === $kind) { + $kind = $node->getAttribute('kind', Scalar\Int_::KIND_DEC); + if (Scalar\Int_::KIND_DEC === $kind) { return (string) $node->value; } @@ -201,11 +201,11 @@ class Standard extends PrettyPrinterAbstract { $str = (string) $node->value; } switch ($kind) { - case Scalar\LNumber::KIND_BIN: + case Scalar\Int_::KIND_BIN: return $sign . '0b' . base_convert($str, 10, 2); - case Scalar\LNumber::KIND_OCT: + case Scalar\Int_::KIND_OCT: return $sign . '0' . base_convert($str, 10, 8); - case Scalar\LNumber::KIND_HEX: + case Scalar\Int_::KIND_HEX: return $sign . '0x' . base_convert($str, 10, 16); } throw new \Exception('Invalid number kind'); diff --git a/test/PhpParser/Builder/ClassConstTest.php b/test/PhpParser/Builder/ClassConstTest.php index 05ed1215..715a5bb6 100644 --- a/test/PhpParser/Builder/ClassConstTest.php +++ b/test/PhpParser/Builder/ClassConstTest.php @@ -12,7 +12,7 @@ use PhpParser\Node\Expr; use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Scalar; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt; class ClassConstTest extends \PHPUnit\Framework\TestCase { @@ -29,7 +29,7 @@ class ClassConstTest extends \PHPUnit\Framework\TestCase { $this->assertEquals( new Stmt\ClassConst( [ - new Const_("TEST", new LNumber(1)) + new Const_("TEST", new Int_(1)) ], Modifiers::PRIVATE ), @@ -44,7 +44,7 @@ class ClassConstTest extends \PHPUnit\Framework\TestCase { $this->assertEquals( new Stmt\ClassConst( [ - new Const_("TEST", new LNumber(1)) + new Const_("TEST", new Int_(1)) ], Modifiers::PROTECTED ), @@ -59,7 +59,7 @@ class ClassConstTest extends \PHPUnit\Framework\TestCase { $this->assertEquals( new Stmt\ClassConst( [ - new Const_("TEST", new LNumber(1)) + new Const_("TEST", new Int_(1)) ], Modifiers::PUBLIC ), @@ -74,7 +74,7 @@ class ClassConstTest extends \PHPUnit\Framework\TestCase { $this->assertEquals( new Stmt\ClassConst( [ - new Const_("TEST", new LNumber(1)) + new Const_("TEST", new Int_(1)) ], Modifiers::FINAL ), @@ -91,7 +91,7 @@ class ClassConstTest extends \PHPUnit\Framework\TestCase { $this->assertEquals( new Stmt\ClassConst( [ - new Const_("TEST", new LNumber(1)) + new Const_("TEST", new Int_(1)) ], Modifiers::PUBLIC, [ @@ -110,8 +110,8 @@ class ClassConstTest extends \PHPUnit\Framework\TestCase { $this->assertEquals( new Stmt\ClassConst( [ - new Const_("FIRST_TEST", new LNumber(1)), - new Const_("SECOND_TEST", new LNumber(2)) + new Const_("FIRST_TEST", new Int_(1)), + new Const_("SECOND_TEST", new Int_(2)) ] ), $node @@ -121,7 +121,7 @@ class ClassConstTest extends \PHPUnit\Framework\TestCase { public function testAddAttribute() { $attribute = new Attribute( new Name('Attr'), - [new Arg(new LNumber(1), false, false, [], new Identifier('name'))] + [new Arg(new Int_(1), false, false, [], new Identifier('name'))] ); $attributeGroup = new AttributeGroup([$attribute]); @@ -132,7 +132,7 @@ class ClassConstTest extends \PHPUnit\Framework\TestCase { $this->assertEquals( new Stmt\ClassConst( [ - new Const_("ATTR_GROUP", new LNumber(1)) + new Const_("ATTR_GROUP", new Int_(1)) ], 0, [], @@ -169,7 +169,7 @@ class ClassConstTest extends \PHPUnit\Framework\TestCase { ], [ 31415, - new Scalar\LNumber(31415) + new Scalar\Int_(31415) ], [ 3.1415, @@ -182,9 +182,9 @@ class ClassConstTest extends \PHPUnit\Framework\TestCase { [ [1, 2, 3], new Expr\Array_([ - new \PhpParser\Node\ArrayItem(new Scalar\LNumber(1)), - new \PhpParser\Node\ArrayItem(new Scalar\LNumber(2)), - new \PhpParser\Node\ArrayItem(new Scalar\LNumber(3)), + new \PhpParser\Node\ArrayItem(new Scalar\Int_(1)), + new \PhpParser\Node\ArrayItem(new Scalar\Int_(2)), + new \PhpParser\Node\ArrayItem(new Scalar\Int_(3)), ]) ], [ diff --git a/test/PhpParser/Builder/ClassTest.php b/test/PhpParser/Builder/ClassTest.php index 160de913..24e6b139 100644 --- a/test/PhpParser/Builder/ClassTest.php +++ b/test/PhpParser/Builder/ClassTest.php @@ -10,7 +10,7 @@ use PhpParser\Node\Attribute; use PhpParser\Node\AttributeGroup; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt; class ClassTest extends \PHPUnit\Framework\TestCase { @@ -144,7 +144,7 @@ DOC; public function testAddAttribute() { $attribute = new Attribute( new Name('Attr'), - [new Arg(new LNumber(1), false, false, [], new Identifier('name'))] + [new Arg(new Int_(1), false, false, [], new Identifier('name'))] ); $attributeGroup = new AttributeGroup([$attribute]); diff --git a/test/PhpParser/Builder/EnumCaseTest.php b/test/PhpParser/Builder/EnumCaseTest.php index be3a8635..437877c4 100644 --- a/test/PhpParser/Builder/EnumCaseTest.php +++ b/test/PhpParser/Builder/EnumCaseTest.php @@ -9,7 +9,7 @@ use PhpParser\Node\AttributeGroup; use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Scalar; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt; class EnumCaseTest extends \PHPUnit\Framework\TestCase { @@ -37,7 +37,7 @@ class EnumCaseTest extends \PHPUnit\Framework\TestCase { public function testAddAttribute() { $attribute = new Attribute( new Name('Attr'), - [new Arg(new LNumber(1), false, false, [], new Identifier('name'))] + [new Arg(new Int_(1), false, false, [], new Identifier('name'))] ); $attributeGroup = new AttributeGroup([$attribute]); @@ -72,7 +72,7 @@ class EnumCaseTest extends \PHPUnit\Framework\TestCase { return [ [ 31415, - new Scalar\LNumber(31415) + new Scalar\Int_(31415) ], [ 'Hallo World', diff --git a/test/PhpParser/Builder/EnumTest.php b/test/PhpParser/Builder/EnumTest.php index f4ab3b90..51f94a61 100644 --- a/test/PhpParser/Builder/EnumTest.php +++ b/test/PhpParser/Builder/EnumTest.php @@ -9,7 +9,7 @@ use PhpParser\Node\Attribute; use PhpParser\Node\AttributeGroup; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt; class EnumTest extends \PHPUnit\Framework\TestCase { @@ -109,7 +109,7 @@ DOC; public function testAddAttribute() { $attribute = new Attribute( new Name('Attr'), - [new Arg(new LNumber(1), false, false, [], new Identifier('name'))] + [new Arg(new Int_(1), false, false, [], new Identifier('name'))] ); $attributeGroup = new AttributeGroup([$attribute]); diff --git a/test/PhpParser/Builder/FunctionTest.php b/test/PhpParser/Builder/FunctionTest.php index 175ff6d4..0152b30a 100644 --- a/test/PhpParser/Builder/FunctionTest.php +++ b/test/PhpParser/Builder/FunctionTest.php @@ -11,7 +11,7 @@ use PhpParser\Node\Expr\Print_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt; @@ -89,7 +89,7 @@ class FunctionTest extends \PHPUnit\Framework\TestCase { public function testAddAttribute() { $attribute = new Attribute( new Name('Attr'), - [new Arg(new LNumber(1), false, false, [], new Identifier('name'))] + [new Arg(new Int_(1), false, false, [], new Identifier('name'))] ); $attributeGroup = new AttributeGroup([$attribute]); diff --git a/test/PhpParser/Builder/InterfaceTest.php b/test/PhpParser/Builder/InterfaceTest.php index 34ee277e..4ae93956 100644 --- a/test/PhpParser/Builder/InterfaceTest.php +++ b/test/PhpParser/Builder/InterfaceTest.php @@ -10,7 +10,7 @@ use PhpParser\Node\AttributeGroup; use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Scalar\Float_; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt; class InterfaceTest extends \PHPUnit\Framework\TestCase { @@ -84,7 +84,7 @@ class InterfaceTest extends \PHPUnit\Framework\TestCase { public function testAddAttribute() { $attribute = new Attribute( new Name('Attr'), - [new Arg(new LNumber(1), false, false, [], new Identifier('name'))] + [new Arg(new Int_(1), false, false, [], new Identifier('name'))] ); $attributeGroup = new AttributeGroup([$attribute]); diff --git a/test/PhpParser/Builder/MethodTest.php b/test/PhpParser/Builder/MethodTest.php index ee0ea492..6381aaac 100644 --- a/test/PhpParser/Builder/MethodTest.php +++ b/test/PhpParser/Builder/MethodTest.php @@ -12,7 +12,7 @@ use PhpParser\Node\Expr\Print_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt; @@ -131,7 +131,7 @@ class MethodTest extends \PHPUnit\Framework\TestCase { public function testAddAttribute() { $attribute = new Attribute( new Name('Attr'), - [new Arg(new LNumber(1), false, false, [], new Identifier('name'))] + [new Arg(new Int_(1), false, false, [], new Identifier('name'))] ); $attributeGroup = new AttributeGroup([$attribute]); diff --git a/test/PhpParser/Builder/ParamTest.php b/test/PhpParser/Builder/ParamTest.php index 188c97ea..62c357e7 100644 --- a/test/PhpParser/Builder/ParamTest.php +++ b/test/PhpParser/Builder/ParamTest.php @@ -10,7 +10,7 @@ use PhpParser\Node\Expr; use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Scalar; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; class ParamTest extends \PHPUnit\Framework\TestCase { public function createParamBuilder($name) { @@ -45,7 +45,7 @@ class ParamTest extends \PHPUnit\Framework\TestCase { ], [ 31415, - new Scalar\LNumber(31415) + new Scalar\Int_(31415) ], [ 3.1415, @@ -58,9 +58,9 @@ class ParamTest extends \PHPUnit\Framework\TestCase { [ [1, 2, 3], new Expr\Array_([ - new Node\ArrayItem(new Scalar\LNumber(1)), - new Node\ArrayItem(new Scalar\LNumber(2)), - new Node\ArrayItem(new Scalar\LNumber(3)), + new Node\ArrayItem(new Scalar\Int_(1)), + new Node\ArrayItem(new Scalar\Int_(2)), + new Node\ArrayItem(new Scalar\Int_(3)), ]) ], [ @@ -207,7 +207,7 @@ class ParamTest extends \PHPUnit\Framework\TestCase { public function testAddAttribute() { $attribute = new Attribute( new Name('Attr'), - [new Arg(new LNumber(1), false, false, [], new Identifier('name'))] + [new Arg(new Int_(1), false, false, [], new Identifier('name'))] ); $attributeGroup = new AttributeGroup([$attribute]); diff --git a/test/PhpParser/Builder/PropertyTest.php b/test/PhpParser/Builder/PropertyTest.php index f20f66e8..329641c8 100644 --- a/test/PhpParser/Builder/PropertyTest.php +++ b/test/PhpParser/Builder/PropertyTest.php @@ -11,7 +11,7 @@ use PhpParser\Node\Expr; use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Scalar; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt; class PropertyTest extends \PHPUnit\Framework\TestCase { @@ -113,7 +113,7 @@ class PropertyTest extends \PHPUnit\Framework\TestCase { public function testAddAttribute() { $attribute = new Attribute( new Name('Attr'), - [new Arg(new LNumber(1), false, false, [], new Identifier('name'))] + [new Arg(new Int_(1), false, false, [], new Identifier('name'))] ); $attributeGroup = new AttributeGroup([$attribute]); @@ -152,7 +152,7 @@ class PropertyTest extends \PHPUnit\Framework\TestCase { ], [ 31415, - new Scalar\LNumber(31415) + new Scalar\Int_(31415) ], [ 3.1415, @@ -165,9 +165,9 @@ class PropertyTest extends \PHPUnit\Framework\TestCase { [ [1, 2, 3], new Expr\Array_([ - new \PhpParser\Node\ArrayItem(new Scalar\LNumber(1)), - new \PhpParser\Node\ArrayItem(new Scalar\LNumber(2)), - new \PhpParser\Node\ArrayItem(new Scalar\LNumber(3)), + new \PhpParser\Node\ArrayItem(new Scalar\Int_(1)), + new \PhpParser\Node\ArrayItem(new Scalar\Int_(2)), + new \PhpParser\Node\ArrayItem(new Scalar\Int_(3)), ]) ], [ diff --git a/test/PhpParser/Builder/TraitTest.php b/test/PhpParser/Builder/TraitTest.php index 3285d19c..80283336 100644 --- a/test/PhpParser/Builder/TraitTest.php +++ b/test/PhpParser/Builder/TraitTest.php @@ -9,7 +9,7 @@ use PhpParser\Node\Attribute; use PhpParser\Node\AttributeGroup; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassConst; @@ -96,7 +96,7 @@ class TraitTest extends \PHPUnit\Framework\TestCase { public function testAddAttribute() { $attribute = new Attribute( new Name('Attr'), - [new Arg(new LNumber(1), false, false, [], new Identifier('name'))] + [new Arg(new Int_(1), false, false, [], new Identifier('name'))] ); $attributeGroup = new AttributeGroup([$attribute]); diff --git a/test/PhpParser/BuilderFactoryTest.php b/test/PhpParser/BuilderFactoryTest.php index 74a917c3..2434dd21 100644 --- a/test/PhpParser/BuilderFactoryTest.php +++ b/test/PhpParser/BuilderFactoryTest.php @@ -8,7 +8,7 @@ use PhpParser\Node\Expr; use PhpParser\Node\Expr\BinaryOp\Concat; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; class BuilderFactoryTest extends \PHPUnit\Framework\TestCase { @@ -141,7 +141,7 @@ class BuilderFactoryTest extends \PHPUnit\Framework\TestCase { new Expr\MethodCall( new Expr\Variable('obj'), new Identifier('method'), - [new Arg(new LNumber(42))] + [new Arg(new Int_(42))] ), $factory->methodCall(new Expr\Variable('obj'), 'method', [42]) ); diff --git a/test/PhpParser/BuilderHelpersTest.php b/test/PhpParser/BuilderHelpersTest.php index ec7d06f5..493e71e9 100644 --- a/test/PhpParser/BuilderHelpersTest.php +++ b/test/PhpParser/BuilderHelpersTest.php @@ -174,19 +174,19 @@ class BuilderHelpersTest extends \PHPUnit\Framework\TestCase { } public function testNormalizeValue() { - $expression = new Scalar\LNumber(1); + $expression = new Scalar\Int_(1); $this->assertSame($expression, BuilderHelpers::normalizeValue($expression)); $this->assertEquals(new Expr\ConstFetch(new Node\Name('null')), BuilderHelpers::normalizeValue(null)); $this->assertEquals(new Expr\ConstFetch(new Node\Name('true')), BuilderHelpers::normalizeValue(true)); $this->assertEquals(new Expr\ConstFetch(new Node\Name('false')), BuilderHelpers::normalizeValue(false)); - $this->assertEquals(new Scalar\LNumber(2), BuilderHelpers::normalizeValue(2)); + $this->assertEquals(new Scalar\Int_(2), BuilderHelpers::normalizeValue(2)); $this->assertEquals(new Scalar\Float_(2.5), BuilderHelpers::normalizeValue(2.5)); $this->assertEquals(new Scalar\String_('text'), BuilderHelpers::normalizeValue('text')); $this->assertEquals( new Expr\Array_([ - new Node\ArrayItem(new Scalar\LNumber(0)), - new Node\ArrayItem(new Scalar\LNumber(1), new Scalar\String_('test')), + new Node\ArrayItem(new Scalar\Int_(0)), + new Node\ArrayItem(new Scalar\Int_(1), new Scalar\String_('test')), ]), BuilderHelpers::normalizeValue([ 0, diff --git a/test/PhpParser/CompatibilityTest.php b/test/PhpParser/CompatibilityTest.php index e32920ab..a762b2bc 100644 --- a/test/PhpParser/CompatibilityTest.php +++ b/test/PhpParser/CompatibilityTest.php @@ -7,7 +7,10 @@ use PhpParser\Node\Scalar; use PhpParser\Node\Stmt; class CompatibilityTest extends \PHPUnit\Framework\TestCase { - /** @runInSeparateProcess */ + /** + * @runInSeparateProcess + * @preserveGlobalState disabled + */ public function testAliases1() { $var = new Expr\Variable('x'); $node = new Node\ClosureUse($var); @@ -18,9 +21,14 @@ class CompatibilityTest extends \PHPUnit\Framework\TestCase { $this->assertTrue($node instanceof Stmt\StaticVar); $node = new Scalar\Float_(1.0); $this->assertTrue($node instanceof Scalar\DNumber); + $node = new Scalar\Int_(1); + $this->assertTrue($node instanceof Scalar\LNumber); } - /** @runInSeparateProcess */ + /** + * @runInSeparateProcess + * @preserveGlobalState disabled + */ public function testAliases2() { $var = new Expr\Variable('x'); $node = new Node\Expr\ClosureUse($var); @@ -31,5 +39,7 @@ class CompatibilityTest extends \PHPUnit\Framework\TestCase { $this->assertTrue($node instanceof Node\StaticVar); $node = new Node\Scalar\DNumber(1.0); $this->assertTrue($node instanceof Scalar\Float_); + $node = new Node\Scalar\LNumber(1); + $this->assertTrue($node instanceof Scalar\Int_); } } diff --git a/test/PhpParser/ConstExprEvaluatorTest.php b/test/PhpParser/ConstExprEvaluatorTest.php index 2d2cfc29..9d78af88 100644 --- a/test/PhpParser/ConstExprEvaluatorTest.php +++ b/test/PhpParser/ConstExprEvaluatorTest.php @@ -89,7 +89,7 @@ class ConstExprEvaluatorTest extends \PHPUnit\Framework\TestCase { throw new ConstExprEvaluationException(); }); $expr = new Expr\BinaryOp\Plus( - new Scalar\LNumber(8), + new Scalar\Int_(8), new Scalar\MagicConst\Line() ); $this->assertSame(50, $evaluator->evaluateDirectly($expr)); @@ -118,12 +118,12 @@ class ConstExprEvaluatorTest extends \PHPUnit\Framework\TestCase { public function provideTestEvaluateSilently() { return [ [ - new Expr\BinaryOp\Mod(new Scalar\LNumber(42), new Scalar\LNumber(0)), + new Expr\BinaryOp\Mod(new Scalar\Int_(42), new Scalar\Int_(0)), \Error::class, 'Modulo by zero' ], [ - new Expr\BinaryOp\Plus(new Scalar\LNumber(42), new Scalar\String_("1foo")), + new Expr\BinaryOp\Plus(new Scalar\Int_(42), new Scalar\String_("1foo")), \ErrorException::class, \PHP_VERSION_ID >= 80000 ? 'A non-numeric value encountered' diff --git a/test/PhpParser/Node/Expr/CallableLikeTest.php b/test/PhpParser/Node/Expr/CallableLikeTest.php index daafcc03..9a0349c3 100644 --- a/test/PhpParser/Node/Expr/CallableLikeTest.php +++ b/test/PhpParser/Node/Expr/CallableLikeTest.php @@ -4,7 +4,7 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Arg; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\VariadicPlaceholder; class CallableLikeTest extends \PHPUnit\Framework\TestCase { @@ -19,7 +19,7 @@ class CallableLikeTest extends \PHPUnit\Framework\TestCase { } public function provideTestIsFirstClassCallable() { - $normalArgs = [new Arg(new LNumber(1))]; + $normalArgs = [new Arg(new Int_(1))]; $callableArgs = [new VariadicPlaceholder()]; return [ [new FuncCall(new Name('test'), $normalArgs), false], diff --git a/test/PhpParser/Node/Scalar/NumberTest.php b/test/PhpParser/Node/Scalar/NumberTest.php index f8f830ca..a4af2345 100644 --- a/test/PhpParser/Node/Scalar/NumberTest.php +++ b/test/PhpParser/Node/Scalar/NumberTest.php @@ -15,9 +15,9 @@ class NumberTest extends \PHPUnit\Framework\TestCase { /** @var Echo_ $echo */ $lLumber = $echo->exprs[0]; - $this->assertInstanceOf(LNumber::class, $lLumber); + $this->assertInstanceOf(Int_::class, $lLumber); - /** @var LNumber $lnumber */ + /** @var Int_ $lnumber */ $this->assertSame(1234, $lLumber->value); $this->assertSame('1_234', $lLumber->getAttribute('rawValue')); } diff --git a/test/PhpParser/NodeAbstractTest.php b/test/PhpParser/NodeAbstractTest.php index 27809905..3efe72a9 100644 --- a/test/PhpParser/NodeAbstractTest.php +++ b/test/PhpParser/NodeAbstractTest.php @@ -238,7 +238,7 @@ PHP; } }, "default": { - "nodeType": "Scalar_LNumber", + "nodeType": "Scalar_Int", "value": 0, "attributes": { "startLine": 4, @@ -395,7 +395,7 @@ JSON; "name": "a" }, "default": { - "nodeType": "Scalar_LNumber", + "nodeType": "Scalar_Int", "attributes": { "startLine": 4, "endLine": 4, diff --git a/test/PhpParser/NodeDumperTest.php b/test/PhpParser/NodeDumperTest.php index 812c8f2f..70ca6f21 100644 --- a/test/PhpParser/NodeDumperTest.php +++ b/test/PhpParser/NodeDumperTest.php @@ -75,7 +75,7 @@ array( var: Expr_Variable[2:1 - 2:2]( name: a ) - expr: Scalar_LNumber[2:6 - 2:6]( + expr: Scalar_Int[2:6 - 2:6]( value: 1 ) ) diff --git a/test/PhpParser/NodeTraverserTest.php b/test/PhpParser/NodeTraverserTest.php index 19692522..27f77c8d 100644 --- a/test/PhpParser/NodeTraverserTest.php +++ b/test/PhpParser/NodeTraverserTest.php @@ -315,7 +315,7 @@ class NodeTraverserTest extends \PHPUnit\Framework\TestCase { } public function provideTestInvalidReturn() { - $num = new Node\Scalar\LNumber(42); + $num = new Node\Scalar\Int_(42); $expr = new Node\Stmt\Expression($num); $stmts = [$expr]; @@ -338,7 +338,7 @@ class NodeTraverserTest extends \PHPUnit\Framework\TestCase { ['leaveNode', $expr, false], ]); $visitor7 = new NodeVisitorForTesting([ - ['enterNode', $expr, new Node\Scalar\LNumber(42)], + ['enterNode', $expr, new Node\Scalar\Int_(42)], ]); $visitor8 = new NodeVisitorForTesting([ ['enterNode', $num, new Node\Stmt\Return_()], @@ -351,8 +351,8 @@ class NodeTraverserTest extends \PHPUnit\Framework\TestCase { [$stmts, $visitor4, 'leaveNode() returned invalid value of type string'], [$stmts, $visitor5, 'leaveNode() may only return an array if the parent structure is an array'], [$stmts, $visitor6, 'bool(false) return from leaveNode() no longer supported. Return NodeTraverser::REMOVE_NODE instead'], - [$stmts, $visitor7, 'Trying to replace statement (Stmt_Expression) with expression (Scalar_LNumber). Are you missing a Stmt_Expression wrapper?'], - [$stmts, $visitor8, 'Trying to replace expression (Scalar_LNumber) with statement (Stmt_Return)'], + [$stmts, $visitor7, 'Trying to replace statement (Stmt_Expression) with expression (Scalar_Int). Are you missing a Stmt_Expression wrapper?'], + [$stmts, $visitor8, 'Trying to replace expression (Scalar_Int) with statement (Stmt_Return)'], ]; } } diff --git a/test/PhpParser/NodeVisitor/NameResolverTest.php b/test/PhpParser/NodeVisitor/NameResolverTest.php index 32372a80..86b29ba9 100644 --- a/test/PhpParser/NodeVisitor/NameResolverTest.php +++ b/test/PhpParser/NodeVisitor/NameResolverTest.php @@ -336,7 +336,7 @@ EOC; new Stmt\Interface_('B'), new Stmt\Function_('C'), new Stmt\Const_([ - new Node\Const_('D', new Node\Scalar\LNumber(42)) + new Node\Const_('D', new Node\Scalar\Int_(42)) ]), new Stmt\Trait_('E'), new Expr\New_(new Stmt\Class_(null)), diff --git a/test/PhpParser/ParserTest.php b/test/PhpParser/ParserTest.php index 91b41257..a35b2724 100644 --- a/test/PhpParser/ParserTest.php +++ b/test/PhpParser/ParserTest.php @@ -127,15 +127,15 @@ EOC; public function provideTestExtraAttributes() { return [ - ['0', ['kind' => Scalar\LNumber::KIND_DEC]], - ['9', ['kind' => Scalar\LNumber::KIND_DEC]], - ['07', ['kind' => Scalar\LNumber::KIND_OCT]], - ['0xf', ['kind' => Scalar\LNumber::KIND_HEX]], - ['0XF', ['kind' => Scalar\LNumber::KIND_HEX]], - ['0b1', ['kind' => Scalar\LNumber::KIND_BIN]], - ['0B1', ['kind' => Scalar\LNumber::KIND_BIN]], - ['0o7', ['kind' => Scalar\LNumber::KIND_OCT]], - ['0O7', ['kind' => Scalar\LNumber::KIND_OCT]], + ['0', ['kind' => Scalar\Int_::KIND_DEC]], + ['9', ['kind' => Scalar\Int_::KIND_DEC]], + ['07', ['kind' => Scalar\Int_::KIND_OCT]], + ['0xf', ['kind' => Scalar\Int_::KIND_HEX]], + ['0XF', ['kind' => Scalar\Int_::KIND_HEX]], + ['0b1', ['kind' => Scalar\Int_::KIND_BIN]], + ['0B1', ['kind' => Scalar\Int_::KIND_BIN]], + ['0o7', ['kind' => Scalar\Int_::KIND_OCT]], + ['0O7', ['kind' => Scalar\Int_::KIND_OCT]], ['[]', ['kind' => Expr\Array_::KIND_SHORT]], ['array()', ['kind' => Expr\Array_::KIND_LONG]], ["'foo'", ['kind' => String_::KIND_SINGLE_QUOTED]], diff --git a/test/PhpParser/PrettyPrinterTest.php b/test/PhpParser/PrettyPrinterTest.php index 86e77605..80b19831 100644 --- a/test/PhpParser/PrettyPrinterTest.php +++ b/test/PhpParser/PrettyPrinterTest.php @@ -7,7 +7,7 @@ use PhpParser\Node\Name; use PhpParser\Node\Scalar\Float_; use PhpParser\Node\Scalar\Encapsed; use PhpParser\Node\Scalar\EncapsedStringPart; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt; use PhpParser\Parser\Php7; @@ -138,11 +138,11 @@ class PrettyPrinterTest extends CodeTestAbstract { public function provideTestUnnaturalLiterals() { return [ - [new LNumber(-1), '-1'], - [new LNumber(-PHP_INT_MAX - 1), '(-' . PHP_INT_MAX . '-1)'], - [new LNumber(-1, ['kind' => LNumber::KIND_BIN]), '-0b1'], - [new LNumber(-1, ['kind' => LNumber::KIND_OCT]), '-01'], - [new LNumber(-1, ['kind' => LNumber::KIND_HEX]), '-0x1'], + [new Int_(-1), '-1'], + [new Int_(-PHP_INT_MAX - 1), '(-' . PHP_INT_MAX . '-1)'], + [new Int_(-1, ['kind' => Int_::KIND_BIN]), '-0b1'], + [new Int_(-1, ['kind' => Int_::KIND_OCT]), '-01'], + [new Int_(-1, ['kind' => Int_::KIND_HEX]), '-0x1'], [new Float_(\INF), '\INF'], [new Float_(-\INF), '-\INF'], [new Float_(-\NAN), '\NAN'], diff --git a/test/code/parser/comments.test b/test/code/parser/comments.test index 90b6b1f0..be797fd3 100644 --- a/test/code/parser/comments.test +++ b/test/code/parser/comments.test @@ -93,7 +93,7 @@ if (42) {} ----- array( 0: Stmt_If( - cond: Scalar_LNumber( + cond: Scalar_Int( value: 42 ) stmts: array( diff --git a/test/code/parser/errorHandling/lexerErrors.test b/test/code/parser/errorHandling/lexerErrors.test index 7ff27eb9..2efcac65 100644 --- a/test/code/parser/errorHandling/lexerErrors.test +++ b/test/code/parser/errorHandling/lexerErrors.test @@ -13,7 +13,7 @@ array( var: Expr_Variable( name: a ) - expr: Scalar_LNumber( + expr: Scalar_Int( value: 42 ) ) @@ -40,7 +40,7 @@ array( var: Expr_Variable[3:1 - 3:2]( name: a ) - expr: Scalar_LNumber[3:6 - 3:7]( + expr: Scalar_Int[3:6 - 3:7]( value: 42 ) ) @@ -50,7 +50,7 @@ array( var: Expr_Variable[5:1 - 5:2]( name: b ) - expr: Scalar_LNumber[5:6 - 5:7]( + expr: Scalar_Int[5:6 - 5:7]( value: 24 ) ) @@ -71,7 +71,7 @@ array( var: Expr_Variable[3:1 - 3:2]( name: a ) - expr: Scalar_LNumber[3:6 - 3:7]( + expr: Scalar_Int[3:6 - 3:7]( value: 42 ) ) @@ -81,7 +81,7 @@ array( var: Expr_Variable[5:1 - 5:2]( name: b ) - expr: Scalar_LNumber[5:6 - 5:7]( + expr: Scalar_Int[5:6 - 5:7]( value: 24 ) ) @@ -105,7 +105,7 @@ array( var: Expr_Variable[3:1 - 3:2]( name: a ) - expr: Scalar_LNumber[3:6 - 3:6]( + expr: Scalar_Int[3:6 - 3:6]( value: 1 ) ) @@ -115,7 +115,7 @@ array( var: Expr_Variable[5:1 - 5:2]( name: b ) - expr: Scalar_LNumber[5:6 - 5:6]( + expr: Scalar_Int[5:6 - 5:6]( value: 2 ) ) @@ -125,7 +125,7 @@ array( var: Expr_Variable[7:1 - 7:2]( name: c ) - expr: Scalar_LNumber[7:6 - 7:6]( + expr: Scalar_Int[7:6 - 7:6]( value: 3 ) ) @@ -140,4 +140,4 @@ if ($b) { } ----- Unterminated comment from 5:5 to 6:2 -Syntax error, unexpected EOF from 6:2 to 6:2 \ No newline at end of file +Syntax error, unexpected EOF from 6:2 to 6:2 diff --git a/test/code/parser/errorHandling/recovery.test b/test/code/parser/errorHandling/recovery.test index 1771c765..7abe0d09 100644 --- a/test/code/parser/errorHandling/recovery.test +++ b/test/code/parser/errorHandling/recovery.test @@ -147,7 +147,7 @@ array( ) ) 1: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) @@ -172,7 +172,7 @@ array( returnType: null stmts: array( 0: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) @@ -195,7 +195,7 @@ array( var: Expr_Variable( name: i ) - expr: Scalar_LNumber( + expr: Scalar_Int( value: 0 ) ) @@ -205,7 +205,7 @@ array( var: Expr_Variable( name: j ) - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) @@ -215,7 +215,7 @@ array( var: Expr_Variable( name: k ) - expr: Scalar_LNumber( + expr: Scalar_Int( value: 2 ) ) @@ -238,7 +238,7 @@ array( var: Expr_Variable( name: i ) - expr: Scalar_LNumber( + expr: Scalar_Int( value: 0 ) ) @@ -248,7 +248,7 @@ array( var: Expr_Variable( name: j ) - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) @@ -258,7 +258,7 @@ array( var: Expr_Variable( name: k ) - expr: Scalar_LNumber( + expr: Scalar_Int( value: 2 ) ) @@ -513,7 +513,7 @@ array( name: Identifier( name: A ) - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) ) @@ -523,7 +523,7 @@ array( num: null ) 5: Stmt_Break( - num: Scalar_LNumber( + num: Scalar_Int( value: 2 ) ) @@ -531,7 +531,7 @@ array( num: null ) 7: Stmt_Continue( - num: Scalar_LNumber( + num: Scalar_Int( value: 2 ) ) @@ -539,7 +539,7 @@ array( expr: null ) 9: Stmt_Return( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 2 ) ) @@ -674,7 +674,7 @@ array( name: Identifier( name: A ) - value: Scalar_LNumber( + value: Scalar_Int( value: 42 ) ) @@ -744,7 +744,7 @@ array( name: Identifier( name: A ) - value: Scalar_LNumber( + value: Scalar_Int( value: 42 ) ) @@ -804,7 +804,7 @@ array( key: Identifier( name: a ) - value: Scalar_LNumber( + value: Scalar_Int( value: 42 ) ) @@ -1500,7 +1500,7 @@ array( name: Identifier( name: X ) - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) ) diff --git a/test/code/parser/expr/arrayDef.test b/test/code/parser/expr/arrayDef.test index 98c5addd..11596277 100644 --- a/test/code/parser/expr/arrayDef.test +++ b/test/code/parser/expr/arrayDef.test @@ -129,7 +129,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -137,7 +137,7 @@ array( ) 1: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 2 ) byRef: false @@ -145,7 +145,7 @@ array( ) 2: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 3 ) byRef: false diff --git a/test/code/parser/expr/arrayEmptyElemens.test b/test/code/parser/expr/arrayEmptyElemens.test index 150f4039..48e6451d 100644 --- a/test/code/parser/expr/arrayEmptyElemens.test +++ b/test/code/parser/expr/arrayEmptyElemens.test @@ -14,7 +14,7 @@ array( items: array( 0: ArrayItem[3:2 - 3:2]( key: null - value: Scalar_LNumber[3:2 - 3:2]( + value: Scalar_Int[3:2 - 3:2]( value: 1 ) byRef: false @@ -29,7 +29,7 @@ array( ) 2: ArrayItem[3:7 - 3:7]( key: null - value: Scalar_LNumber[3:7 - 3:7]( + value: Scalar_Int[3:7 - 3:7]( value: 2 ) byRef: false @@ -43,7 +43,7 @@ array( items: array( 0: ArrayItem[4:7 - 4:7]( key: null - value: Scalar_LNumber[4:7 - 4:7]( + value: Scalar_Int[4:7 - 4:7]( value: 1 ) byRef: false @@ -58,7 +58,7 @@ array( ) 2: ArrayItem[4:12 - 4:12]( key: null - value: Scalar_LNumber[4:12 - 4:12]( + value: Scalar_Int[4:12 - 4:12]( value: 2 ) byRef: false diff --git a/test/code/parser/expr/arraySpread.test b/test/code/parser/expr/arraySpread.test index e5aa6778..c6004406 100644 --- a/test/code/parser/expr/arraySpread.test +++ b/test/code/parser/expr/arraySpread.test @@ -32,7 +32,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -40,7 +40,7 @@ array( ) 1: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 2 ) byRef: false @@ -48,7 +48,7 @@ array( ) 2: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 3 ) byRef: false @@ -74,7 +74,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 4 ) byRef: false @@ -82,7 +82,7 @@ array( ) 1: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 5 ) byRef: false @@ -110,7 +110,7 @@ array( var: Expr_Variable( name: i ) - expr: Scalar_LNumber( + expr: Scalar_Int( value: 11 ) ) @@ -120,7 +120,7 @@ array( left: Expr_Variable( name: i ) - right: Scalar_LNumber( + right: Scalar_Int( value: 15 ) ) @@ -169,7 +169,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -177,7 +177,7 @@ array( ) 1: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 2 ) byRef: false @@ -185,7 +185,7 @@ array( ) 2: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 3 ) byRef: false @@ -311,7 +311,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 0 ) byRef: false @@ -341,7 +341,7 @@ array( ) 3: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 6 ) byRef: false @@ -349,7 +349,7 @@ array( ) 4: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 7 ) byRef: false @@ -357,7 +357,7 @@ array( ) 5: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 8 ) byRef: false @@ -365,7 +365,7 @@ array( ) 6: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 9 ) byRef: false @@ -373,7 +373,7 @@ array( ) 7: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 10 ) byRef: false @@ -401,7 +401,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 0 ) byRef: false diff --git a/test/code/parser/expr/arrow_function.test b/test/code/parser/expr/arrow_function.test index 5b727a62..47bd8c55 100644 --- a/test/code/parser/expr/arrow_function.test +++ b/test/code/parser/expr/arrow_function.test @@ -57,7 +57,7 @@ array( var: Expr_Variable( name: x ) - default: Scalar_LNumber( + default: Scalar_Int( value: 42 ) ) diff --git a/test/code/parser/expr/concatPrecedence.test b/test/code/parser/expr/concatPrecedence.test index 21dee622..b7a8ce94 100644 --- a/test/code/parser/expr/concatPrecedence.test +++ b/test/code/parser/expr/concatPrecedence.test @@ -9,18 +9,18 @@ array( 0: Stmt_Expression( expr: Expr_BinaryOp_Concat( left: Expr_BinaryOp_Plus( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 2 ) ) right: Expr_BinaryOp_Plus( - left: Scalar_LNumber( + left: Scalar_Int( value: 3 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 4 ) ) @@ -29,18 +29,18 @@ array( 1: Stmt_Expression( expr: Expr_BinaryOp_Concat( left: Expr_BinaryOp_ShiftLeft( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 2 ) ) right: Expr_BinaryOp_ShiftLeft( - left: Scalar_LNumber( + left: Scalar_Int( value: 3 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 4 ) ) @@ -58,18 +58,18 @@ array( expr: Expr_BinaryOp_Plus( left: Expr_BinaryOp_Concat( left: Expr_BinaryOp_Plus( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 2 ) ) - right: Scalar_LNumber( + right: Scalar_Int( value: 3 ) ) - right: Scalar_LNumber( + right: Scalar_Int( value: 4 ) ) @@ -77,19 +77,19 @@ array( 1: Stmt_Expression( expr: Expr_BinaryOp_ShiftLeft( left: Expr_BinaryOp_ShiftLeft( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) right: Expr_BinaryOp_Concat( - left: Scalar_LNumber( + left: Scalar_Int( value: 2 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 3 ) ) ) - right: Scalar_LNumber( + right: Scalar_Int( value: 4 ) ) diff --git a/test/code/parser/expr/constant_expr.test b/test/code/parser/expr/constant_expr.test index 87cb59aa..926ebcbc 100644 --- a/test/code/parser/expr/constant_expr.test +++ b/test/code/parser/expr/constant_expr.test @@ -48,10 +48,10 @@ array( name: T_1 ) value: Expr_BinaryOp_ShiftLeft( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 1 ) ) @@ -65,10 +65,10 @@ array( name: T_2 ) value: Expr_BinaryOp_Div( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 2 ) ) @@ -124,7 +124,7 @@ array( value: 1.5 ) ) - right: Scalar_LNumber( + right: Scalar_Int( value: 2 ) ) @@ -143,11 +143,11 @@ array( left: Scalar_String( value: foo ) - right: Scalar_LNumber( + right: Scalar_Int( value: 2 ) ) - right: Scalar_LNumber( + right: Scalar_Int( value: 3 ) ) @@ -189,7 +189,7 @@ array( ) value: Expr_BitwiseNot( expr: Expr_UnaryMinus( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) @@ -206,23 +206,23 @@ array( value: Expr_BinaryOp_Plus( left: Expr_Ternary( cond: Expr_UnaryMinus( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) if: null - else: Scalar_LNumber( + else: Scalar_Int( value: 1 ) ) right: Expr_Ternary( - cond: Scalar_LNumber( + cond: Scalar_Int( value: 0 ) - if: Scalar_LNumber( + if: Scalar_Int( value: 2 ) - else: Scalar_LNumber( + else: Scalar_Int( value: 3 ) ) @@ -237,10 +237,10 @@ array( name: T_11 ) value: Expr_BinaryOp_BooleanAnd( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 0 ) ) @@ -254,10 +254,10 @@ array( name: T_12 ) value: Expr_BinaryOp_LogicalAnd( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 1 ) ) @@ -271,10 +271,10 @@ array( name: T_13 ) value: Expr_BinaryOp_BooleanOr( - left: Scalar_LNumber( + left: Scalar_Int( value: 0 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 0 ) ) @@ -288,10 +288,10 @@ array( name: T_14 ) value: Expr_BinaryOp_LogicalOr( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 0 ) ) @@ -305,10 +305,10 @@ array( name: T_15 ) value: Expr_BinaryOp_LogicalXor( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 1 ) ) @@ -322,10 +322,10 @@ array( name: T_16 ) value: Expr_BinaryOp_LogicalXor( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 0 ) ) @@ -339,10 +339,10 @@ array( name: T_17 ) value: Expr_BinaryOp_Smaller( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 0 ) ) @@ -356,10 +356,10 @@ array( name: T_18 ) value: Expr_BinaryOp_SmallerOrEqual( - left: Scalar_LNumber( + left: Scalar_Int( value: 0 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 0 ) ) @@ -373,10 +373,10 @@ array( name: T_19 ) value: Expr_BinaryOp_Greater( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 0 ) ) @@ -390,10 +390,10 @@ array( name: T_20 ) value: Expr_BinaryOp_GreaterOrEqual( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 0 ) ) @@ -407,10 +407,10 @@ array( name: T_21 ) value: Expr_BinaryOp_Identical( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 1 ) ) @@ -424,10 +424,10 @@ array( name: T_22 ) value: Expr_BinaryOp_NotIdentical( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 1 ) ) @@ -441,7 +441,7 @@ array( name: T_23 ) value: Expr_BinaryOp_NotEqual( - left: Scalar_LNumber( + left: Scalar_Int( value: 0 ) right: Scalar_String( @@ -458,7 +458,7 @@ array( name: T_24 ) value: Expr_BinaryOp_Equal( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) right: Scalar_String( @@ -475,14 +475,14 @@ array( name: T_25 ) value: Expr_BinaryOp_Plus( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) right: Expr_BinaryOp_Mul( - left: Scalar_LNumber( + left: Scalar_Int( value: 2 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 3 ) ) @@ -501,7 +501,7 @@ array( left: Scalar_String( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 2 ) ) @@ -519,10 +519,10 @@ array( name: T_27 ) value: Expr_BinaryOp_Pow( - left: Scalar_LNumber( + left: Scalar_Int( value: 2 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 3 ) ) @@ -540,7 +540,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -548,7 +548,7 @@ array( ) 1: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 2 ) byRef: false @@ -556,7 +556,7 @@ array( ) 2: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 3 ) byRef: false @@ -564,7 +564,7 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 1 ) ) @@ -578,10 +578,10 @@ array( name: T_29 ) value: Expr_BinaryOp_Minus( - left: Scalar_LNumber( + left: Scalar_Int( value: 12 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 13 ) ) @@ -595,10 +595,10 @@ array( name: T_30 ) value: Expr_BinaryOp_BitwiseXor( - left: Scalar_LNumber( + left: Scalar_Int( value: 12 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 13 ) ) @@ -612,10 +612,10 @@ array( name: T_31 ) value: Expr_BinaryOp_BitwiseAnd( - left: Scalar_LNumber( + left: Scalar_Int( value: 12 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 13 ) ) @@ -629,10 +629,10 @@ array( name: T_32 ) value: Expr_BinaryOp_BitwiseOr( - left: Scalar_LNumber( + left: Scalar_Int( value: 12 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 13 ) ) @@ -646,10 +646,10 @@ array( name: T_33 ) value: Expr_BinaryOp_Mod( - left: Scalar_LNumber( + left: Scalar_Int( value: 12 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 3 ) ) @@ -663,10 +663,10 @@ array( name: T_34 ) value: Expr_BinaryOp_ShiftRight( - left: Scalar_LNumber( + left: Scalar_Int( value: 100 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 4 ) ) diff --git a/test/code/parser/expr/exprInIsset.test b/test/code/parser/expr/exprInIsset.test index 0d057849..43e78b4b 100644 --- a/test/code/parser/expr/exprInIsset.test +++ b/test/code/parser/expr/exprInIsset.test @@ -29,10 +29,10 @@ array( expr: Expr_Isset( vars: array( 0: Expr_BinaryOp_Plus( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 1 ) ) diff --git a/test/code/parser/expr/exprInList.test b/test/code/parser/expr/exprInList.test index 682b0972..1916074c 100644 --- a/test/code/parser/expr/exprInList.test +++ b/test/code/parser/expr/exprInList.test @@ -51,10 +51,10 @@ array( 0: ArrayItem( key: null value: Expr_BinaryOp_Plus( - left: Scalar_LNumber( + left: Scalar_Int( value: 1 ) - right: Scalar_LNumber( + right: Scalar_Int( value: 1 ) ) diff --git a/test/code/parser/expr/fetchAndCall/constantDeref.test b/test/code/parser/expr/fetchAndCall/constantDeref.test index 5959726d..b13349ac 100644 --- a/test/code/parser/expr/fetchAndCall/constantDeref.test +++ b/test/code/parser/expr/fetchAndCall/constantDeref.test @@ -21,7 +21,7 @@ array( var: Scalar_String( value: abc ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 2 ) ) @@ -33,15 +33,15 @@ array( var: Scalar_String( value: abc ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 2 ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) @@ -52,7 +52,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -60,7 +60,7 @@ array( ) 1: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 2 ) byRef: false @@ -68,7 +68,7 @@ array( ) 2: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 3 ) byRef: false @@ -76,7 +76,7 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 2 ) ) @@ -89,7 +89,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -97,7 +97,7 @@ array( ) 1: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 2 ) byRef: false @@ -105,7 +105,7 @@ array( ) 2: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 3 ) byRef: false @@ -113,15 +113,15 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 2 ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) @@ -132,7 +132,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -140,7 +140,7 @@ array( ) 1: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 2 ) byRef: false @@ -148,7 +148,7 @@ array( ) 2: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 3 ) byRef: false @@ -156,7 +156,7 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 2 ) ) @@ -169,7 +169,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -177,7 +177,7 @@ array( ) 1: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 2 ) byRef: false @@ -185,7 +185,7 @@ array( ) 2: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 3 ) byRef: false @@ -193,15 +193,15 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 2 ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) @@ -215,7 +215,7 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) @@ -232,7 +232,7 @@ array( name: BAR ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 1 ) ) @@ -249,15 +249,15 @@ array( name: BAR ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 2 ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 1 ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) diff --git a/test/code/parser/expr/fetchAndCall/namedArgs.test b/test/code/parser/expr/fetchAndCall/namedArgs.test index 882de112..1d75cf2d 100644 --- a/test/code/parser/expr/fetchAndCall/namedArgs.test +++ b/test/code/parser/expr/fetchAndCall/namedArgs.test @@ -48,7 +48,7 @@ array( name: Identifier( name: class ) - value: Scalar_LNumber( + value: Scalar_Int( value: 0 ) byRef: false diff --git a/test/code/parser/expr/issetAndEmpty.test b/test/code/parser/expr/issetAndEmpty.test index cd0e869c..3db32c3d 100644 --- a/test/code/parser/expr/issetAndEmpty.test +++ b/test/code/parser/expr/issetAndEmpty.test @@ -59,7 +59,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -67,7 +67,7 @@ array( ) 1: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 2 ) byRef: false @@ -75,7 +75,7 @@ array( ) 2: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 3 ) byRef: false diff --git a/test/code/parser/expr/match.test b/test/code/parser/expr/match.test index 1d513629..364701eb 100644 --- a/test/code/parser/expr/match.test +++ b/test/code/parser/expr/match.test @@ -11,13 +11,13 @@ array( 0: Stmt_Echo( exprs: array( 0: Expr_Match( - cond: Scalar_LNumber( + cond: Scalar_Int( value: 1 ) arms: array( 0: MatchArm( conds: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 0 ) ) @@ -27,7 +27,7 @@ array( ) 1: MatchArm( conds: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 1 ) ) @@ -55,19 +55,19 @@ array( name: value ) expr: Expr_Match( - cond: Scalar_LNumber( + cond: Scalar_Int( value: 1 ) arms: array( 0: MatchArm( conds: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 0 comments: array( 0: // list of conditions ) ) - 1: Scalar_LNumber( + 1: Scalar_Int( value: 1 ) ) @@ -149,7 +149,7 @@ array( arms: array( 0: MatchArm( conds: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 1 ) ) @@ -183,16 +183,16 @@ array( name: value ) expr: Expr_Match( - cond: Scalar_LNumber( + cond: Scalar_Int( value: 1 ) arms: array( 0: MatchArm( conds: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 0 ) - 1: Scalar_LNumber( + 1: Scalar_Int( value: 1 ) ) diff --git a/test/code/parser/expr/uvs/constDeref.test b/test/code/parser/expr/uvs/constDeref.test index 6d2ca32d..03f67175 100644 --- a/test/code/parser/expr/uvs/constDeref.test +++ b/test/code/parser/expr/uvs/constDeref.test @@ -61,7 +61,7 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) @@ -77,15 +77,15 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 1 ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 2 ) ) @@ -99,7 +99,7 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) @@ -116,7 +116,7 @@ array( name: B ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) @@ -135,15 +135,15 @@ array( name: B ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 1 ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 2 ) ) @@ -160,7 +160,7 @@ array( name: B ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) @@ -258,7 +258,7 @@ array( expr: Expr_ArrayDimFetch( var: Scalar_MagicConst_Function( ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) diff --git a/test/code/parser/expr/uvs/indirectCall.test b/test/code/parser/expr/uvs/indirectCall.test index 5515cfdd..7168b4e7 100644 --- a/test/code/parser/expr/uvs/indirectCall.test +++ b/test/code/parser/expr/uvs/indirectCall.test @@ -38,7 +38,7 @@ array( args: array( 0: Arg( name: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -81,7 +81,7 @@ array( args: array( 0: Arg( name: null - value: Scalar_LNumber( + value: Scalar_Int( value: 2 ) byRef: false @@ -120,7 +120,7 @@ array( args: array( 0: Arg( name: null - value: Scalar_LNumber( + value: Scalar_Int( value: 4 ) byRef: false @@ -168,7 +168,7 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 1 ) ) @@ -189,7 +189,7 @@ array( args: array( 0: Arg( name: null - value: Scalar_LNumber( + value: Scalar_Int( value: 5 ) byRef: false @@ -257,7 +257,7 @@ array( args: array( 0: Arg( name: null - value: Scalar_LNumber( + value: Scalar_Int( value: 8 ) byRef: false @@ -348,7 +348,7 @@ array( args: array( 0: Arg( name: null - value: Scalar_LNumber( + value: Scalar_Int( value: 9 ) byRef: false @@ -422,7 +422,7 @@ array( args: array( 0: Arg( name: null - value: Scalar_LNumber( + value: Scalar_Int( value: 10 ) byRef: false @@ -467,7 +467,7 @@ array( args: array( 0: Arg( name: null - value: Scalar_LNumber( + value: Scalar_Int( value: 12 ) byRef: false @@ -505,7 +505,7 @@ array( args: array( 0: Arg( name: null - value: Scalar_LNumber( + value: Scalar_Int( value: 13 ) byRef: false @@ -534,7 +534,7 @@ array( args: array( 0: Arg( name: null - value: Scalar_LNumber( + value: Scalar_Int( value: 14 ) byRef: false diff --git a/test/code/parser/expr/uvs/isset.test b/test/code/parser/expr/uvs/isset.test index e198de0b..9757d6a4 100644 --- a/test/code/parser/expr/uvs/isset.test +++ b/test/code/parser/expr/uvs/isset.test @@ -16,7 +16,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 0 ) byRef: false @@ -24,7 +24,7 @@ array( ) 1: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -37,7 +37,7 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) diff --git a/test/code/parser/expr/uvs/misc.test b/test/code/parser/expr/uvs/misc.test index c31925cd..bcb4f2d8 100644 --- a/test/code/parser/expr/uvs/misc.test +++ b/test/code/parser/expr/uvs/misc.test @@ -33,7 +33,7 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) @@ -70,14 +70,14 @@ array( name: b ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) args: array( 0: Arg( name: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -93,7 +93,7 @@ array( items: array( 0: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 0 ) byRef: false @@ -101,7 +101,7 @@ array( ) 1: ArrayItem( key: null - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -109,11 +109,11 @@ array( ) ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) diff --git a/test/code/parser/expr/uvs/new.test b/test/code/parser/expr/uvs/new.test index ba2325ba..0d93615e 100644 --- a/test/code/parser/expr/uvs/new.test +++ b/test/code/parser/expr/uvs/new.test @@ -99,7 +99,7 @@ array( var: Expr_Variable( name: weird ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) diff --git a/test/code/parser/expr/uvs/staticProperty.test b/test/code/parser/expr/uvs/staticProperty.test index 97e7e28e..96c61a61 100644 --- a/test/code/parser/expr/uvs/staticProperty.test +++ b/test/code/parser/expr/uvs/staticProperty.test @@ -64,7 +64,7 @@ array( var: Scalar_String( value: A ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) @@ -97,7 +97,7 @@ array( name: c ) ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 1 ) ) diff --git a/test/code/parser/scalar/encapsedNegVarOffset.test b/test/code/parser/scalar/encapsedNegVarOffset.test index b5be51d5..82c93629 100644 --- a/test/code/parser/scalar/encapsedNegVarOffset.test +++ b/test/code/parser/scalar/encapsedNegVarOffset.test @@ -29,7 +29,7 @@ array( var: Expr_Variable( name: a ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: -1 ) ) @@ -71,11 +71,11 @@ array( var: Expr_Variable( name: a ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: @@{ -PHP_INT_MAX - 1 }@@ ) ) ) ) ) -) \ No newline at end of file +) diff --git a/test/code/parser/scalar/encapsedString.test b/test/code/parser/scalar/encapsedString.test index 57be611e..31f0f4b7 100644 --- a/test/code/parser/scalar/encapsedString.test +++ b/test/code/parser/scalar/encapsedString.test @@ -72,7 +72,7 @@ array( var: Expr_Variable( name: A ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 0 ) ) @@ -86,7 +86,7 @@ array( var: Expr_Variable( name: A ) - dim: Scalar_LNumber( + dim: Scalar_Int( value: 1234 ) ) diff --git a/test/code/parser/scalar/explicitOctal.test b/test/code/parser/scalar/explicitOctal.test index b880f9e7..b3c9aa29 100644 --- a/test/code/parser/scalar/explicitOctal.test +++ b/test/code/parser/scalar/explicitOctal.test @@ -8,17 +8,17 @@ Explicit octal syntax ----- array( 0: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 83 ) ) 1: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 83 ) ) 2: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 83 ) ) diff --git a/test/code/parser/scalar/int.test b/test/code/parser/scalar/int.test index ee9eb7ab..12081e93 100644 --- a/test/code/parser/scalar/int.test +++ b/test/code/parser/scalar/int.test @@ -14,17 +14,17 @@ Different integer syntaxes ----- array( 0: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 0 ) ) 1: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) 2: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: @@{ PHP_INT_MAX }@@ ) ) @@ -34,27 +34,27 @@ array( ) ) 4: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 4095 ) ) 5: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 4095 ) ) 6: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 4095 ) ) 7: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 511 ) ) 8: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 3640 ) ) diff --git a/test/code/parser/scalar/invalidOctal.test b/test/code/parser/scalar/invalidOctal.test index 291c13f3..04160487 100644 --- a/test/code/parser/scalar/invalidOctal.test +++ b/test/code/parser/scalar/invalidOctal.test @@ -7,7 +7,7 @@ Invalid octal literals Invalid numeric literal from 2:1 to 2:4 array( 0: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 0 ) ) @@ -19,7 +19,7 @@ array( !!version=5.6 array( 0: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 7 ) ) diff --git a/test/code/parser/scalar/numberSeparators.test b/test/code/parser/scalar/numberSeparators.test index be944f9f..3de89ae6 100644 --- a/test/code/parser/scalar/numberSeparators.test +++ b/test/code/parser/scalar/numberSeparators.test @@ -36,22 +36,22 @@ array( ) ) 1: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 299792458 ) ) 2: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 3405705229 ) ) 3: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 95 ) ) 4: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 48673 ) ) @@ -74,7 +74,7 @@ array( ) ) 6: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 100 comments: array( 0: // syntax errors @@ -94,7 +94,7 @@ array( ) ) 8: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) @@ -108,7 +108,7 @@ array( ) ) 10: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) @@ -141,7 +141,7 @@ array( ) ) 15: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 0 ) ) @@ -155,7 +155,7 @@ array( ) ) 17: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 0 ) ) @@ -169,7 +169,7 @@ array( ) ) 19: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) @@ -183,7 +183,7 @@ array( ) ) 21: Stmt_Expression( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) diff --git a/test/code/parser/semiReserved.test b/test/code/parser/semiReserved.test index 1d76d56b..de914bdd 100644 --- a/test/code/parser/semiReserved.test +++ b/test/code/parser/semiReserved.test @@ -157,7 +157,7 @@ array( name: Identifier( name: TRAIT ) - value: Scalar_LNumber( + value: Scalar_Int( value: 3 ) ) @@ -165,7 +165,7 @@ array( name: Identifier( name: FINAL ) - value: Scalar_LNumber( + value: Scalar_Int( value: 4 ) ) @@ -180,7 +180,7 @@ array( name: Identifier( name: __CLASS__ ) - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) ) @@ -188,7 +188,7 @@ array( name: Identifier( name: __TRAIT__ ) - value: Scalar_LNumber( + value: Scalar_Int( value: 2 ) ) @@ -196,7 +196,7 @@ array( name: Identifier( name: __FUNCTION__ ) - value: Scalar_LNumber( + value: Scalar_Int( value: 3 ) ) @@ -204,7 +204,7 @@ array( name: Identifier( name: __METHOD__ ) - value: Scalar_LNumber( + value: Scalar_Int( value: 4 ) ) @@ -212,7 +212,7 @@ array( name: Identifier( name: __LINE__ ) - value: Scalar_LNumber( + value: Scalar_Int( value: 5 ) ) @@ -220,7 +220,7 @@ array( name: Identifier( name: __FILE__ ) - value: Scalar_LNumber( + value: Scalar_Int( value: 6 ) ) @@ -228,7 +228,7 @@ array( name: Identifier( name: __DIR__ ) - value: Scalar_LNumber( + value: Scalar_Int( value: 7 ) ) @@ -236,7 +236,7 @@ array( name: Identifier( name: __NAMESPACE__ ) - value: Scalar_LNumber( + value: Scalar_Int( value: 8 ) ) diff --git a/test/code/parser/stmt/attributes.test b/test/code/parser/stmt/attributes.test index d3ec8573..0198af97 100644 --- a/test/code/parser/stmt/attributes.test +++ b/test/code/parser/stmt/attributes.test @@ -63,7 +63,7 @@ array( args: array( 0: Arg( name: null - value: Scalar_LNumber( + value: Scalar_Int( value: 0 ) byRef: false @@ -82,7 +82,7 @@ array( name: Identifier( name: x ) - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) byRef: false @@ -313,7 +313,7 @@ array( params: array( ) returnType: null - expr: Scalar_LNumber( + expr: Scalar_Int( value: 0 ) ) @@ -378,7 +378,7 @@ array( params: array( ) returnType: null - expr: Scalar_LNumber( + expr: Scalar_Int( value: 0 ) ) diff --git a/test/code/parser/stmt/class/class_position.test b/test/code/parser/stmt/class/class_position.test index f90ad9df..82991499 100644 --- a/test/code/parser/stmt/class/class_position.test +++ b/test/code/parser/stmt/class/class_position.test @@ -9,7 +9,7 @@ class C {} !!positions array( 0: Stmt_If[3:1 - 3:7]( - cond: Scalar_LNumber[3:5 - 3:5]( + cond: Scalar_Int[3:5 - 3:5]( value: 1 ) stmts: array( @@ -42,7 +42,7 @@ trait X {} !!positions array( 0: Stmt_If[3:1 - 3:7]( - cond: Scalar_LNumber[3:5 - 3:5]( + cond: Scalar_Int[3:5 - 3:5]( value: 1 ) stmts: array( @@ -71,7 +71,7 @@ interface X {} !!positions array( 0: Stmt_If[3:1 - 3:7]( - cond: Scalar_LNumber[3:5 - 3:5]( + cond: Scalar_Int[3:5 - 3:5]( value: 1 ) stmts: array( diff --git a/test/code/parser/stmt/class/constModifierErrors.test b/test/code/parser/stmt/class/constModifierErrors.test index 7b6132a3..c810bfb8 100644 --- a/test/code/parser/stmt/class/constModifierErrors.test +++ b/test/code/parser/stmt/class/constModifierErrors.test @@ -27,7 +27,7 @@ array( name: Identifier( name: X ) - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) ) @@ -64,7 +64,7 @@ array( name: Identifier( name: X ) - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) ) @@ -101,7 +101,7 @@ array( name: Identifier( name: X ) - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) ) @@ -138,7 +138,7 @@ array( name: Identifier( name: X ) - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) ) diff --git a/test/code/parser/stmt/class/constModifiers.test b/test/code/parser/stmt/class/constModifiers.test index e7afdaed..6a16ca32 100644 --- a/test/code/parser/stmt/class/constModifiers.test +++ b/test/code/parser/stmt/class/constModifiers.test @@ -31,7 +31,7 @@ array( name: Identifier( name: A ) - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) ) @@ -46,7 +46,7 @@ array( name: Identifier( name: B ) - value: Scalar_LNumber( + value: Scalar_Int( value: 2 ) ) @@ -61,7 +61,7 @@ array( name: Identifier( name: C ) - value: Scalar_LNumber( + value: Scalar_Int( value: 3 ) ) @@ -76,7 +76,7 @@ array( name: Identifier( name: D ) - value: Scalar_LNumber( + value: Scalar_Int( value: 4 ) ) @@ -91,7 +91,7 @@ array( name: Identifier( name: E ) - value: Scalar_LNumber( + value: Scalar_Int( value: 5 ) ) diff --git a/test/code/parser/stmt/class/enum.test b/test/code/parser/stmt/class/enum.test index 731da969..dfc76522 100644 --- a/test/code/parser/stmt/class/enum.test +++ b/test/code/parser/stmt/class/enum.test @@ -77,7 +77,7 @@ array( name: Identifier( name: Foo ) - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) diff --git a/test/code/parser/stmt/class/property_promotion.test b/test/code/parser/stmt/class/property_promotion.test index c9b397bc..467943b7 100644 --- a/test/code/parser/stmt/class/property_promotion.test +++ b/test/code/parser/stmt/class/property_promotion.test @@ -93,7 +93,7 @@ array( var: Expr_Variable( name: a ) - default: Scalar_LNumber( + default: Scalar_Int( value: 0 ) ) diff --git a/test/code/parser/stmt/const.test b/test/code/parser/stmt/const.test index 4d2d4185..2e7a1ce2 100644 --- a/test/code/parser/stmt/const.test +++ b/test/code/parser/stmt/const.test @@ -11,7 +11,7 @@ array( name: Identifier( name: A ) - value: Scalar_LNumber( + value: Scalar_Int( value: 0 ) ) diff --git a/test/code/parser/stmt/controlFlow.test b/test/code/parser/stmt/controlFlow.test index d9c9fcf3..94184f8f 100644 --- a/test/code/parser/stmt/controlFlow.test +++ b/test/code/parser/stmt/controlFlow.test @@ -21,7 +21,7 @@ array( num: null ) 1: Stmt_Break( - num: Scalar_LNumber( + num: Scalar_Int( value: 2 ) ) @@ -29,7 +29,7 @@ array( num: null ) 3: Stmt_Continue( - num: Scalar_LNumber( + num: Scalar_Int( value: 2 ) ) diff --git a/test/code/parser/stmt/function/defaultValues.test b/test/code/parser/stmt/function/defaultValues.test index a66080ab..a87057c9 100644 --- a/test/code/parser/stmt/function/defaultValues.test +++ b/test/code/parser/stmt/function/defaultValues.test @@ -87,7 +87,7 @@ array( name: f ) default: Expr_UnaryPlus( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) diff --git a/test/code/parser/stmt/generator/yieldUnaryPrecedence.test b/test/code/parser/stmt/generator/yieldUnaryPrecedence.test index ed78bca5..e4759abe 100644 --- a/test/code/parser/stmt/generator/yieldUnaryPrecedence.test +++ b/test/code/parser/stmt/generator/yieldUnaryPrecedence.test @@ -24,7 +24,7 @@ array( expr: Expr_Yield( key: null value: Expr_UnaryPlus( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) @@ -34,7 +34,7 @@ array( expr: Expr_Yield( key: null value: Expr_UnaryMinus( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) @@ -47,7 +47,7 @@ array( value: null ) right: Expr_UnaryMinus( - expr: Scalar_LNumber( + expr: Scalar_Int( value: 1 ) ) diff --git a/test/code/parser/stmt/loop/for.test b/test/code/parser/stmt/loop/for.test index c942d311..5d5edc26 100644 --- a/test/code/parser/stmt/loop/for.test +++ b/test/code/parser/stmt/loop/for.test @@ -22,7 +22,7 @@ array( var: Expr_Variable( name: i ) - expr: Scalar_LNumber( + expr: Scalar_Int( value: 0 ) ) diff --git a/test/code/parser/stmt/namespace/mix.test b/test/code/parser/stmt/namespace/mix.test index 0fbfbf42..f11b8a1e 100644 --- a/test/code/parser/stmt/namespace/mix.test +++ b/test/code/parser/stmt/namespace/mix.test @@ -19,7 +19,7 @@ array( stmts: array( 0: Stmt_Echo( exprs: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 1 ) ) @@ -35,7 +35,7 @@ array( stmts: array( 0: Stmt_Echo( exprs: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 2 ) ) @@ -44,7 +44,7 @@ array( ) 2: Stmt_Echo( exprs: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 3 ) ) @@ -70,7 +70,7 @@ array( stmts: array( 0: Stmt_Echo( exprs: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 1 ) ) @@ -79,7 +79,7 @@ array( ) 1: Stmt_Echo( exprs: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 2 ) ) @@ -93,7 +93,7 @@ array( stmts: array( 0: Stmt_Echo( exprs: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 3 ) ) diff --git a/test/code/parser/stmt/namespace/outsideStmtInvalid.test b/test/code/parser/stmt/namespace/outsideStmtInvalid.test index 85bd1808..f6ac5981 100644 --- a/test/code/parser/stmt/namespace/outsideStmtInvalid.test +++ b/test/code/parser/stmt/namespace/outsideStmtInvalid.test @@ -9,14 +9,14 @@ Namespace declaration statement has to be the very first statement in the script array( 0: Stmt_Echo( exprs: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 1 ) ) ) 1: Stmt_Echo( exprs: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 2 ) ) @@ -49,7 +49,7 @@ array( ) 1: Stmt_Echo( exprs: array( - 0: Scalar_LNumber( + 0: Scalar_Int( value: 1 ) ) @@ -79,7 +79,7 @@ array( key: Identifier( name: ticks ) - value: Scalar_LNumber( + value: Scalar_Int( value: 1 ) ) diff --git a/test/code/parser/stmt/switch.test b/test/code/parser/stmt/switch.test index fc24508e..8316b52c 100644 --- a/test/code/parser/stmt/switch.test +++ b/test/code/parser/stmt/switch.test @@ -25,7 +25,7 @@ array( ) cases: array( 0: Stmt_Case( - cond: Scalar_LNumber( + cond: Scalar_Int( value: 0 ) stmts: array( @@ -35,7 +35,7 @@ array( ) ) 1: Stmt_Case( - cond: Scalar_LNumber( + cond: Scalar_Int( value: 1 ) stmts: array(