Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Validator] Breaking change caused by return types upgrade from 4.3 to 4.4 #34478

Closed
@s-duval

Description

@s-duval

Symfony version(s) affected: 4.4.0

Description
Upgrading from 4.3 to 4.4 today causing cache clearing and the bundle : sonata admin bundle to throw errors.

From the commit "Add return types to internal|final|private methods" 3211618

Return type was forced even on magic methods which can cause breaking changes on third party libraries overriding them without specifying the return type

How to reproduce
To reproduce the bug simply create a new Constraint class overriding one of the method where the return type was forced in 4.4, this class will work in 4.3 but not when upgrading in 4.4

class MyConstraint extends Constraint { public function __sleep(){ ...} }

Possible Solution
Maybe don't force return types on 4.4 version to keep retro compatibility
and do those breaking changes in 5 ?

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