Documentation

LoopContextPass extends CodeCleanerPass
in package

The loop context pass handles invalid `break` and `continue` statements.

Table of Contents

$loopDepth  : mixed
afterTraverse()  : null|array<string|int, Node>
Called once after traversal.
beforeTraverse()  : mixed
{@inheritdoc}
enterNode()  : mixed
leaveNode()  : mixed

Properties

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()

{@inheritdoc}

public beforeTraverse(array<string|int, mixed> $nodes) : mixed
Parameters
$nodes : array<string|int, mixed>
Return values
mixed

enterNode()

public enterNode(Node $node) : mixed
Parameters
$node : Node
Tags
throws
FatalErrorException

if the node is a break or continue in a non-loop or switch context

throws
FatalErrorException

if the node is trying to break out of more nested structures than exist

throws
FatalErrorException

if the node is a break or continue and has a non-numeric argument

throws
FatalErrorException

if the node is a break or continue and has an argument less than 1

Return values
mixed

Search results