1 | <?php |
||
2 | /** |
||
3 | * Created by Gorlum 17.10.2017 10:48 |
||
4 | */ |
||
5 | |||
6 | namespace DBAL; |
||
7 | |||
8 | use \mysqli_result; |
||
0 ignored issues
–
show
|
|||
9 | |||
10 | /** |
||
11 | * Class DbMysqliResultIterator |
||
12 | * |
||
13 | * Simplest implementation of DbAbstractResultIterator - getting result from constructor |
||
14 | * |
||
15 | * @package DBAL |
||
16 | */ |
||
17 | class DbMysqliResultIterator extends DbAbstractResultIterator { |
||
18 | /** |
||
19 | * DbMysqliResultIterator constructor. |
||
20 | * |
||
21 | * @param mysqli_result|bool $mysqli_result |
||
22 | */ |
||
23 | public function __construct($mysqli_result) { |
||
24 | $this->mysqli_result = $mysqli_result; |
||
0 ignored issues
–
show
It seems like
$mysqli_result can also be of type boolean . However, the property $mysqli_result is declared as type \mysqli_result|false . Maybe add an additional type check?
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly. For example, imagine you have a variable Either this assignment is in error or a type check should be added for that assignment. class Id
{
public $id;
public function __construct($id)
{
$this->id = $id;
}
}
class Account
{
/** @var Id $id */
public $id;
}
$account_id = false;
if (starsAreRight()) {
$account_id = new Id(42);
}
$account = new Account();
if ($account instanceof Id)
{
$account->id = $account_id;
}
![]() |
|||
25 | |||
26 | $this->rewind(); |
||
27 | } |
||
28 | |||
29 | } |
||
30 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths