We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9ec6c15 commit a56bfceCopy full SHA for a56bfce
1 file changed
src/Collection.php
@@ -121,12 +121,11 @@ public function mode($key = null)
121
122
/**
123
* @template TValue of array-key
124
- * @phpstan-ignore-next-line
125
* @var static<TValue, int> $counts
126
*/
127
$counts = new self();
128
$collection->each(function ($value) use ($counts) {
129
- $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1;
+ $counts->offsetSet($value, isset($counts[$value]) ? $counts[$value] + 1 : 1);
130
});
131
$sorted = $counts->sort();
132
$highestValue = $sorted->last();
0 commit comments