Parsing PHP and return a AST of the code

Code
<?php

use PhpParser\ParserFactory;

$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP5);

$php '<?php echo "Hello budgies"; if (true) { echo "true"; }';

$parsed $parser->parse($php);

dump($parsed);
Result
^ array:2 [
  0 => PhpParser\Node\Stmt\Echo_ {#2528
    #attributes: array:2 [
      "startLine" => 1
      "endLine" => 1
    ]
    +exprs: array:1 [
      0 => PhpParser\Node\Scalar\String_ {#2527
        #attributes: array:3 [
          "startLine" => 1
          "endLine" => 1
          "kind" => 2
        ]
        +value: "Hello budgies"
      }
    ]
  }
  1 => PhpParser\Node\Stmt\If_ {#2533
    #attributes: array:2 [
      "startLine" => 1
      "endLine" => 1
    ]
    +cond: PhpParser\Node\Expr\ConstFetch {#2530
      #attributes: array:2 [
        "startLine" => 1
        "endLine" => 1
      ]
      +name: PhpParser\Node\Name {#2529
        #attributes: array:2 [
          "startLine" => 1
          "endLine" => 1
        ]
        +parts: array:1 [
          0 => "true"
        ]
      }
    }
    +stmts: array:1 [
      0 => PhpParser\Node\Stmt\Echo_ {#2532
        #attributes: array:2 [
          "startLine" => 1
          "endLine" => 1
        ]
        +exprs: array:1 [
          0 => PhpParser\Node\Scalar\String_ {#2531
            #attributes: array:3 [
              "startLine" => 1
              "endLine" => 1
              "kind" => 2
            ]
            +value: "true"
          }
        ]
      }
    ]
    +elseifs: []
    +else: null
  }
]
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8