1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix #4011 - prevent mixed assignment in loop

This commit is contained in:
Brown 2020-08-18 08:51:09 -04:00
parent 17ed440f2e
commit 134955a5f4
2 changed files with 14 additions and 2 deletions

View File

@ -531,7 +531,7 @@ class SimpleAssertionReconciler extends \Psalm\Type\Reconciler
$failed_reconciliation = 2;
return Type::getMixed();
return Type::getEmpty();
}
/**

View File

@ -451,7 +451,19 @@ class WhileTest extends \Psalm\Tests\TestCase
return $elements;
}',
]
],
'reconcilePositiveInt' => [
'<?php
$counter = 0;
while (rand(0, 1)) {
if ($counter > 0) {
$counter = $counter - 1;
} else {
$counter = $counter + 1;
}
}'
],
];
}