@@ -408,7 +408,7 @@ |
||
408 | 408 | * @param string $parameterName |
409 | 409 | * @param iterable $value |
410 | 410 | * |
411 | - * @return iterable |
|
411 | + * @return Generator |
|
412 | 412 | */ |
413 | 413 | private function parseOperationsAndArguments(string $parameterName, iterable $value): iterable |
414 | 414 | { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | public function getMappedIncludes(): iterable |
246 | 246 | { |
247 | 247 | $fromScheme = $this->getRootScheme(); |
248 | - $getMappedRelLinks = function (iterable $links) use ($fromScheme) : iterable { |
|
248 | + $getMappedRelLinks = function(iterable $links) use ($fromScheme) : iterable { |
|
249 | 249 | foreach ($links as $link) { |
250 | 250 | assert(is_string($link)); |
251 | 251 | $fromSchemaClass = get_class($fromScheme); |
@@ -289,14 +289,14 @@ discard block |
||
289 | 289 | // ['rel2_name1', ], |
290 | 290 | // ['rel3_name1', 'rel3_name2', 'rel3_name3', ], |
291 | 291 | // ] |
292 | - $includeAsModelNames = function (iterable $relationships): iterable { |
|
292 | + $includeAsModelNames = function(iterable $relationships): iterable { |
|
293 | 293 | foreach ($relationships as $relationship) { |
294 | 294 | assert($relationship instanceof RelationshipInterface); |
295 | 295 | yield $relationship->getNameInModel(); |
296 | 296 | } |
297 | 297 | }; |
298 | 298 | $mappedIncludes = $this->getMappedIncludes(); |
299 | - $getIncludes = function () use ($mappedIncludes, $includeAsModelNames) : iterable { |
|
299 | + $getIncludes = function() use ($mappedIncludes, $includeAsModelNames) : iterable { |
|
300 | 300 | foreach ($mappedIncludes as $relationships) { |
301 | 301 | yield $includeAsModelNames($relationships); |
302 | 302 | } |
@@ -264,7 +264,7 @@ |
||
264 | 264 | * @param string $parameterName |
265 | 265 | * @param array $value |
266 | 266 | * |
267 | - * @return iterable |
|
267 | + * @return Generator |
|
268 | 268 | */ |
269 | 269 | private function parseOperationsAndArguments(string $parameterName, array $value): iterable |
270 | 270 | { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | // debug check all fields are strings |
94 | 94 | assert( |
95 | - (function () use ($fields) { |
|
95 | + (function() use ($fields) { |
|
96 | 96 | $allAreStrings = !empty($fields); |
97 | 97 | foreach ($fields as $field) { |
98 | 98 | $allAreStrings = $allAreStrings === true && is_string($field) === true && empty($field) === false; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | // debug check all fields are strings |
136 | 136 | assert( |
137 | - (function () use ($fields) { |
|
137 | + (function() use ($fields) { |
|
138 | 138 | $allAreStrings = !empty($fields); |
139 | 139 | foreach ($fields as $field) { |
140 | 140 | $allAreStrings = $allAreStrings === true && is_string($field) === true && empty($field) === false; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | { |
177 | 177 | // debug check all fields are strings |
178 | 178 | assert( |
179 | - (function () use ($paths) { |
|
179 | + (function() use ($paths) { |
|
180 | 180 | $allAreStrings = !empty($paths); |
181 | 181 | foreach ($paths as $path) { |
182 | 182 | $allAreStrings = $allAreStrings === true && is_string($path) === true && empty($path) === false; |
@@ -121,7 +121,7 @@ |
||
121 | 121 | * |
122 | 122 | * @return array|null |
123 | 123 | */ |
124 | - public function fetchRow(QueryBuilder $builder, string $modelClass): ?array; |
|
124 | + public function fetchRow(QueryBuilder $builder, string $modelClass): ? array; |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * @param QueryBuilder $builder |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | public function fetchResources(QueryBuilder $builder, string $modelClass): PaginatedDataInterface; |
109 | 109 | |
110 | 110 | /** |
111 | - * @param QueryBuilder|null $builder |
|
111 | + * @param QueryBuilder $builder |
|
112 | 112 | * @param string|null $modelClass |
113 | 113 | * |
114 | 114 | * @return mixed|null |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param string $modelClass |
129 | 129 | * @param string $columnName |
130 | 130 | * |
131 | - * @return iterable |
|
131 | + * @return \Generator |
|
132 | 132 | */ |
133 | 133 | public function fetchColumn(QueryBuilder $builder, string $modelClass, string $columnName): iterable; |
134 | 134 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | ): array; |
212 | 212 | |
213 | 213 | /** |
214 | - * @param int|string $index |
|
214 | + * @param string $index |
|
215 | 215 | * @param string $name |
216 | 216 | * @param iterable|null $relationshipFilters |
217 | 217 | * @param iterable|null $relationshipSorts |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | protected static function readJsonFromRequest(ContainerInterface $container, ServerRequestInterface $request): array |
242 | 242 | { |
243 | - $body = (string)$request->getBody(); |
|
243 | + $body = (string) $request->getBody(); |
|
244 | 244 | if (empty($body) === true || ($json = json_decode($body, true)) === null) { |
245 | 245 | /** @var FactoryInterface $factory */ |
246 | 246 | $factory = $container->get(FactoryInterface::class); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | { |
384 | 384 | assert( |
385 | 385 | empty(static::ON_CREATE_VALIDATION_RULES_SET_CLASS) === false, |
386 | - 'Validation rules set should be defined for class ' . static::class . '.' |
|
386 | + 'Validation rules set should be defined for class '.static::class.'.' |
|
387 | 387 | ); |
388 | 388 | |
389 | 389 | return static::createJsonApiValidator($container, static::ON_CREATE_VALIDATION_RULES_SET_CLASS); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | { |
399 | 399 | assert( |
400 | 400 | empty(static::ON_UPDATE_VALIDATION_RULES_SET_CLASS) === false, |
401 | - 'Validation rules set should be defined for class ' . static::class . '.' |
|
401 | + 'Validation rules set should be defined for class '.static::class.'.' |
|
402 | 402 | ); |
403 | 403 | |
404 | 404 | return static::createJsonApiValidator($container, static::ON_UPDATE_VALIDATION_RULES_SET_CLASS); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | ContainerInterface $container, |
607 | 607 | ServerRequestInterface $request |
608 | 608 | ): array { |
609 | - $jsonData = static::normalizeIndexValueOnUpdate( |
|
609 | + $jsonData = static::normalizeIndexValueOnUpdate( |
|
610 | 610 | $routeParams, |
611 | 611 | $container, |
612 | 612 | static::readJsonFromRequest($container, $request) |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @param string $name |
271 | 271 | * @param iterable $operationsAndArgs |
272 | 272 | * |
273 | - * @return iterable |
|
273 | + * @return \Generator |
|
274 | 274 | */ |
275 | 275 | private function getValidatedOperationsAndArguments( |
276 | 276 | int $blockIndex, |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @param string $name |
288 | 288 | * @param iterable $arguments |
289 | 289 | * |
290 | - * @return iterable |
|
290 | + * @return \Generator |
|
291 | 291 | */ |
292 | 292 | private function getValidatedArguments(int $blockIndex, string $name, iterable $arguments): iterable |
293 | 293 | { |
@@ -378,7 +378,7 @@ |
||
378 | 378 | /** |
379 | 379 | * @return int[]|null |
380 | 380 | */ |
381 | - private function getAttributeRules(): ?array |
|
381 | + private function getAttributeRules(): ? array |
|
382 | 382 | { |
383 | 383 | return $this->attributeRules; |
384 | 384 | } |
@@ -162,7 +162,7 @@ |
||
162 | 162 | protected function setWrapperErrors(array $wrapperErrors): self |
163 | 163 | { |
164 | 164 | if (empty($wrapperErrors) === false) { |
165 | - assert(call_user_func(function () use ($wrapperErrors) : bool { |
|
165 | + assert(call_user_func(function() use ($wrapperErrors) : bool { |
|
166 | 166 | $allAreErrors = true; |
167 | 167 | |
168 | 168 | foreach ($wrapperErrors as $error) { |
@@ -105,8 +105,7 @@ |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | $reply = $count > 0 ? |
108 | - BlockReplies::createSuccessReply($values) : |
|
109 | - BlockReplies::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
108 | + BlockReplies::createSuccessReply($values) : BlockReplies::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
110 | 109 | |
111 | 110 | return $reply; |
112 | 111 | } |
@@ -86,8 +86,7 @@ |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | $reply = $foundInvalidType === null ? |
89 | - BlockReplies::createSuccessReply($indexes) : |
|
90 | - BlockReplies::createErrorReply($context, $foundInvalidType, ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
|
89 | + BlockReplies::createSuccessReply($indexes) : BlockReplies::createErrorReply($context, $foundInvalidType, ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
|
91 | 90 | |
92 | 91 | return $reply; |
93 | 92 | } |
@@ -77,8 +77,7 @@ |
||
77 | 77 | assert(is_scalar($index) === true && is_scalar($type) === true); |
78 | 78 | $expectedType = $context->getProperties()->getProperty(self::PROPERTY_RESOURCE_TYPE); |
79 | 79 | $reply = $type === $expectedType ? |
80 | - BlockReplies::createSuccessReply($index) : |
|
81 | - BlockReplies::createErrorReply($context, $type, ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
|
80 | + BlockReplies::createSuccessReply($index) : BlockReplies::createErrorReply($context, $type, ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
|
82 | 81 | |
83 | 82 | return $reply; |
84 | 83 | } |