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

What the analyzer knows about each variable at one point in a function body.

Properties§

public bool $combined = false

Whether joining branch states lost their pairing.

Methods§

public function __construct(
    array<string, Domain> $variables = [],
    ?ObjectMemory $objects = null,
)

Parameters

$variablesarray<string, Domain>Initial bindings, keyed by variable name without the sigil
$objects?ObjectMemory
Calls 4
public function read(string $name): Domain

The domain bound to a variable, or an unresolved domain when it has none.

Parameters

$namestring

Returns

Test cases 52
Called from 11
Calls 7
public function write(string $name, Domain $domain): void

Binds a variable to a domain.

Parameters

$namestring
$domainDomain
Test cases 2
Called from 9
Calls 3
public function narrow(string $name, Domain $domain): void

Narrows a value while keeping a possible absence distinct from present null.

Parameters

$namestring
$domainDomain
Test cases 1
Calls 4
public function forget(string $name): void

Drops the binding of a variable.

Parameters

$namestring
Test cases 1
public function copy(): self

An independent copy, so a branch can be analyzed without disturbing the caller.

Returns

self
Test cases 5
Called from 11
public function join(self $other): self

The environment holding, for each variable, what either branch may leave in it.

A variable bound in only one branch keeps that branch's domain widened with the unresolved value it holds when the branch is not taken.

Parameters

$otherself

Returns

self
Test cases 4
Called from 2
Calls 11
public function invalidate(string $name, Origin $origin = Origin::Unresolved): void
public function signature(): string

A canonical string used to compare environments.

Returns

string
Test cases 34
Called from 1
Calls 4
public function equals(self $other): bool
public function objects(): ObjectMemory

The object snapshots shared by this run's aliases.

Test cases 3
Called from 13
Calls 1

Private surface 3§

Implementation details, listed for orientation only.

private array<string, Domain> $variables
private ?ObjectMemory $objects
private array<string, Presence> $presence = []

Test cases 210§

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

Dedicated tests 22
Other tests reaching this symbol 188

Relations§

Instantiated in 15
Method calls 54
Type declarations 58