classPropertyWrites
final class PropertyWrites
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
$index | ProgramIndex | |
$modified | ?ModifiedNames |
Calls 2
- new
NodeFinderline 51 - new ModifiedNames line 52
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
$className | string | |
$property | string | |
$depth | int | |
$deriver | Deriver |
Returns
list<Domain>Test cases 3
Calls 11
- function-call
strtolowerline 67 - new
PropertyFetchline 73 - new
Variableline 73 - class-const FreeNames::THIS() line 73
- method-call PropertyWrites::writersOf() line 74
- method-call Deriver::spent() line 75
- method-call Deriver::solveAtExits() line 76
- method-call PropertyWrites::promotions() line 81
- function-call
array_mergeline 82 - method-call Deriver::binder() line 82
- method-call PropertyWrites::defaultOf() line 84
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
$className | string | |
$property | string |
Returns
list<ClassMethod>Test cases 1
Called from 1
Calls 3
- function-call
strtolowerline 100 - method-call ProgramIndex::lineage() line 105
- method-call PropertyWrites::writes() line 108
public function writes(ClassMethod $method, string $property): boolWhether a method writes the property of $this anywhere in its body.
Parameters
$method | ClassMethod | |
$property | string |
Returns
boolTest cases 1
Called from 1
Calls 3
- class-const FreeNames::THIS() line 123
- method-call
NodeFinder::find()line 124 - method-call ModifiedNames::baseName() line 126
public function promotions(string $className, string $property): list<ClassMethod>The constructors that promote a parameter of that name to the property.
Parameters
$className | string | |
$property | string |
Returns
list<ClassMethod>Called from 1
Calls 1
- method-call ProgramIndex::lineage() line 143
public function defaultOf(string $className, string $property): ?ExprThe default the property is declared with, or null when it is declared without one.
Parameters
$className | string | |
$property | string |
Returns
?ExprTest cases 1
Called from 1
Calls 1
- method-call ProgramIndex::lineage() line 164
Private surface 5§
Implementation details, listed for orientation only.
private ProgramIndex $indexprivate NodeFinder $finderprivate ModifiedNames $modifiedprivate 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
PropertyWritesTest::testDefaultOfIsTheNearestDeclaredDefaultcallsPropertyWritesTest::testPromotionsAreTheConstructorsPromotingAParameterOfThatNamecallsPropertyWritesTest::testValuesOfCollectsWhatEveryWriterLeavescallsPropertyWritesTest::testValuesOfReadsThePropertyAgainOnceTheFirstReadingIsDonecallsPropertyWritesTest::testValuesOfSkipsTheWritersOnceTheBudgetIsSpentcallsPropertyWritesTest::testWritersOfFindsTheMethodsOfTheClassAndItsAncestorsThatWriteThePropertycallsPropertyWritesTest::testWritesSeesOnlyAssignmentsToThePropertyOfThiscalls
Other tests reaching this symbol 23
CatalogCommandTestcallsCallEvaluatorTestcallsConstantReaderTestcallsCalleeReturnsTestcallsCallersTestcallsDeriverTestcallsEntryBinderTestcallsCallbackEffectsTestcallsSliceExecutorTestcallsExpressionEvaluatorTestcallsRegistryTestcallsInterpreterTestcallsModelQueriesTestcallsReferenceEvaluatorTestcallsCallContextTestcallsQueryModelInterfaceTestcallsBuilderCallsTestcallsBuilderQueriesTestcallsCallbackModelTestcallsCallModelTestcallsAnalyzerTestcallsJsonReporterTestcallsTextReporterTestcalls