mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Fix PHPMAXINT offset (#4707)
This commit is contained in:
parent
01ceaf7006
commit
4bbb72329e
@ -171,7 +171,10 @@ class ArrayAnalyzer
|
|||||||
|
|
||||||
if ($item->key instanceof PhpParser\Node\Scalar\String_
|
if ($item->key instanceof PhpParser\Node\Scalar\String_
|
||||||
&& preg_match('/^(0|[1-9][0-9]*)$/', $item->key->value)
|
&& preg_match('/^(0|[1-9][0-9]*)$/', $item->key->value)
|
||||||
&& (int) $item->key->value <= PHP_INT_MAX
|
&& (
|
||||||
|
(int) $item->key->value < PHP_INT_MAX ||
|
||||||
|
$item->key->value === (string) PHP_INT_MAX
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
$key_type = Type::getInt(false, (int) $item->key->value);
|
$key_type = Type::getInt(false, (int) $item->key->value);
|
||||||
}
|
}
|
||||||
|
@ -1545,6 +1545,14 @@ class ArrayAssignmentTest extends TestCase
|
|||||||
$_a = [$b => "a"];
|
$_a = [$b => "a"];
|
||||||
',
|
',
|
||||||
],
|
],
|
||||||
|
'ArrayOffsetNumericSupPHPINTMAX' => [
|
||||||
|
'<?php
|
||||||
|
$_a = [
|
||||||
|
"9223372036854775808" => 1,
|
||||||
|
"9223372036854775809" => 2
|
||||||
|
];
|
||||||
|
',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user