Skip to content

Commit 672ea35

Browse files
committed
refactor
1 parent 20325e2 commit 672ea35

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/Rules/Arrays/DuplicateKeysInLiteralArraysRule.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,20 @@ public function processNode(Node $node, Scope $scope): array
9696
$newValuesType = TypeCombinator::remove($newValuesType, $seenKey);
9797

9898
if (
99-
!($newValuesType instanceof NeverType)
100-
&& !$newValuesType->isSuperTypeOf($seenKey)->yes()
99+
$newValuesType instanceof NeverType
100+
|| $newValuesType->isSuperTypeOf($seenKey)->yes()
101101
) {
102-
continue;
103-
}
104-
105-
$duplicate = true;
106-
}
107-
108-
if (!$newValuesType instanceof UnionType) {
109-
foreach ($seenKeys as $k => $seenKey) {
110-
$seenKeys[$k] = TypeCombinator::remove($seenKey, $newValuesType);
102+
$duplicate = true;
103+
break;
111104
}
112105
}
113106

114107
if (!$newValuesType instanceof NeverType) {
108+
if (!$newValuesType instanceof UnionType) {
109+
foreach ($seenKeys as $k => $seenKey) {
110+
$seenKeys[$k] = TypeCombinator::remove($seenKey, $newValuesType);
111+
}
112+
}
115113
$seenKeys[] = $newValuesType;
116114
}
117115

0 commit comments

Comments
 (0)