Skip to content

Compatibility issue with Symfony 7.2.1: Symfony\Component\TypeInfo\Type::union(): Return value must be of type ... error #59223

@scorpion3dd

Description

@scorpion3dd

Symfony version(s) affected

7.2.1

Description

After upgrading Symfony to version 7.2.1, my project stopped working with the following error:
Symfony\Component\TypeInfo\Type::union(): Return value must be of type Symfony\Component\TypeInfo\Type\UnionType, Symfony\Component\TypeInfo\Type\BuiltinType returned

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.

How to reproduce

Steps to Reproduce:

Use Symfony 7.2.1.
Open any application page.
Expected Behavior:
The application page should be processed normally without any errors.

Actual Behavior:
The error mentioned above is thrown, and the application fails to start.
http://prntscr.com/Q8XV-Y0k2tzy

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.2.1.

Please let me know if further details or logs are needed.

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions