We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
14 | class Argument implements \ArrayAccess, \Countable |
||
15 | { |
||
16 | private $arguments = []; |
||
17 | |||
18 | 5 | public function __construct($arguments) |
|
19 | { |
||
20 | 5 | if (!is_array($arguments) && !$arguments instanceof \ArrayAccess) { |
|
21 | 5 | $arguments = [$arguments]; |
|
22 | 5 | } |
|
23 | 5 | $this->arguments = $arguments; |
|
|
|||
24 | 5 | } |
|
25 | |||
26 | public function offsetExists($offset) |
||
30 | |||
31 | public function offsetGet($offset) |
||
35 | |||
36 | public function offsetSet($offset, $value) |
||
40 | |||
41 | public function offsetUnset($offset) |
||
45 | |||
46 | public function __get($key) |
||
50 | |||
51 | public function __set($key, $value) |
||
55 | |||
56 | public function getRawArguments() |
||
57 | { |
||
58 | return $this->arguments; |
||
59 | } |
||
60 | |||
61 | public function count() |
||
65 | } |
||
66 |
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.