1 | <?php |
||
23 | class Address extends Api |
||
24 | { |
||
25 | /** |
||
26 | * The response array. |
||
27 | * |
||
28 | * @var array|null |
||
29 | */ |
||
30 | protected $response = null; |
||
31 | |||
32 | /** |
||
33 | * The cache directory. |
||
34 | * |
||
35 | * @var string|null |
||
36 | */ |
||
37 | protected $cacheDir = __DIR__ . '/cache/'; |
||
38 | |||
39 | /** |
||
40 | * The cache file name. |
||
41 | * |
||
42 | * @var string|null |
||
43 | */ |
||
44 | protected $file = __DIR__ . '/cache/' . 'address_'; |
||
45 | |||
46 | /** |
||
47 | * Returns a list of all the addresses from a string. |
||
48 | * |
||
49 | * @param string $address |
||
50 | * @param int $page |
||
51 | * @param string $lang |
||
52 | * @return Address |
||
53 | */ |
||
54 | public function find($address, $page = 1, $lang = 'A') |
||
104 | |||
105 | /** |
||
106 | * Returns all the addresses found. |
||
107 | * |
||
108 | * @return array |
||
109 | */ |
||
110 | public function all() |
||
116 | |||
117 | /** |
||
118 | * Returns all the addresses found. |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | public function get() |
||
126 | |||
127 | /** |
||
128 | * Verify an address. |
||
129 | * |
||
130 | * @param int $buildingNumber |
||
131 | * @param int $zip |
||
132 | * @param int $additionalNumber |
||
133 | * @param string $lang |
||
134 | * @return array |
||
135 | */ |
||
136 | public function verify($buildingNumber, $zip, $additionalNumber, $lang = 'A') |
||
150 | |||
151 | /** |
||
152 | * Check if find() method was called first. |
||
153 | * |
||
154 | * @return void |
||
155 | * @throws \BadMethodCallException |
||
156 | */ |
||
157 | protected function check() |
||
163 | } |
||
164 |
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.