@@ -52,17 +52,17 @@ |
||
| 52 | 52 | public function withIncludes(iterable $includes): self; |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * @return iterable |
|
| 55 | + * @return \Generator |
|
| 56 | 56 | */ |
| 57 | 57 | public function getMappedFilters(): iterable; |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * @return iterable |
|
| 60 | + * @return \Generator |
|
| 61 | 61 | */ |
| 62 | 62 | public function getMappedSorts(): iterable; |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | - * @return iterable |
|
| 65 | + * @return \Generator |
|
| 66 | 66 | */ |
| 67 | 67 | public function getMappedIncludes(): iterable; |
| 68 | 68 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Contracts\Http\Query; |
| 4 | 4 | |
@@ -756,9 +756,9 @@ discard block |
||
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | /** |
| 759 | - * @param iterable $paths (string[]) |
|
| 759 | + * @param iterable|null $paths (string[]) |
|
| 760 | 760 | * |
| 761 | - * @return iterable |
|
| 761 | + * @return Generator |
|
| 762 | 762 | */ |
| 763 | 763 | private static function getPaths(iterable $paths): iterable |
| 764 | 764 | { |
@@ -1399,7 +1399,7 @@ discard block |
||
| 1399 | 1399 | * @param string $modelClass |
| 1400 | 1400 | * @param string $keyColumnName |
| 1401 | 1401 | * |
| 1402 | - * @return iterable |
|
| 1402 | + * @return Generator |
|
| 1403 | 1403 | * |
| 1404 | 1404 | * @throws DBALException |
| 1405 | 1405 | * |
@@ -1503,7 +1503,7 @@ discard block |
||
| 1503 | 1503 | * @param null|string $index |
| 1504 | 1504 | * @param iterable $attributes |
| 1505 | 1505 | * |
| 1506 | - * @return iterable |
|
| 1506 | + * @return Generator |
|
| 1507 | 1507 | */ |
| 1508 | 1508 | protected function filterAttributesOnCreate(?string $index, iterable $attributes): iterable |
| 1509 | 1509 | { |
@@ -1523,7 +1523,7 @@ discard block |
||
| 1523 | 1523 | /** |
| 1524 | 1524 | * @param iterable $attributes |
| 1525 | 1525 | * |
| 1526 | - * @return iterable |
|
| 1526 | + * @return Generator |
|
| 1527 | 1527 | */ |
| 1528 | 1528 | protected function filterAttributesOnUpdate(iterable $attributes): iterable |
| 1529 | 1529 | { |
@@ -1722,10 +1722,10 @@ discard block |
||
| 1722 | 1722 | |
| 1723 | 1723 | /** |
| 1724 | 1724 | * @param iterable $attributes |
| 1725 | - * @param array $typeNames |
|
| 1725 | + * @param Type[] $typeNames |
|
| 1726 | 1726 | * @param AbstractPlatform $platform |
| 1727 | 1727 | * |
| 1728 | - * @return iterable |
|
| 1728 | + * @return Generator |
|
| 1729 | 1729 | * |
| 1730 | 1730 | * @throws DBALException |
| 1731 | 1731 | */ |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Api; |
| 4 | 4 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | throw new InvalidArgumentException($this->getMessage(Messages::MSG_ERR_INVALID_ARGUMENT)); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - assert(call_user_func(function () use ($indexes) { |
|
| 212 | + assert(call_user_func(function() use ($indexes) { |
|
| 213 | 213 | $allOk = true; |
| 214 | 214 | |
| 215 | 215 | foreach ($indexes as $index) { |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | $classAtPath = new ArrayObject(); |
| 764 | 764 | $idsAtPath = new ArrayObject(); |
| 765 | 765 | |
| 766 | - $registerModelAtRoot = function ($model) use ($modelStorage, $modelsAtPath, $idsAtPath): void { |
|
| 766 | + $registerModelAtRoot = function($model) use ($modelStorage, $modelsAtPath, $idsAtPath): void { |
|
| 767 | 767 | self::registerModelAtPath( |
| 768 | 768 | $model, |
| 769 | 769 | static::ROOT_PATH, |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | assert(is_string($pathPiece)); |
| 852 | 852 | $parent = $tmpPath; |
| 853 | 853 | $tmpPath = empty($tmpPath) === true ? |
| 854 | - $pathPiece : $tmpPath . static::PATH_SEPARATOR . $pathPiece; |
|
| 854 | + $pathPiece : $tmpPath.static::PATH_SEPARATOR.$pathPiece; |
|
| 855 | 855 | $normalizedPaths[$tmpPath] = [$parent, $pathPiece]; |
| 856 | 856 | $pathsDepths[$parent] = $parentDepth++; |
| 857 | 857 | } |
@@ -999,7 +999,7 @@ discard block |
||
| 999 | 999 | $this->createCountBuilderFromBuilder($this->createIndexModelBuilder()) |
| 1000 | 1000 | )->execute()->fetchColumn(); |
| 1001 | 1001 | |
| 1002 | - return $result === false ? null : (int)$result; |
|
| 1002 | + return $result === false ? null : (int) $result; |
|
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | 1005 | /** |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | ): ModelQueryBuilder { |
| 1021 | 1021 | assert( |
| 1022 | 1022 | $this->getModelSchemas()->hasRelationship($this->getModelClass(), $relationshipName), |
| 1023 | - "Relationship `$relationshipName` do not exist in model `" . $this->getModelClass() . '`' |
|
| 1023 | + "Relationship `$relationshipName` do not exist in model `".$this->getModelClass().'`' |
|
| 1024 | 1024 | ); |
| 1025 | 1025 | |
| 1026 | 1026 | // as we read data from a relationship our main table and model would be the table/model in the relationship |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | if ($this->hasFilters() === true) { |
| 1039 | 1039 | $filters = $this->getFilters(); |
| 1040 | 1040 | $sorts = $this->getSorts(); |
| 1041 | - $joinCondition = $this->areFiltersWithAnd() === true ? ModelQueryBuilder::AND : ModelQueryBuilder::OR; |
|
| 1041 | + $joinCondition = $this->areFiltersWithAnd() === true ? ModelQueryBuilder:: AND : ModelQueryBuilder:: OR ; |
|
| 1042 | 1042 | $builder->addRelationshipFiltersAndSorts($reverseRelName, $filters, $sorts, $joinCondition); |
| 1043 | 1043 | } |
| 1044 | 1044 | // ... and the input filters to actual data we select |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | ) { |
| 1070 | 1070 | assert( |
| 1071 | 1071 | $this->getModelSchemas()->hasRelationship($this->getModelClass(), $name), |
| 1072 | - "Relationship `$name` do not exist in model `" . $this->getModelClass() . '`' |
|
| 1072 | + "Relationship `$name` do not exist in model `".$this->getModelClass().'`' |
|
| 1073 | 1073 | ); |
| 1074 | 1074 | |
| 1075 | 1075 | // depending on the relationship type we expect the result to be either single resource or a collection |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | ): array { |
| 1099 | 1099 | assert( |
| 1100 | 1100 | $this->getModelSchemas()->hasRelationship($this->getModelClass(), $name), |
| 1101 | - "Relationship `$name` do not exist in model `" . $this->getModelClass() . '`' |
|
| 1101 | + "Relationship `$name` do not exist in model `".$this->getModelClass().'`' |
|
| 1102 | 1102 | ); |
| 1103 | 1103 | |
| 1104 | 1104 | // depending on the relationship type we expect the result to be either single resource or a collection |
@@ -1167,7 +1167,7 @@ discard block |
||
| 1167 | 1167 | |
| 1168 | 1168 | $this->clearFetchParameters(); |
| 1169 | 1169 | |
| 1170 | - return (int)$deleted; |
|
| 1170 | + return (int) $deleted; |
|
| 1171 | 1171 | } |
| 1172 | 1172 | |
| 1173 | 1173 | /** |
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | |
| 1184 | 1184 | $this->clearFetchParameters(); |
| 1185 | 1185 | |
| 1186 | - return (int)$deleted > 0; |
|
| 1186 | + return (int) $deleted > 0; |
|
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | 1189 | /** |
@@ -1204,7 +1204,7 @@ discard block |
||
| 1204 | 1204 | |
| 1205 | 1205 | $this->clearBuilderParameters()->clearFetchParameters(); |
| 1206 | 1206 | |
| 1207 | - $this->inTransaction(function () use ($saveMain, $toMany, &$index) { |
|
| 1207 | + $this->inTransaction(function() use ($saveMain, $toMany, &$index) { |
|
| 1208 | 1208 | $saveMain->execute(); |
| 1209 | 1209 | |
| 1210 | 1210 | // if no index given will use last insert ID as index |
@@ -1241,12 +1241,12 @@ discard block |
||
| 1241 | 1241 | ->createBuilder($this->getModelClass()) |
| 1242 | 1242 | ->updateModels($allowedChanges) |
| 1243 | 1243 | ->addFiltersWithAndToTable($filters); |
| 1244 | - $saveMain = $this->builderSaveResourceOnUpdate($saveMain); |
|
| 1244 | + $saveMain = $this->builderSaveResourceOnUpdate($saveMain); |
|
| 1245 | 1245 | $saveMain->getSQL(); // prepare |
| 1246 | 1246 | |
| 1247 | 1247 | $this->clearBuilderParameters()->clearFetchParameters(); |
| 1248 | 1248 | |
| 1249 | - $this->inTransaction(function () use ($saveMain, $toMany, $index, &$updated) { |
|
| 1249 | + $this->inTransaction(function() use ($saveMain, $toMany, $index, &$updated) { |
|
| 1250 | 1250 | $updated = $saveMain->execute(); |
| 1251 | 1251 | |
| 1252 | 1252 | $builderHook = Closure::fromCallable([$this, 'builderSaveRelationshipOnUpdate']); |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | )->execute(); |
| 1263 | 1263 | |
| 1264 | 1264 | // add new ones |
| 1265 | - $updated += $this->addInToManyRelationship( |
|
| 1265 | + $updated += $this->addInToManyRelationship( |
|
| 1266 | 1266 | $connection, |
| 1267 | 1267 | $index, |
| 1268 | 1268 | $relationshipName, |
@@ -1272,7 +1272,7 @@ discard block |
||
| 1272 | 1272 | } |
| 1273 | 1273 | }); |
| 1274 | 1274 | |
| 1275 | - return (int)$updated; |
|
| 1275 | + return (int) $updated; |
|
| 1276 | 1276 | } |
| 1277 | 1277 | |
| 1278 | 1278 | /** |
@@ -1289,9 +1289,9 @@ discard block |
||
| 1289 | 1289 | public function createInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int |
| 1290 | 1290 | { |
| 1291 | 1291 | // Check that relationship is `BelongsToMany` |
| 1292 | - assert(call_user_func(function () use ($name): bool { |
|
| 1292 | + assert(call_user_func(function() use ($name): bool { |
|
| 1293 | 1293 | $relType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name); |
| 1294 | - $errMsg = "Relationship `$name` of class `" . $this->getModelClass() . |
|
| 1294 | + $errMsg = "Relationship `$name` of class `".$this->getModelClass(). |
|
| 1295 | 1295 | '` either is not `belongsToMany` or do not exist in the class.'; |
| 1296 | 1296 | $isOk = $relType === RelationshipTypes::BELONGS_TO_MANY; |
| 1297 | 1297 | |
@@ -1313,9 +1313,9 @@ discard block |
||
| 1313 | 1313 | public function removeInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int |
| 1314 | 1314 | { |
| 1315 | 1315 | // Check that relationship is `BelongsToMany` |
| 1316 | - assert(call_user_func(function () use ($name): bool { |
|
| 1316 | + assert(call_user_func(function() use ($name): bool { |
|
| 1317 | 1317 | $relType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name); |
| 1318 | - $errMsg = "Relationship `$name` of class `" . $this->getModelClass() . |
|
| 1318 | + $errMsg = "Relationship `$name` of class `".$this->getModelClass(). |
|
| 1319 | 1319 | '` either is not `belongsToMany` or do not exist in the class.'; |
| 1320 | 1320 | $isOk = $relType === RelationshipTypes::BELONGS_TO_MANY; |
| 1321 | 1321 | |
@@ -1483,7 +1483,7 @@ discard block |
||
| 1483 | 1483 | { |
| 1484 | 1484 | $countBuilder = $this->createBuilder($this->getModelClass()); |
| 1485 | 1485 | $countBuilder->setParameters($builder->getParameters()); |
| 1486 | - $countBuilder->select('COUNT(*)')->from('(' . $builder->getSQL() . ') AS RESULT'); |
|
| 1486 | + $countBuilder->select('COUNT(*)')->from('('.$builder->getSQL().') AS RESULT'); |
|
| 1487 | 1487 | |
| 1488 | 1488 | return $countBuilder; |
| 1489 | 1489 | } |
@@ -1517,7 +1517,7 @@ discard block |
||
| 1517 | 1517 | |
| 1518 | 1518 | foreach ($secondaryIdentities as $secondaryId) { |
| 1519 | 1519 | try { |
| 1520 | - $inserted += (int)$saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute(); |
|
| 1520 | + $inserted += (int) $saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute(); |
|
| 1521 | 1521 | } /** @noinspection PhpRedundantCatchClauseInspection */ catch (UcvException $exception) { |
| 1522 | 1522 | // Spec: If all of the specified resources can be added to, or are already present in, |
| 1523 | 1523 | // the relationship then the server MUST return a successful response. |
@@ -1764,7 +1764,7 @@ discard block |
||
| 1764 | 1764 | |
| 1765 | 1765 | $pkName = $this->getModelSchemas()->getPrimaryKey($parentClass); |
| 1766 | 1766 | |
| 1767 | - $registerModelAtPath = function ($model, string $path) use ($deDup, $modelsAtPath, $idsAtPath) { |
|
| 1767 | + $registerModelAtPath = function($model, string $path) use ($deDup, $modelsAtPath, $idsAtPath) { |
|
| 1768 | 1768 | return self::registerModelAtPath( |
| 1769 | 1769 | $model, |
| 1770 | 1770 | $path, |
@@ -1776,7 +1776,7 @@ discard block |
||
| 1776 | 1776 | }; |
| 1777 | 1777 | |
| 1778 | 1778 | foreach ($childRelationships as $name) { |
| 1779 | - $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath . static::PATH_SEPARATOR . $name : $name; |
|
| 1779 | + $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath.static::PATH_SEPARATOR.$name : $name; |
|
| 1780 | 1780 | |
| 1781 | 1781 | $relationshipType = $this->getModelSchemas()->getRelationshipType($parentClass, $name); |
| 1782 | 1782 | list ($targetModelClass, $reverseRelName) = |
@@ -1831,7 +1831,7 @@ discard block |
||
| 1831 | 1831 | [$pkName => [FilterParameterInterface::OPERATION_EQUALS => [$parent->{$pkName}]]], |
| 1832 | 1832 | [] |
| 1833 | 1833 | ); |
| 1834 | - $children = $this->fetchPaginatedResourcesWithoutRelationships( |
|
| 1834 | + $children = $this->fetchPaginatedResourcesWithoutRelationships( |
|
| 1835 | 1835 | $clonedBuilder, |
| 1836 | 1836 | $clonedBuilder->getModelClass() |
| 1837 | 1837 | ); |
@@ -409,7 +409,7 @@ |
||
| 409 | 409 | * @param string $parameterName |
| 410 | 410 | * @param iterable $value |
| 411 | 411 | * |
| 412 | - * @return iterable |
|
| 412 | + * @return Generator |
|
| 413 | 413 | * |
| 414 | 414 | * @SuppressWarnings(PHPMD.CyclomaticComplexity) |
| 415 | 415 | */ |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Http\Query; |
| 4 | 4 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | public function getMappedIncludes(): iterable |
| 250 | 250 | { |
| 251 | 251 | $fromSchema = $this->getRootSchema(); |
| 252 | - $getMappedRelLinks = function (iterable $links) use ($fromSchema) : iterable { |
|
| 252 | + $getMappedRelLinks = function(iterable $links) use ($fromSchema) : iterable { |
|
| 253 | 253 | foreach ($links as $link) { |
| 254 | 254 | assert(is_string($link)); |
| 255 | 255 | $fromSchemaClass = get_class($fromSchema); |
@@ -299,14 +299,14 @@ discard block |
||
| 299 | 299 | // ['rel2_name1', ], |
| 300 | 300 | // ['rel3_name1', 'rel3_name2', 'rel3_name3', ], |
| 301 | 301 | // ] |
| 302 | - $includeAsModelNames = function (iterable $relationships): iterable { |
|
| 302 | + $includeAsModelNames = function(iterable $relationships): iterable { |
|
| 303 | 303 | foreach ($relationships as $relationship) { |
| 304 | 304 | assert($relationship instanceof RelationshipInterface); |
| 305 | 305 | yield $relationship->getNameInModel(); |
| 306 | 306 | } |
| 307 | 307 | }; |
| 308 | 308 | $mappedIncludes = $this->getMappedIncludes(); |
| 309 | - $getIncludes = function () use ($mappedIncludes, $includeAsModelNames) : iterable { |
|
| 309 | + $getIncludes = function() use ($mappedIncludes, $includeAsModelNames) : iterable { |
|
| 310 | 310 | foreach ($mappedIncludes as $relationships) { |
| 311 | 311 | yield $includeAsModelNames($relationships); |
| 312 | 312 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** |
| 382 | - * @return iterable |
|
| 382 | + * @return Generator |
|
| 383 | 383 | * |
| 384 | 384 | * @SuppressWarnings(PHPMD.ElseExpression) |
| 385 | 385 | */ |
@@ -421,9 +421,9 @@ discard block |
||
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | /** |
| 424 | - * @param iterable $fieldsFromParent |
|
| 424 | + * @param Generator $fieldsFromParent |
|
| 425 | 425 | * |
| 426 | - * @return iterable |
|
| 426 | + * @return Generator |
|
| 427 | 427 | * |
| 428 | 428 | * @SuppressWarnings(PHPMD.StaticAccess) |
| 429 | 429 | * @SuppressWarnings(PHPMD.ElseExpression) |
@@ -456,9 +456,9 @@ discard block |
||
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | /** |
| 459 | - * @param iterable $sortsFromParent |
|
| 459 | + * @param Generator $sortsFromParent |
|
| 460 | 460 | * |
| 461 | - * @return iterable |
|
| 461 | + * @return Generator |
|
| 462 | 462 | * |
| 463 | 463 | * @SuppressWarnings(PHPMD.StaticAccess) |
| 464 | 464 | * @SuppressWarnings(PHPMD.ElseExpression) |
@@ -488,9 +488,9 @@ discard block |
||
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | /** |
| 491 | - * @param iterable $includesFromParent |
|
| 491 | + * @param Generator $includesFromParent |
|
| 492 | 492 | * |
| 493 | - * @return iterable |
|
| 493 | + * @return Generator |
|
| 494 | 494 | * |
| 495 | 495 | * @SuppressWarnings(PHPMD.StaticAccess) |
| 496 | 496 | * @SuppressWarnings(PHPMD.ElseExpression) |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | /** |
| 523 | - * @param iterable $iterable |
|
| 523 | + * @param Generator $iterable |
|
| 524 | 524 | * |
| 525 | 525 | * @return array |
| 526 | 526 | */ |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | * @param int $ruleIndex |
| 684 | 684 | * @param iterable $values |
| 685 | 685 | * |
| 686 | - * @return iterable |
|
| 686 | + * @return Generator |
|
| 687 | 687 | */ |
| 688 | 688 | private function validateValues(int $ruleIndex, iterable $values): iterable |
| 689 | 689 | { |
@@ -698,9 +698,9 @@ discard block |
||
| 698 | 698 | |
| 699 | 699 | /** |
| 700 | 700 | * @param int $ruleIndex |
| 701 | - * @param iterable $opsAndArgs |
|
| 701 | + * @param Generator $opsAndArgs |
|
| 702 | 702 | * |
| 703 | - * @return iterable |
|
| 703 | + * @return Generator |
|
| 704 | 704 | */ |
| 705 | 705 | private function validateFilterArguments(int $ruleIndex, iterable $opsAndArgs): iterable |
| 706 | 706 | { |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | * @param string $parameterName |
| 859 | 859 | * @param array $value |
| 860 | 860 | * |
| 861 | - * @return iterable |
|
| 861 | + * @return Generator |
|
| 862 | 862 | * |
| 863 | 863 | * @SuppressWarnings(PHPMD.ElseExpression) |
| 864 | 864 | */ |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\JsonApi; |
| 4 | 4 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | ) { |
| 190 | 190 | assert( |
| 191 | 191 | in_array(JsonApiQueryRulesSerializerInterface::class, class_implements($serializerClass)), |
| 192 | - "`$serializerClass` should implement interface `" . JsonApiQueryRulesSerializerInterface::class . '`.' |
|
| 192 | + "`$serializerClass` should implement interface `".JsonApiQueryRulesSerializerInterface::class.'`.' |
|
| 193 | 193 | ); |
| 194 | 194 | |
| 195 | 195 | $parameters = []; |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | { |
| 692 | 692 | // no validation rule means we should accept any input value |
| 693 | 693 | if ($ruleIndexes === null) { |
| 694 | - return is_numeric($value) === true ? (int)$value : 0; |
|
| 694 | + return is_numeric($value) === true ? (int) $value : 0; |
|
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | $ruleIndex = $this->serializerClass::readRuleMainIndex($ruleIndexes); |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | $validatedValue = $this->readSingleCapturedValue(); |
| 704 | 704 | |
| 705 | - return (int)$validatedValue; |
|
| 705 | + return (int) $validatedValue; |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | /** |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | public function fetchResources(QueryBuilder $builder, string $modelClass): PaginatedDataInterface; |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | - * @param QueryBuilder|null $builder |
|
| 123 | + * @param QueryBuilder $builder |
|
| 124 | 124 | * @param string|null $modelClass |
| 125 | 125 | * |
| 126 | 126 | * @return mixed|null |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @param string $modelClass |
| 141 | 141 | * @param string $columnName |
| 142 | 142 | * |
| 143 | - * @return iterable |
|
| 143 | + * @return \Generator |
|
| 144 | 144 | */ |
| 145 | 145 | public function fetchColumn(QueryBuilder $builder, string $modelClass, string $columnName): iterable; |
| 146 | 146 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Contracts\Api; |
| 4 | 4 | |
@@ -161,7 +161,7 @@ |
||
| 161 | 161 | public static function readRulesEndIndexes(array $arrayRuleIndexes): array; |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | - * @param array $arrayRuleIndexes |
|
| 164 | + * @param integer[] $arrayRuleIndexes |
|
| 165 | 165 | * @param string $name |
| 166 | 166 | * |
| 167 | 167 | * @return array |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Contracts\Validation; |
| 4 | 4 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
| 220 | - * @param iterable $attributes |
|
| 220 | + * @param \Generator $attributes |
|
| 221 | 221 | * |
| 222 | 222 | * @return self |
| 223 | 223 | * |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
| 242 | - * @param iterable $attributes |
|
| 242 | + * @param \Generator $attributes |
|
| 243 | 243 | * |
| 244 | 244 | * @return self |
| 245 | 245 | * |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * @param string $modelClass |
| 263 | 263 | * @param iterable $attributes |
| 264 | 264 | * |
| 265 | - * @return iterable |
|
| 265 | + * @return \Generator |
|
| 266 | 266 | * |
| 267 | 267 | * @SuppressWarnings(PHPMD.StaticAccess) |
| 268 | 268 | * |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
| 400 | - * @param iterable $filters |
|
| 400 | + * @param \Limoncello\Flute\Api\iterable|null $filters |
|
| 401 | 401 | * |
| 402 | 402 | * @return self |
| 403 | 403 | * |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | /** |
| 416 | - * @param iterable $filters |
|
| 416 | + * @param \Limoncello\Flute\Api\iterable|null $filters |
|
| 417 | 417 | * |
| 418 | 418 | * @return self |
| 419 | 419 | * |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | /** |
| 432 | - * @param iterable $filters |
|
| 432 | + * @param \Limoncello\Flute\Api\iterable|null $filters |
|
| 433 | 433 | * |
| 434 | 434 | * @return self |
| 435 | 435 | * |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | /** |
| 526 | - * @param iterable $sortParameters |
|
| 526 | + * @param \Limoncello\Flute\Api\iterable|null $sortParameters |
|
| 527 | 527 | * |
| 528 | 528 | * @return self |
| 529 | 529 | * |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Adapters; |
| 4 | 4 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * Condition joining method. |
| 52 | 52 | */ |
| 53 | - public const OR = self::AND + 1; |
|
| 53 | + public const OR = self:: AND + 1; |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @var string |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | string $relationshipName, |
| 466 | 466 | ?iterable $relationshipFilters, |
| 467 | 467 | ?iterable $relationshipSorts, |
| 468 | - int $joinIndividuals = self::AND, |
|
| 469 | - int $joinRelationship = self::AND |
|
| 468 | + int $joinIndividuals = self:: AND , |
|
| 469 | + int $joinRelationship = self:: AND |
|
| 470 | 470 | ): self { |
| 471 | 471 | $targetAlias = null; |
| 472 | 472 | |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | $reversePk = $isBelongsTo === true ? |
| 479 | 479 | $this->getModelSchemas()->getReversePrimaryKey($this->getModelClass(), $relationshipName)[0] : null; |
| 480 | 480 | |
| 481 | - $addWith = $joinIndividuals === self::AND ? $this->expr()->andX() : $this->expr()->orX(); |
|
| 481 | + $addWith = $joinIndividuals === self:: AND ? $this->expr()->andX() : $this->expr()->orX(); |
|
| 482 | 482 | |
| 483 | 483 | foreach ($relationshipFilters as $columnName => $operationsWithArgs) { |
| 484 | 484 | if ($columnName === $reversePk) { |
@@ -498,14 +498,14 @@ discard block |
||
| 498 | 498 | foreach ($operationsWithArgs as $operation => $arguments) { |
| 499 | 499 | assert( |
| 500 | 500 | is_iterable($arguments) === true || is_array($arguments) === true, |
| 501 | - "Operation arguments are missing for `$columnName` column. " . |
|
| 501 | + "Operation arguments are missing for `$columnName` column. ". |
|
| 502 | 502 | 'Use an empty array as an empty argument list.' |
| 503 | 503 | ); |
| 504 | 504 | $addWith->add($this->createFilterExpression($fullColumnName, $operation, $arguments)); |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | if ($addWith->count() > 0) { |
| 508 | - $joinRelationship === self::AND ? $this->andWhere($addWith) : $this->orWhere($addWith); |
|
| 508 | + $joinRelationship === self:: AND ? $this->andWhere($addWith) : $this->orWhere($addWith); |
|
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | } |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | foreach ($operationsWithArgs as $operation => $arguments) { |
| 647 | 647 | assert( |
| 648 | 648 | is_iterable($arguments) === true || is_array($arguments) === true, |
| 649 | - "Operation arguments are missing for `$columnName` column. " . |
|
| 649 | + "Operation arguments are missing for `$columnName` column. ". |
|
| 650 | 650 | 'Use an empty array as an empty argument list.' |
| 651 | 651 | ); |
| 652 | 652 | $expression->add($this->createFilterExpression($fullColumnName, $operation, $arguments)); |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | { |
| 700 | 700 | $platform = $this->getConnection()->getDatabasePlatform(); |
| 701 | 701 | |
| 702 | - return $platform->quoteSingleIdentifier($tableOrAlias) . '.' . $platform->quoteSingleIdentifier($column); |
|
| 702 | + return $platform->quoteSingleIdentifier($tableOrAlias).'.'.$platform->quoteSingleIdentifier($column); |
|
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | /** |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | */ |
| 742 | 742 | public function createAlias(string $tableName): string |
| 743 | 743 | { |
| 744 | - $alias = $tableName . (++$this->aliasIdCounter); |
|
| 744 | + $alias = $tableName.(++$this->aliasIdCounter); |
|
| 745 | 745 | $this->knownAliases[$tableName] = $alias; |
| 746 | 746 | |
| 747 | 747 | return $alias; |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | string $targetColumn |
| 765 | 765 | ): string { |
| 766 | 766 | $targetAlias = $this->createAlias($targetTable); |
| 767 | - $joinCondition = $this->quoteDoubleIdentifier($fromAlias, $fromColumn) . '=' . |
|
| 767 | + $joinCondition = $this->quoteDoubleIdentifier($fromAlias, $fromColumn).'='. |
|
| 768 | 768 | $this->quoteDoubleIdentifier($targetAlias, $targetColumn); |
| 769 | 769 | |
| 770 | 770 | $this->innerJoin( |
@@ -977,7 +977,7 @@ discard block |
||
| 977 | 977 | } else { |
| 978 | 978 | assert( |
| 979 | 979 | $value !== null, |
| 980 | - 'It seems you are trying to use `null` with =, >, <, or etc operator. ' . |
|
| 980 | + 'It seems you are trying to use `null` with =, >, <, or etc operator. '. |
|
| 981 | 981 | 'Use `is null` or `not null` instead.' |
| 982 | 982 | ); |
| 983 | 983 | assert(is_string($value), "Only strings, booleans and integers are supported."); |
@@ -251,7 +251,7 @@ |
||
| 251 | 251 | * @param FactoryInterface $errorFactory |
| 252 | 252 | * @param FormatterFactoryInterface $formatterFactory |
| 253 | 253 | * |
| 254 | - * @return ResponseInterface |
|
| 254 | + * @return string |
|
| 255 | 255 | */ |
| 256 | 256 | protected static function defaultCreate( |
| 257 | 257 | string $requestBody, |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Http\Traits; |
| 4 | 4 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $title = $formatter->formatMessage(Messages::MSG_ERR_CANNOT_CREATE_NON_UNIQUE_RESOURCE); |
| 281 | 281 | $details = null; |
| 282 | 282 | $errorCode = JsonApiResponse::HTTP_CONFLICT; |
| 283 | - $errors->addDataError($title, $details, (string)$errorCode); |
|
| 283 | + $errors->addDataError($title, $details, (string) $errorCode); |
|
| 284 | 284 | |
| 285 | 285 | throw new JsonApiException($errors); |
| 286 | 286 | } |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | list ($index, $attributes, $toMany) = static::mapSchemaDataToModelData($captures, $schemaClass, $schemaInfo); |
| 410 | 410 | |
| 411 | 411 | try { |
| 412 | - $updated = $crud->update((string)$index, $attributes, $toMany); |
|
| 412 | + $updated = $crud->update((string) $index, $attributes, $toMany); |
|
| 413 | 413 | } /** @noinspection PhpRedundantCatchClauseInspection */ catch (UniqueConstraintViolationException $exception) { |
| 414 | 414 | $errors = $errorFactory->createErrorCollection(); |
| 415 | 415 | $formatter = $formatterFactory->createFormatter(Messages::NAMESPACE_NAME); |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | ->formatMessage(Messages::MSG_ERR_CANNOT_UPDATE_WITH_UNIQUE_CONSTRAINT_VIOLATION); |
| 418 | 418 | $details = null; |
| 419 | 419 | $errorCode = JsonApiResponse::HTTP_CONFLICT; |
| 420 | - $errors->addDataError($title, $details, (string)$errorCode); |
|
| 420 | + $errors->addDataError($title, $details, (string) $errorCode); |
|
| 421 | 421 | |
| 422 | 422 | throw new JsonApiException($errors); |
| 423 | 423 | } |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | $modelClass = $schemaClass::MODEL; |
| 625 | 625 | assert($schemaInfo->hasRelationship($modelClass, $modelRelName)); |
| 626 | 626 | assert( |
| 627 | - ($type =$schemaInfo->getRelationshipType($modelClass, $modelRelName)) === RelationshipTypes::BELONGS_TO || |
|
| 627 | + ($type = $schemaInfo->getRelationshipType($modelClass, $modelRelName)) === RelationshipTypes::BELONGS_TO || |
|
| 628 | 628 | $type === RelationshipTypes::BELONGS_TO_MANY |
| 629 | 629 | ); |
| 630 | 630 | |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | ): string { |
| 876 | 876 | $schema = $jsonSchemas->getSchema($model); |
| 877 | 877 | $selfLink = $schema->getSelfLink($model); |
| 878 | - $urlPrefix = (string)$requestUri->withPath('')->withQuery('')->withFragment(''); |
|
| 878 | + $urlPrefix = (string) $requestUri->withPath('')->withQuery('')->withFragment(''); |
|
| 879 | 879 | $fullUrl = $selfLink->getStringRepresentation($urlPrefix); |
| 880 | 880 | |
| 881 | 881 | return $fullUrl; |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | */ |
| 889 | 889 | private static function assertClassValueDefined(?string $value): void |
| 890 | 890 | { |
| 891 | - assert(empty($value) === false, 'Value should be defined in `' . static::class . '`.'); |
|
| 891 | + assert(empty($value) === false, 'Value should be defined in `'.static::class.'`.'); |
|
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | /** |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | { |
| 902 | 902 | assert( |
| 903 | 903 | array_key_exists($interface, class_implements($class)) === true, |
| 904 | - "Class `$class` should implement `" . $interface . '` interface.' |
|
| 904 | + "Class `$class` should implement `".$interface.'` interface.' |
|
| 905 | 905 | ); |
| 906 | 906 | } |
| 907 | 907 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Http\ThrowableHandlers; |
| 4 | 4 | |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | $details = null; |
| 133 | 133 | if ($this->isDebug === true) { |
| 134 | 134 | $message = $throwable->getMessage(); |
| 135 | - $details = (string)$throwable; |
|
| 135 | + $details = (string) $throwable; |
|
| 136 | 136 | } |
| 137 | - $errors->add(new Error(null, null, null, (string)$httpCode, null, $message, $details)); |
|
| 137 | + $errors->add(new Error(null, null, null, (string) $httpCode, null, $message, $details)); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | // encode the error and send to client |