\SuperClosure\Analyzer\VisitorMagicConstantVisitor

This is a visitor that resolves magic constants (e.g., __FILE__) to their intended values within a closure's AST.

Summary

Methods
Properties
Constants
beforeTraverse()
enterNode()
leaveNode()
afterTraverse()
__construct()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$location
N/A

Properties

$location

$location : array

Type

array

Methods

beforeTraverse()

beforeTraverse(array  $nodes) : null|array<mixed,\PhpParser\Node>

Called once before traversal.

Return value semantics:

  • null: $nodes stays as-is
  • otherwise: $nodes is set to the return value

Parameters

array $nodes

Array of nodes

Returns

null|array<mixed,\PhpParser\Node> —

Array of nodes

enterNode()

enterNode(\PhpParser\Node  $node) : null|integer|\PhpParser\Node

Called when entering a node.

Return value semantics:

  • null => $node stays as-is
  • NodeTraverser::DONT_TRAVERSE_CHILDREN => Children of $node are not traversed. $node stays as-is
  • NodeTraverser::STOP_TRAVERSAL => Traversal is aborted. $node stays as-is
  • otherwise => $node is set to the return value

Parameters

\PhpParser\Node $node

Node

Returns

null|integer|\PhpParser\Node

Node

leaveNode()

leaveNode(\PhpParser\Node  $node) : null|false|integer|\PhpParser\Node|array<mixed,\PhpParser\Node>

Called when leaving a node.

Return value semantics:

  • null => $node stays as-is
  • NodeTraverser::REMOVE_NODE => $node is removed from the parent array
  • NodeTraverser::STOP_TRAVERSAL => Traversal is aborted. $node stays as-is
  • array (of Nodes) => The return value is merged into the parent array (at the position of the $node)
  • otherwise => $node is set to the return value

Parameters

\PhpParser\Node $node

Node

Returns

null|false|integer|\PhpParser\Node|array<mixed,\PhpParser\Node> —

Node

afterTraverse()

afterTraverse(array  $nodes) : null|array<mixed,\PhpParser\Node>

Called once after traversal.

Return value semantics:

  • null: $nodes stays as-is
  • otherwise: $nodes is set to the return value

Parameters

array $nodes

Array of nodes

Returns

null|array<mixed,\PhpParser\Node> —

Array of nodes

__construct()

__construct(array  $location) 

Parameters

array $location