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