class RequestDependentBindingRule implements Rule

internal  
 

Reports a #[BindWhen] condition whose code, including its nested callbacks, contains a read of the current request or user.

A matched condition becomes a binding for the worker's lifetime, so the first request it matches selects the implementation for every later one. Conditions are read from source, never executed, so whether a nested callback actually runs isn't known.

Traits

Constants

private AUTH_READS

The lowercase auth methods that read the current user.

private REQUEST_CONTEXT_READS

The lowercase RequestContext methods that read the current request or its values.

Properties

protected Container|null $container from  HasContainer

Methods

void
setContainer(Container $container)

Set the container used for resolution.

getContainer()

Return the current container.

mixed
resolve(string $abstract)

Resolve the given type from the container.

__construct(ReflectionProvider $reflectionProvider, RuntimeInputs $runtimeInputs, WorkerStateHelper $workerStateHelper, ConstructorParser $constructorParser, CoroutineRuleHelper $coroutineRuleHelper, ScopeFactory $scopeFactory, Parser $parser)

Create a new request-dependent binding rule instance.

string
getNodeType()

Get the node type the rule checks.

array
processNode(Node $node, Scope $scope)

Report each #[BindWhen] condition on the class that reads request or user state.

Details

in HasContainer at line 19
void setContainer(Container $container)

Set the container used for resolution.

Parameters

Container $container

Return Value

void

in HasContainer at line 27
Container getContainer()

Return the current container.

Return Value

Container

in HasContainer at line 35
mixed resolve(string $abstract)

Resolve the given type from the container.

Parameters

string $abstract

Return Value

mixed

at line 89
__construct(ReflectionProvider $reflectionProvider, RuntimeInputs $runtimeInputs, WorkerStateHelper $workerStateHelper, ConstructorParser $constructorParser, CoroutineRuleHelper $coroutineRuleHelper, ScopeFactory $scopeFactory, Parser $parser)

Create a new request-dependent binding rule instance.

Parameters

ReflectionProvider $reflectionProvider
RuntimeInputs $runtimeInputs
WorkerStateHelper $workerStateHelper
ConstructorParser $constructorParser
CoroutineRuleHelper $coroutineRuleHelper
ScopeFactory $scopeFactory
Parser $parser

at line 104
string getNodeType()

Get the node type the rule checks.

Return Value

string

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

Report each #[BindWhen] condition on the class that reads request or user state.

Parameters

Node $node
Scope $scope

Return Value

array