diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7796b66..497faec 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,44 +1,45 @@ name: Tests on: - push: - branches: [master] - pull_request: - branches: [master] - schedule: - - cron: "0 7 * * 1" + push: + branches: [master] + pull_request: + branches: [master] + schedule: + - cron: '0 7 * * 1' jobs: - unit-tests: - runs-on: ubuntu-latest - strategy: - matrix: - php: ["7.4", "8.0", "8.1"] - sf: ["5.4.*", "6.0.*", "6.1.*"] - exclude: - - php: "7.4" - sf: "6.1.*" - - php: "8.0" - sf: "6.1.*" - - php: "7.4" - sf: "6.0.*" - steps: - - uses: actions/checkout@v2 - - uses: php-actions/composer@v6 - with: - php_version: "${{ matrix.php }}" - command: require symfony/serializer:${{ matrix.sf }} --no-update - - uses: php-actions/composer@v6 - with: - php_version: "${{ matrix.php }}" - command: update - - uses: php-actions/phpunit@v3 - with: - configuration: phpunit.xml.dist - memory_limit: 256M - php_version: "${{ matrix.php }}" - - uses: php-actions/phpstan@v3 - with: - php_version: "${{ matrix.php }}" - level: max - path: src/ + unit-tests: + runs-on: ubuntu-latest + strategy: + matrix: + php: ['7.4', '8.0', '8.1'] + sf: ['5.4.*', '6.4.*', '7.0.*'] + exclude: + - php: '7.4' + sf: '6.4.*' + - php: '8.0' + sf: '6.4.*' + - php: '8.1' + sf: '7.0.*' + steps: + - uses: actions/checkout@v2 + - uses: php-actions/composer@v6 + with: + php_version: '${{ matrix.php }}' + command: require symfony/serializer:${{ matrix.sf }} --no-update + - uses: php-actions/composer@v6 + with: + php_version: '${{ matrix.php }}' + command: update + - uses: php-actions/phpunit@v3 + with: + configuration: phpunit.xml.dist + memory_limit: 256M + php_version: '${{ matrix.php }}' + version: 9.5 + - uses: php-actions/phpstan@v3 + with: + php_version: '${{ matrix.php }}' + level: max + path: src/ diff --git a/composer.json b/composer.json index d94461c..f8b80e2 100644 --- a/composer.json +++ b/composer.json @@ -13,12 +13,12 @@ } }, "require": { - "php": "^7.4|^8.0|^8.1", + "php": "^7.4|^8.0", "ramsey/uuid": "^4.0", - "symfony/serializer": "^5.4|^6.0" + "symfony/serializer": "^5.4|^6.0|^7.0" }, "require-dev": { - "symfony/property-access": "^5.4|^6.0", + "symfony/property-access": "^5.4|^6.0|^7.0", "phpdocumentor/reflection-docblock": "^5.3", "phpunit/phpunit": "^9.5", "phpstan/phpstan": "^1.8" diff --git a/src/UuidDenormalizer.php b/src/UuidDenormalizer.php index 203087e..621dd84 100644 --- a/src/UuidDenormalizer.php +++ b/src/UuidDenormalizer.php @@ -15,15 +15,11 @@ class UuidDenormalizer implements DenormalizerInterface { /** - * {@inheritdoc} - * * @param array $context * * @throws UnexpectedValueException - * - * @return UuidInterface|null */ - public function denormalize($data, $type, $format = null, array $context = []) + public function denormalize(mixed $data, string $type, string $format = null, array $context = []): ?UuidInterface { if (null === $data) { return null; @@ -37,12 +33,17 @@ public function denormalize($data, $type, $format = null, array $context = []) } /** - * {@inheritdoc} - * * @param array $context */ - public function supportsDenormalization($data, string $type, string $format = null, array $context = []) + public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool { return Uuid::class === $type || UuidInterface::class === $type; } + + public function getSupportedTypes(?string $format): array + { + return [ + UuidInterface::class => true, + ]; + } } diff --git a/src/UuidNormalizer.php b/src/UuidNormalizer.php index 9ed3aad..e414233 100644 --- a/src/UuidNormalizer.php +++ b/src/UuidNormalizer.php @@ -13,25 +13,25 @@ class UuidNormalizer implements NormalizerInterface { /** - * {@inheritdoc} - * - * @param array $context - * @param UuidInterface $object - * - * @return string + * @param array $context */ - public function normalize($object, $format = null, array $context = []) + public function normalize(mixed $object, $format = null, array $context = []): string { return $object->toString(); } /** - * {@inheritdoc} - * * @param array $context */ - public function supportsNormalization($data, $format = null, array $context = []) + public function supportsNormalization(mixed $data, $format = null, array $context = []): bool { return $data instanceof UuidInterface; } + + public function getSupportedTypes(?string $format): array + { + return [ + UuidInterface::class => true, + ]; + } }