Sylius: Incompatible normalizers and denormalizers with SF4.4

Created on 15 Sep 2020  路  7Comments  路  Source: Sylius/Sylius

Sylius version affected: 1.8

Description
I get this exception and more similar when I have Symfony serializer 4.4 installed:

Compile Error: Declaration of Sylius\Bundle\ApiBundle\Swagger\ShopAuthenticationTokenDocumentationNormalizer::normalize($object, ?string $format = NULL, array $context = Array) must be compatible with Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize($object, $format = NULL, array $context = Array)

Steps to reproduce

  1. composer update --prefer-lowest
  2. bin/console

Possible Solution
Either make the normalizers and denormalizers compatible with Symfony serializer v4.4 or do a composer req symfony/serializer:"^5.0". I'd vote for the former solution.

Related
The same is true for Symfony property info component where I have this exception:

Compile Error: Declaration of Sylius\Bundle\ApiBundle\PropertyInfo\Extractor\EmptyPropertyListExtractor::getProperties(string $class, array $context = Array): ?array must be compatible with Symfony\Component\PropertyInfo\PropertyListExtractorInterface::getProperties($class, array $context = Array)
Bug

Most helpful comment

I believe #11981 solved the issue for now :)

All 7 comments

We also have this problem in the Clerk plugin

I can confirm this one

CI is passing because symfony/serializer is getting installed at 5.1. Nowhere in any Sylius package is a direct dependency to the Serializer component being declared, which is problematic in its own right because you're relying on it being included through transient dependencies.

Yes @mbabker you鈥檙e totally right. And is for this kind of issues that I provided the https://github.com/Sylius/Sylius/pull/10664 PR, but it has never been merged...

Hey folks, PropertyInfor was already fixed at #11911. The same should happen for serializers. In addition, @mmenozzi can we revive your PR?

Sure @lchrusciel. Let me know how I can help.

I believe #11981 solved the issue for now :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hmonglee picture hmonglee  路  3Comments

loic425 picture loic425  路  3Comments

stefandoorn picture stefandoorn  路  3Comments

mezoni picture mezoni  路  3Comments

crbelaus picture crbelaus  路  3Comments