Skip to content

Commit c354d9b

Browse files
authored
Merge pull request #56 from webrium/fix/callable-typehint-ide-false-positive
fix(builder,model): narrow string|callable type hints to string|Closure
2 parents fd96998 + 66a1f71 commit c354d9b

2 files changed

Lines changed: 20 additions & 20 deletions

File tree

src/Eloquent/Model.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
* @method static Builder distinct()
5656
*
5757
* WHERE
58-
* @method static Builder where(string|callable $column, mixed $operatorOrValue = null, mixed $value = null)
59-
* @method static Builder orWhere(string|callable $column, mixed $operatorOrValue = null, mixed $value = null)
58+
* @method static Builder where(string|\Closure $column, mixed $operatorOrValue = null, mixed $value = null)
59+
* @method static Builder orWhere(string|\Closure $column, mixed $operatorOrValue = null, mixed $value = null)
6060
* @method static Builder whereNot(string $column, mixed $operatorOrValue, mixed $value = null)
6161
* @method static Builder whereRaw(string $expression, array $bindings = [])
6262
* @method static Builder orWhereRaw(string $expression, array $bindings = [])
@@ -713,13 +713,13 @@ public static function create(array $attributes): static
713713
/**
714714
* Begin a fluent WHERE query on the model's table.
715715
*
716-
* @param string|callable $column
716+
* @param string|\Closure $column
717717
* @param mixed $operatorOrValue
718718
* @param mixed $value
719719
* @return ModelBuilder<static>
720720
*/
721721
public static function where(
722-
string|callable $column,
722+
string|\Closure $column,
723723
mixed $operatorOrValue = null,
724724
mixed $value = null,
725725
): ModelBuilder {

src/Query/Builder.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,14 @@ public function fromSub(Builder $query, string $alias): static
188188
/**
189189
* Add a basic WHERE condition.
190190
*
191-
* @param string|RawExpression|callable $column
191+
* @param string|RawExpression|\Closure $column
192192
* @param mixed $operatorOrValue
193193
* @param mixed $value
194194
* @param string $boolean
195195
* @return static
196196
*/
197197
public function where(
198-
string|RawExpression|callable $column,
198+
string|RawExpression|\Closure $column,
199199
mixed $operatorOrValue = null,
200200
mixed $value = null,
201201
string $boolean = 'AND',
@@ -234,13 +234,13 @@ public function where(
234234
/**
235235
* Add an OR WHERE condition.
236236
*
237-
* @param string|RawExpression|callable $column
237+
* @param string|RawExpression|\Closure $column
238238
* @param mixed $operatorOrValue
239239
* @param mixed $value
240240
* @return static
241241
*/
242242
public function orWhere(
243-
string|RawExpression|callable $column,
243+
string|RawExpression|\Closure $column,
244244
mixed $operatorOrValue = null,
245245
mixed $value = null,
246246
): static {
@@ -802,14 +802,14 @@ public function notNull(string $column): static
802802
* })
803803
*
804804
* @param string $table
805-
* @param string|callable $firstOrCallback
805+
* @param string|\Closure $firstOrCallback
806806
* @param string|null $operator
807807
* @param string|null $second
808808
* @return static
809809
*/
810810
public function join(
811811
string $table,
812-
string|callable $firstOrCallback,
812+
string|\Closure $firstOrCallback,
813813
?string $operator = null,
814814
?string $second = null,
815815
): static {
@@ -820,14 +820,14 @@ public function join(
820820
* Add a LEFT JOIN.
821821
*
822822
* @param string $table
823-
* @param string|callable $firstOrCallback
823+
* @param string|\Closure $firstOrCallback
824824
* @param string|null $operator
825825
* @param string|null $second
826826
* @return static
827827
*/
828828
public function leftJoin(
829829
string $table,
830-
string|callable $firstOrCallback,
830+
string|\Closure $firstOrCallback,
831831
?string $operator = null,
832832
?string $second = null,
833833
): static {
@@ -838,14 +838,14 @@ public function leftJoin(
838838
* Add a RIGHT JOIN.
839839
*
840840
* @param string $table
841-
* @param string|callable $firstOrCallback
841+
* @param string|\Closure $firstOrCallback
842842
* @param string|null $operator
843843
* @param string|null $second
844844
* @return static
845845
*/
846846
public function rightJoin(
847847
string $table,
848-
string|callable $firstOrCallback,
848+
string|\Closure $firstOrCallback,
849849
?string $operator = null,
850850
?string $second = null,
851851
): static {
@@ -871,7 +871,7 @@ public function crossJoin(string $table): static
871871
*
872872
* @param Builder $query
873873
* @param string $alias
874-
* @param string|callable $firstOrCallback
874+
* @param string|\Closure $firstOrCallback
875875
* @param string|null $operator
876876
* @param string|null $second
877877
* @param string $type
@@ -880,7 +880,7 @@ public function crossJoin(string $table): static
880880
public function joinSub(
881881
Builder $query,
882882
string $alias,
883-
string|callable $firstOrCallback,
883+
string|\Closure $firstOrCallback,
884884
?string $operator = null,
885885
?string $second = null,
886886
string $type = 'INNER',
@@ -896,15 +896,15 @@ public function joinSub(
896896
*
897897
* @param Builder $query
898898
* @param string $alias
899-
* @param string|callable $firstOrCallback
899+
* @param string|\Closure $firstOrCallback
900900
* @param string|null $operator
901901
* @param string|null $second
902902
* @return static
903903
*/
904904
public function leftJoinSub(
905905
Builder $query,
906906
string $alias,
907-
string|callable $firstOrCallback,
907+
string|\Closure $firstOrCallback,
908908
?string $operator = null,
909909
?string $second = null,
910910
): static {
@@ -929,15 +929,15 @@ public function joinRaw(string $expression): static
929929
*
930930
* @param string $type
931931
* @param string $table
932-
* @param string|callable $firstOrCallback
932+
* @param string|\Closure $firstOrCallback
933933
* @param string|null $operator
934934
* @param string|null $second
935935
* @return static
936936
*/
937937
protected function addJoin(
938938
string $type,
939939
string $table,
940-
string|callable $firstOrCallback,
940+
string|\Closure $firstOrCallback,
941941
?string $operator,
942942
?string $second,
943943
): static {

0 commit comments

Comments
 (0)