mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Static property fetching is bad
This commit is contained in:
parent
8589e4af55
commit
9d6939226e
@ -176,6 +176,8 @@ class StaticPropertyFetchAnalyzer
|
||||
);
|
||||
}
|
||||
|
||||
$project_analyzer = $statements_analyzer->getProjectAnalyzer();
|
||||
|
||||
if ($context->mutation_free) {
|
||||
if (IssueBuffer::accepts(
|
||||
new \Psalm\Issue\ImpureStaticProperty(
|
||||
@ -186,6 +188,12 @@ class StaticPropertyFetchAnalyzer
|
||||
)) {
|
||||
// fall through
|
||||
}
|
||||
} elseif ($codebase->alter_code
|
||||
&& isset($project_analyzer->getIssuesToFix()['MissingPureAnnotation'])
|
||||
&& $statements_analyzer->getSource()
|
||||
instanceof \Psalm\Internal\Analyzer\FunctionLikeAnalyzer
|
||||
) {
|
||||
$statements_analyzer->getSource()->inferred_impure = true;
|
||||
}
|
||||
|
||||
if ($var_id && $context->hasVariable($var_id, $statements_analyzer)) {
|
||||
|
Loading…
Reference in New Issue
Block a user