Skip to content

Commit

Permalink
fix deprecation for symfony/serializer 6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaicher authored and maxhelias committed May 23, 2023
1 parent 0291f17 commit cb058c3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- name: PHP-CS-Fixer
uses: docker://jakzal/phpqa:php8.0
with:
args: php-cs-fixer fix --config=.php_cs.dist.php --dry-run
args: php-cs-fixer fix --config=.php_cs.dist.php --dry-run --diff
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"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",
Expand Down
6 changes: 6 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="./vendor/autoload.php" colors="true">
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="999999" />
</php>
<testsuites>
<testsuite name="MisdPhoneNumberBundle Test Suite">
<directory>tests</directory>
Expand All @@ -11,4 +14,7 @@
<directory>src</directory>
</whitelist>
</filter>
<listeners>
<listener class="\Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
</phpunit>
10 changes: 9 additions & 1 deletion src/Serializer/Normalizer/PhoneNumberNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ public function denormalize($data, $class, $format = null, array $context = []):
*/
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
{
return 'libphonenumber\PhoneNumber' === $type && \is_string($data);
return PhoneNumber::class === $type && \is_string($data);
}

/**
* for symfony/serializer >= 6.3.
*/
public function getSupportedTypes(?string $format): array
{
return [PhoneNumber::class => false];
}
}

0 comments on commit cb058c3

Please sign in to comment.