1<?php declare(strict_types=1); 2 3namespace PhpParser\Node\Scalar; 4 5use PhpParser\Node\Stmt\Echo_; 6use PhpParser\ParserFactory; 7 8class NumberTest extends \PHPUnit\Framework\TestCase { 9 public function testRawValue(): void { 10 $parser = (new ParserFactory())->createForNewestSupportedVersion(); 11 $nodes = $parser->parse('<?php echo 1_234;'); 12 13 $echo = $nodes[0]; 14 $this->assertInstanceOf(Echo_::class, $echo); 15 16 /** @var Echo_ $echo */ 17 $lLumber = $echo->exprs[0]; 18 $this->assertInstanceOf(Int_::class, $lLumber); 19 20 /** @var Int_ $lnumber */ 21 $this->assertSame(1234, $lLumber->value); 22 $this->assertSame('1_234', $lLumber->getAttribute('rawValue')); 23 } 24} 25