class PhpDocTypeNameResolver

Properties

protected array<string, array<string, array<string, class-string>>> $imports

Methods

string
resolve(string $name, ReflectionClass $class)

Resolve a PHPDoc type name in its declaring class context.

array
importsFor(ReflectionClass $class)

Get the class imports declared by the source file.

array
parseImports(string $file)

Parse class imports from a PHP source file.

array
parseNamespace(array $tokens, int $index)

Parse a namespace declaration.

array
collectUseStatement(array $tokens, int $index)

Collect the tokens belonging to one use statement.

array
parseUseStatement(array $tokens)

Parse one normal or grouped use statement.

array
parseImportEntries(array $tokens, string $prefix = '')

Parse comma-separated import entries.

PhpToken|null
nextSignificantToken(array $tokens, int $index)

Find the next non-ignorable token.

string
joinTokenText(array $tokens)

Join token text without whitespace or comments.

static bool
isBuiltIn(string $type)

Determine if the type is built into PHP or PHPDoc.

Details

at line 21
string resolve(string $name, ReflectionClass $class)

Resolve a PHPDoc type name in its declaring class context.

Parameters

string $name
ReflectionClass $class

Return Value

string

at line 50
protected array importsFor(ReflectionClass $class)

Get the class imports declared by the source file.

Parameters

ReflectionClass $class

Return Value

array

at line 68
protected array parseImports(string $file)

Parse class imports from a PHP source file.

Parameters

string $file

Return Value

array

at line 132
protected array parseNamespace(array $tokens, int $index)

Parse a namespace declaration.

Parameters

array $tokens
int $index

Return Value

array

at line 157
protected array collectUseStatement(array $tokens, int $index)

Collect the tokens belonging to one use statement.

Parameters

array $tokens
int $index

Return Value

array

at line 180
protected array parseUseStatement(array $tokens)

Parse one normal or grouped use statement.

Parameters

array $tokens

Return Value

array

at line 200
protected array parseImportEntries(array $tokens, string $prefix = '')

Parse comma-separated import entries.

Parameters

array $tokens
string $prefix

Return Value

array

at line 236
protected PhpToken|null nextSignificantToken(array $tokens, int $index)

Find the next non-ignorable token.

Parameters

array $tokens
int $index

Return Value

PhpToken|null

at line 252
protected string joinTokenText(array $tokens)

Join token text without whitespace or comments.

Parameters

array $tokens

Return Value

string

at line 268
static protected bool isBuiltIn(string $type)

Determine if the type is built into PHP or PHPDoc.

Parameters

string $type

Return Value

bool