class WorkerStateAnalysis

internal  
 

The worker-state model of one analysis, shared by the rules that judge collected code by the request, job or operation it runs in: the booted lifetimes, with the collected route closures and parameter reassignments.

Lifetimes come from every analyzed file and the booted application, so the model is built once from the collected data rather than per file.

Properties

WorkerLifetimes $lifetimes

The worker lifetimes of the booted application and the collected roots.

Methods

__construct(CollectedDataNode $node, ReflectionProvider $reflectionProvider, Container $container, RuntimeInputs $runtimeInputs)

Build the model from the collected data and the booted container.

void
track(Scope $scope)

Declare that a rule's errors depend on the booted application and the classes the lifetimes were read from, after the rule's queries have read them.

static string
describeContext(string $context)

Describe when code in the context runs.

string|null
getContext(array $function, string $file)

Get the operation the function always handles: the route action it is, a booted handler method, a helper such a method or a job calls, or else its collected context.

bool
isReassigned(array $function, string $parameter, string $file)

Determine whether the function gives the parameter another value before the code at its position.

bool
isInjectedConfig(array $function, string $parameter, string $file)

Determine whether the container injects the global configuration repository into the function's parameter, and the function still holds it: a controller action, a route closure or a job's handler.

bool
isPromotedConfig(array $function, string $constructor, string $property)

Determine whether a readonly property the constructor promotes holds the global configuration repository in the method's instances: the container built them and injects that repository.

bool
sharesPromotedProperty(array $function, string $constructor, string $property)

Determine whether a readonly property the constructor promotes holds the instance the container shares for the worker in the method's instances: the container built them and injects that instance.

Details

at line 63
__construct(CollectedDataNode $node, ReflectionProvider $reflectionProvider, Container $container, RuntimeInputs $runtimeInputs)

Build the model from the collected data and the booted container.

Parameters

CollectedDataNode $node
ReflectionProvider $reflectionProvider
Container $container
RuntimeInputs $runtimeInputs

at line 132
void track(Scope $scope)

Declare that a rule's errors depend on the booted application and the classes the lifetimes were read from, after the rule's queries have read them.

Parameters

Scope $scope

Return Value

void

at line 149
static string describeContext(string $context)

Describe when code in the context runs.

Parameters

string $context

Return Value

string

at line 167
string|null getContext(array $function, string $file)

Get the operation the function always handles: the route action it is, a booted handler method, a helper such a method or a job calls, or else its collected context.

A registration is better evidence than the class alone: a queueable class's handle() registered as a passive observer runs synchronously during its event.

Parameters

array $function
string $file

Return Value

string|null

at line 185
bool isReassigned(array $function, string $parameter, string $file)

Determine whether the function gives the parameter another value before the code at its position.

Parameters

array $function
string $parameter
string $file

Return Value

bool

at line 198
bool isInjectedConfig(array $function, string $parameter, string $file)

Determine whether the container injects the global configuration repository into the function's parameter, and the function still holds it: a controller action, a route closure or a job's handler.

Parameters

array $function
string $parameter
string $file

Return Value

bool

at line 221
bool isPromotedConfig(array $function, string $constructor, string $property)

Determine whether a readonly property the constructor promotes holds the global configuration repository in the method's instances: the container built them and injects that repository.

Parameters

array $function
string $constructor
string $property

Return Value

bool

at line 235
bool sharesPromotedProperty(array $function, string $constructor, string $property)

Determine whether a readonly property the constructor promotes holds the instance the container shares for the worker in the method's instances: the container built them and injects that instance.

Parameters

array $function
string $constructor
string $property

Return Value

bool