mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Fix #4306 - negating positive-numeric is useless, avoid crash
This commit is contained in:
parent
7195275993
commit
5be7276a17
@ -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