1 | <?php |
||
2 | |||
3 | namespace NStack\Models; |
||
4 | |||
5 | /** |
||
6 | * Class VersionUpdate |
||
7 | * |
||
8 | * @package NStack\Models |
||
9 | * @author Tiago Araujo <[email protected]> |
||
10 | */ |
||
11 | class VersionUpdate extends Model |
||
12 | { |
||
13 | /** @var int */ |
||
14 | protected $id; |
||
15 | |||
16 | /** @var String */ |
||
17 | protected $version; |
||
18 | |||
19 | /** @var String */ |
||
20 | protected $update; |
||
21 | |||
22 | /** @var bool */ |
||
23 | protected $newInVersion; |
||
24 | |||
25 | /** @var String */ |
||
26 | protected $changeLog; |
||
27 | |||
28 | /** @var String */ |
||
29 | protected $fileUrl; |
||
30 | |||
31 | /** |
||
32 | * parse |
||
33 | * |
||
34 | * @param array $data |
||
35 | */ |
||
36 | public function parse(array $data) |
||
37 | { |
||
38 | $this->id = (String)$data['id']; |
||
0 ignored issues
–
show
|
|||
39 | $this->version = (array)$data['version']; |
||
0 ignored issues
–
show
It seems like
(array)$data['version'] of type array is incompatible with the declared type string of property $version .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
40 | $this->update = (string)$data['update']; |
||
41 | $this->newInVersion = (array)$data['new_in_version']; |
||
0 ignored issues
–
show
It seems like
(array)$data['new_in_version'] of type array is incompatible with the declared type boolean of property $newInVersion .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
42 | $this->changeLog = (array)$data['change_log']; |
||
0 ignored issues
–
show
It seems like
(array)$data['change_log'] of type array is incompatible with the declared type string of property $changeLog .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
43 | $this->fileUrl = (array)$data['file_url']; |
||
0 ignored issues
–
show
It seems like
(array)$data['file_url'] of type array is incompatible with the declared type string of property $fileUrl .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
44 | } |
||
45 | |||
46 | /** |
||
47 | * toArray |
||
48 | * |
||
49 | * @return array |
||
50 | * @author Casper Rasmussen <[email protected]> |
||
51 | */ |
||
52 | public function toArray(): array |
||
53 | { |
||
54 | return [ |
||
55 | 'id' => $this->id, |
||
56 | 'version' => $this->version, |
||
57 | 'update' => $this->update, |
||
58 | 'new_in_version' => $this->newInVersion, |
||
59 | 'change_log' => $this->changeLog, |
||
60 | 'file_url' => $this->fileUrl, |
||
61 | ]; |
||
62 | } |
||
63 | } |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.