Failed Conditions
Push — master ( ac0e13...24dbc4 )
by Sergei
22s queued 15s
created

src/Logging/EchoSQLLogger.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\DBAL\Logging;
6
7
use function var_dump;
8
use const PHP_EOL;
9
10
/**
11
 * A SQL logger that logs to the standard output using echo/var_dump.
12
 */
13
final class EchoSQLLogger implements SQLLogger
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function startQuery(string $sql, array $params = [], array $types = []) : void
19
    {
20
        echo $sql . PHP_EOL;
21
22
        if ($params) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $params of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
23
            var_dump($params);
24
        }
25
26
        if (! $types) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $types of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
27
            return;
28
        }
29
30
        var_dump($types);
31
    }
32
33
    public function stopQuery() : void
34
    {
35
    }
36
}
37