class NikicNodeExtractor implements NodeExtractorInterface (View source)

Nikic/php-parser implementation of NodeExtractorInterface.

Extracts AST nodes from PHP stub code using nikic/php-parser and wraps them in adapter objects.

Methods

__construct()

No description

extractFunction(string $stubCode)

No description

extractClass(string $stubCode)

No description

array
extractAllClasses(string $stubCode)

No description

array
extractAllClassesWithImports(string $stubCode)

Extract all classes with their import context from stub code.

array
extractAllFunctions(string $stubCode)

No description

array
extractAllInterfaces(string $stubCode)

No description

array
extractAllInterfacesWithImports(string $stubCode)

Extract all interfaces with their import context from stub code.

array
extractAllEnums(string $stubCode)

No description

array
extractAllEnumsWithImports(string $stubCode)

Extract all enums with their import context from stub code.

array
extractAllDefineConstants(string $stubCode)

Extract all define() constant nodes.

array
extractAllModernConstants(string $stubCode)

Extract all const declarations (const A = 1;).

Details

__construct()

No description

FunctionNode extractFunction(string $stubCode)

No description

Parameters

string $stubCode

Return Value

FunctionNode

Function node with namespace set

Exceptions

RuntimeException

ClassNode extractClass(string $stubCode)

No description

Parameters

string $stubCode

Return Value

ClassNode

Class node with namespace set

Exceptions

RuntimeException

array extractAllClasses(string $stubCode)

No description

Parameters

string $stubCode

Return Value

array

Array of class nodes with namespace set

array extractAllClassesWithImports(string $stubCode)

Extract all classes with their import context from stub code.

Returns array of ['node' => ClassNode, 'imports' => array].

Parameters

string $stubCode

Return Value

array

Array of ['node' => ClassNode, 'imports' => array]

array extractAllFunctions(string $stubCode)

No description

Parameters

string $stubCode

Return Value

array

Array of function nodes with namespace set

array extractAllInterfaces(string $stubCode)

No description

Parameters

string $stubCode

Return Value

array

Array of interface nodes with namespace set

array extractAllInterfacesWithImports(string $stubCode)

Extract all interfaces with their import context from stub code.

Returns array of ['node' => InterfaceNode, 'imports' => array].

Parameters

string $stubCode

Return Value

array

Array of ['node' => InterfaceNode, 'imports' => array]

array extractAllEnums(string $stubCode)

No description

Parameters

string $stubCode

Return Value

array

Array of enum nodes with namespace set

array extractAllEnumsWithImports(string $stubCode)

Extract all enums with their import context from stub code.

Returns array of ['node' => EnumNode, 'imports' => array].

Parameters

string $stubCode

Return Value

array

Array of ['node' => EnumNode, 'imports' => array]

array extractAllDefineConstants(string $stubCode)

Extract all define() constant nodes.

Parameters

string $stubCode

Return Value

array

Array of constant nodes with namespace set

array extractAllModernConstants(string $stubCode)

Extract all const declarations (const A = 1;).

Parameters

string $stubCode

Return Value

array

Array of constant nodes with namespace set