1
0
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:
Brown 2019-09-03 12:16:31 -04:00
parent da23c2e73a
commit 8601731fa2

View File

@ -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()