mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Avoid false positive for param
This commit is contained in:
parent
4f26c8d749
commit
86bf159bd0
@ -28,8 +28,6 @@ class TernaryAnalyzer
|
||||
PhpParser\Node\Expr\Ternary $stmt,
|
||||
Context $context
|
||||
) {
|
||||
$context->referenced_var_ids = [];
|
||||
|
||||
$first_if_cond_expr = IfAnalyzer::getDefinitelyEvaluatedExpression($stmt->cond);
|
||||
|
||||
$context->inside_conditional = true;
|
||||
|
@ -908,8 +908,17 @@ class UnusedVariableTest extends TestCase
|
||||
* @psalm-suppress MissingParamType
|
||||
*/
|
||||
function foo($a) : void {
|
||||
$b = "b";
|
||||
$a->bar([$b]);
|
||||
$b = "b";
|
||||
$a->bar([$b]);
|
||||
}',
|
||||
],
|
||||
'paramUsedInsideLoop' => [
|
||||
'<?php
|
||||
function foo(int $counter) : void {
|
||||
foreach ([1, 2, 3] as $_) {
|
||||
echo ($counter = $counter + 1);
|
||||
echo rand(0, 1) ? 1 : 0;
|
||||
}
|
||||
}',
|
||||
],
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user