1 | <?php |
||
16 | class Document implements JsonSerializable |
||
17 | { |
||
18 | use LinksTrait; |
||
19 | use MetaTrait; |
||
20 | |||
21 | const MEDIA_TYPE = 'application/vnd.api+json'; |
||
22 | |||
23 | /** |
||
24 | * The included array. |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $included = []; |
||
29 | |||
30 | /** |
||
31 | * The errors array. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $errors; |
||
36 | |||
37 | /** |
||
38 | * The jsonapi array. |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | protected $jsonapi; |
||
43 | |||
44 | /** |
||
45 | * The data object. |
||
46 | * |
||
47 | * @var ElementInterface |
||
48 | */ |
||
49 | protected $data; |
||
50 | |||
51 | /** |
||
52 | 12 | * @param ElementInterface $data |
|
|
|||
53 | */ |
||
54 | 12 | public function __construct(ElementInterface $data = null) |
|
58 | |||
59 | /** |
||
60 | * Get included resources. |
||
61 | * |
||
62 | * @param \Tobscure\JsonApi\ElementInterface $element |
||
63 | * @param bool $includeParent |
||
64 | * |
||
65 | 9 | * @return \Tobscure\JsonApi\Resource[] |
|
66 | */ |
||
67 | 9 | protected function getIncluded(ElementInterface $element, $includeParent = false) |
|
111 | |||
112 | /** |
||
113 | * @param \Tobscure\JsonApi\Resource[] $resources |
||
114 | * @param \Tobscure\JsonApi\Resource $newResource |
||
115 | * |
||
116 | 3 | * @return \Tobscure\JsonApi\Resource[] |
|
117 | */ |
||
118 | 3 | protected function mergeResource(array $resources, Resource $newResource) |
|
131 | |||
132 | /** |
||
133 | * Set the data object. |
||
134 | * |
||
135 | * @param \Tobscure\JsonApi\ElementInterface $element |
||
136 | * |
||
137 | * @return $this |
||
138 | */ |
||
139 | public function setData(ElementInterface $element) |
||
145 | |||
146 | /** |
||
147 | * Set the errors array. |
||
148 | * |
||
149 | * @param array $errors |
||
150 | * |
||
151 | * @return $this |
||
152 | */ |
||
153 | public function setErrors($errors) |
||
159 | |||
160 | /** |
||
161 | * Set the jsonapi array. |
||
162 | * |
||
163 | * @param array $jsonapi |
||
164 | * |
||
165 | * @return $this |
||
166 | */ |
||
167 | public function setJsonapi($jsonapi) |
||
173 | |||
174 | /** |
||
175 | * Map everything to arrays. |
||
176 | * |
||
177 | 12 | * @return array |
|
178 | */ |
||
179 | 12 | public function toArray() |
|
213 | |||
214 | /** |
||
215 | * Map to string. |
||
216 | * |
||
217 | 6 | * @return string |
|
218 | */ |
||
219 | 6 | public function __toString() |
|
223 | |||
224 | /** |
||
225 | * Serialize for JSON usage. |
||
226 | * |
||
227 | * @return array |
||
228 | */ |
||
229 | public function jsonSerialize() |
||
233 | } |
||
234 |
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.