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
    +exprs: array:1 [
      0 => PhpParser\Node\Scalar\String_ {#2527
        +value: "Hello budgies"
        #attributes: array:3 [
          "startLine" => 1
          "endLine" => 1
          "kind" => 2
        ]
      }
    ]
    #attributes: array:2 [
      "startLine" => 1
      "endLine" => 1
    ]
  }
  1 => PhpParser\Node\Stmt\If_ {#2533
    +cond: PhpParser\Node\Expr\ConstFetch {#2530
      +name: PhpParser\Node\Name {#2529
        +parts: array:1 [
          0 => "true"
        ]
        #attributes: array:2 [
          "startLine" => 1
          "endLine" => 1
        ]
      }
      #attributes: array:2 [
        "startLine" => 1
        "endLine" => 1
      ]
    }
    +stmts: array:1 [
      0 => PhpParser\Node\Stmt\Echo_ {#2532
        +exprs: array:1 [
          0 => PhpParser\Node\Scalar\String_ {#2531
            +value: "true"
            #attributes: array:3 [
              "startLine" => 1
              "endLine" => 1
              "kind" => 2
            ]
          }
        ]
        #attributes: array:2 [
          "startLine" => 1
          "endLine" => 1
        ]
      }
    ]
    +elseifs: []
    +else: null
    #attributes: array:2 [
      "startLine" => 1
      "endLine" => 1
    ]
  }
]
Used Versions
PHP 8.0, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8