diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 778f1f25..9da1a3da 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,15 +13,29 @@ jobs: - '8.3' symfony: - '5.4' - - '6.2' - - '6.3' - # - '6.4' - # - '7.0' + - '6.4' minimumStability: - 'stable' composerOptions: - '--prefer-stable --prefer-lowest' - '--prefer-stable' + include: + - symfony: '7.0' + php: '8.2' + minimumStability: 'stable' + composerOptions: '--prefer-stable --prefer-lowest' + - symfony: '7.0' + php: '8.2' + minimumStability: 'stable' + composerOptions: '--prefer-stable' + - symfony: '7.0' + php: '8.3' + minimumStability: 'stable' + composerOptions: '--prefer-stable --prefer-lowest' + - symfony: '7.0' + php: '8.3' + minimumStability: 'stable' + composerOptions: '--prefer-stable' steps: - uses: shivammathur/setup-php@v2 with: diff --git a/README.md b/README.md index 0a82bd85..859575f4 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Are you often tired to repeat static choices like gender or civility in your app ## Requirements - PHP >= 8.0 -- Symfony 5.4 or 6.* +- Symfony 5.4, 6.4 or 7.* ## Installation diff --git a/composer.json b/composer.json index 67722a12..ff747cda 100644 --- a/composer.json +++ b/composer.json @@ -18,12 +18,12 @@ ], "require": { "php": ">=8.0", - "symfony/config": "^5.4 || ^6.2@dev", - "symfony/dependency-injection": "^5.4 || ^6.2@dev", - "symfony/form": "^5.4 || ^6.2@dev", - "symfony/http-foundation": "^5.4 || ^6.2@dev", - "symfony/http-kernel": "^5.4 || ^6.2@dev", - "symfony/validator": "^5.4 || ^6.2@dev", + "symfony/config": "^5.4 || ^6.4 || ^7.0@dev", + "symfony/dependency-injection": "^5.4 || ^6.4 || ^7.0@dev", + "symfony/form": "^5.4 || ^6.4 || ^7.0@dev", + "symfony/http-foundation": "^5.4 || ^6.4 || ^7.0@dev", + "symfony/http-kernel": "^5.4 || ^6.4 || ^7.0@dev", + "symfony/validator": "^5.4 || ^6.4 || ^7.0@dev", "twig/twig": "^2.15.3 || ^3.4.3" }, "require-dev": { @@ -35,8 +35,8 @@ "phpspec/prophecy": "1.18.0", "phpstan/phpstan": "1.10.59", "rector/rector": "1.0.1", - "symfony/twig-bridge": "^5.4 || ^6.2@dev", - "symfony/var-dumper": "^5.4 || ^6.2@dev", + "symfony/twig-bridge": "^5.4 || ^6.4 || ^7.0@dev", + "symfony/var-dumper": "^5.4 || ^6.4 || ^7.0@dev", "webmozart/assert": "1.11.0" }, "minimum-stability": "stable", diff --git a/src/Knp/DictionaryBundle/Symfony/SupportedVersion.php b/src/Knp/DictionaryBundle/Symfony/SupportedVersion.php deleted file mode 100644 index ed50d7be..00000000 --- a/src/Knp/DictionaryBundle/Symfony/SupportedVersion.php +++ /dev/null @@ -1,14 +0,0 @@ -dictionaries[$constraint->name]; + $values = $dictionary->getKeys(); + + if (!\in_array($value, $values, true)) { + $this->context->addViolation( + $constraint->message, + [ + '{{ key }}' => $this->varToString($value), + '{{ keys }}' => implode(', ', array_map([$this, 'varToString'], $values)), + ] + ); + } + } + private function varToString(mixed $var): string { if (null === $var) { diff --git a/src/Knp/DictionaryBundle/Validator/Constraints/DictionaryValidator/SymfonyCompatibilityTrait.php b/src/Knp/DictionaryBundle/Validator/Constraints/DictionaryValidator/SymfonyCompatibilityTrait.php deleted file mode 100644 index 5febe2f9..00000000 --- a/src/Knp/DictionaryBundle/Validator/Constraints/DictionaryValidator/SymfonyCompatibilityTrait.php +++ /dev/null @@ -1,78 +0,0 @@ -dictionaries[$constraint->name]; - $values = $dictionary->getKeys(); - - if (!\in_array($value, $values, true)) { - $this->context->addViolation( - $constraint->message, - [ - '{{ key }}' => $this->varToString($value), - '{{ keys }}' => implode(', ', array_map([$this, 'varToString'], $values)), - ] - ); - } - } - } - - break; - - case Symfony\SupportedVersion::v6_2: - case Symfony\SupportedVersion::v6_3: - trait SymfonyCompatibilityTrait - { - public function validate(mixed $value, Constraint $constraint): void - { - if (!$constraint instanceof Dictionary) { - throw new UnexpectedTypeException($constraint, Dictionary::class); - } - - if (null === $value || '' === $value) { - return; - } - - $dictionary = $this->dictionaries[$constraint->name]; - $values = $dictionary->getKeys(); - - if (!\in_array($value, $values, true)) { - $this->context->addViolation( - $constraint->message, - [ - '{{ key }}' => $this->varToString($value), - '{{ keys }}' => implode(', ', array_map([$this, 'varToString'], $values)), - ] - ); - } - } - } - - break; -}