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

What a property of an object can hold when a method starts, read from everywhere the class writes it.

A method that reads $this->table without writing it first sees whatever the object was left holding: the declared default, or the value some method of the class assigned — most often the constructor, from an argument the code that creates the object passes. Each of those writes is worked out at the place it is written, like any other value, so a table name handed to a repository's constructor resolves where the repository issues its queries.

Methods§

public function __construct(ProgramIndex $index, ?ModifiedNames $modified = null)

Wires the reader to the declarations it looks for writes in.

Parameters

Calls 2
public function valuesOf(
    string $className,
    string $property,
    int $depth,
    Deriver $deriver,
): list<Domain>

Every value the property can hold when a method of the class starts.

Each method that writes the property is read at the point it finishes, so a property built up in steps — assigned, then appended to under a condition — is seen as each of the values it can be left holding rather than as whichever assignment happens to come last in the source.

Parameters

$classNamestring
$propertystring
$depthint
$deriverDeriver

Returns

list<Domain>
Test cases 3
Calls 11
public function writersOf(string $className, string $property): list<ClassMethod>

The methods of the class and the classes it inherits from that write the property.

Parameters

$classNamestring
$propertystring

Returns

list<ClassMethod>
Test cases 1
Called from 1
Calls 3
public function writes(ClassMethod $method, string $property): bool

Whether a method writes the property of $this anywhere in its body.

Parameters

$methodClassMethod
$propertystring

Returns

bool
Test cases 1
Called from 1
Calls 3
public function promotions(string $className, string $property): list<ClassMethod>

The constructors that promote a parameter of that name to the property.

Parameters

$classNamestring
$propertystring

Returns

list<ClassMethod>
Test cases 1
Called from 1
Calls 1
public function defaultOf(string $className, string $property): ?Expr

The default the property is declared with, or null when it is declared without one.

Parameters

$classNamestring
$propertystring

Returns

?Expr
Test cases 1
Called from 1
Calls 1

Private surface 5§

Implementation details, listed for orientation only.

private ProgramIndex $index
private NodeFinder $finder
private ModifiedNames $modified
private array<string, list<ClassMethod>> $writers = []
private array<string, true> $reading = []

Test cases 30§

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

Dedicated tests 7
Other tests reaching this symbol 23

Relations§

Instantiated in 1
Type declarations 2