mirror of
https://github.com/danog/psalm.git
synced 2024-11-29 20:28:59 +01:00
don't throw InvalidArrayOffset when dealing with templates (#5019)
This commit is contained in:
parent
d56f941303
commit
8954c12eaa
@ -154,6 +154,7 @@ class ArrayAnalyzer
|
|||||||
&& !$atomic_key_type instanceof Type\Atomic\TInt
|
&& !$atomic_key_type instanceof Type\Atomic\TInt
|
||||||
&& !$atomic_key_type instanceof Type\Atomic\TArrayKey
|
&& !$atomic_key_type instanceof Type\Atomic\TArrayKey
|
||||||
&& !$atomic_key_type instanceof Type\Atomic\TMixed
|
&& !$atomic_key_type instanceof Type\Atomic\TMixed
|
||||||
|
&& !$atomic_key_type instanceof Type\Atomic\TTemplateParam
|
||||||
&& !(
|
&& !(
|
||||||
$atomic_key_type instanceof Type\Atomic\TObjectWithProperties
|
$atomic_key_type instanceof Type\Atomic\TObjectWithProperties
|
||||||
&& isset($atomic_key_type->methods['__toString'])
|
&& isset($atomic_key_type->methods['__toString'])
|
||||||
|
@ -1506,6 +1506,16 @@ class ArrayAssignmentTest extends TestCase
|
|||||||
return $list;
|
return $list;
|
||||||
}'
|
}'
|
||||||
],
|
],
|
||||||
|
'ArrayCreateTemplateArrayKey' => [
|
||||||
|
'/**
|
||||||
|
* @template K of array-key
|
||||||
|
* @param K $key
|
||||||
|
*/
|
||||||
|
function with($key): void
|
||||||
|
{
|
||||||
|
[$key => 123];
|
||||||
|
}',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user