@@ -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 | - $mappedIncludes = $this->getMappedIncludes(); |
|
| 299 | - $getIncludes = function () use ($mappedIncludes, $includeAsModelNames) : iterable { |
|
| 298 | + $mappedIncludes = $this->getMappedIncludes(); |
|
| 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; |
@@ -49,22 +49,22 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $container[FactoryInterface::class] = $factory; |
| 51 | 51 | |
| 52 | - $container[JsonSchemesInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
| 52 | + $container[JsonSchemesInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
| 53 | 53 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
| 54 | 54 | $modelSchemes = $container->get(ModelSchemeInfoInterface::class); |
| 55 | 55 | |
| 56 | 56 | return $factory->createJsonSchemes($settings[FluteSettings::KEY_MODEL_TO_SCHEME_MAP], $modelSchemes); |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | - $container[QueryParserInterface::class] = function (PsrContainerInterface $container) { |
|
| 59 | + $container[QueryParserInterface::class] = function(PsrContainerInterface $container) { |
|
| 60 | 60 | return new QueryParser($container->get(PaginationStrategyInterface::class)); |
| 61 | 61 | }; |
| 62 | 62 | |
| 63 | - $container[ParametersMapperInterface::class] = function (PsrContainerInterface $container) { |
|
| 63 | + $container[ParametersMapperInterface::class] = function(PsrContainerInterface $container) { |
|
| 64 | 64 | return new ParametersMapper($container->get(JsonSchemesInterface::class)); |
| 65 | 65 | }; |
| 66 | 66 | |
| 67 | - $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
| 67 | + $container[EncoderInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
| 68 | 68 | /** @var JsonSchemesInterface $jsonSchemes */ |
| 69 | 69 | $jsonSchemes = $container->get(JsonSchemesInterface::class); |
| 70 | 70 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | return $encoder; |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | - $container[PaginationStrategyInterface::class] = function (PsrContainerInterface $container) { |
|
| 82 | + $container[PaginationStrategyInterface::class] = function(PsrContainerInterface $container) { |
|
| 83 | 83 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
| 84 | 84 | |
| 85 | 85 | return new PaginationStrategy( |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | ); |
| 89 | 89 | }; |
| 90 | 90 | |
| 91 | - $container[JsonApiValidatorFactoryInterface::class] = function (PsrContainerInterface $container) { |
|
| 91 | + $container[JsonApiValidatorFactoryInterface::class] = function(PsrContainerInterface $container) { |
|
| 92 | 92 | $factory = new JsonApiValidatorFactory($container); |
| 93 | 93 | |
| 94 | 94 | return $factory; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public static function configureExceptionHandler(LimoncelloContainerInterface $container) |
| 118 | 118 | { |
| 119 | - $container[ThrowableHandlerInterface::class] = function (PsrContainerInterface $container) { |
|
| 119 | + $container[ThrowableHandlerInterface::class] = function(PsrContainerInterface $container) { |
|
| 120 | 120 | $appSettings = $container->get(SettingsProviderInterface::class)->get(A::class); |
| 121 | 121 | $fluteSettings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
| 122 | 122 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | - * @param iterable $attributes |
|
| 131 | + * @param Generator $attributes |
|
| 132 | 132 | * |
| 133 | 133 | * @return self |
| 134 | 134 | * |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | - * @param iterable $attributes |
|
| 151 | + * @param Generator $attributes |
|
| 152 | 152 | * |
| 153 | 153 | * @return self |
| 154 | 154 | * |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @param string $modelClass |
| 170 | 170 | * @param iterable $attributes |
| 171 | 171 | * |
| 172 | - * @return iterable |
|
| 172 | + * @return Generator |
|
| 173 | 173 | * |
| 174 | 174 | * @SuppressWarnings(PHPMD.StaticAccess) |
| 175 | 175 | */ |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | - * @param iterable $filters |
|
| 252 | + * @param \Limoncello\Flute\Api\iterable|null $filters |
|
| 253 | 253 | * |
| 254 | 254 | * @return self |
| 255 | 255 | */ |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
| 262 | - * @param iterable $filters |
|
| 262 | + * @param \Limoncello\Flute\Api\iterable|null $filters |
|
| 263 | 263 | * |
| 264 | 264 | * @return self |
| 265 | 265 | */ |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | - * @param iterable $filters |
|
| 272 | + * @param \Limoncello\Flute\Api\iterable|null $filters |
|
| 273 | 273 | * |
| 274 | 274 | * @return self |
| 275 | 275 | */ |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | |
| 315 | 315 | /** |
| 316 | 316 | * @param string $relationshipName |
| 317 | - * @param iterable $relationshipFilters |
|
| 317 | + * @param \Limoncello\Flute\Api\iterable|null $relationshipFilters |
|
| 318 | 318 | * @param iterable|null $relationshipSorts |
| 319 | 319 | * |
| 320 | 320 | * @return self |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /** |
| 338 | - * @param iterable $sortParameters |
|
| 338 | + * @param \Limoncello\Flute\Api\iterable|null $sortParameters |
|
| 339 | 339 | * |
| 340 | 340 | * @return self |
| 341 | 341 | */ |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | string $relationshipName, |
| 290 | 290 | iterable $relationshipFilters, |
| 291 | 291 | ?iterable $relationshipSorts |
| 292 | - ): self { |
|
| 292 | + ) : self { |
|
| 293 | 293 | $joinWith = $this->expr()->andX(); |
| 294 | 294 | |
| 295 | 295 | return $this->addRelationshipFiltersAndSorts( |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | string $relationshipName, |
| 324 | 324 | iterable $relationshipFilters, |
| 325 | 325 | ?iterable $relationshipSorts |
| 326 | - ): self { |
|
| 326 | + ) : self { |
|
| 327 | 327 | $joinWith = $this->expr()->orX(); |
| 328 | 328 | |
| 329 | 329 | return $this->addRelationshipFiltersAndSorts( |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | CompositeExpression $filterLink, |
| 387 | 387 | iterable $relationshipFilters, |
| 388 | 388 | ?iterable $relationshipSorts |
| 389 | - ): self { |
|
| 389 | + ) : self { |
|
| 390 | 390 | $relationshipType = $this->getModelSchemes()->getRelationshipType($this->getModelClass(), $relationshipName); |
| 391 | 391 | switch ($relationshipType) { |
| 392 | 392 | case RelationshipTypes::BELONGS_TO: |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | CompositeExpression $filterLink, |
| 460 | 460 | iterable $relationshipFilters, |
| 461 | 461 | ?iterable $relationshipSorts |
| 462 | - ): self { |
|
| 462 | + ) : self { |
|
| 463 | 463 | $foreignKey = $this->getModelSchemes()->getForeignKey($this->getModelClass(), $relationshipName); |
| 464 | 464 | list($onePrimaryKey, $oneTable) = |
| 465 | 465 | $this->getModelSchemes()->getReversePrimaryKey($this->getModelClass(), $relationshipName); |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | CompositeExpression $filterLink, |
| 492 | 492 | iterable $relationshipFilters, |
| 493 | 493 | ?iterable $relationshipSorts |
| 494 | - ): self { |
|
| 494 | + ) : self { |
|
| 495 | 495 | $primaryKey = $this->getModelSchemes()->getPrimaryKey($this->getModelClass()); |
| 496 | 496 | list($manyForeignKey, $manyTable) = |
| 497 | 497 | $this->getModelSchemes()->getReverseForeignKey($this->getModelClass(), $relationshipName); |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | CompositeExpression $targetFilterLink, |
| 524 | 524 | iterable $relationshipFilters, |
| 525 | 525 | ?iterable $relationshipSorts |
| 526 | - ): self { |
|
| 526 | + ) : self { |
|
| 527 | 527 | $primaryKey = $this->getModelSchemes()->getPrimaryKey($this->getModelClass()); |
| 528 | 528 | list ($intermediateTable, $intermediatePk, $intermediateFk) = |
| 529 | 529 | $this->getModelSchemes()->getBelongsToManyRelationship($this->getModelClass(), $relationshipName); |
@@ -571,9 +571,9 @@ discard block |
||
| 571 | 571 | ?CompositeExpression $targetFilterLink, |
| 572 | 572 | ?iterable $targetFilterParams, |
| 573 | 573 | ?iterable $relationshipSorts |
| 574 | - ): string { |
|
| 574 | + ) : string { |
|
| 575 | 575 | $targetAlias = $this->createAlias($targetTable); |
| 576 | - $joinCondition = $this->buildColumnName($fromAlias, $fromColumn) . '=' . |
|
| 576 | + $joinCondition = $this->buildColumnName($fromAlias, $fromColumn).'='. |
|
| 577 | 577 | $this->buildColumnName($targetAlias, $targetColumn); |
| 578 | 578 | |
| 579 | 579 | $this->innerJoin( |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | ?CompositeExpression $targetFilterLink, |
| 633 | 633 | ?iterable $targetFilterParams, |
| 634 | 634 | ?iterable $targetSortParams |
| 635 | - ): string { |
|
| 635 | + ) : string { |
|
| 636 | 636 | $intNoSorting = null; |
| 637 | 637 | $intAlias = $this->innerJoinOneTable( |
| 638 | 638 | $fromAlias, |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | $intFilterParams, |
| 644 | 644 | $intNoSorting |
| 645 | 645 | ); |
| 646 | - $targetAlias = $this->innerJoinOneTable( |
|
| 646 | + $targetAlias = $this->innerJoinOneTable( |
|
| 647 | 647 | $intAlias, |
| 648 | 648 | $intToTargetColumn, |
| 649 | 649 | $targetTable, |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | */ |
| 664 | 664 | private function createAlias(string $tableName): string |
| 665 | 665 | { |
| 666 | - $alias = $tableName . (++$this->aliasIdCounter); |
|
| 666 | + $alias = $tableName.(++$this->aliasIdCounter); |
|
| 667 | 667 | $this->knownAliases[$tableName] = $alias; |
| 668 | 668 | |
| 669 | 669 | return $alias; |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | } else { |
| 828 | 828 | assert( |
| 829 | 829 | $value !== null, |
| 830 | - 'It seems you are trying to use `null` with =, >, <, or etc operator. ' . |
|
| 830 | + 'It seems you are trying to use `null` with =, >, <, or etc operator. '. |
|
| 831 | 831 | 'Use `is null` or `not null` instead.' |
| 832 | 832 | ); |
| 833 | 833 | assert(is_string($value), "Only strings, booleans and integers are supported."); |
@@ -616,9 +616,9 @@ discard block |
||
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | /** |
| 619 | - * @param iterable $paths (string[]) |
|
| 619 | + * @param iterable|null $paths (string[]) |
|
| 620 | 620 | * |
| 621 | - * @return iterable |
|
| 621 | + * @return Generator |
|
| 622 | 622 | */ |
| 623 | 623 | private static function getPaths(iterable $paths): iterable |
| 624 | 624 | { |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | * @param null|string $index |
| 1231 | 1231 | * @param iterable $attributes |
| 1232 | 1232 | * |
| 1233 | - * @return iterable |
|
| 1233 | + * @return Generator |
|
| 1234 | 1234 | */ |
| 1235 | 1235 | protected function filterAttributesOnCreate(?string $index, iterable $attributes): iterable |
| 1236 | 1236 | { |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | /** |
| 1251 | 1251 | * @param iterable $attributes |
| 1252 | 1252 | * |
| 1253 | - * @return iterable |
|
| 1253 | + * @return Generator |
|
| 1254 | 1254 | */ |
| 1255 | 1255 | protected function filterAttributesOnUpdate(iterable $attributes): iterable |
| 1256 | 1256 | { |
@@ -1422,10 +1422,10 @@ discard block |
||
| 1422 | 1422 | |
| 1423 | 1423 | /** |
| 1424 | 1424 | * @param iterable $attributes |
| 1425 | - * @param array $typeNames |
|
| 1425 | + * @param Type[] $typeNames |
|
| 1426 | 1426 | * @param AbstractPlatform $platform |
| 1427 | 1427 | * |
| 1428 | - * @return iterable |
|
| 1428 | + * @return Generator |
|
| 1429 | 1429 | */ |
| 1430 | 1430 | private function readTypedAttributes(iterable $attributes, array $typeNames, AbstractPlatform $platform): iterable |
| 1431 | 1431 | { |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | assert(is_string($pathPiece)); |
| 723 | 723 | $parent = $tmpPath; |
| 724 | 724 | $tmpPath = empty($tmpPath) === true ? |
| 725 | - $pathPiece : $tmpPath . static::PATH_SEPARATOR . $pathPiece; |
|
| 725 | + $pathPiece : $tmpPath.static::PATH_SEPARATOR.$pathPiece; |
|
| 726 | 726 | $normalizedPaths[$tmpPath] = [$parent, $pathPiece]; |
| 727 | 727 | $pathsDepths[$parent] = $parentDepth++; |
| 728 | 728 | } |
@@ -894,8 +894,7 @@ discard block |
||
| 894 | 894 | $filters = $this->getFilters(); |
| 895 | 895 | $sorts = $this->getSorts(); |
| 896 | 896 | $this->areFiltersWithAnd() ? |
| 897 | - $builder->addRelationshipFiltersAndSortsWithAnd($reverseRelName, $filters, $sorts) : |
|
| 898 | - $builder->addRelationshipFiltersAndSortsWithOr($reverseRelName, $filters, $sorts); |
|
| 897 | + $builder->addRelationshipFiltersAndSortsWithAnd($reverseRelName, $filters, $sorts) : $builder->addRelationshipFiltersAndSortsWithOr($reverseRelName, $filters, $sorts); |
|
| 899 | 898 | } |
| 900 | 899 | // ... and the input filters to actual data we select |
| 901 | 900 | if ($relationshipFilters !== null) { |
@@ -1014,7 +1013,7 @@ discard block |
||
| 1014 | 1013 | |
| 1015 | 1014 | $this->clearFetchParameters(); |
| 1016 | 1015 | |
| 1017 | - return (int)$deleted; |
|
| 1016 | + return (int) $deleted; |
|
| 1018 | 1017 | } |
| 1019 | 1018 | |
| 1020 | 1019 | /** |
@@ -1028,7 +1027,7 @@ discard block |
||
| 1028 | 1027 | |
| 1029 | 1028 | $this->clearFetchParameters(); |
| 1030 | 1029 | |
| 1031 | - return (int)$deleted > 0; |
|
| 1030 | + return (int) $deleted > 0; |
|
| 1032 | 1031 | } |
| 1033 | 1032 | |
| 1034 | 1033 | /** |
@@ -1049,7 +1048,7 @@ discard block |
||
| 1049 | 1048 | |
| 1050 | 1049 | $this->clearBuilderParameters()->clearFetchParameters(); |
| 1051 | 1050 | |
| 1052 | - $this->inTransaction(function () use ($saveMain, $toMany, &$index) { |
|
| 1051 | + $this->inTransaction(function() use ($saveMain, $toMany, &$index) { |
|
| 1053 | 1052 | $saveMain->execute(); |
| 1054 | 1053 | |
| 1055 | 1054 | // if no index given will use last insert ID as index |
@@ -1065,7 +1064,7 @@ discard block |
||
| 1065 | 1064 | ->prepareCreateInToManyRelationship($relationshipName, $index, $secondaryIdBindName) |
| 1066 | 1065 | ); |
| 1067 | 1066 | foreach ($secondaryIds as $secondaryId) { |
| 1068 | - $inserted += (int)$saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute(); |
|
| 1067 | + $inserted += (int) $saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute(); |
|
| 1069 | 1068 | } |
| 1070 | 1069 | } |
| 1071 | 1070 | }); |
@@ -1094,12 +1093,12 @@ discard block |
||
| 1094 | 1093 | ->createBuilder($this->getModelClass()) |
| 1095 | 1094 | ->updateModels($allowedChanges) |
| 1096 | 1095 | ->addFiltersWithAndToTable($filters); |
| 1097 | - $saveMain = $this->builderSaveResourceOnUpdate($saveMain); |
|
| 1096 | + $saveMain = $this->builderSaveResourceOnUpdate($saveMain); |
|
| 1098 | 1097 | $saveMain->getSQL(); // prepare |
| 1099 | 1098 | |
| 1100 | 1099 | $this->clearBuilderParameters()->clearFetchParameters(); |
| 1101 | 1100 | |
| 1102 | - $this->inTransaction(function () use ($saveMain, $toMany, $index, &$updated) { |
|
| 1101 | + $this->inTransaction(function() use ($saveMain, $toMany, $index, &$updated) { |
|
| 1103 | 1102 | $updated = $saveMain->execute(); |
| 1104 | 1103 | |
| 1105 | 1104 | foreach ($toMany as $relationshipName => $secondaryIds) { |
@@ -1119,12 +1118,12 @@ discard block |
||
| 1119 | 1118 | ->prepareCreateInToManyRelationship($relationshipName, $index, $secondaryIdBindName) |
| 1120 | 1119 | ); |
| 1121 | 1120 | foreach ($secondaryIds as $secondaryId) { |
| 1122 | - $updated += (int)$saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute(); |
|
| 1121 | + $updated += (int) $saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute(); |
|
| 1123 | 1122 | } |
| 1124 | 1123 | } |
| 1125 | 1124 | }); |
| 1126 | 1125 | |
| 1127 | - return (int)$updated; |
|
| 1126 | + return (int) $updated; |
|
| 1128 | 1127 | } |
| 1129 | 1128 | |
| 1130 | 1129 | /** |
@@ -1208,7 +1207,7 @@ discard block |
||
| 1208 | 1207 | /** |
| 1209 | 1208 | * @inheritdoc |
| 1210 | 1209 | */ |
| 1211 | - public function fetchRow(QueryBuilder $builder, string $modelClass): ?array |
|
| 1210 | + public function fetchRow(QueryBuilder $builder, string $modelClass): ? array |
|
| 1212 | 1211 | { |
| 1213 | 1212 | $model = null; |
| 1214 | 1213 | |
@@ -1358,7 +1357,7 @@ discard block |
||
| 1358 | 1357 | * |
| 1359 | 1358 | * @return iterable |
| 1360 | 1359 | */ |
| 1361 | - protected function filterAttributesOnCreate(?string $index, iterable $attributes): iterable |
|
| 1360 | + protected function filterAttributesOnCreate(?string $index, iterable $attributes) : iterable |
|
| 1362 | 1361 | { |
| 1363 | 1362 | if ($index !== null) { |
| 1364 | 1363 | $pkName = $this->getModelSchemes()->getPrimaryKey($this->getModelClass()); |
@@ -1417,7 +1416,7 @@ discard block |
||
| 1417 | 1416 | $pkName = $this->getModelSchemes()->getPrimaryKey($parentClass); |
| 1418 | 1417 | |
| 1419 | 1418 | foreach ($childRelationships as $name) { |
| 1420 | - $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath . static::PATH_SEPARATOR . $name : $name; |
|
| 1419 | + $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath.static::PATH_SEPARATOR.$name : $name; |
|
| 1421 | 1420 | |
| 1422 | 1421 | $relationshipType = $this->getModelSchemes()->getRelationshipType($parentClass, $name); |
| 1423 | 1422 | list ($targetModelClass, $reverseRelName) = |
@@ -1438,7 +1437,7 @@ discard block |
||
| 1438 | 1437 | [$pkName => [FilterParameterInterface::OPERATION_EQUALS => [$parent->{$pkName}]]], |
| 1439 | 1438 | [] |
| 1440 | 1439 | ); |
| 1441 | - $child = $deDup->register($this->fetchResourceWithoutRelationships( |
|
| 1440 | + $child = $deDup->register($this->fetchResourceWithoutRelationships( |
|
| 1442 | 1441 | $clonedBuilder, |
| 1443 | 1442 | $clonedBuilder->getModelClass() |
| 1444 | 1443 | )); |
@@ -1459,7 +1458,7 @@ discard block |
||
| 1459 | 1458 | [$pkName => [FilterParameterInterface::OPERATION_EQUALS => [$parent->{$pkName}]]], |
| 1460 | 1459 | [] |
| 1461 | 1460 | ); |
| 1462 | - $children = $this->fetchPaginatedResourcesWithoutRelationships( |
|
| 1461 | + $children = $this->fetchPaginatedResourcesWithoutRelationships( |
|
| 1463 | 1462 | $clonedBuilder, |
| 1464 | 1463 | $clonedBuilder->getModelClass() |
| 1465 | 1464 | ); |
@@ -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) |