1 | <?php |
||
13 | class QueryBuilder extends Builder |
||
14 | { |
||
15 | /** |
||
16 | * Allow ignore invalid fields without throwing an exception |
||
17 | * if is false |
||
18 | * |
||
19 | * @var bool |
||
20 | */ |
||
21 | protected $exceptionInvalidFilter = true; |
||
22 | |||
23 | use FiltersQuery, |
||
24 | SortsQuery, |
||
25 | AddsIncludesToQuery, |
||
26 | AddsFieldsToQuery, |
||
27 | AppendsAttributesToResults; |
||
28 | |||
29 | /** @var \Spatie\QueryBuilder\QueryBuilderRequest */ |
||
30 | protected $request; |
||
31 | |||
32 | public function __construct(Builder $builder, ? Request $request = null) |
||
40 | |||
41 | /** |
||
42 | * Create a new QueryBuilder for a request and model. |
||
43 | * |
||
44 | * @param string|\Illuminate\Database\Eloquent\Builder $baseQuery Model class or base query builder |
||
45 | * @param \Illuminate\Http\Request $request |
||
46 | * |
||
47 | * @return \Spatie\QueryBuilder\QueryBuilder |
||
48 | */ |
||
49 | public static function for($baseQuery, ?Request $request = null): self |
||
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | public function get($columns = ['*']) |
||
72 | |||
73 | /** |
||
74 | * Add the model, scopes, eager loaded relationships, local macro's and onDelete callback |
||
75 | * from the $builder to this query builder. |
||
76 | * |
||
77 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
78 | */ |
||
79 | protected function initializeFromBuilder(Builder $builder) |
||
95 | |||
96 | /** |
||
97 | * Allow ignore invalid fields without throwing an exception |
||
98 | * |
||
99 | * @param bool $value |
||
100 | */ |
||
101 | public function setExceptionInvalidFilter(bool $value = true) |
||
107 | } |
||
108 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.