Helper class for parsing PHP files.

package Default

 Methods

Returns an abstract syntax tree's code.

astToString(array<mixed,array> $ast) : string
Static

Parameters

$ast

array<mixed,array>

Returns

string

Returns the code's abstract syntax tree.

getAst() : array<mixed,array>

Returns

array<mixed,array>

Asserts that the code defines one class and returns it.

getExactlyOneClass(string $fileSource) : \PhpParser\Node\Stmt\Class_

Parameters

$fileSource

string

Returns

\PhpParser\Node\Stmt\Class_

Parses a PHP file.

parseFile(string $fileName) : \FeaturePhp\Helper\PhpParser

Parameters

$fileName

string

Returns

\FeaturePhp\Helper\PhpParser

Parses a PHP string.

parseString(string $str) : \FeaturePhp\Helper\PhpParser

Parameters

$str

string

Returns

\FeaturePhp\Helper\PhpParser

 Properties

 

the code's abstract syntax tree

$ast : array<mixed,array>

Default

null