Failed Conditions
Push — refactor/improve-static-analys... ( 0a1035...ba8000 )
by Bas
08:06
created

BuildsWheres::whereJsonLength()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 15
rs 10
cc 1
nc 1
nop 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LaravelFreelancerNL\Aranguent\Query\Concerns;
6
7
use Carbon\CarbonPeriod;
8
use Closure;
9
use Illuminate\Contracts\Database\Query\ConditionExpression;
10
use Illuminate\Contracts\Database\Query\Expression as ExpressionContract;
11
use Illuminate\Contracts\Support\Arrayable;
12
use Illuminate\Database\Query\Builder as IlluminateQueryBuilder;
13
use Illuminate\Database\Query\Expression;
14
use Illuminate\Support\Arr;
15
use InvalidArgumentException;
16
use LaravelFreelancerNL\Aranguent\Query\Builder;
17
use LogicException;
18
19
trait BuildsWheres
20
{
21
    /**
22
     * Add a "where fulltext" clause to the query.
23
     *
24
     * @param  string|string[]  $columns
25
     * @param  string  $value
26
     * @param  string  $boolean
27
     * @return $this
28
     */
29
    public function whereFullText($columns, $value, array $options = [], $boolean = 'and')
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

29
    public function whereFullText($columns, $value, /** @scrutinizer ignore-unused */ array $options = [], $boolean = 'and')

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $value is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

29
    public function whereFullText($columns, /** @scrutinizer ignore-unused */ $value, array $options = [], $boolean = 'and')

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $columns is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

29
    public function whereFullText(/** @scrutinizer ignore-unused */ $columns, $value, array $options = [], $boolean = 'and')

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $boolean is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

29
    public function whereFullText($columns, $value, array $options = [], /** @scrutinizer ignore-unused */ $boolean = 'and')

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
    {
31
        // NOTE: can be done by listing all fulltext calls and using it on the collection name from $builder->from
32
        // distinctly merging results from multiple calls on the same collection.
33
        // For a call on a joined collection it might need to be moved to the JoinClause
34
        throw new LogicException('This database driver does not support the whereFullText method.');
35
    }
36
37
    /**
38
     * Prepare the value and operator for a where clause.
39
     *
40
     * @param  string  $value
41
     * @param  string  $operator
42
     * @param  bool  $useDefault
43
     * @return array
44
     *
45
     * @throws \InvalidArgumentException
46
     */
47
    public function prepareValueAndOperator($value, $operator, $useDefault = false)
48
    {
49
        if ($useDefault) {
50
            return [$operator, '=='];
51
        } elseif ($this->invalidOperatorAndValue($operator, $value)) {
0 ignored issues
show
Bug introduced by
It seems like invalidOperatorAndValue() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

51
        } elseif ($this->/** @scrutinizer ignore-call */ invalidOperatorAndValue($operator, $value)) {
Loading history...
52
            throw new InvalidArgumentException('Illegal operator and value combination.');
53
        }
54
55
        return [$value, $operator];
56
    }
57
58
    /**
59
     * Add a date based (year, month, day, time) statement to the query.
60
     *
61
     * @param  string  $type
62
     * @param  string  $column
63
     * @param  string  $operator
64
     * @param  mixed  $value
65
     * @param  string  $boolean
66
     * @return IlluminateQueryBuilder
67
     */
68
    protected function addDateBasedWhere($type, $column, $operator, $value, $boolean = 'and')
69
    {
70
        $value = $this->bindValue($value);
0 ignored issues
show
Bug introduced by
It seems like bindValue() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

70
        /** @scrutinizer ignore-call */ 
71
        $value = $this->bindValue($value);
Loading history...
71
72
        $this->wheres[] = compact('column', 'type', 'boolean', 'operator', 'value');
0 ignored issues
show
Bug Best Practice introduced by
The property wheres does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
73
74
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type LaravelFreelancerNL\Aran...y\Concerns\BuildsWheres which is incompatible with the documented return type Illuminate\Database\Query\Builder.
Loading history...
75
    }
76
77
78
    /**
79
     * Add another query builder as a nested where to the query builder.
80
     *
81
     * @param  \Illuminate\Database\Query\Builder  $query
82
     * @param  string  $boolean
83
     * @return $this
84
     */
85
    public function addNestedWhereQuery($query, $boolean = 'and')
86
    {
87
        if (count($query->wheres)) {
88
            $type = 'Nested';
89
90
            $this->wheres[] = compact('type', 'query', 'boolean');
0 ignored issues
show
Bug Best Practice introduced by
The property wheres does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
91
            $this->importBindings($query);
0 ignored issues
show
Bug introduced by
It seems like importBindings() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

91
            $this->/** @scrutinizer ignore-call */ 
92
                   importBindings($query);
Loading history...
92
        }
93
94
        return $this;
95
    }
96
97
    /**
98
     * Add an exists clause to the query.
99
     *
100
     * @param  \Illuminate\Database\Query\Builder  $query
101
     * @param  string  $boolean
102
     * @param  bool  $not
103
     * @return $this
104
     */
105
    public function addWhereExistsQuery(IlluminateQueryBuilder $query, $boolean = 'and', $not = false)
106
    {
107
        $type = $not ? 'NotExists' : 'Exists';
108
109
        $subquery = '(' . $query->toSql() . ')';
110
111
        $this->wheres[] = compact('type', 'subquery', 'boolean');
0 ignored issues
show
Bug Best Practice introduced by
The property wheres does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
112
113
        $this->importBindings($query);
114
115
        return $this;
116
    }
117
118
    /**
119
     * Add a basic where clause to the query.
120
     *
121
     * @param  \Closure|Expression|string|array  $column
122
     * @param  mixed  $operator
123
     * @param  mixed  $value
124
     * @param  string  $boolean
125
     * @return IlluminateQueryBuilder
126
     */
127
    public function where($column, $operator = null, $value = null, $boolean = 'and')
128
    {
129
        if ($column instanceof ConditionExpression) {
130
            $type = 'Expression';
131
132
            $this->wheres[] = compact('type', 'column', 'boolean');
0 ignored issues
show
Bug Best Practice introduced by
The property wheres does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
133
134
            return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type LaravelFreelancerNL\Aran...y\Concerns\BuildsWheres which is incompatible with the documented return type Illuminate\Database\Query\Builder.
Loading history...
135
        }
136
137
        // If the column is an array, we will assume it is an array of key-value pairs
138
        // and can add them each as a where clause. We will maintain the boolean we
139
        // received when the method was called and pass it into the nested where.
140
        if (is_array($column)) {
141
            return $this->addArrayOfWheres($column, $boolean);
0 ignored issues
show
Bug introduced by
It seems like addArrayOfWheres() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

141
            return $this->/** @scrutinizer ignore-call */ addArrayOfWheres($column, $boolean);
Loading history...
142
        }
143
144
        // Here we will make some assumptions about the operator. If only 2 values are
145
        // passed to the method, we will assume that the operator is an equals sign
146
        // and keep going. Otherwise, we'll require the operator to be passed in.
147
        [$value, $operator] = $this->prepareValueAndOperator(
148
            $value,
149
            $operator,
150
            func_num_args() === 2
151
        );
152
153
        // If the column is actually a Closure instance, we will assume the developer
154
        // wants to begin a nested where statement which is wrapped in parentheses.
155
        // We will add that Closure to the query and return back out immediately.
156
        if ($column instanceof Closure && is_null($operator)) {
157
            return $this->whereNested($column, $boolean);
0 ignored issues
show
Bug introduced by
The method whereNested() does not exist on LaravelFreelancerNL\Aran...y\Concerns\BuildsWheres. Did you maybe mean where()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

157
            return $this->/** @scrutinizer ignore-call */ whereNested($column, $boolean);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
158
        }
159
160
        // If the column is a Closure instance and there is an operator value, we will
161
        // assume the developer wants to run a subquery and then compare the result
162
        // of that subquery with the given value that was provided to the method.
163
        if ($this->isQueryable($column) && !is_null($operator)) {
0 ignored issues
show
Bug introduced by
It seems like isQueryable() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

163
        if ($this->/** @scrutinizer ignore-call */ isQueryable($column) && !is_null($operator)) {
Loading history...
164
            [$sub, $bindings] = $this->createSub($column);
0 ignored issues
show
Bug introduced by
It seems like createSub() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

164
            /** @scrutinizer ignore-call */ 
165
            [$sub, $bindings] = $this->createSub($column);
Loading history...
165
166
            //FIXME: Check for limit in query, if limit 1, surround subquery with first(());
167
168
            if (!empty($bindings)) {
169
                $this->addBinding($bindings, 'where');
0 ignored issues
show
Bug introduced by
It seems like addBinding() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

169
                $this->/** @scrutinizer ignore-call */ 
170
                       addBinding($bindings, 'where');
Loading history...
170
            }
171
172
            return $this->where(new Expression('(' . $sub . ')'), $operator, $value, $boolean);
173
        }
174
175
        // If the given operator is not found in the list of valid operators we will
176
        // assume that the developer is just short-cutting the '==' operators and
177
        // we will set the operators to '==' and set the values appropriately.
178
        if ($this->invalidOperator($operator)) {
0 ignored issues
show
Bug introduced by
It seems like invalidOperator() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

178
        if ($this->/** @scrutinizer ignore-call */ invalidOperator($operator)) {
Loading history...
179
            [$value, $operator] = [$operator, '=='];
180
        }
181
182
        // If the value is a Closure, it means the developer is performing an entire
183
        // sub-select within the query and we will need to compile the sub-select
184
        // within the where clause to get the appropriate query record results.
185
        if ($this->isQueryable($value)) {
186
            return $this->whereSub($column, $operator, $value, $boolean);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->whereSub($...ator, $value, $boolean) returns the type LaravelFreelancerNL\Aran...y\Concerns\BuildsWheres which is incompatible with the documented return type Illuminate\Database\Query\Builder.
Loading history...
Bug introduced by
It seems like $column can also be of type Closure; however, parameter $column of LaravelFreelancerNL\Aran...uildsWheres::whereSub() does only seem to accept Illuminate\Contracts\Dat...Query\Expression|string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

186
            return $this->whereSub(/** @scrutinizer ignore-type */ $column, $operator, $value, $boolean);
Loading history...
187
        }
188
189
        // If the value is "null", we will just assume the developer wants to add a
190
        // where null clause to the query. So, we will allow a short-cut here to
191
        // that method for convenience so the developer doesn't have to check.
192
        if (is_null($value)) {
193
            return $this->whereNull($column, $boolean, $operator !== '==');
0 ignored issues
show
Bug introduced by
The method whereNull() does not exist on LaravelFreelancerNL\Aran...y\Concerns\BuildsWheres. Did you maybe mean where()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

193
            return $this->/** @scrutinizer ignore-call */ whereNull($column, $boolean, $operator !== '==');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
194
        }
195
196
        $type = 'Basic';
197
198
        $columnString = ($column instanceof ExpressionContract)
199
            ? $this->grammar->getValue($column)
200
            : $column;
201
202
        // If the column is making a JSON reference we'll check to see if the value
203
        // is a boolean. If it is, we'll add the raw boolean string as an actual
204
        // value to the query to ensure this is properly handled by the query.
205
        if (str_contains($columnString, '->') && is_bool($value)) {
0 ignored issues
show
Bug introduced by
It seems like $columnString can also be of type Closure; however, parameter $haystack of str_contains() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

205
        if (str_contains(/** @scrutinizer ignore-type */ $columnString, '->') && is_bool($value)) {
Loading history...
206
            $value = new Expression($value ? 'true' : 'false');
207
208
            if (is_string($column)) {
209
                $type = 'JsonBoolean';
210
            }
211
        }
212
213
        if ($this->isBitwiseOperator($operator)) {
0 ignored issues
show
Bug introduced by
It seems like isBitwiseOperator() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

213
        if ($this->/** @scrutinizer ignore-call */ isBitwiseOperator($operator)) {
Loading history...
214
            $type = 'Bitwise';
215
        }
216
217
        if (!$value instanceof ExpressionContract) {
218
            $value = $this->bindValue($this->flattenValue($value));
0 ignored issues
show
Bug introduced by
It seems like flattenValue() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

218
            $value = $this->bindValue($this->/** @scrutinizer ignore-call */ flattenValue($value));
Loading history...
219
        }
220
221
        // Now that we are working with just a simple query we can put the elements
222
        // in our array and add the query binding to our array of bindings that
223
        // will be bound to each SQL statements when it is finally executed.
224
        $this->wheres[] = compact(
225
            'type',
226
            'column',
227
            'operator',
228
            'value',
229
            'boolean'
230
        );
231
232
233
234
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type LaravelFreelancerNL\Aran...y\Concerns\BuildsWheres which is incompatible with the documented return type Illuminate\Database\Query\Builder.
Loading history...
235
    }
236
237
    /**
238
     * Add a where between statement to the query.
239
     *
240
     * @param  string|Expression  $column
241
     * @param  string  $boolean
242
     * @param  bool  $not
243
     * @return IlluminateQueryBuilder
244
     */
245
    public function whereBetween($column, iterable $values, $boolean = 'and', $not = false)
246
    {
247
        $type = 'between';
248
249
        if ($values instanceof CarbonPeriod) {
250
            $values = $values->toArray();
251
        }
252
253
        $values = array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2);
0 ignored issues
show
Bug introduced by
It seems like cleanBindings() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

253
        $values = array_slice($this->/** @scrutinizer ignore-call */ cleanBindings(Arr::flatten($values)), 0, 2);
Loading history...
254
        $values[0] = $this->bindValue($values[0]);
255
        $values[1] = $this->bindValue($values[1]);
256
257
        $this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not');
0 ignored issues
show
Bug Best Practice introduced by
The property wheres does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
258
259
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type LaravelFreelancerNL\Aran...y\Concerns\BuildsWheres which is incompatible with the documented return type Illuminate\Database\Query\Builder.
Loading history...
260
    }
261
262
    /**
263
     * Add a "where in" clause to the query.
264
     *
265
     * @param  string  $column
266
     * @param  mixed  $values
267
     * @param  string  $boolean
268
     * @param  bool  $not
269
     * @return IlluminateQueryBuilder
270
     */
271
    public function whereIn($column, $values, $boolean = 'and', $not = false)
272
    {
273
        $type = $not ? 'NotIn' : 'In';
274
275
        // If the value is a query builder instance we will assume the developer wants to
276
        // look for any values that exist within this given query. So, we will add the
277
        // query accordingly so that this query is properly executed when it is run.
278
        if ($this->isQueryable($values)) {
279
            [$query, $bindings] = $this->createSub($values);
280
281
            $values = [new Expression($query)];
282
283
            $this->addBinding($bindings, 'where');
284
        }
285
286
        // Next, if the value is Arrayable we need to cast it to its raw array form so we
287
        // have the underlying array value instead of an Arrayable object which is not
288
        // able to be added as a binding, etc. We will then add to the wheres array.
289
        if ($values instanceof Arrayable) {
290
            $values = $values->toArray();
291
        }
292
293
        $values = $this->bindValue($this->cleanBindings($values));
294
295
        $this->wheres[] = compact('type', 'column', 'values', 'boolean');
0 ignored issues
show
Bug Best Practice introduced by
The property wheres does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
296
297
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type LaravelFreelancerNL\Aran...y\Concerns\BuildsWheres which is incompatible with the documented return type Illuminate\Database\Query\Builder.
Loading history...
298
    }
299
300
    /**
301
     * Add a "where JSON contains" clause to the query.
302
     *
303
     * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
304
     *
305
     * @param  string  $column
306
     * @param  mixed  $value
307
     * @param  string  $boolean
308
     * @param  bool  $not
309
     * @return IlluminateQueryBuilder
310
     */
311
    public function whereJsonContains($column, $value, $boolean = 'and', $not = false)
312
    {
313
        $type = 'JsonContains';
314
315
        $value = $this->bindValue($value);
316
317
        $this->wheres[] = compact('type', 'column', 'value', 'boolean', 'not');
0 ignored issues
show
Bug Best Practice introduced by
The property wheres does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
318
319
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type LaravelFreelancerNL\Aran...y\Concerns\BuildsWheres which is incompatible with the documented return type Illuminate\Database\Query\Builder.
Loading history...
320
    }
321
322
    /**
323
     * Add a "where JSON length" clause to the query.
324
     *
325
     * @param  string  $column
326
     * @param  mixed  $operator
327
     * @param  mixed  $value
328
     * @param  string  $boolean
329
     * @return IlluminateQueryBuilder
330
     */
331
    public function whereJsonLength($column, $operator, $value = null, $boolean = 'and')
332
    {
333
        $type = 'JsonLength';
334
335
        [$value, $operator] = $this->prepareValueAndOperator(
336
            $value,
337
            $operator,
338
            func_num_args() === 2
339
        );
340
341
        $value = $this->bindValue((int) $this->flattenValue($value));
342
343
        $this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean');
0 ignored issues
show
Bug Best Practice introduced by
The property wheres does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
344
345
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type LaravelFreelancerNL\Aran...y\Concerns\BuildsWheres which is incompatible with the documented return type Illuminate\Database\Query\Builder.
Loading history...
346
    }
347
348
    /**
349
     * Add a full sub-select to the query.
350
     *
351
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $column
352
     * @param  string  $operator
353
     * @param  \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder  $callback
354
     * @param  string  $boolean
355
     * @return $this
356
     */
357
    protected function whereSub($column, $operator, $callback, $boolean)
358
    {
359
        $type = 'Sub';
360
361
        // Once we have the query instance we can simply execute it so it can add all
362
        // of the sub-select's conditions to itself, and then we can cache it off
363
        // in the array of where clauses for the "main" parent query instance.
364
        call_user_func($callback, $query = $this->forSubQuery());
0 ignored issues
show
Bug introduced by
It seems like forSubQuery() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

364
        call_user_func($callback, $query = $this->/** @scrutinizer ignore-call */ forSubQuery());
Loading history...
Bug introduced by
It seems like $callback can also be of type Illuminate\Database\Eloquent\Builder and Illuminate\Database\Query\Builder; however, parameter $callback of call_user_func() does only seem to accept callable, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

364
        call_user_func(/** @scrutinizer ignore-type */ $callback, $query = $this->forSubQuery());
Loading history...
365
366
        assert($query instanceof Builder);
367
368
        $query->grammar->compileSelect($query);
369
370
        $subquery = '(' . $query->toSql() . ')';
371
372
        // ArangoDB always returns an array of results. SQL will return a singular result
373
        // To mimic the same behaviour we take the first result.
374
        if ($query->hasLimitOfOne($query)) {
375
            $subquery = 'FIRST(' . $subquery . ')';
376
        }
377
378
        $this->bindings = array_merge(
0 ignored issues
show
Bug Best Practice introduced by
The property bindings does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
379
            $this->bindings,
380
            $query->bindings
381
        );
382
383
        $this->wheres[] = compact(
0 ignored issues
show
Bug Best Practice introduced by
The property wheres does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
384
            'type',
385
            'column',
386
            'operator',
387
            'subquery',
388
            'boolean'
389
        );
390
391
        return $this;
392
    }
393
}
394