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 | 12 | public function __construct(ElementInterface $data = null) |
|
56 | |||
57 | /** |
||
58 | * Get included resources. |
||
59 | * |
||
60 | * @param \Tobscure\JsonApi\ElementInterface $element |
||
61 | * @param bool $includeParent |
||
62 | * |
||
63 | * @return \Tobscure\JsonApi\Resource[] |
||
64 | */ |
||
65 | 9 | protected function getIncluded(ElementInterface $element, $includeParent = false) |
|
109 | |||
110 | /** |
||
111 | * @param \Tobscure\JsonApi\Resource[] $resources |
||
112 | * @param \Tobscure\JsonApi\Resource $newResource |
||
113 | * |
||
114 | * @return \Tobscure\JsonApi\Resource[] |
||
115 | */ |
||
116 | 3 | protected function mergeResource(array $resources, Resource $newResource) |
|
129 | |||
130 | /** |
||
131 | * Set the data object. |
||
132 | * |
||
133 | * @param \Tobscure\JsonApi\ElementInterface $element |
||
134 | * |
||
135 | * @return $this |
||
136 | */ |
||
137 | public function setData(ElementInterface $element) |
||
143 | |||
144 | /** |
||
145 | * Set the errors array. |
||
146 | * |
||
147 | * @param array $errors |
||
148 | * |
||
149 | * @return $this |
||
150 | */ |
||
151 | public function setErrors($errors) |
||
157 | |||
158 | /** |
||
159 | * Set the jsonapi array. |
||
160 | * |
||
161 | * @param array $jsonapi |
||
162 | * |
||
163 | * @return $this |
||
164 | */ |
||
165 | public function setJsonapi($jsonapi) |
||
171 | |||
172 | /** |
||
173 | * Map everything to arrays. |
||
174 | * |
||
175 | * @return array |
||
176 | */ |
||
177 | 12 | public function toArray() |
|
211 | |||
212 | /** |
||
213 | * Map to string. |
||
214 | * |
||
215 | * @return string |
||
216 | */ |
||
217 | 6 | public function __toString() |
|
221 | |||
222 | /** |
||
223 | * Serialize for JSON usage. |
||
224 | * |
||
225 | * @return array |
||
226 | */ |
||
227 | public function jsonSerialize() |
||
231 | } |
||
232 |
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.