PhpDocTypeNameResolver
class PhpDocTypeNameResolver
Properties
| protected array<string, array{imports: array<string, array<string, class-string>>, namespaces: array<int, string>}> | $sources |
Methods
Resolve a PHPDoc type name in its declaring class context.
Get the class imports declared for a namespace by the source file.
Get the parsed imports and namespace declarations of a source file.
Parse class imports and namespace declaration lines from a PHP source file.
Parse a namespace declaration.
Collect the tokens belonging to one use statement.
Parse one normal or grouped use statement.
Parse comma-separated import entries.
Find the next non-ignorable token.
Join token text without whitespace or comments.
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.
at line 51
protected string
namespaceFor(ReflectionClass $class)
Get the namespace a class is declared in.
An anonymous class is named after its parent, so its namespace comes from its position in the source file.
at line 78
protected array
importsFor(ReflectionClass $class, string $namespace)
Get the class imports declared for a namespace by the source file.
at line 94
protected array
source(string $file)
Get the parsed imports and namespace declarations of a source file.
at line 104
protected array
parseSource(string $file)
Parse class imports and namespace declaration lines from a PHP source file.
at line 170
protected array
parseNamespace(array $tokens, int $index)
Parse a namespace declaration.
at line 195
protected array
collectUseStatement(array $tokens, int $index)
Collect the tokens belonging to one use statement.
at line 218
protected array
parseUseStatement(array $tokens)
Parse one normal or grouped use statement.
at line 238
protected array
parseImportEntries(array $tokens, string $prefix = '')
Parse comma-separated import entries.
at line 274
protected PhpToken|null
nextSignificantToken(array $tokens, int $index)
Find the next non-ignorable token.
at line 290
protected string
joinTokenText(array $tokens)
Join token text without whitespace or comments.
at line 306
static protected bool
isBuiltIn(string $type)
Determine if the type is built into PHP or PHPDoc.