@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | foreach ($includePaths as $curPath) { |
111 | 111 | if ($pathLength === 0) { |
112 | 112 | $relationshipName = $this->getRelationshipNameForTopResource($curPath); |
113 | - } elseif (strpos($curPath, $pathBeginning . DocumentInterface::PATH_SEPARATOR) === 0) { |
|
113 | + } elseif (strpos($curPath, $pathBeginning.DocumentInterface::PATH_SEPARATOR) === 0) { |
|
114 | 114 | $relationshipName = $this->getRelationshipNameForResource($curPath, $pathLength); |
115 | 115 | } else { |
116 | 116 | $relationshipName = null; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | if ($path !== null) { |
168 | 168 | foreach ($paths as $targetPath) { |
169 | - if (strpos($targetPath, $path . DocumentInterface::PATH_SEPARATOR) === 0) { |
|
169 | + if (strpos($targetPath, $path.DocumentInterface::PATH_SEPARATOR) === 0) { |
|
170 | 170 | $hasMatch = true; |
171 | 171 | break; |
172 | 172 | } |
@@ -221,8 +221,7 @@ discard block |
||
221 | 221 | { |
222 | 222 | $nextSeparatorPos = strpos($curPath, DocumentInterface::PATH_SEPARATOR, $pathLength + 1); |
223 | 223 | $relationshipName = $nextSeparatorPos === false ? |
224 | - substr($curPath, $pathLength + 1) : |
|
225 | - substr($curPath, $pathLength + 1, $nextSeparatorPos - $pathLength - 1); |
|
224 | + substr($curPath, $pathLength + 1) : substr($curPath, $pathLength + 1, $nextSeparatorPos - $pathLength - 1); |
|
226 | 225 | |
227 | 226 | return $relationshipName; |
228 | 227 | } |
@@ -160,7 +160,7 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
163 | - * @return iterable |
|
163 | + * @return \Generator |
|
164 | 164 | * |
165 | 165 | * @SuppressWarnings(PHPMD.ElseExpression) |
166 | 166 | * @SuppressWarnings(PHPMD.CyclomaticComplexity) |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | */ |
91 | 91 | const MESSAGES = [ |
92 | 92 | self::MSG_GET_SCHEMA_FAILED_FOR_RESOURCE_AT_ROOT => |
93 | - 'Getting Schema for a top-level resource of type `%s` failed. ' . |
|
93 | + 'Getting Schema for a top-level resource of type `%s` failed. '. |
|
94 | 94 | 'Please check you have added a Schema for this type.', |
95 | 95 | |
96 | 96 | self::MSG_GET_SCHEMA_FAILED_FOR_RESOURCE_AT_PATH => |
97 | - 'Getting Schema for a resource of type `%s` at path `%s` failed. ' . |
|
97 | + 'Getting Schema for a resource of type `%s` at path `%s` failed. '. |
|
98 | 98 | 'Please check you have added a Schema for this type.', |
99 | 99 | ]; |
100 | 100 | |
@@ -339,8 +339,7 @@ discard block |
||
339 | 339 | { |
340 | 340 | ($data === null || (is_array($data) === true && empty($data) === true)) ?: Exceptions::throwLogicException(); |
341 | 341 | |
342 | - $replyType = ($data === null ? ParserReplyInterface::REPLY_TYPE_NULL_RESOURCE_STARTED : |
|
343 | - ParserReplyInterface::REPLY_TYPE_EMPTY_RESOURCE_STARTED); |
|
342 | + $replyType = ($data === null ? ParserReplyInterface::REPLY_TYPE_NULL_RESOURCE_STARTED : ParserReplyInterface::REPLY_TYPE_EMPTY_RESOURCE_STARTED); |
|
344 | 343 | |
345 | 344 | return $this->parserFactory->createEmptyReply($replyType, $this->stack); |
346 | 345 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param array $parameters |
31 | 31 | * @param string $errorTitle |
32 | 32 | * |
33 | - * @return iterable |
|
33 | + * @return \Generator |
|
34 | 34 | */ |
35 | 35 | protected function getIncludes(array $parameters, string $errorTitle): iterable |
36 | 36 | { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param array $parameters |
54 | 54 | * @param string $errorTitle |
55 | 55 | * |
56 | - * @return iterable |
|
56 | + * @return \Generator |
|
57 | 57 | */ |
58 | 58 | protected function getFields(array $parameters, string $errorTitle): iterable |
59 | 59 | { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param array $parameters |
74 | 74 | * @param string $errorTitle |
75 | 75 | * |
76 | - * @return iterable |
|
76 | + * @return \Generator |
|
77 | 77 | */ |
78 | 78 | protected function getSorts(array $parameters, string $errorTitle): iterable |
79 | 79 | { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @param string|mixed $shouldBeString |
107 | 107 | * @param string $errorTitle |
108 | 108 | * |
109 | - * @return iterable |
|
109 | + * @return \Generator |
|
110 | 110 | */ |
111 | 111 | private function splitCommaSeparatedStringAndCheckNoEmpties( |
112 | 112 | string $paramName, |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param string $separator |
123 | 123 | * @param string $errorTitle |
124 | 124 | * |
125 | - * @return iterable |
|
125 | + * @return \Generator |
|
126 | 126 | */ |
127 | 127 | private function splitStringAndCheckNoEmpties( |
128 | 128 | string $paramName, |
@@ -35,7 +35,7 @@ |
||
35 | 35 | protected function getIncludes(array $parameters, string $errorTitle): iterable |
36 | 36 | { |
37 | 37 | if (array_key_exists(P::PARAM_INCLUDE, $parameters) === true) { |
38 | - $splitByDot = function (string $path) use ($errorTitle): iterable { |
|
38 | + $splitByDot = function(string $path) use ($errorTitle): iterable { |
|
39 | 39 | foreach ($this->splitStringAndCheckNoEmpties(P::PARAM_INCLUDE, $path, '.', $errorTitle) as $link) { |
40 | 40 | yield $link; |
41 | 41 | } |
@@ -132,7 +132,7 @@ |
||
132 | 132 | /** |
133 | 133 | * Encode errors as JSON API string. |
134 | 134 | * |
135 | - * @param ErrorInterface[]|ErrorCollection|iterable $errors |
|
135 | + * @param ErrorInterface[] $errors |
|
136 | 136 | * |
137 | 137 | * @return string |
138 | 138 | */ |
@@ -78,16 +78,16 @@ discard block |
||
78 | 78 | { |
79 | 79 | assert( |
80 | 80 | is_string($this->getResourceType()) === true && empty($this->getResourceType()) === false, |
81 | - 'Resource type is not set for Schema \'' . static::class . '\'.' |
|
81 | + 'Resource type is not set for Schema \''.static::class.'\'.' |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | if ($this->selfSubUrl === null) { |
85 | - $this->selfSubUrl = '/' . $this->getResourceType(); |
|
85 | + $this->selfSubUrl = '/'.$this->getResourceType(); |
|
86 | 86 | } else { |
87 | 87 | assert( |
88 | 88 | is_string($this->selfSubUrl) === true && empty($this->selfSubUrl) === false && |
89 | 89 | $this->selfSubUrl[0] === '/' && $this->selfSubUrl[strlen($this->selfSubUrl) - 1] != '/', |
90 | - '\'Self\' sub-url set incorrectly for Schema \'' . static::class . '\'.' |
|
90 | + '\'Self\' sub-url set incorrectly for Schema \''.static::class.'\'.' |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function getSelfSubUrl($resource = null): string |
109 | 109 | { |
110 | - return $resource === null ? $this->selfSubUrl : $this->selfSubUrl . '/' . $this->getId($resource); |
|
110 | + return $resource === null ? $this->selfSubUrl : $this->selfSubUrl.'/'.$this->getId($resource); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | protected function getRelationshipSelfUrl($resource, $name) |
274 | 274 | { |
275 | - $url = $this->getSelfSubUrl($resource) . '/' . DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $name; |
|
275 | + $url = $this->getSelfSubUrl($resource).'/'.DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$name; |
|
276 | 276 | |
277 | 277 | return $url; |
278 | 278 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | */ |
286 | 286 | protected function getRelationshipRelatedUrl($resource, $name) |
287 | 287 | { |
288 | - $url = $this->getSelfSubUrl($resource) . '/' . $name; |
|
288 | + $url = $this->getSelfSubUrl($resource).'/'.$name; |
|
289 | 289 | |
290 | 290 | return $url; |
291 | 291 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | array_key_exists(self::DATA, $desc) === true || |
340 | 340 | array_key_exists(self::META, $desc) === true || |
341 | 341 | array_key_exists(self::LINKS, $desc) === true, |
342 | - 'A `' . $this->getResourceType() . ".$name` relationship must contain at least data, links or meta." |
|
342 | + 'A `'.$this->getResourceType().".$name` relationship must contain at least data, links or meta." |
|
343 | 343 | ); |
344 | 344 | |
345 | 345 | $data = $desc[self::DATA] ?? null; |