class BorrowedResourceEscapeRule implements Rule

internal  
 

Reports a pooled resource that escapes the callback it is lent to.

The pool lends the resource to other coroutines once the callback returns, and a pinned database session can return to its pool once its pin ends, so anything still holding them afterwards may act on another coroutine's work. Each callback is read as written, in statement order: the lent parameter, the raw handles taken from it, and the local variables, arrays and closures holding them are followed, but not values passed through calls.

Traits

Constants

private LENDING_METHODS

The lowercase names of the lending methods below.

private LENDERS

The resource each lending method lends its callback, by declaring class and lowercase method.

private RESOURCES

Each resource's name, and the names of the raw handles its lowercase methods take from it.

A pinned session lends nothing, but keeps the PDOs taken from its connection on the pinned session.

private NO_FACT

What a value that holds nothing borrowed is.

private SPAWNING_FUNCTIONS

The functions that run their callbacks in a coroutine or later, so the callbacks can outlive the caller.

private SPAWNING_METHODS

The lowercase methods that run their callbacks in a coroutine or later, by exact declaring class.

Parallel cancels its children with its owner but does not join them, so a child whose cleanup yields can still run after the callback returns. The Concurrency driver is configuration, so only an explicit sync driver's run() keeps its tasks in place.

Properties

Node> $found

Methods

__construct(ReflectionProvider $reflectionProvider)

Create a new borrowed resource escape rule instance.

string
getNodeType()

Get the node type the rule checks.

array
processNode(Node $node, Scope $scope)

Report the escapes from a lending method's callback.

int|null
enterNode(Node $node)

No description

Details

at line 237
__construct(ReflectionProvider $reflectionProvider)

Create a new borrowed resource escape rule instance.

Parameters

ReflectionProvider $reflectionProvider

at line 245
string getNodeType()

Get the node type the rule checks.

Return Value

string

at line 257
array processNode(Node $node, Scope $scope)

Report the escapes from a lending method's callback.

Parameters

Node $node
Scope $scope

Return Value

array

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

No description

Parameters

Node $node

Return Value

int|null