mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 12:24:49 +01:00
Fix #4306 - negating positive-numeric is useless, avoid crash
This commit is contained in:
parent
4f5a3ca82b
commit
01781af718
@ -67,6 +67,10 @@ class NegatedAssertionReconciler extends Reconciler
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($is_equality && $assertion === 'positive-numeric') {
|
||||||
|
return $existing_var_type;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$is_equality) {
|
if (!$is_equality) {
|
||||||
if ($assertion === 'isset') {
|
if ($assertion === 'isset') {
|
||||||
if ($existing_var_type->possibly_undefined) {
|
if ($existing_var_type->possibly_undefined) {
|
||||||
|
@ -775,6 +775,12 @@ class ValueTest extends \Psalm\Tests\TestCase
|
|||||||
if ($foo) {}
|
if ($foo) {}
|
||||||
}',
|
}',
|
||||||
],
|
],
|
||||||
|
'allowCheckOnPositiveNumericInverse' => [
|
||||||
|
'<?php
|
||||||
|
function foo(int $a): void {
|
||||||
|
if (false === ($a > 1)){}
|
||||||
|
}'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user