mnabialek /
laravel-sql-logger
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Mnabialek\LaravelSqlLogger; |
||||
| 4 | |||||
| 5 | use Mnabialek\LaravelSqlLogger\Objects\SqlQuery; |
||||
| 6 | use Mnabialek\LaravelVersion\Version; |
||||
| 7 | |||||
| 8 | class Query |
||||
| 9 | { |
||||
| 10 | /** |
||||
| 11 | * @var Version |
||||
| 12 | */ |
||||
| 13 | private $version; |
||||
| 14 | |||||
| 15 | /** |
||||
| 16 | * Query constructor. |
||||
| 17 | * |
||||
| 18 | * @param Version $version |
||||
| 19 | */ |
||||
| 20 | public function __construct(Version $version) |
||||
| 21 | { |
||||
| 22 | $this->version = $version; |
||||
| 23 | } |
||||
| 24 | |||||
| 25 | /** |
||||
| 26 | * @param int $number |
||||
| 27 | * @param string|\Illuminate\Database\Events\QueryExecuted $query |
||||
| 28 | * @param array|null $bindings |
||||
| 29 | * @param float|null $time |
||||
| 30 | * |
||||
| 31 | * @return SqlQuery |
||||
| 32 | */ |
||||
| 33 | public function get($number, $query, array $bindings = null, $time = null) |
||||
| 34 | { |
||||
| 35 | // for Laravel/Lumen 5.2+ $query is object and it holds all the data |
||||
| 36 | if ($this->version->min('5.2.0')) { |
||||
| 37 | $bindings = $query->bindings; |
||||
| 38 | $time = $query->time; |
||||
| 39 | $query = $query->sql; |
||||
| 40 | } |
||||
| 41 | |||||
| 42 | return new SqlQuery($number, $query, $bindings, $time); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
It seems like
$bindings can also be of type null; however, parameter $bindings of Mnabialek\LaravelSqlLogg...SqlQuery::__construct() does only seem to accept array, 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
Loading history...
|
|||||
| 43 | } |
||||
| 44 | } |
||||
| 45 |