@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\Rules; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\Rules; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\Rules; |
| 4 | 4 | |
@@ -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 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $title = $this->formatMessage(ErrorCodes::INVALID_VALUE); |
| 232 | 232 | $details = $this->formatMessage(ErrorCodes::UNKNOWN_RELATIONSHIP); |
| 233 | 233 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 234 | - $this->getJsonApiErrorCollection()->addRelationshipError($name, $title, $details, (string)$status); |
|
| 234 | + $this->getJsonApiErrorCollection()->addRelationshipError($name, $title, $details, (string) $status); |
|
| 235 | 235 | $this->addErrorStatus($status); |
| 236 | 236 | } else { |
| 237 | 237 | assert($isFoundInToOne xor $isFoundInToMany); |
@@ -244,12 +244,11 @@ discard block |
||
| 244 | 244 | $this->executeStarts($this->getSerializer()::readRuleStartIndexes($ruleIndexes)); |
| 245 | 245 | $ruleIndex = $this->getSerializer()::readRuleIndex($ruleIndexes); |
| 246 | 246 | $isFoundInToOne === true ? |
| 247 | - $this->validateAsToOneRelationship($ruleIndex, $name, $jsonData) : |
|
| 248 | - $this->validateAsToManyRelationship($ruleIndex, $name, $jsonData); |
|
| 247 | + $this->validateAsToOneRelationship($ruleIndex, $name, $jsonData) : $this->validateAsToManyRelationship($ruleIndex, $name, $jsonData); |
|
| 249 | 248 | $this->executeEnds($this->getSerializer()::readRuleEndIndexes($ruleIndexes)); |
| 250 | 249 | |
| 251 | 250 | if (count($this->getErrorAggregator()) > 0) { |
| 252 | - $status = JsonApiResponse::HTTP_CONFLICT; |
|
| 251 | + $status = JsonApiResponse::HTTP_CONFLICT; |
|
| 253 | 252 | foreach ($this->getErrorAggregator()->get() as $error) { |
| 254 | 253 | $this->getJsonApiErrorCollection()->addValidationRelationshipError($error, $status); |
| 255 | 254 | $this->addErrorStatus($status); |
@@ -355,7 +354,7 @@ discard block |
||
| 355 | 354 | $title = $this->formatMessage(ErrorCodes::INVALID_VALUE); |
| 356 | 355 | $details = $this->formatMessage(ErrorCodes::TYPE_MISSING); |
| 357 | 356 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 358 | - $this->getJsonApiErrorCollection()->addDataTypeError($title, $details, (string)$status); |
|
| 357 | + $this->getJsonApiErrorCollection()->addDataTypeError($title, $details, (string) $status); |
|
| 359 | 358 | $this->addErrorStatus($status); |
| 360 | 359 | } |
| 361 | 360 | |
@@ -367,7 +366,7 @@ discard block |
||
| 367 | 366 | $status = JsonApiResponse::HTTP_CONFLICT; |
| 368 | 367 | foreach ($this->getErrorAggregator()->get() as $error) { |
| 369 | 368 | $details = $this->getMessage($error); |
| 370 | - $this->getJsonApiErrorCollection()->addDataTypeError($title, $details, (string)$status); |
|
| 369 | + $this->getJsonApiErrorCollection()->addDataTypeError($title, $details, (string) $status); |
|
| 371 | 370 | } |
| 372 | 371 | $this->addErrorStatus($status); |
| 373 | 372 | $this->getErrorAggregator()->clear(); |
@@ -404,7 +403,7 @@ discard block |
||
| 404 | 403 | $status = JsonApiResponse::HTTP_CONFLICT; |
| 405 | 404 | foreach ($this->getErrorAggregator()->get() as $error) { |
| 406 | 405 | $details = $this->getMessage($error); |
| 407 | - $this->getJsonApiErrorCollection()->addDataIdError($title, $details, (string)$status); |
|
| 406 | + $this->getJsonApiErrorCollection()->addDataIdError($title, $details, (string) $status); |
|
| 408 | 407 | } |
| 409 | 408 | $this->addErrorStatus($status); |
| 410 | 409 | $this->getErrorAggregator()->clear(); |
@@ -433,7 +432,7 @@ discard block |
||
| 433 | 432 | $title = $this->formatMessage(ErrorCodes::INVALID_VALUE); |
| 434 | 433 | $details = $this->formatMessage(ErrorCodes::INVALID_ATTRIBUTES); |
| 435 | 434 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 436 | - $this->getJsonApiErrorCollection()->addAttributesError($title, $details, (string)$status); |
|
| 435 | + $this->getJsonApiErrorCollection()->addAttributesError($title, $details, (string) $status); |
|
| 437 | 436 | $this->addErrorStatus($status); |
| 438 | 437 | } else { |
| 439 | 438 | // execute main validation block(s) |
@@ -445,7 +444,7 @@ discard block |
||
| 445 | 444 | $details = $this->formatMessage(ErrorCodes::UNKNOWN_ATTRIBUTE); |
| 446 | 445 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 447 | 446 | $this->getJsonApiErrorCollection() |
| 448 | - ->addDataAttributeError($name, $title, $details, (string)$status); |
|
| 447 | + ->addDataAttributeError($name, $title, $details, (string) $status); |
|
| 449 | 448 | $this->addErrorStatus($status); |
| 450 | 449 | } |
| 451 | 450 | } |
@@ -456,7 +455,7 @@ discard block |
||
| 456 | 455 | $this->executeEnds($this->getSerializer()::readRulesEndIndexes($this->getAttributeRules())); |
| 457 | 456 | |
| 458 | 457 | if (count($this->getErrorAggregator()) > 0) { |
| 459 | - $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
|
| 458 | + $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
|
| 460 | 459 | foreach ($this->getErrorAggregator()->get() as $error) { |
| 461 | 460 | $this->getJsonApiErrorCollection()->addValidationAttributeError($error, $status); |
| 462 | 461 | } |
@@ -490,7 +489,7 @@ discard block |
||
| 490 | 489 | $title = $this->formatMessage(ErrorCodes::INVALID_VALUE); |
| 491 | 490 | $details = $this->formatMessage(ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
| 492 | 491 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 493 | - $this->getJsonApiErrorCollection()->addRelationshipsError($title, $details, (string)$status); |
|
| 492 | + $this->getJsonApiErrorCollection()->addRelationshipsError($title, $details, (string) $status); |
|
| 494 | 493 | $this->addErrorStatus($status); |
| 495 | 494 | } else { |
| 496 | 495 | // ok we got to something that could be null or a valid relationship |
@@ -510,7 +509,7 @@ discard block |
||
| 510 | 509 | $details = $this->formatMessage(ErrorCodes::UNKNOWN_RELATIONSHIP); |
| 511 | 510 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 512 | 511 | $this->getJsonApiErrorCollection() |
| 513 | - ->addRelationshipError($name, $title, $details, (string)$status); |
|
| 512 | + ->addRelationshipError($name, $title, $details, (string) $status); |
|
| 514 | 513 | $this->addErrorStatus($status); |
| 515 | 514 | } |
| 516 | 515 | } |
@@ -524,7 +523,7 @@ discard block |
||
| 524 | 523 | )); |
| 525 | 524 | |
| 526 | 525 | if (count($this->getErrorAggregator()) > 0) { |
| 527 | - $status = JsonApiResponse::HTTP_CONFLICT; |
|
| 526 | + $status = JsonApiResponse::HTTP_CONFLICT; |
|
| 528 | 527 | foreach ($this->getErrorAggregator()->get() as $error) { |
| 529 | 528 | $this->getJsonApiErrorCollection()->addValidationRelationshipError($error, $status); |
| 530 | 529 | } |
@@ -556,7 +555,7 @@ discard block |
||
| 556 | 555 | $title = $this->formatMessage(ErrorCodes::INVALID_VALUE); |
| 557 | 556 | $details = $this->formatMessage(ErrorCodes::INVALID_RELATIONSHIP); |
| 558 | 557 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 559 | - $this->getJsonApiErrorCollection()->addRelationshipError($name, $title, $details, (string)$status); |
|
| 558 | + $this->getJsonApiErrorCollection()->addRelationshipError($name, $title, $details, (string) $status); |
|
| 560 | 559 | $this->addErrorStatus($status); |
| 561 | 560 | } |
| 562 | 561 | } |
@@ -598,7 +597,7 @@ discard block |
||
| 598 | 597 | $title = $this->formatMessage(ErrorCodes::INVALID_VALUE); |
| 599 | 598 | $details = $this->formatMessage(ErrorCodes::INVALID_RELATIONSHIP); |
| 600 | 599 | $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
| 601 | - $this->getJsonApiErrorCollection()->addRelationshipError($name, $title, $details, (string)$status); |
|
| 600 | + $this->getJsonApiErrorCollection()->addRelationshipError($name, $title, $details, (string) $status); |
|
| 602 | 601 | $this->addErrorStatus($status); |
| 603 | 602 | } |
| 604 | 603 | } |
@@ -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\Rules; |
| 4 | 4 | |
@@ -84,7 +84,6 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | return $result === true ? |
| 87 | - static::createSuccessReply($values) : |
|
| 88 | - static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
| 87 | + static::createSuccessReply($values) : static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
| 89 | 88 | } |
| 90 | 89 | } |
@@ -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\Rules; |
| 4 | 4 | |
@@ -83,8 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $reply = $count <= 0 ? |
| 86 | - static::createSuccessReply($value) : |
|
| 87 | - static::createErrorReply($context, $value, ErrorCodes::UNIQUE_IN_DATABASE_SINGLE); |
|
| 86 | + static::createSuccessReply($value) : static::createErrorReply($context, $value, ErrorCodes::UNIQUE_IN_DATABASE_SINGLE); |
|
| 88 | 87 | |
| 89 | 88 | return $reply; |
| 90 | 89 | } |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare (strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Limoncello\Flute\Validation\JsonApi\Rules; |
| 4 | 4 | |
@@ -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\Rules; |
| 4 | 4 | |
@@ -85,13 +85,12 @@ discard block |
||
| 85 | 85 | ->where($builder->expr()->in($primaryName, $placeholders)) |
| 86 | 86 | ->execute(); |
| 87 | 87 | |
| 88 | - $count = (int)$statement->fetchColumn(); |
|
| 88 | + $count = (int) $statement->fetchColumn(); |
|
| 89 | 89 | $result = $count === count($values); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $reply = $result === true ? |
| 93 | - static::createSuccessReply($values) : |
|
| 94 | - static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
| 93 | + static::createSuccessReply($values) : static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
| 95 | 94 | |
| 96 | 95 | return $reply; |
| 97 | 96 | } |
@@ -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\Rules; |
| 4 | 4 | |
@@ -73,8 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $reply = $foundInvalidType === null ? |
| 76 | - static::createSuccessReply($indexes) : |
|
| 77 | - static::createErrorReply($context, $foundInvalidType, ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
|
| 76 | + static::createSuccessReply($indexes) : static::createErrorReply($context, $foundInvalidType, ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
|
| 78 | 77 | |
| 79 | 78 | return $reply; |
| 80 | 79 | } |