mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
fix error with 0 being considered positive
This commit is contained in:
parent
7c8441baec
commit
204d09b271
@ -1193,7 +1193,7 @@ class TypeCombiner
|
||||
|
||||
if (!isset($combination->value_types['int'])) {
|
||||
$combination->value_types['int'] = $all_nonnegative
|
||||
? new TIntRange(1, null)
|
||||
? new TIntRange(0, null) // improvement: use min and max literals to bound
|
||||
: new TNonspecificLiteralInt();
|
||||
}
|
||||
}
|
||||
|
@ -704,6 +704,18 @@ class IntRangeTest extends TestCase
|
||||
'$_arr===' => 'non-empty-array<int<0, max>, int<0, max>>',
|
||||
],
|
||||
],
|
||||
'noErrorPushingBigShapeIntoConstant' => [
|
||||
'code' => '<?php
|
||||
class DocComment
|
||||
{
|
||||
private const PSALM_ANNOTATIONS = [
|
||||
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
|
||||
];
|
||||
}',
|
||||
'assertions' => [
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user