Completed
Push — master ( a098b4...5a38a9 )
by Renato
05:12
created

Criterias/Filters/FilterExpression.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

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
$query is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

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.

Loading history...
21 2
            return true;
22
        }
23
24 13
        return false;
25
    }
26
}
27