Skip to content

Commit ca0cc3c

Browse files
committed
phpstan fixes
1 parent 5cb4216 commit ca0cc3c

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

‎src/Map.php‎

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ public function getIterator(): \Generator
109109
* @template GK
110110
* @template GV
111111
*
112-
* @param Arr<GV>|iterable<int, GV> $items
113-
* @param callable(GV, int): GK $callback
112+
* @param iterable<int, GV> $items
113+
* @param callable(GV, int): GK $callback
114114
*
115115
* @return self<GK, Arr<GV>>
116116
*/
@@ -119,22 +119,12 @@ public static function groupBy(iterable $items, callable $callback): self
119119
/** @var self<GK, Arr<GV>> $map */
120120
$map = new self();
121121

122-
if ($items instanceof Arr) {
123-
$length = $items->length;
122+
$i = 0;
124123

125-
for ($i = 0; $i < $length; ++$i) {
126-
$value = $items[$i];
127-
$key = $callback($value, $i);
128-
self::appendToGroup($map, $key, $value);
129-
}
130-
} else {
131-
$i = 0;
132-
133-
foreach ($items as $value) {
134-
$key = $callback($value, $i);
135-
self::appendToGroup($map, $key, $value);
136-
++$i;
137-
}
124+
foreach ($items as $value) {
125+
$key = $callback($value, $i);
126+
self::appendToGroup($map, $key, $value);
127+
++$i;
138128
}
139129

140130
return $map;

0 commit comments

Comments
 (0)