classWriteEffects
final class WriteEffects
Writes whose values cannot be reconstructed, including writes hidden behind calls.
A wildcard means code can modify the current symbol table. Reference aliases are treated conservatively, never as evidence that a local is undefined.
Constants§
public const ALL = '*'Every local may be changed.
Methods§
public function own(Node $node, ?ProgramIndex $index = null): array<string, true>The names an operation may change without an ordinary assignment.
Parameters
$node | Node | |
$index | ?ProgramIndex |
Returns
array<string, true>Test cases 1
Called from 4
- method-call SqlCatalog\Core\Analysis\CallEvaluator::applyEffects() packages/sql-catalog/src/Core/Analysis/CallEvaluator.php:133
- method-call SqlCatalog\Core\Analysis\Derivation\ModifiedNames::own() packages/sql-catalog/src/Core/Analysis/Derivation/ModifiedNames.php:106
- method-call SqlCatalog\Core\Analysis\Derivation\ModifiedNames::own() packages/sql-catalog/src/Core/Analysis/Derivation/ModifiedNames.php:130
- method-call SqlCatalog\Core\Analysis\ExpressionEvaluator::evaluate() packages/sql-catalog/src/Core/Analysis/ExpressionEvaluator.php:85
Calls 8
- class-const WriteEffects::ALL() line 39
- new ModifiedNames line 41
- method-call WriteEffects::dynamicTarget() line 43
- method-call ModifiedNames::targets() line 49
- method-call
Node::isFirstClassCallable()line 51 - function-call
in_arrayline 55 - function-call
strtolowerline 55 - method-call WriteEffects::arguments() line 59
public function assignment(Expr $target, Environment $environment): voidInvalidates possible aliases before the direct target receives its new value.
Parameters
$target | Expr | |
$environment | Environment |
Calls 5
- method-call ModifiedNames::targets() line 67
- new ModifiedNames line 67
- new ReferenceEffects line 68
- method-call WriteEffects::apply() line 69
- method-call WriteEffects::dynamicTarget() line 69
public function dynamicTarget(Expr $target): array<string, true>Dynamic assignment targets can address any binding in the current scope.
Parameters
$target | Expr |
Returns
array<string, true>Test cases 1
Called from 6
- method-call SqlCatalog\Core\Analysis\Effect\ReferenceEffects::collect() packages/sql-catalog/src/Core/Analysis/Effect/ReferenceEffects.php:89
- method-call SqlCatalog\Core\Analysis\Effect\WriteEffects::own() packages/sql-catalog/src/Core/Analysis/Effect/WriteEffects.php:43
- method-call SqlCatalog\Core\Analysis\Effect\WriteEffects::assignment() packages/sql-catalog/src/Core/Analysis/Effect/WriteEffects.php:69
- method-call SqlCatalog\Core\Analysis\Effect\WriteEffects::dynamicTarget() packages/sql-catalog/src/Core/Analysis/Effect/WriteEffects.php:80
- method-call SqlCatalog\Core\Analysis\Effect\WriteEffects::dynamicTarget() packages/sql-catalog/src/Core/Analysis/Effect/WriteEffects.php:87
- method-call SqlCatalog\Core\Analysis\Effect\WriteEffects::arguments() packages/sql-catalog/src/Core/Analysis/Effect/WriteEffects.php:118
Calls 3
- method-call WriteEffects::dynamicTarget() line 80
- function-call
is_stringline 82 - class-const WriteEffects::ALL() line 83
public function arguments(CallLike $call, ?ProgramIndex $index = null): array<string, true>Writable arguments stay open unless a source declaration excludes reference passing.
Parameters
$call | CallLike | |
$index | ?ProgramIndex |
Returns
array<string, true>Test cases 2
Called from 1
Calls 4
- new ModifiedNames line 105
- method-call
CallLike::getArgs()line 107 - method-call ModifiedNames::targets() line 118
- method-call WriteEffects::dynamicTarget() line 118
public function apply(
array<string, true> $names,
Environment $environment,
Origin $origin = Origin::Unresolved,
): voidOpens affected bindings after an operation; later definite assignments may close them again.
Parameters
$names | array<string, true> | |
$environment | Environment | |
$origin | Origin |
Test cases 1
Called from 5
- method-call SqlCatalog\Core\Analysis\CallEvaluator::applyEffects() packages/sql-catalog/src/Core/Analysis/CallEvaluator.php:122
- method-call SqlCatalog\Core\Analysis\CallEvaluator::applyEffects() packages/sql-catalog/src/Core/Analysis/CallEvaluator.php:135
- method-call SqlCatalog\Core\Analysis\Derivation\SliceExecutor::abandon() packages/sql-catalog/src/Core/Analysis/Derivation/SliceExecutor.php:176
- method-call SqlCatalog\Core\Analysis\Effect\WriteEffects::assignment() packages/sql-catalog/src/Core/Analysis/Effect/WriteEffects.php:69
- method-call SqlCatalog\Core\Analysis\ExpressionEvaluator::evaluate() packages/sql-catalog/src/Core/Analysis/ExpressionEvaluator.php:85
Calls 5
- class-const Origin::Unresolved() line 129
- class-const WriteEffects::ALL() line 131
- function-call
array_fill_keysline 132 - method-call Environment::names() line 132
- method-call Environment::invalidate() line 135
Private surface 1§
Implementation details, listed for orientation only.
private ?ReferenceEffects $references = nullTest cases 32§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
WriteEffectsTest::testApplyInvalidatesAbsenceAndValuesWithoutChangingUnrelatedBindingscallsWriteEffectsTest::testArgumentsRetainsWritableArgumentsOnlycallsWriteEffectsTest::testArgumentsUsesReferenceDeclarationsAndNamedArgumentscallsWriteEffectsTest::testAssignmentInvalidatesAliasValuesBeforeWritingTheTargetcallsWriteEffectsTest::testDynamicTargetFindsNestedVariableVariablescallsWriteEffectsTest::testOwnRecognizesUnmodelledWritescalls
Other tests reaching this symbol 26
CatalogCommandTestcallsCallEvaluatorTestcallsConstantReaderTestcallsBindingTestcallsCalleeReturnsTestcallsCallersTestcallsDeriverTestcallsEntryBinderTestcallsModifiedNamesTestcallsCallbackEffectsTestcallsPropertyWritesTestcallsAssignmentStepsTestcallsBackwardSlicerTestcallsLoopPassesTestcallsSliceExecutorTestcallsReferenceEffectsTestcallsExpressionEvaluatorTestcallsInterpreterTestcallsModelQueriesTestcallsReferenceEvaluatorTestcallsBuilderQueriesTestcallsCallbackModelTestcallsCallModelTestcallsAnalyzerTestcallsJsonReporterTestcallsTextReporterTestcalls
Relations§
Instantiated in 8
- new SqlCatalog\Core\Analysis\CallEvaluator::applyEffects() packages/sql-catalog/src/Core/Analysis/CallEvaluator.php:122
- new SqlCatalog\Core\Analysis\CallEvaluator::applyEffects() packages/sql-catalog/src/Core/Analysis/CallEvaluator.php:132
- new SqlCatalog\Core\Analysis\Derivation\ModifiedNames::own() packages/sql-catalog/src/Core/Analysis/Derivation/ModifiedNames.php:106
- new SqlCatalog\Core\Analysis\Derivation\ModifiedNames::own() packages/sql-catalog/src/Core/Analysis/Derivation/ModifiedNames.php:130
- new SqlCatalog\Core\Analysis\Derivation\SliceExecutor::abandon() packages/sql-catalog/src/Core/Analysis/Derivation/SliceExecutor.php:176
- new SqlCatalog\Core\Analysis\Effect\ReferenceEffects::collect() packages/sql-catalog/src/Core/Analysis/Effect/ReferenceEffects.php:87
- new SqlCatalog\Core\Analysis\ExpressionEvaluator::evaluate() packages/sql-catalog/src/Core/Analysis/ExpressionEvaluator.php:84
- new SqlCatalog\Core\Analysis\ReferenceEvaluator::assign() packages/sql-catalog/src/Core/Analysis/ReferenceEvaluator.php:295
Method calls 9
- method-call SqlCatalog\Core\Analysis\CallEvaluator::applyEffects() packages/sql-catalog/src/Core/Analysis/CallEvaluator.php:122
- method-call SqlCatalog\Core\Analysis\CallEvaluator::applyEffects() packages/sql-catalog/src/Core/Analysis/CallEvaluator.php:133
- method-call SqlCatalog\Core\Analysis\CallEvaluator::applyEffects() packages/sql-catalog/src/Core/Analysis/CallEvaluator.php:135
- method-call SqlCatalog\Core\Analysis\Derivation\ModifiedNames::own() packages/sql-catalog/src/Core/Analysis/Derivation/ModifiedNames.php:106
- method-call SqlCatalog\Core\Analysis\Derivation\ModifiedNames::own() packages/sql-catalog/src/Core/Analysis/Derivation/ModifiedNames.php:130
- method-call SqlCatalog\Core\Analysis\Derivation\SliceExecutor::abandon() packages/sql-catalog/src/Core/Analysis/Derivation/SliceExecutor.php:176
- method-call SqlCatalog\Core\Analysis\Effect\ReferenceEffects::collect() packages/sql-catalog/src/Core/Analysis/Effect/ReferenceEffects.php:89
- method-call SqlCatalog\Core\Analysis\ExpressionEvaluator::evaluate() packages/sql-catalog/src/Core/Analysis/ExpressionEvaluator.php:85
- method-call SqlCatalog\Core\Analysis\ExpressionEvaluator::evaluate() packages/sql-catalog/src/Core/Analysis/ExpressionEvaluator.php:85
Constant reads 3
- class-const SqlCatalog\Core\Analysis\Derivation\ModifiedNames::touches() packages/sql-catalog/src/Core/Analysis/Derivation/ModifiedNames.php:54
- class-const SqlCatalog\Core\Analysis\Derivation\Slice\AssignmentSteps::over() packages/sql-catalog/src/Core/Analysis/Derivation/Slice/AssignmentSteps.php:50
- class-const SqlCatalog\Core\Analysis\Effect\ReferenceEffects::affected() packages/sql-catalog/src/Core/Analysis/Effect/ReferenceEffects.php:60