1 | <?php |
||
16 | class Badge implements BadgeInterface, JsonSerializable |
||
17 | { |
||
18 | /** @var string */ |
||
19 | protected $file; |
||
20 | |||
21 | /** @var string */ |
||
22 | protected $id; |
||
23 | |||
24 | /** @var string */ |
||
25 | protected $title; |
||
26 | |||
27 | /** @var string */ |
||
28 | protected $description; |
||
29 | |||
30 | /** @var string */ |
||
31 | protected $imagePath; |
||
32 | |||
33 | /** @var ArrayCollection */ |
||
34 | protected $tags; |
||
35 | |||
36 | /** @var ArrayCollection */ |
||
37 | protected $completions; |
||
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | public function getId() |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | public function getTitle() |
||
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | public function setTitle($title) |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function getDescription() |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | public function setDescription($description) |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | public function getImagePath() |
||
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | public function setImagePath($imagePath) |
||
100 | |||
101 | /** |
||
102 | * {@inheritdoc} |
||
103 | */ |
||
104 | public function setFile(UploadedFile $file = null) |
||
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | */ |
||
112 | public function getFile() |
||
116 | |||
117 | /** |
||
118 | * {@inheritdoc} |
||
119 | */ |
||
120 | public function upload() |
||
143 | |||
144 | /** |
||
145 | * {@inheritdoc} |
||
146 | */ |
||
147 | public function addTag(TagInterface $tag) |
||
153 | |||
154 | /** |
||
155 | * {@inheritdoc} |
||
156 | */ |
||
157 | public function setTags(ArrayCollection $tags) |
||
161 | |||
162 | /** |
||
163 | * {@inheritdoc} |
||
164 | */ |
||
165 | public function getTags() |
||
169 | |||
170 | /** |
||
171 | * {@inheritdoc} |
||
172 | */ |
||
173 | public function getCompletions() |
||
177 | |||
178 | /** |
||
179 | * {@inheritdoc} |
||
180 | */ |
||
181 | public function setCompletions($completions) |
||
185 | |||
186 | /** |
||
187 | * Returns the absolute path of the image, null if no image |
||
188 | * |
||
189 | * @return null|string |
||
190 | */ |
||
191 | public function getImageAbsolutePath() |
||
197 | |||
198 | /** |
||
199 | * Returns the path of the image for the web, null if no image |
||
200 | * |
||
201 | * @return null|string |
||
202 | */ |
||
203 | public function getImageWebPath() |
||
209 | |||
210 | /** |
||
211 | * {@inheritdoc} |
||
212 | */ |
||
213 | public function jsonSerialize() |
||
222 | |||
223 | /** |
||
224 | * Returns the absolute directory path where uploaded documents should be saved |
||
225 | * |
||
226 | * @return string |
||
227 | */ |
||
228 | protected function getUploadRootDir() |
||
232 | |||
233 | /** |
||
234 | * Returns the path where upload files. |
||
235 | * |
||
236 | * Get rid of the __DIR__ so it doesn't screw up when displaying uploaded doc/image in the view. |
||
237 | * |
||
238 | * @return string |
||
239 | */ |
||
240 | protected function getUploadDir() |
||
244 | |||
245 | /** |
||
246 | * @return string |
||
247 | */ |
||
248 | public function __toString() |
||
252 | } |
||
253 |
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.