final class ReferenceEvaluator
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Reads the value behind a name: a variable, a property, a constant or an element.

Methods§

public function __construct(ProgramIndex $index, ExternalInput $external, NodeText $text)

Wires the reader to the declarations it resolves names against.

Parameters

Calls 1
public function readElement(
    ArrayDimFetch $node,
    Environment $environment,
    FunctionScope $scope,
    ExpressionEvaluator $expressions,
): Domain

The value of an array element.

A key that resolved reads the element written under it. A key that did not — self::TABLES[$kind] with $kind coming from a request — reads every element the array holds: whatever the key turns out to be, the value is one of them, and an array written out in full lists them all.

Parameters

$nodeArrayDimFetch
$environmentEnvironment
$scopeFunctionScope
$expressionsExpressionEvaluator

Returns

Test cases 1
Called from 1
Calls 5
public function readProperty(
    PropertyFetch|NullsafePropertyFetch|StaticPropertyFetch $node,
    Environment $environment,
    FunctionScope $scope,
    ExpressionEvaluator $expressions,
): Domain

The value of a property read, resolving a settled default when there is one.

A static property is read the same way: self::$tables declared with a default and assigned nowhere else holds that default for the life of the process, which makes it a constant spelled as a property.

Parameters

$nodePropertyFetch|NullsafePropertyFetch|StaticPropertyFetch
$environmentEnvironment
$scopeFunctionScope
$expressionsExpressionEvaluator

Returns

Test cases 4
Called from 1
Calls 13
public function readEnumProperty(
    Domain $receiver,
    string $owner,
    string $property,
    FunctionScope $scope,
    ExpressionEvaluator $expressions,
): ?Domain

The value behind ->value or ->name on an enum.

A value typed as a backed enum can only ever be one of that enum's cases, so reading its backing value resolves to the union of them. That is what turns a parameter typed Status into the handful of strings the column can hold rather than an opaque string.

Parameters

$receiverDomain
$ownerstring
$propertystring
$scopeFunctionScope
$expressionsExpressionEvaluator

Returns

Test cases 3
Called from 1
Calls 5
public function trackedName(Expr $target): ?string

The name a target is tracked under in the environment, or null when it is not tracked.

A variable is tracked under its name, and a property of $this under this->property, so that assigning it earlier in a body is seen when it is read later in the same body.

Parameters

$targetExpr

Returns

?string
Test cases 1
Called from 4
Calls 1
public function assignElement(
    ArrayDimFetch $target,
    Domain $value,
    Environment $environment,
    FunctionScope $scope,
    ExpressionEvaluator $expressions,
): void

Writes a value into an array held by a tracked name, keeping the key when one is written.

A write one level down, such as $parts['where'][] = …, is not followed element by element: the array it goes into is marked as no longer known in full, so reading it back never claims to have seen all of it.

Parameters

$targetArrayDimFetch
$valueDomain
$environmentEnvironment
$scopeFunctionScope
$expressionsExpressionEvaluator
Test cases 3
Called from 1
Calls 11

Private surface 5§

Implementation details, listed for orientation only.

private ProgramIndex $index
private ExternalInput $external
private NodeText $text
private ConstantReader $constants
private ?WriteEffects $effects = null

Test cases 57§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 34
Other tests reaching this symbol 23

Relations§

Instantiated in 1
Method calls 3
Type declarations 3