1 | <?php |
||
16 | class Document implements JsonSerializable |
||
17 | { |
||
18 | use LinksTrait; |
||
19 | use MetaTrait; |
||
20 | |||
21 | /** |
||
22 | * The included array. |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $included = []; |
||
27 | |||
28 | /** |
||
29 | * The errors array. |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $errors; |
||
34 | |||
35 | /** |
||
36 | * The jsonapi array. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $jsonapi; |
||
41 | |||
42 | /** |
||
43 | * The data object. |
||
44 | * |
||
45 | * @var ElementInterface |
||
46 | */ |
||
47 | protected $data; |
||
48 | |||
49 | /** |
||
50 | * @param ElementInterface $data |
||
|
|||
51 | */ |
||
52 | 6 | public function __construct(ElementInterface $data = null) |
|
56 | |||
57 | /** |
||
58 | * Get included resources. |
||
59 | * |
||
60 | * @param ElementInterface $element |
||
61 | * @param bool $includeParent |
||
62 | * @return Resource[] |
||
63 | */ |
||
64 | 3 | protected function getIncluded(ElementInterface $element, $includeParent = false) |
|
108 | |||
109 | /** |
||
110 | * @param Resource[] $resources |
||
111 | * @param Resource $newResource |
||
112 | * @return Resource[] |
||
113 | */ |
||
114 | protected function mergeResource(array $resources, Resource $newResource) |
||
127 | |||
128 | /** |
||
129 | * Set the data object. |
||
130 | * |
||
131 | * @param ElementInterface $element |
||
132 | * @return $this |
||
133 | */ |
||
134 | public function setData(ElementInterface $element) |
||
140 | |||
141 | /** |
||
142 | * Set the errors array. |
||
143 | * |
||
144 | * @param array $errors |
||
145 | * @return $this |
||
146 | */ |
||
147 | public function setErrors($errors) |
||
153 | |||
154 | /** |
||
155 | * Set the jsonapi array. |
||
156 | * |
||
157 | * @param array $jsonapi |
||
158 | * @return $this |
||
159 | */ |
||
160 | public function setJsonapi($jsonapi) |
||
166 | |||
167 | /** |
||
168 | * Map everything to arrays. |
||
169 | * |
||
170 | * @return array |
||
171 | */ |
||
172 | 6 | public function toArray() |
|
206 | |||
207 | /** |
||
208 | * Map to string. |
||
209 | * |
||
210 | * @return string |
||
211 | */ |
||
212 | 3 | public function __toString() |
|
216 | |||
217 | /** |
||
218 | * Serialize for JSON usage. |
||
219 | * |
||
220 | * @return array |
||
221 | */ |
||
222 | public function jsonSerialize() |
||
226 | } |
||
227 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.