Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deprecation for symfony/serializer 6.3 #148

Merged
merged 1 commit into from
May 23, 2023

Conversation

dmaicher
Copy link

@dmaicher dmaicher commented May 22, 2023

This fixes the following deprecations with Symfony 6.3:

$ vendor/bin/phpunit 
PHPUnit 9.6.8 by Sebastian Bergmann and contributors.

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

Testing 
...............................................................  63 / 156 ( 40%)
...SSS..SSSS..................W................................ 126 / 156 ( 80%)
..............................                                  156 / 156 (100%)

Time: 00:00.179, Memory: 26.00 MB

There was 1 warning:

1) Misd\PhoneNumberBundle\Tests\Validator\Constraints\PhoneNumberTest::testProperties
assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.

WARNINGS!
Tests: 156, Assertions: 234, Warnings: 1, Skipped: 7.

Remaining direct deprecation notices (2)

  1x: Class "Misd\PhoneNumberBundle\Serializer\Normalizer\PhoneNumberNormalizer" should implement method "Symfony\Component\Serializer\Normalizer\NormalizerInterface::getSupportedTypes(?string $format): array".
    1x in PhoneNumberNormalizerTest::testSupportNormalization from Misd\PhoneNumberBundle\Tests\Serializer\Normalizer

  1x: Class "Misd\PhoneNumberBundle\Serializer\Normalizer\PhoneNumberNormalizer" should implement method "Symfony\Component\Serializer\Normalizer\DenormalizerInterface::getSupportedTypes(?string $format): array".
    1x in PhoneNumberNormalizerTest::testSupportNormalization from Misd\PhoneNumberBundle\Tests\Serializer\Normalizer

fixes issue #147

@dmaicher dmaicher force-pushed the fix_issue_147 branch 2 times, most recently from 7f9b2da to f906266 Compare May 22, 2023 14:18
*/
public function getSupportedTypes(?string $format): array
{
return [PhoneNumber::class => false];
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used false to indicate that we cannot cache the calls to supportsDenormalization because there we also check is_string($data)

@maxhelias maxhelias requested a review from Nek- May 23, 2023 13:22
@maxhelias maxhelias merged commit cb058c3 into odolbeau:master May 23, 2023
@dmaicher dmaicher deleted the fix_issue_147 branch May 23, 2023 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants