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) |
|
104 | |||
105 | /** |
||
106 | * @param Resource[] $resources |
||
107 | * @param Resource $newResource |
||
108 | * @return Resource[] |
||
109 | */ |
||
110 | protected function mergeResource(array $resources, Resource $newResource) |
||
123 | |||
124 | /** |
||
125 | * Set the data object. |
||
126 | * |
||
127 | * @param ElementInterface $element |
||
128 | * @return $this |
||
129 | */ |
||
130 | public function setData(ElementInterface $element) |
||
136 | |||
137 | /** |
||
138 | * Set the errors array. |
||
139 | * |
||
140 | * @param array $errors |
||
141 | * @return $this |
||
142 | */ |
||
143 | public function setErrors($errors) |
||
149 | |||
150 | /** |
||
151 | * Set the jsonapi array. |
||
152 | * |
||
153 | * @param array $jsonapi |
||
154 | * @return $this |
||
155 | */ |
||
156 | public function setJsonapi($jsonapi) |
||
162 | 6 | ||
163 | /** |
||
164 | * Map everything to arrays. |
||
165 | * |
||
166 | 6 | * @return array |
|
167 | 3 | */ |
|
168 | public function toArray() |
||
202 | |||
203 | /** |
||
204 | * Map to string. |
||
205 | * |
||
206 | * @return string |
||
207 | */ |
||
208 | public function __toString() |
||
212 | |||
213 | /** |
||
214 | * Serialize for JSON usage. |
||
215 | * |
||
216 | * @return array |
||
217 | */ |
||
218 | public function jsonSerialize() |
||
222 | } |
||
223 |
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.