These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace NwLaravel\Repositories\Criterias\Filters; |
||
3 | |||
4 | use Illuminate\Database\Query\Expression; |
||
5 | |||
6 | class FilterExpression implements FilterInterface |
||
7 | { |
||
8 | /** |
||
9 | * Filter |
||
10 | * |
||
11 | * @param Query\Builder $query |
||
12 | * @param int|string $key |
||
13 | * @param mixed $value |
||
14 | * |
||
15 | * @return boolean |
||
16 | */ |
||
17 | 14 | public function filter($query, $key, $value) |
|
18 | { |
||
19 | 14 | if (is_int($key) && $value instanceof Expression) { |
|
20 | 2 | $query = $query->whereRaw($value); |
|
0 ignored issues
–
show
|
|||
21 | 2 | return true; |
|
22 | } |
||
23 | |||
24 | 13 | return false; |
|
25 | } |
||
26 | } |
||
27 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.