Issues (281)

Branch: master

src/Backend/Core/Engine/DataGridDatabase.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Backend\Core\Engine;
4
5
use Backend\Core\Engine\Model as BackendModel;
6
7
/**
8
 * A datagrid with a database-connection as source
9
 */
10
class DataGridDatabase extends DataGrid
11
{
12
    /**
13
     * @param string $query The query to retrieve the data.
14
     * @param array $parameters The parameters to be used inside the query.
15
     * @param string $resultsQuery The optional count query, used to calculate the number of results.
16
     * @param array $resultsParameters The parameters to be used inside the results query.
17
     */
18 19
    public function __construct(
19
        string $query,
20
        array $parameters = [],
21
        string $resultsQuery = null,
22
        array $resultsParameters = []
23
    ) {
24 19
        parent::__construct(
25 19
            new \SpoonDatagridSourceDB(
26 19
                BackendModel::get('database'),
0 ignored issues
show
It seems like Backend\Core\Engine\Model::get('database') can also be of type null; however, parameter $dbConnection of SpoonDatagridSourceDB::__construct() does only seem to accept SpoonDatabase, 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 ignore-type  annotation

26
                /** @scrutinizer ignore-type */ BackendModel::get('database'),
Loading history...
27 19
                [$query, $parameters],
28 19
                $resultsQuery === null ? null : [$resultsQuery, $resultsParameters]
0 ignored issues
show
It seems like $resultsQuery === null ?...ry, $resultsParameters) can also be of type array<integer,array|string>; however, parameter $numResultsQuery of SpoonDatagridSourceDB::__construct() does only seem to accept string, 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 ignore-type  annotation

28
                /** @scrutinizer ignore-type */ $resultsQuery === null ? null : [$resultsQuery, $resultsParameters]
Loading history...
29
            )
30
        );
31 19
    }
32
}
33