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

Error in JaneObjectNormalizer after updating symfony/serializer to 7.x #45

Closed
theteknocat opened this issue Feb 10, 2024 · 2 comments
Closed

Comments

@theteknocat
Copy link

theteknocat commented Feb 10, 2024

After updating the symfony/serializer package from 6 to 7, the following error is generated:

Declaration of JoliCode\Harvest\Api\Normalizer\JaneObjectNormalizer::denormalize($data, $class, $format = null, array $context = []) must be compatible with Symfony\Component\Serializer\Normalizer\DenormalizerInterface::denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed

There is also a similar error for the normalize method. The symfony/serializer is a dependency of jane-php/open-api-runtime, though it is just a dev requirement and doesn't need to be used in production deployments. It will happily use versions ^5.4, ^6.4 or ^7.0 of the serializer, so not everyone will necessarily run into this if whatever project they are using this library in does not end up installing a 7.x version of the serializer. It would all depend on how composer determines which set of packages are needed to make all the dependencies work.

I ran a composer update on Laravel 9 with PHP 8.2 and it upgraded the serializer from 6 to 7. It's easy enough to update the JaneObjectNormalizer to be compatible, but that may impact it's compatibility with older versions. I don't know the best way to handle that, but I will submit a pull request to provide a patch and leave it to people who are smarter than be to figure out how to make it compatible with all possible versions that may be used.

@theteknocat theteknocat changed the title Declaration of JoliCode\Harvest\Api\Normalizer\JaneObjectNormalizer::denormalize($data, $class, $format = null, array $context = []) must be compatible with Symfony\Component\Serializer\Normalizer\DenormalizerInterface::denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed Error in JaneObjectNormalizer after updating symfony/serializer to 7.x Feb 10, 2024
@theteknocat
Copy link
Author

In further testing, it seems there are many normalizers with incompatible code, so I'll update the pull request with all of them updated.

@theteknocat
Copy link
Author

Resolved by #47.

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 a pull request may close this issue.

1 participant