mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix #561 - add all the do-defined vars before checking loop
This commit is contained in:
parent
67312be2a9
commit
4873228e52
@ -59,6 +59,12 @@ class DoChecker
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($do_context->vars_in_scope as $var_id => $type) {
|
||||
if (!isset($context->vars_in_scope[$var_id])) {
|
||||
$context->vars_in_scope[$var_id] = clone $type;
|
||||
}
|
||||
}
|
||||
|
||||
$mixed_var_ids = [];
|
||||
|
||||
foreach ($do_context->vars_in_scope as $var_id => $type) {
|
||||
|
@ -975,6 +975,14 @@ class LoopScopeTest extends TestCase
|
||||
}
|
||||
}',
|
||||
],
|
||||
'doWhileDefinedVar' => [
|
||||
'<?php
|
||||
$value = null;
|
||||
do {
|
||||
$count = rand(0, 1);
|
||||
$value = 6;
|
||||
} while ($count);',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user