1 | <?php |
||
25 | class QueryBuilderFactory |
||
26 | { |
||
27 | /** |
||
28 | * @var ContainerInterface $container |
||
29 | */ |
||
30 | private $container; |
||
31 | |||
32 | /** |
||
33 | * @param ContainerInterface $container |
||
34 | */ |
||
35 | public function __construct(ContainerInterface $container) |
||
39 | |||
40 | /** |
||
41 | * @return ContainerInterface |
||
42 | */ |
||
43 | public function getContainer() |
||
47 | |||
48 | /** |
||
49 | * @return SelectBuilder |
||
50 | */ |
||
51 | public function select() |
||
55 | |||
56 | /** |
||
57 | * @return UpdateBuilder |
||
58 | */ |
||
59 | public function update() |
||
63 | |||
64 | /** |
||
65 | * @return DeleteBuilder |
||
66 | */ |
||
67 | public function delete() |
||
71 | |||
72 | /** |
||
73 | * @return InsertBuilder |
||
74 | */ |
||
75 | public function insert() |
||
79 | |||
80 | /** |
||
81 | * @return InsertSelectBuilder |
||
82 | */ |
||
83 | public function insertSelect() |
||
87 | } |
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
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.