Failed Conditions
Push — master ( 77e3e5...46b695 )
by Michael
26s queued 19s
created

SingleSelectExecutor::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ORM\Query\Exec;
6
7
use Doctrine\DBAL\Connection;
8
use Doctrine\ORM\Query\AST\SelectStatement;
9
use Doctrine\ORM\Query\SqlWalker;
10
11
/**
12
 * Executor that executes the SQL statement for simple DQL SELECT statements.
13
 */
14
class SingleSelectExecutor extends AbstractSqlExecutor
15
{
16 643
    public function __construct(SelectStatement $AST, SqlWalker $sqlWalker)
17
    {
18 643
        $this->sqlStatements = $sqlWalker->walkSelectStatement($AST);
0 ignored issues
show
Documentation Bug introduced by
It seems like $sqlWalker->walkSelectStatement($AST) of type string is incompatible with the declared type string[] of property $sqlStatements.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
19 635
    }
20
21
    /**
22
     * {@inheritDoc}
23
     */
24 433
    public function execute(Connection $conn, array $params, array $types)
25
    {
26 433
        return $conn->executeQuery($this->sqlStatements, $params, $types, $this->queryCacheProfile);
0 ignored issues
show
Bug introduced by
$this->sqlStatements of type string[] is incompatible with the type string expected by parameter $query of Doctrine\DBAL\Connection::executeQuery(). ( Ignorable by Annotation )

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

26
        return $conn->executeQuery(/** @scrutinizer ignore-type */ $this->sqlStatements, $params, $types, $this->queryCacheProfile);
Loading history...
Bug Best Practice introduced by
The expression return $conn->executeQue...his->queryCacheProfile) also could return the type Doctrine\DBAL\Driver\ResultStatement which includes types incompatible with the return type mandated by Doctrine\ORM\Query\Exec\...tSqlExecutor::execute() of Doctrine\DBAL\Driver\Statement. Consider adding a type-check to rule them out.
Loading history...
27
    }
28
}
29