diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index bfb9fd71..4c284b51 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -7,7 +7,7 @@ jobs: steps: - uses: actions/checkout@master - name: PHPStan - uses: docker://jakzal/phpqa:php8.0 + uses: docker://jakzal/phpqa:php8.2 with: args: phpstan analyze --no-progress @@ -17,6 +17,6 @@ jobs: steps: - uses: actions/checkout@master - name: PHP-CS-Fixer - uses: docker://jakzal/phpqa:php8.0 + uses: docker://jakzal/phpqa:php8.2 with: args: php-cs-fixer fix --config=.php_cs.dist.php --dry-run --diff diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ddc5d574..b7a58bde 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,14 +13,13 @@ jobs: strategy: matrix: include: - - php: '7.4' - symfony-require: 4.4.* - - php: '8.0' - symfony-require: 5.3.* - - php: '8.0' - symfony-require: 6.0.* - stability: dev - php: '8.1' + symfony-require: 6.3.* + - php: '8.2' + symfony-require: 7.0.* + stability: dev + - php: '8.3' + continue-on-error: true fail-fast: false steps: diff --git a/composer.json b/composer.json index da41d438..79fbdaf2 100644 --- a/composer.json +++ b/composer.json @@ -12,22 +12,22 @@ "sort-packages": true }, "require": { - "php": ">=7.4", + "php": ">=8.1", "giggsey/libphonenumber-for-php": "^8.0", - "symfony/framework-bundle": "^4.4|^5.3|^6.0", - "symfony/intl": "^4.4|^5.3|^6.0", + "symfony/framework-bundle": "^5.4|^6.3|^7.0", + "symfony/intl": "^5.4|^6.3|^7.0", "symfony/polyfill-mbstring": "^1.28" }, "require-dev": { "doctrine/doctrine-bundle": "^1.12|^2.0", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "symfony/form": "^4.4|^5.3|^6.0", - "symfony/phpunit-bridge": "^6.2", - "symfony/property-access": "^4.4|^5.3|^6.0", - "symfony/serializer": "^4.4|^5.3|^6.0.1", - "symfony/twig-bundle": "^4.4|^5.3|^6.0", - "symfony/validator": "^4.4|^5.3|^6.0" + "symfony/form": "^5.4|^6.3|^7.0", + "symfony/phpunit-bridge": "^7.0", + "symfony/property-access": "^5.4|^6.3|^7.0", + "symfony/serializer": "^5.4|^6.3|^7.0", + "symfony/twig-bundle": "^5.4|^6.3|^7.0", + "symfony/validator": "^5.4|^6.3|^7.0" }, "suggest": { "doctrine/doctrine-bundle": "Add a DBAL mapping type", @@ -52,10 +52,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.6.x-dev" + "dev-master": "3.10.x-dev" } - }, - "conflict": { - "symfony/serializer": "6.0.0" } } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index e34a993a..85410572 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -4,8 +4,3 @@ parameters: - src - tests inferPrivatePropertyTypeFromConstructor: true - ignoreErrors: - - - message: "#^Attribute class Symfony\\\\Component\\\\Validator\\\\Attribute\\\\HasNamedArguments does not exist\\.$#" - count: 1 - path: src/Validator/Constraints/PhoneNumber.php diff --git a/tests/Validator/Constraints/PhoneNumberTest.php b/tests/Validator/Constraints/PhoneNumberTest.php index f4ebfda8..50d3ec36 100644 --- a/tests/Validator/Constraints/PhoneNumberTest.php +++ b/tests/Validator/Constraints/PhoneNumberTest.php @@ -24,10 +24,10 @@ public function testProperties() { $phoneNumber = new PhoneNumber(); - $this->assertObjectHasAttribute('message', $phoneNumber); - $this->assertObjectHasAttribute('type', $phoneNumber); - $this->assertObjectHasAttribute('defaultRegion', $phoneNumber); - $this->assertObjectHasAttribute('regionPath', $phoneNumber); + $this->assertObjectHasProperty('message', $phoneNumber); + $this->assertObjectHasProperty('type', $phoneNumber); + $this->assertObjectHasProperty('defaultRegion', $phoneNumber); + $this->assertObjectHasProperty('regionPath', $phoneNumber); } /** diff --git a/tests/Validator/Constraints/PhoneNumberValidatorTest.php b/tests/Validator/Constraints/PhoneNumberValidatorTest.php index e4abdf9f..04c5883a 100644 --- a/tests/Validator/Constraints/PhoneNumberValidatorTest.php +++ b/tests/Validator/Constraints/PhoneNumberValidatorTest.php @@ -21,6 +21,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader; +use Symfony\Component\Validator\Mapping\Loader\AttributeLoader; use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; /** @@ -68,8 +69,7 @@ public function testValidate($value, $violates, $type = null, $defaultRegion = n ->with($this->isType('string')) ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->method('addViolation') - ->willReturn($constraintViolationBuilder); + ->method('addViolation'); $this->context ->expects($this->once()) @@ -89,7 +89,13 @@ public function testValidate($value, $violates, $type = null, $defaultRegion = n public function testValidateFromAttribute() { $classMetadata = new ClassMetadata(PhoneNumberDummy::class); - (new AnnotationLoader())->loadClassMetadata($classMetadata); + if (class_exists(AttributeLoader::class)) { + (new AttributeLoader())->loadClassMetadata($classMetadata); + } else { + // AnnotationLoader have been removed in favor of AttributeLoader in 7.0 + /* @phpstan-ignore-next-line */ + (new AnnotationLoader())->loadClassMetadata($classMetadata); + } [$constraint1] = $classMetadata->properties['phoneNumber1']->constraints; [$constraint2] = $classMetadata->properties['phoneNumber2']->constraints;