Documentation

SudoVisitor extends NodeVisitorAbstract
in package

A PHP Parser node visitor which rewrites property and method access to use the Psy\Sudo visibility bypass methods.

Tags
todo

handle assigning by reference

Table of Contents

CLASS_CONST_FETCH  = 'fetchClassConst'
METHOD_CALL  = 'callMethod'
PROPERTY_ASSIGN  = 'assignProperty'
PROPERTY_FETCH  = 'fetchProperty'
STATIC_CALL  = 'callStatic'
STATIC_PROPERTY_ASSIGN  = 'assignStaticProperty'
STATIC_PROPERTY_FETCH  = 'fetchStaticProperty'
SUDO_CLASS  = 'Psy\Sudo'
afterTraverse()  : null|array<string|int, Node>
Called once after traversal.
beforeTraverse()  : null|array<string|int, Node>
Called once before traversal.
enterNode()  : null|int|Node
Called when entering a node.
leaveNode()  : null|int|Node|array<string|int, Node>
Called when leaving a node.
prepareCall()  : mixed

Constants

CLASS_CONST_FETCH

public mixed CLASS_CONST_FETCH = 'fetchClassConst'

PROPERTY_ASSIGN

public mixed PROPERTY_ASSIGN = 'assignProperty'

PROPERTY_FETCH

public mixed PROPERTY_FETCH = 'fetchProperty'

STATIC_PROPERTY_ASSIGN

public mixed STATIC_PROPERTY_ASSIGN = 'assignStaticProperty'

STATIC_PROPERTY_FETCH

public mixed STATIC_PROPERTY_FETCH = 'fetchStaticProperty'

Methods

afterTraverse()

Called once after traversal.

public afterTraverse(array<string|int, mixed> $nodes) : null|array<string|int, Node>

Return value semantics:

  • null: $nodes stays as-is
  • otherwise: $nodes is set to the return value
Parameters
$nodes : array<string|int, mixed>

Array of nodes

Return values
null|array<string|int, Node>

Array of nodes

beforeTraverse()

Called once before traversal.

public beforeTraverse(array<string|int, mixed> $nodes) : null|array<string|int, Node>

Return value semantics:

  • null: $nodes stays as-is
  • otherwise: $nodes is set to the return value
Parameters
$nodes : array<string|int, mixed>

Array of nodes

Return values
null|array<string|int, Node>

Array of nodes

enterNode()

Called when entering a node.

public enterNode(Node $node) : null|int|Node
Parameters
$node : Node

Node

Return values
null|int|Node

Replacement node (or special return value)

leaveNode()

Called when leaving a node.

public leaveNode(Node $node) : null|int|Node|array<string|int, 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
$node : Node

Node

Return values
null|int|Node|array<string|int, Node>

Replacement node (or special return value)

prepareCall()

private prepareCall(mixed $method, mixed $args) : mixed
Parameters
$method : mixed
$args : mixed
Return values
mixed

Search results