1 | <?php |
||
10 | class PushMessageDTO |
||
11 | { |
||
12 | /** |
||
13 | * @Serializer\Type("array<string>") |
||
14 | * |
||
15 | * @var string[] |
||
16 | */ |
||
17 | private $attributes; |
||
18 | |||
19 | /** |
||
20 | * @Serializer\Type("string") |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | private $data; |
||
25 | |||
26 | /** |
||
27 | * @Serializer\Type("string") |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | private $messageId; |
||
32 | |||
33 | /** |
||
34 | * @Serializer\Type("string") |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | private $publishTime; |
||
39 | |||
40 | /** |
||
41 | * PushMessageDTO constructor. |
||
42 | * |
||
43 | * @param string $data |
||
44 | * @param string[] $attributes |
||
45 | */ |
||
46 | public function __construct($data = null, array $attributes = null) |
||
51 | |||
52 | /** |
||
53 | * @return string[] |
||
54 | */ |
||
55 | public function getAttributes() |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | public function getData() |
||
67 | |||
68 | /** |
||
69 | * @return string |
||
70 | */ |
||
71 | public function getMessageId() |
||
75 | |||
76 | /** |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getPublishTime() |
||
83 | |||
84 | /** |
||
85 | * @param string[] $attributes |
||
86 | * @return PushMessageDTO |
||
87 | */ |
||
88 | public function setAttributes(array $attributes) |
||
94 | |||
95 | /** |
||
96 | * @param string $data |
||
97 | * @return PushMessageDTO |
||
98 | */ |
||
99 | public function setData($data) |
||
105 | |||
106 | /** |
||
107 | * @param string $messageId |
||
108 | * @return PushMessageDTO |
||
109 | */ |
||
110 | public function setMessageId($messageId) |
||
116 | |||
117 | /** |
||
118 | * @param string $publishTime |
||
119 | * @return PushMessageDTO |
||
120 | */ |
||
121 | public function setPublishTime($publishTime) |
||
127 | } |
||
128 |
Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.
To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.
The function can be called with either null or an array for the parameter
$needle
but will only accept an array as$haystack
.