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

Symfony 6 serializer compatibility #4635

Closed
mitalcoi opened this issue Jan 17, 2022 · 3 comments
Closed

Symfony 6 serializer compatibility #4635

mitalcoi opened this issue Jan 17, 2022 · 3 comments

Comments

@mitalcoi
Copy link
Contributor

mitalcoi commented Jan 17, 2022

API Platform version(s) affected:2.6.8

Description
Trying to upgrade project to symfony 6, getting Compile Error:

" Fatal error: Declaration of ApiPlatform\Core\JsonLd\Serializer\ObjectNormalizer::normalize($object, $format = null, array $context = []) must be compatible with Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize(mixed $object, ?string $format = null, array $context = []): ArrayObject|array|string|int|float|bool|null in /Users/mitalcoi/development/phonedo_project/phonedo/vendor/api-platform/core/src/JsonLd/Serializer/ObjectNormalizer.php on line 65
"

The only way to temporary fix - is to update directly in vendor/ folder specific types:
Снимок экрана 2022-01-17 в 14 05 52

@PierreRebeilleau
Copy link
Contributor

What's your php version ? And Symfony\Component\Serializer\Normalizer\NormalizerInterface should look like this in vendor after update to sf6:

image

@chalasr
Copy link
Contributor

chalasr commented Jan 17, 2022

The NormalizerInterface::normalize() return type declaration has been removed in symfony/serializer v6.0.1 so it looks like you installed v6.0.0. Try running composer update symfony/serializer --no-cache

@mitalcoi
Copy link
Contributor Author

Upgrading to serializer v6.0.1 fixed issue, thx a lot!

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

No branches or pull requests

3 participants