mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Prohibit mutation-free assignment ops
This commit is contained in:
parent
da23c2e73a
commit
8601731fa2
@ -736,10 +736,10 @@ class AssignmentAnalyzer
|
|||||||
$statements_analyzer
|
$statements_analyzer
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($array_var_id && $context->pure && strpos($array_var_id, '->')) {
|
if ($array_var_id && $context->mutation_free && strpos($array_var_id, '->')) {
|
||||||
if (IssueBuffer::accepts(
|
if (IssueBuffer::accepts(
|
||||||
new ImpurePropertyAssignment(
|
new ImpurePropertyAssignment(
|
||||||
'Cannot assign to a property from a pure context',
|
'Cannot assign to a property from a mutation-free context',
|
||||||
new CodeLocation($statements_analyzer, $stmt->var)
|
new CodeLocation($statements_analyzer, $stmt->var)
|
||||||
),
|
),
|
||||||
$statements_analyzer->getSuppressedIssues()
|
$statements_analyzer->getSuppressedIssues()
|
||||||
|
Loading…
Reference in New Issue
Block a user