PHP Class PhpParser\NodeVisitor\NameResolver

Inheritance: extends PhpParser\NodeVisitorAbstract
显示文件 Open project: nikic/PHP-Parser Class Usage Examples

Protected Properties

Property Type Description
$aliases Map of format [aliasType => [aliasName => originalName]]
$errorHandler Error handler
$namespace Current namespace
$preserveOriginalNames Whether to preserve original names

Public Methods

Method Description
__construct ( PhpParser\ErrorHandler $errorHandler = null, array $options = [] ) Constructs a name resolution visitor.
beforeTraverse ( array $nodes )
enterNode ( PhpParser\Node $node )

Protected Methods

Method Description
addAlias ( UseUse $use, $type, Name $prefix = null )
addNamespacedName ( PhpParser\Node $node )
resetState ( Name $namespace = null )
resolveClassName ( Name $name )
resolveOtherName ( Name $name, $type )

Private Methods

Method Description
resolveSignature ( Function_ | ClassMethod | Closure $node )

Method Details

__construct() public method

Options: If "preserveOriginalNames" is enabled, an "originalName" attribute will be added to all name nodes that underwent resolution.
public __construct ( PhpParser\ErrorHandler $errorHandler = null, array $options = [] )
$errorHandler PhpParser\ErrorHandler Error handler
$options array Options

addAlias() protected method

protected addAlias ( UseUse $use, $type, Name $prefix = null )
$use PhpParser\Node\Stmt\UseUse
$prefix PhpParser\Node\Name

addNamespacedName() protected method

protected addNamespacedName ( PhpParser\Node $node )
$node PhpParser\Node

beforeTraverse() public method

public beforeTraverse ( array $nodes )
$nodes array

enterNode() public method

public enterNode ( PhpParser\Node $node )
$node PhpParser\Node

resetState() protected method

protected resetState ( Name $namespace = null )
$namespace PhpParser\Node\Name

resolveClassName() protected method

protected resolveClassName ( Name $name )
$name PhpParser\Node\Name

resolveOtherName() protected method

protected resolveOtherName ( Name $name, $type )
$name PhpParser\Node\Name

Property Details

$aliases protected_oe property

Map of format [aliasType => [aliasName => originalName]]
protected $aliases

$errorHandler protected_oe property

Error handler
protected $errorHandler

$namespace protected_oe property

Current namespace
protected $namespace

$preserveOriginalNames protected_oe property

Whether to preserve original names
protected $preserveOriginalNames