mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Add for post conditions to assignment map analysis
This commit is contained in:
parent
298ee214e9
commit
34c133d5d0
@ -40,7 +40,7 @@ class LoopChecker
|
||||
$assignment_mapper = new \Psalm\Visitor\AssignmentMapVisitor($loop_scope->loop_context->self);
|
||||
$traverser->addVisitor($assignment_mapper);
|
||||
|
||||
$traverser->traverse($stmts);
|
||||
$traverser->traverse(array_merge($stmts, $post_conditions));
|
||||
|
||||
$assignment_map = $assignment_mapper->getAssignmentMap();
|
||||
|
||||
|
@ -188,6 +188,19 @@ class RedundantConditionTest extends TestCase
|
||||
$ch = curl_init();
|
||||
if (!$ch) {}',
|
||||
],
|
||||
'noRedundantConditionInForCheck' => [
|
||||
'<?php
|
||||
class Node
|
||||
{
|
||||
/** @var Node|null */
|
||||
public $next;
|
||||
|
||||
public function iterate(): void
|
||||
{
|
||||
for ($node = $this; $node !== null; $node = $node->next) {}
|
||||
}
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user