class StubInterfaceParser implements MultiEntityStubParserInterface (View source)

Parses PHP interface nodes from AST into PHPInterface domain objects.

Parser-agnostic: works with any AST node implementing InterfaceNode interface. Uses dedicated parsers for child entities (methods, constants).

Methods

__construct(InterfaceNodeExtractorInterface|null $nodeExtractor = null, PhpDocParserInterface|null $phpDocParser = null, TypeParserInterface|null $typeParser = null, AvailableVersionParserInterface|null $versionParser = null)

No description

parse(string $stubCode)

Parses stub code string into PHPInterface.

parseNode(InterfaceNode $node, array $imports = [])

Parses an interface AST node into PHPInterface domain object.

array
extractAndParseAll(string $stubContent)

Extract and parse all interfaces from stub content.

Details

__construct(InterfaceNodeExtractorInterface|null $nodeExtractor = null, PhpDocParserInterface|null $phpDocParser = null, TypeParserInterface|null $typeParser = null, AvailableVersionParserInterface|null $versionParser = null)

No description

Parameters

InterfaceNodeExtractorInterface|null $nodeExtractor
PhpDocParserInterface|null $phpDocParser
TypeParserInterface|null $typeParser
AvailableVersionParserInterface|null $versionParser

PHPInterface parse(string $stubCode)

Parses stub code string into PHPInterface.

This is a convenience method that delegates to parseNode().

Parameters

string $stubCode

PHP stub code

Return Value

PHPInterface

PHPInterface parseNode(InterfaceNode $node, array $imports = [])

Parses an interface AST node into PHPInterface domain object.

Works with any InterfaceNode implementation (parser-agnostic).

Parameters

InterfaceNode $node

The interface AST node with namespace set

array $imports

Map of import aliases to fully qualified names

Return Value

PHPInterface

array extractAndParseAll(string $stubContent)

Extract and parse all interfaces from stub content.

Parameters

string $stubContent

The PHP stub file content to parse

Return Value

array

Array of parsed entities (PHPClass, PHPFunction, etc.). Returns empty array if no entities found.