Methods |
public
|
__construct(ErrorHandler $errorHandler)
Create a name context.
Parameters
$errorHandler |
Error handling used to report errors
|
|
#
|
public
|
startNamespace(Name|null $namespace = null): void
Start a new namespace.
Start a new namespace.
This also resets the alias table.
Parameters
$namespace |
Null is the global namespace
|
|
#
|
public
|
addAlias(Name $name, string $aliasName, Stmt\Use_::TYPE_* $type, array<string, mixed> $errorAttrs = []): void
Add an alias / import.
Parameters
$name |
Original name
|
$aliasName |
Aliased name
|
$type |
One of Stmt\Use_::TYPE_*
|
$errorAttrs |
Attributes to use to report an error
|
|
#
|
public
|
getNamespace(): null|Name
Get current namespace.
Returns
Namespace (or null if global namespace)
|
#
|
public
|
getResolvedName(Name $name, Stmt\Use_::TYPE_* $type): null|Name
Get resolved name.
Parameters
$name |
Name to resolve
|
$type |
One of Stmt\Use_::TYPE_{FUNCTION|CONSTANT}
|
Returns
Resolved name, or null if static resolution is not possible
|
#
|
public
|
getResolvedClassName(Name $name): Name
Get resolved class name.
Parameters
$name |
Class ame to resolve
|
Returns
|
#
|
public
|
getPossibleNames(string $name, Stmt\Use_::TYPE_* $type): Name[]
Get possible ways of writing a fully qualified name (e.g., by making use of aliases).
Get possible ways of writing a fully qualified name (e.g., by making use of aliases).
Parameters
$name |
Fully-qualified name (without leading namespace separator)
|
$type |
One of Stmt\Use_::TYPE_*
|
Returns
Possible representations of the name
|
#
|
public
|
getShortName(string $name, Stmt\Use_::TYPE_* $type): Name
Get shortest representation of this fully-qualified name.
Get shortest representation of this fully-qualified name.
Parameters
$name |
Fully-qualified name (without leading namespace separator)
|
$type |
One of Stmt\Use_::TYPE_*
|
Returns
|
#
|