From 053263ce98b0cadd0e6cb5165ba7d77896a2312a Mon Sep 17 00:00:00 2001 From: Florian Guimier Date: Wed, 8 Jan 2025 17:03:17 +0100 Subject: [PATCH 1/2] Update assoconnect/validator-bundle + drop SF 5 support --- .github/workflows/build.yml | 5 +++-- composer.json | 6 +++--- tests/Validator/Constraints/PercentValidatorTest.php | 7 +++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 306f5e3..7e64e98 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build on: push: - branches: [ master ] + branches: [ main ] pull_request: types: [opened, synchronize, reopened] @@ -11,7 +11,8 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.2', '8.3'] + dependency-versions: ['lowest', 'highest'] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/composer.json b/composer.json index 41a96de..b8adc7d 100644 --- a/composer.json +++ b/composer.json @@ -26,11 +26,11 @@ }, "require": { "php": "^7.4|^8.0", - "symfony/framework-bundle": "^5.0|^6.0|^7.0", + "symfony/framework-bundle": "^6.0|^7.0", "assoconnect/php-percent": "^1.1", "doctrine/dbal": "^2.10|^3.0", - "symfony/serializer": "^5.0|^6.0", - "assoconnect/validator-bundle": "^2.19" + "symfony/serializer": "^6.0", + "assoconnect/validator-bundle": "^2.32" }, "config": { "allow-plugins": { diff --git a/tests/Validator/Constraints/PercentValidatorTest.php b/tests/Validator/Constraints/PercentValidatorTest.php index c951e6f..99003f7 100644 --- a/tests/Validator/Constraints/PercentValidatorTest.php +++ b/tests/Validator/Constraints/PercentValidatorTest.php @@ -12,8 +12,11 @@ use Symfony\Component\Validator\Constraints\LessThanOrEqual; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\Type; -use Symfony\Component\Validator\ConstraintValidatorInterface; +use Symfony\Component\Validator\ConstraintValidator; +/** + * @extends ConstraintValidatorTestCase + */ class PercentValidatorTest extends ConstraintValidatorTestCase { protected function getConstraint(): Constraint @@ -21,7 +24,7 @@ protected function getConstraint(): Constraint return new Percent(10, 50); } - public function createValidator(): ConstraintValidatorInterface + public function createValidator(): ConstraintValidator { return new PercentValidator(); } From 20239a0efe39f67bb14de7ef9c9ae5ce35cff642 Mon Sep 17 00:00:00 2001 From: Florian Guimier Date: Wed, 8 Jan 2025 17:05:13 +0100 Subject: [PATCH 2/2] Fix --- src/Validator/Constraints/PercentValidator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Validator/Constraints/PercentValidator.php b/src/Validator/Constraints/PercentValidator.php index b3e77e6..9156a47 100644 --- a/src/Validator/Constraints/PercentValidator.php +++ b/src/Validator/Constraints/PercentValidator.php @@ -30,7 +30,7 @@ protected function isEmptyStringAccepted(): bool /** * @inheritDoc */ - protected function sanitizeValue($value): mixed + protected function sanitizeValue(mixed $value): mixed { if ($value instanceof \AssoConnect\PHPPercent\Percent) { return $value->toInteger(); @@ -38,7 +38,7 @@ protected function sanitizeValue($value): mixed return $value; } - protected function getValidatorsAndConstraints($value, Constraint $constraint): array + protected function getValidatorsAndConstraints(mixed $value, Constraint $constraint): array { if (!$constraint instanceof Percent) { throw new UnexpectedTypeException($constraint, Percent::class);