classAssignmentSteps
final class AssignmentSteps
Walks a path back over what one statement assigns.
An assignment to a name the path needs becomes a step, and the names its right-hand side reads are needed instead. An assignment that replaces its target settles the name; one that only adds to it, like .= or $a[] =, keeps the name needed so the walk goes on to find what it added to.
Methods§
public function __construct(FreeNames $names, ModifiedNames $modified)Wires the walk to what tells it which names an assignment reads and writes.
Parameters
$names | FreeNames | |
$modified | ModifiedNames |
One path walked back over the assignments an expression makes, last first.
Parameters
$expression | Expr | |
$path | Pending |
Returns
Test cases 2
Called from 4
- method-call SqlCatalog\Core\Analysis\Derivation\Slice\BackwardSlicer::over() packages/sql-catalog/src/Core/Analysis/Derivation/Slice/BackwardSlicer.php:286
- method-call SqlCatalog\Core\Analysis\Derivation\Slice\BackwardSlicer::over() packages/sql-catalog/src/Core/Analysis/Derivation/Slice/BackwardSlicer.php:289
- method-call SqlCatalog\Core\Analysis\Derivation\Slice\BackwardSlicer::over() packages/sql-catalog/src/Core/Analysis/Derivation/Slice/BackwardSlicer.php:306
- method-call SqlCatalog\Core\Analysis\Derivation\Slice\LoopPasses::expressions() packages/sql-catalog/src/Core/Analysis/Derivation/Slice/LoopPasses.php:218
Calls 11
- function-call
array_reverseline 44 - method-call AssignmentSteps::within() line 44
- method-call ModifiedNames::of() line 45
- method-call ModifiedNames::touches() line 46
- method-call ModifiedNames::targets() line 49
- method-call ModifiedNames::own() line 49
- method-call AssignmentSteps::replaces() line 50
- class-const WriteEffects::ALL() line 50
- function-call
array_diff_keyline 50 - new SliceStep line 51
- method-call FreeNames::read() line 51
public function replaces(Expr $assignment): boolWhether an assignment replaces what its target held rather than adding to it.
Parameters
$assignment | Expr |
Returns
boolpublic function within(Node $node): list<Expr>The assignments an expression makes, in the order they run.
Parameters
$node | Node |
Returns
list<Expr>Test cases 2
Called from 2
- method-call SqlCatalog\Core\Analysis\Derivation\Slice\AssignmentSteps::over() packages/sql-catalog/src/Core/Analysis/Derivation/Slice/AssignmentSteps.php:44
- method-call SqlCatalog\Core\Analysis\Derivation\Slice\AssignmentSteps::within() packages/sql-catalog/src/Core/Analysis/Derivation/Slice/AssignmentSteps.php:84
Calls 7
- method-call ModifiedNames::tracksObjects() line 75
- method-call ModifiedNames::own() line 75
- method-call ModifiedNames::of() line 77
- function-call
get_object_varsline 81 - function-call
is_arrayline 82 - function-call
array_mergeline 84 - method-call AssignmentSteps::within() line 84
One path walked back over a global, static or unset that defines names it needs.
Parameters
$statement | Global_|Static_|Unset_ | |
$path | Pending |
Returns
Test cases 1
Called from 1
Calls 4
- method-call ModifiedNames::own() line 97
- function-call
array_diff_keyline 98 - method-call Pending::through() line 103
- new SliceStep line 103
Private surface 2§
Implementation details, listed for orientation only.
private FreeNames $namesprivate ModifiedNames $modifiedTest cases 33§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
AssignmentStepsTest::testDeclarationDefinesWhatAGlobalListsButKeepsLookingPastAnUnsetcallsAssignmentStepsTest::testOverWalksBackOverTheLastAssignmentFirstcallsAssignmentStepsTest::testReplacesIsTrueOnlyForAnAssignmentThatOverwritesItsTargetcallsAssignmentStepsTest::testWithinKeepsConditionalWritesTogethercallsAssignmentStepsTest::testWithinLeavesOutWhatAClosureAssignscalls
Other tests reaching this symbol 28
CatalogCommandTestcallsCallEvaluatorTestcallsConstantReaderTestcallsCalleeReturnsTestcallsCallersTestcallsDeriverTestcallsEntryBinderTestcallsCallbackEffectsTestcallsPropertyWritesTestcallsBackwardSlicerTestcallsLoopPassesTestcallsSliceExecutorTestcallsExpressionEvaluatorTestcallsRegistryTestcallsInterpreterTestcallsModelQueriesTestcallsReferenceEvaluatorTestcallsCallContextTestcallsModelContextTestcallsQueryModelInterfaceTestcallsBuilderCallsTestcallsBuilderQueriesTestcallsCallbackModelTestcallsCallModelTestcallsLaravelExtensionTestcallsAnalyzerTestcallsJsonReporterTestcallsTextReporterTestcalls
Relations§
Instantiated in 2
Method calls 5
- method-call SqlCatalog\Core\Analysis\Derivation\Slice\BackwardSlicer::over() packages/sql-catalog/src/Core/Analysis/Derivation/Slice/BackwardSlicer.php:286
- method-call SqlCatalog\Core\Analysis\Derivation\Slice\BackwardSlicer::over() packages/sql-catalog/src/Core/Analysis/Derivation/Slice/BackwardSlicer.php:289
- method-call SqlCatalog\Core\Analysis\Derivation\Slice\BackwardSlicer::over() packages/sql-catalog/src/Core/Analysis/Derivation/Slice/BackwardSlicer.php:292
- method-call SqlCatalog\Core\Analysis\Derivation\Slice\BackwardSlicer::over() packages/sql-catalog/src/Core/Analysis/Derivation/Slice/BackwardSlicer.php:306
- method-call SqlCatalog\Core\Analysis\Derivation\Slice\LoopPasses::expressions() packages/sql-catalog/src/Core/Analysis/Derivation/Slice/LoopPasses.php:218