Skip to content

Commit

Permalink
IBX-8180: Applied review remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
barw4 committed Jul 16, 2024
1 parent 0c19ebe commit b0fb202
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"symfony/routing": "^5.3",
"symfony/security-bundle": "^5.3",
"symfony/security-csrf": "^5.3",
"symfony/yaml": "^5.3"
"symfony/yaml": "^5.3",
"webmozart/assert": "^1.11"
},
"require-dev": {
"ibexa/ci-scripts": "^0.2@dev",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Ibexa\Rest\Server\Exceptions\ValidationFailedException;
use Ibexa\Rest\Server\Validation\Builder\Input\Parser\BaseInputParserValidatorBuilder;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Webmozart\Assert\Assert;

abstract class AbstractDestinationLocationParser extends BaseParser
{
Expand Down Expand Up @@ -56,8 +57,11 @@ private function getLocationByPath(string $path): Location
private function extractLocationIdFromPath(string $path): int
{
$pathParts = explode('/', $path);
$lastPart = array_pop($pathParts);

return (int)array_pop($pathParts);
Assert::integerish($lastPart);

return (int)$lastPart;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints as Assert;

class SwapLocationInputValidatorBuilder extends BaseInputParserValidatorBuilder
final class SwapLocationInputValidatorBuilder extends BaseInputParserValidatorBuilder
{
protected function buildConstraint(): Constraint
{
Expand Down

0 comments on commit b0fb202

Please sign in to comment.