mirror of
https://github.com/danog/psalm.git
synced 2024-12-02 09:37:59 +01:00
Off-by-one fun
This commit is contained in:
parent
65f849a5a2
commit
95e0614b2e
@ -340,7 +340,7 @@ class TKeyedArray extends Atomic
|
||||
$value_type = $value_type->setPossiblyUndefined(false);
|
||||
|
||||
if ($this->fallback_params === null) {
|
||||
$key_type = new Union([new TIntRange(0, count($this->properties), false, $list_var_id)]);
|
||||
$key_type = new Union([new TIntRange(0, count($this->properties)-1, false, $list_var_id)]);
|
||||
} else {
|
||||
$key_type = new Union([new TIntRange(0, null, false, $list_var_id)]);
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ class FunctionTemplateTest extends TestCase
|
||||
|
||||
$a = splat_proof(...$foo);',
|
||||
'assertions' => [
|
||||
'$a' => 'array<int, int>',
|
||||
'$a' => 'array<int<0, 2>, int>',
|
||||
],
|
||||
],
|
||||
'passArrayByRef' => [
|
||||
|
@ -624,7 +624,7 @@ class TypeCombinationTest extends TestCase
|
||||
],
|
||||
],
|
||||
'combineNonEmptyListWithTKeyedArrayList' => [
|
||||
'list{null|string, ...<int, string>}',
|
||||
'list{null|string, ...<int<0, max>, string>}',
|
||||
[
|
||||
'non-empty-list<string>',
|
||||
'array{null}'
|
||||
|
Loading…
Reference in New Issue
Block a user