class CoroutineRuleHelper

Constants

private NATIVE_WAITS

The native channel, WaitGroup, Waiter and join methods, keyed by declaring class, that a try may call and still keep an exact catch: each either doesn't wait or throws cancellation directly.

Properties

Node> $found

Methods

__construct(Closure $filter, string|null $variable)

No description

bool
isCancellation(Name $name)

Determine whether the name is Swoole's cancellation exception.

bool|null
guardPolarity(Expr $condition, string $variable)

Get whether the condition is a Coroutine::causedByCancellation() guard on the variable (true), the guard negated (false), or neither (null).

bool
endsWith(array $statements, array $exits)

Determine whether the statements end by leaving their block through one of the given statement or expression types.

bool
assigns(Node $node, string $variable)

Determine whether the node writes the variable: =, =& or a compound assignment, including through destructuring, a foreach key or value, or a catch binding.

static array
getWriteTargets(Node $node)

Get the targets the node writes, such as variables and properties: through =, =& or a compound assignment, including destructuring, a foreach key or value, or a catch binding.

static array
getTargetLeaves(Expr|null $target)

Get the targets a write assigns, such as variables and properties, through destructuring.

static array
getReferenceLeaves(Expr|null $target)

Get the destructuring leaves the target binds by reference, such as $value in [&$value] = $items.

static array|null
getStorageAlias(AssignRef $node, array $roots)

Get the plain variable a reference assignment binds to one of the given variables or an offset of it, and that root: $alias =& $root['key'], or $root['key'] =& $alias. A plain variable assigned by reference is only re-pointed, so it never passes its old binding on. A property isn't followed, since a property can return other storage by reference than its object's.

static array
getDetachedNames(Node $node)

Get the variable names the node unbinds from what they were bound to, such as a global or a caller's by-reference variable: unset(), a static declaration, or binding the variable itself by reference through =&, a by-reference foreach value or a by-reference destructuring item. Unsetting or binding an offset or property by reference writes through the binding instead.

array
find(array $statements, Closure $filter, string|null $variable = null)

Find the matching nodes in the statements, skipping the bodies of nested functions and classes, and of nested catches that bind the given variable again, since it names another exception there.

int|null
enterNode(Node $node)

No description

Details

at line 297
__construct(Closure $filter, string|null $variable)

No description

Parameters

Closure $filter
string|null $variable

at line 95
bool isCancellation(Name $name)

Determine whether the name is Swoole's cancellation exception.

Parameters

Name $name

Return Value

bool

at line 104
bool|null guardPolarity(Expr $condition, string $variable)

Get whether the condition is a Coroutine::causedByCancellation() guard on the variable (true), the guard negated (false), or neither (null).

Parameters

Expr $condition
string $variable

Return Value

bool|null

at line 137
bool endsWith(array $statements, array $exits)

Determine whether the statements end by leaving their block through one of the given statement or expression types.

Parameters

array $statements
array $exits

Return Value

bool

at line 155
bool assigns(Node $node, string $variable)

Determine whether the node writes the variable: =, =& or a compound assignment, including through destructuring, a foreach key or value, or a catch binding.

Parameters

Node $node
string $variable

Return Value

bool

at line 166
static array getWriteTargets(Node $node)

Get the targets the node writes, such as variables and properties: through =, =& or a compound assignment, including destructuring, a foreach key or value, or a catch binding.

Parameters

Node $node

Return Value

array

at line 181
static array getTargetLeaves(Expr|null $target)

Get the targets a write assigns, such as variables and properties, through destructuring.

Parameters

Expr|null $target

Return Value

array

at line 205
static array getReferenceLeaves(Expr|null $target)

Get the destructuring leaves the target binds by reference, such as $value in [&$value] = $items.

Parameters

Expr|null $target

Return Value

array

at line 232
static array|null getStorageAlias(AssignRef $node, array $roots)

Get the plain variable a reference assignment binds to one of the given variables or an offset of it, and that root: $alias =& $root['key'], or $root['key'] =& $alias. A plain variable assigned by reference is only re-pointed, so it never passes its old binding on. A property isn't followed, since a property can return other storage by reference than its object's.

Parameters

AssignRef $node
array $roots

Return Value

array|null

at line 257
static array getDetachedNames(Node $node)

Get the variable names the node unbinds from what they were bound to, such as a global or a caller's by-reference variable: unset(), a static declaration, or binding the variable itself by reference through =&, a by-reference foreach value or a by-reference destructuring item. Unsetting or binding an offset or property by reference writes through the binding instead.

Parameters

Node $node

Return Value

array

at line 288
array find(array $statements, Closure $filter, string|null $variable = null)

Find the matching nodes in the statements, skipping the bodies of nested functions and classes, and of nested catches that bind the given variable again, since it names another exception there.

Parameters

array $statements
Closure $filter
string|null $variable

Return Value

array

at line 303
int|null enterNode(Node $node)

No description

Parameters

Node $node

Return Value

int|null