Skip to content

Commit 649fd74

Browse files
committed
fix: pluck generics
1 parent 60d780f commit 649fd74

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

src/Illuminate/Collections/Enumerable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ public function pipeThrough($pipes);
11461146
*
11471147
* @param string|array<array-key, string> $value
11481148
* @param string|null $key
1149-
* @return static<int, mixed>
1149+
* @return static<array-key, mixed>
11501150
*/
11511151
public function pluck($value, $key = null);
11521152

src/Illuminate/Collections/LazyCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ public function last(?callable $callback = null, $default = null)
739739
*
740740
* @param string|array<array-key, string> $value
741741
* @param string|null $key
742-
* @return static<int, mixed>
742+
* @return static<array-key, mixed>
743743
*/
744744
public function pluck($value, $key = null)
745745
{

src/Illuminate/Database/Eloquent/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ protected function enforceOrderBy()
932932
*
933933
* @param string|\Illuminate\Contracts\Database\Query\Expression $column
934934
* @param string|null $key
935-
* @return \Illuminate\Support\Collection<int|string, mixed>
935+
* @return \Illuminate\Support\Collection<array-key, mixed>
936936
*/
937937
public function pluck($column, $key = null)
938938
{

src/Illuminate/Database/Query/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3239,7 +3239,7 @@ protected function enforceOrderBy()
32393239
*
32403240
* @param \Illuminate\Contracts\Database\Query\Expression|string $column
32413241
* @param string|null $key
3242-
* @return \Illuminate\Support\Collection
3242+
* @return \Illuminate\Support\Collection<array-key, mixed>
32433243
*/
32443244
public function pluck($column, $key = null)
32453245
{

types/Database/Eloquent/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function test(
5656
assertType('User', $query->firstOrFail());
5757
assertType('User', $query->sole());
5858
assertType('Illuminate\Support\LazyCollection<int, User>', $query->cursor());
59-
assertType('Illuminate\Support\Collection<int|string, mixed>', $query->pluck('foo'));
59+
assertType('Illuminate\Support\Collection<(int|string), mixed>', $query->pluck('foo'));
6060
assertType('Illuminate\Database\Eloquent\Relations\Relation<Illuminate\Database\Eloquent\Model, User, *>', $query->getRelation('foo'));
6161
assertType('Illuminate\Database\Eloquent\Builder<Illuminate\Types\Builder\Post>', $query->setModel(new Post()));
6262

types/Support/LazyCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,8 @@
744744

745745
assertType('User', $collection->pipeInto(User::class));
746746

747-
assertType('Illuminate\Support\LazyCollection<int, mixed>', $collection->make(['string' => 'string'])->pluck('string'));
748-
assertType('Illuminate\Support\LazyCollection<int, mixed>', $collection->make(['string' => 'string'])->pluck('string', 'string'));
747+
assertType('Illuminate\Support\LazyCollection<(int|string), mixed>', $collection->make(['string' => 'string'])->pluck('string'));
748+
assertType('Illuminate\Support\LazyCollection<(int|string), mixed>', $collection->make(['string' => 'string'])->pluck('string', 'string'));
749749

750750
assertType('Illuminate\Support\LazyCollection<int, User>', $collection->reject());
751751
assertType('Illuminate\Support\LazyCollection<int, User>', $collection->reject(function ($user) {

0 commit comments

Comments
 (0)