NikicNodeExtractor
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
No description
Discards the shared AST cache. Only needed to release memory or to guarantee a re-parse in tests; correctness does not depend on it, since the cache is keyed by content.
No description
No description
No description
Extract all classes with their import context from stub code.
No description
No description
Extract all interfaces with their import context from stub code.
No description
Extract all enums with their import context from stub code.
Extract all define() constant nodes.
Extract all const declarations (const A = 1;).
Details
__construct()
No description
static void
clearAstCache()
Discards the shared AST cache. Only needed to release memory or to guarantee a re-parse in tests; correctness does not depend on it, since the cache is keyed by content.
FunctionNode
extractFunction(string $stubCode)
No description
ClassNode
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.
Returns array of ['node' => ClassNode, 'imports' => array].
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.
Returns array of ['node' => InterfaceNode, 'imports' => array].
array
extractAllEnums(string $stubCode)
No description
array
extractAllEnumsWithImports(string $stubCode)
Extract all enums with their import context from stub code.
Returns array of ['node' => EnumNode, 'imports' => array].
array
extractAllDefineConstants(string $stubCode)
Extract all define() constant nodes.
array
extractAllModernConstants(string $stubCode)
Extract all const declarations (const A = 1;).