Skip to content

Commit 6cef8cb

Browse files
authored
Improve builder select method type hints (#42680)
1 parent 7280609 commit 6cef8cb

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/Illuminate/Database/Concerns/BuildsQueries.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public function sole($columns = ['*'])
326326
* Paginate the given query using a cursor paginator.
327327
*
328328
* @param int $perPage
329-
* @param array $columns
329+
* @param array|string $columns
330330
* @param string $cursorName
331331
* @param \Illuminate\Pagination\Cursor|string|null $cursor
332332
* @return \Illuminate\Contracts\Pagination\CursorPaginator

src/Illuminate/Database/Eloquent/Builder.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ public function fromQuery($query, $bindings = [])
418418
* Find a model by its primary key.
419419
*
420420
* @param mixed $id
421-
* @param array $columns
421+
* @param array|string $columns
422422
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|null
423423
*/
424424
public function find($id, $columns = ['*'])
@@ -434,7 +434,7 @@ public function find($id, $columns = ['*'])
434434
* Find multiple models by their primary keys.
435435
*
436436
* @param \Illuminate\Contracts\Support\Arrayable|array $ids
437-
* @param array $columns
437+
* @param array|string $columns
438438
* @return \Illuminate\Database\Eloquent\Collection
439439
*/
440440
public function findMany($ids, $columns = ['*'])
@@ -452,7 +452,7 @@ public function findMany($ids, $columns = ['*'])
452452
* Find a model by its primary key or throw an exception.
453453
*
454454
* @param mixed $id
455-
* @param array $columns
455+
* @param array|string $columns
456456
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static|static[]
457457
*
458458
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model>
@@ -486,7 +486,7 @@ public function findOrFail($id, $columns = ['*'])
486486
* Find a model by its primary key or return fresh model instance.
487487
*
488488
* @param mixed $id
489-
* @param array $columns
489+
* @param array|string $columns
490490
* @return \Illuminate\Database\Eloquent\Model|static
491491
*/
492492
public function findOrNew($id, $columns = ['*'])
@@ -502,7 +502,7 @@ public function findOrNew($id, $columns = ['*'])
502502
* Find a model by its primary key or call a callback.
503503
*
504504
* @param mixed $id
505-
* @param \Closure|array $columns
505+
* @param \Closure|array|string $columns
506506
* @param \Closure|null $callback
507507
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|mixed
508508
*/
@@ -572,7 +572,7 @@ public function updateOrCreate(array $attributes, array $values = [])
572572
/**
573573
* Execute the query and get the first result or throw an exception.
574574
*
575-
* @param array $columns
575+
* @param array|string $columns
576576
* @return \Illuminate\Database\Eloquent\Model|static
577577
*
578578
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model>
@@ -589,7 +589,7 @@ public function firstOrFail($columns = ['*'])
589589
/**
590590
* Execute the query and get the first result or call a callback.
591591
*
592-
* @param \Closure|array $columns
592+
* @param \Closure|array|string $columns
593593
* @param \Closure|null $callback
594594
* @return \Illuminate\Database\Eloquent\Model|static|mixed
595595
*/
@@ -865,7 +865,7 @@ public function pluck($column, $key = null)
865865
* Paginate the given query.
866866
*
867867
* @param int|null|\Closure $perPage
868-
* @param array $columns
868+
* @param array|string $columns
869869
* @param string $pageName
870870
* @param int|null $page
871871
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
@@ -897,7 +897,7 @@ public function paginate($perPage = null, $columns = ['*'], $pageName = 'page',
897897
* Paginate the given query into a simple paginator.
898898
*
899899
* @param int|null $perPage
900-
* @param array $columns
900+
* @param array|string $columns
901901
* @param string $pageName
902902
* @param int|null $page
903903
* @return \Illuminate\Contracts\Pagination\Paginator
@@ -923,7 +923,7 @@ public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'p
923923
* Paginate the given query into a cursor paginator.
924924
*
925925
* @param int|null $perPage
926-
* @param array $columns
926+
* @param array|string $columns
927927
* @param string $cursorName
928928
* @param \Illuminate\Pagination\Cursor|string|null $cursor
929929
* @return \Illuminate\Contracts\Pagination\CursorPaginator

src/Illuminate/Database/Eloquent/Model.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ public static function onWriteConnection()
561561
/**
562562
* Get all of the models from the database.
563563
*
564-
* @param array|mixed $columns
564+
* @param array|string $columns
565565
* @return \Illuminate\Database\Eloquent\Collection<int, static>
566566
*/
567567
public static function all($columns = ['*'])

src/Illuminate/Database/Query/Builder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,7 @@ public function toSql()
25462546
* Execute a query for a single record by ID.
25472547
*
25482548
* @param int|string $id
2549-
* @param array $columns
2549+
* @param array|string $columns
25502550
* @return mixed|static
25512551
*/
25522552
public function find($id, $columns = ['*'])
@@ -2558,7 +2558,7 @@ public function find($id, $columns = ['*'])
25582558
* Execute a query for a single record by ID or call a callback.
25592559
*
25602560
* @param mixed $id
2561-
* @param \Closure|array $columns
2561+
* @param \Closure|array|string $columns
25622562
* @param \Closure|null $callback
25632563
* @return mixed|static
25642564
*/
@@ -2635,7 +2635,7 @@ protected function runSelect()
26352635
* Paginate the given query into a simple paginator.
26362636
*
26372637
* @param int|\Closure $perPage
2638-
* @param array $columns
2638+
* @param array|string $columns
26392639
* @param string $pageName
26402640
* @param int|null $page
26412641
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
@@ -2662,7 +2662,7 @@ public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $p
26622662
* This is more efficient on larger data-sets, etc.
26632663
*
26642664
* @param int $perPage
2665-
* @param array $columns
2665+
* @param array|string $columns
26662666
* @param string $pageName
26672667
* @param int|null $page
26682668
* @return \Illuminate\Contracts\Pagination\Paginator
@@ -2685,7 +2685,7 @@ public function simplePaginate($perPage = 15, $columns = ['*'], $pageName = 'pag
26852685
* This is more efficient on larger data-sets, etc.
26862686
*
26872687
* @param int|null $perPage
2688-
* @param array $columns
2688+
* @param array|string $columns
26892689
* @param string $cursorName
26902690
* @param \Illuminate\Pagination\Cursor|string|null $cursor
26912691
* @return \Illuminate\Contracts\Pagination\CursorPaginator

0 commit comments

Comments
 (0)