WorkerStateGlobalWriteCollector
class WorkerStateGlobalWriteCollector implements Collector
Collects writes to global variables, which the whole worker shares like static properties: a
$GLOBALS[...] write wherever it sits, and a write through a name a function's top-level global
statement binds. Detecting the second walks the function's own statements, since PHPStan's scope
doesn't say which variables are global. A request, user or model value written through a plain
variable is collected too, so the rule can tell what such a global write keeps.
Writes include assignments, foreach keys and values, catch bindings, increments, decrements, unset() of
an offset or property, and arguments a by-reference parameter writes. unset(), a static declaration or
binding the variable itself by reference detaches it instead, and a top-level reference assignment between
a plain variable and global storage binds that variable as global does.
Properties
| Node> | $found |
Methods
Get the node type the collector inspects.
Collect the node's global writes and the request state written through a variable.
No description
Details
at line 77
__construct(WorkerStateHelper $helper)
Create a new collector instance.
at line 84
string
getNodeType()
Get the node type the collector inspects.
at line 95
array|null
processNode(Node $node, Scope $scope)
Collect the node's global writes and the request state written through a variable.
at line 346
int|null
enterNode(Node $node)
No description