1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +01:00
This commit is contained in:
Daniil Gentili 2022-12-03 15:04:28 +01:00
parent 6fb4f1f345
commit 9d3b108102
2 changed files with 7 additions and 2 deletions

View File

@ -22,6 +22,7 @@ use Psalm\IssueBuffer;
use Psalm\Type; use Psalm\Type;
use Psalm\Type\Atomic\TArray; use Psalm\Type\Atomic\TArray;
use Psalm\Type\Atomic\TClassStringMap; use Psalm\Type\Atomic\TClassStringMap;
use Psalm\Type\Atomic\TDependentListKey;
use Psalm\Type\Atomic\TIntRange; use Psalm\Type\Atomic\TIntRange;
use Psalm\Type\Atomic\TKeyedArray; use Psalm\Type\Atomic\TKeyedArray;
use Psalm\Type\Atomic\TList; use Psalm\Type\Atomic\TList;
@ -482,9 +483,11 @@ class ArrayAssignmentAnalyzer
if ($key_type->isSingle()) { if ($key_type->isSingle()) {
$key_type_type = $key_type->getSingleAtomic(); $key_type_type = $key_type->getSingleAtomic();
if ($key_type_type instanceof TIntRange if (($key_type_type instanceof TIntRange
&& $key_type_type->dependent_list_key === $parent_var_id && $key_type_type->dependent_list_key === $parent_var_id
) { ) || ($key_type_type instanceof TDependentListKey
&& $key_type_type->var_id === $parent_var_id
)) {
$offset_already_existed = true; $offset_already_existed = true;
} }

View File

@ -3,6 +3,8 @@
namespace Psalm\Type\Atomic; namespace Psalm\Type\Atomic;
/** /**
* @deprecated Will be removed in Psalm v6, use TIntRange instead
*
* Represents a list key created from foreach ($list as $key => $value) * Represents a list key created from foreach ($list as $key => $value)
* @psalm-immutable * @psalm-immutable
*/ */