Description
Symfony version(s) affected
7.2.0
Description
After upgrading Symfony to version 7.2, my project stopped working with the following error:
Cannot create a "Symfony\Component\TypeInfo\Type\NullableType" with "mixed" because it is already nullable in . (which is being imported from "/var/www/back/config/routes/api_platform.yaml"). Make sure there is a loader supporting the "api_platform" type.
This error points to the api_platform type in my config/routes/api_platform.yaml file:
api_platform:
resource: .
type: api_platform
prefix: /api
The issue seems to be related to changes introduced in Symfony 7.2, specifically in the redesigned TypeInfo component, as explained in this blog post: New in Symfony 7.2: Redesigned TypeInfo Component.
It appears that the mixed type is now always nullable, and API Platform may not handle this properly. Before the update, everything worked fine with Symfony 7.1.
How to reproduce
Steps to Reproduce:
Use Symfony 7.2 and the latest version of API Platform.
Create a basic api_platform.yaml file like the one above.
Access any route managed by API Platform.
Expected Behavior:
The routes should be processed normally without any errors.
Actual Behavior:
The error mentioned above is thrown, and the application fails to start.
http://prntscr.com/tT42Y1r46TGI
Steps Taken:
Updated all dependencies to their latest versions.
Cleared the Symfony cache (php bin/console cache:clear).
Verified that the error disappears when downgrading Symfony to version 7.1.
Please let me know if further details or logs are needed.
Possible Solution
No response
Additional Context
No response