interface NodeExtractorInterface implements FunctionNodeExtractorInterface, ClassNodeExtractorInterface, InterfaceNodeExtractorInterface, EnumNodeExtractorInterface, ConstantNodeExtractorInterface (View source)

Composite interface for extracting all AST node types from PHP stub code.

Extends 5 focused interfaces following ISP. Implementations that support all node types (e.g., NikicNodeExtractor) implement this interface. Clients that only need a subset should depend on the focused interface.

Methods

extractFunction(string $stubCode)

No description

array
extractAllFunctions(string $stubCode)

No description

extractClass(string $stubCode)

No description

array
extractAllClasses(string $stubCode)

No description

array
extractAllClassesWithImports(string $stubCode)

Extract all class nodes with their import context.

array
extractAllInterfaces(string $stubCode)

No description

array
extractAllInterfacesWithImports(string $stubCode)

Extract all interface nodes with their import context.

array
extractAllEnums(string $stubCode)

No description

array
extractAllEnumsWithImports(string $stubCode)

Extract all enum nodes with their import context.

array
extractAllDefineConstants(string $stubCode)

Extract all define() constant nodes.

array
extractAllModernConstants(string $stubCode)

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

Details

FunctionNode extractFunction(string $stubCode)

No description

Parameters

string $stubCode

Return Value

FunctionNode

Function node with namespace set

Exceptions

RuntimeException

array extractAllFunctions(string $stubCode)

No description

Parameters

string $stubCode

Return Value

array

Array of function nodes with namespace set

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 class nodes with their import context.

Parameters

string $stubCode

Return Value

array

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

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 interface nodes with their import context.

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 enum nodes with their import context.

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