Skip to content

Commit 9adc7a8

Browse files
authored
[9.x] Fixes Collection::keyBy related types (#40372)
* Fixes Collection::keyBy types * Fixes Collection::keyBy types
1 parent b88546c commit 9adc7a8

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/Illuminate/Collections/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ public function groupBy($groupBy, $preserveKeys = false)
492492
* Key an associative array by a field or using a callback.
493493
*
494494
* @param (callable(TValue, TKey): array-key)|array|string $keyBy
495-
* @return static<array-key, array<array-key, TValue>>
495+
* @return static<array-key, TValue>
496496
*/
497497
public function keyBy($keyBy)
498498
{

src/Illuminate/Collections/Enumerable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ public function groupBy($groupBy, $preserveKeys = false);
513513
* Key an associative array by a field or using a callback.
514514
*
515515
* @param (callable(TValue, TKey): array-key)|array|string $keyBy
516-
* @return static<array-key, array<array-key, TValue>>
516+
* @return static<array-key, TValue>
517517
*/
518518
public function keyBy($keyBy);
519519

src/Illuminate/Collections/LazyCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ public function groupBy($groupBy, $preserveKeys = false)
518518
* Key an associative array by a field or using a callback.
519519
*
520520
* @param (callable(TValue, TKey): array-key)|array|string $keyBy
521-
* @return static<array-key, array<array-key, TValue>>
521+
* @return static<array-key, TValue>
522522
*/
523523
public function keyBy($keyBy)
524524
{

types/Support/Collection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@
388388
return 'foo';
389389
}));
390390

391-
assertType('Illuminate\Support\Collection<(int|string), array<User>>', $collection->keyBy('name'));
392-
assertType('Illuminate\Support\Collection<(int|string), array<User>>', $collection->keyBy(function ($user, $int) {
391+
assertType('Illuminate\Support\Collection<(int|string), User>', $collection->keyBy('name'));
392+
assertType('Illuminate\Support\Collection<(int|string), User>', $collection->keyBy(function ($user, $int) {
393393
// assertType('User', $user);
394394
// assertType('int', $int);
395395

types/Support/LazyCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@
388388
return 'foo';
389389
}));
390390

391-
assertType('Illuminate\Support\LazyCollection<(int|string), array<User>>', $collection->keyBy('name'));
392-
assertType('Illuminate\Support\LazyCollection<(int|string), array<User>>', $collection->keyBy(function ($user, $int) {
391+
assertType('Illuminate\Support\LazyCollection<(int|string), User>', $collection->keyBy('name'));
392+
assertType('Illuminate\Support\LazyCollection<(int|string), User>', $collection->keyBy(function ($user, $int) {
393393
// assertType('User', $user);
394394
// assertType('int', $int);
395395

0 commit comments

Comments
 (0)