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

FormTypeExtensionInterface related deprecation #2445

Closed
javiereguiluz opened this issue Nov 28, 2018 · 2 comments
Closed

FormTypeExtensionInterface related deprecation #2445

javiereguiluz opened this issue Nov 28, 2018 · 2 comments

Comments

@javiereguiluz
Copy link
Collaborator

Describe the bug
I was testing a real app with Symfony 4.2 RC1 and got this deprecation reported:

Not implementing the static getExtendedTypes() method in
EasyCorp\Bundle\EasyAdminBundle\Form\Extension\EasyAdminExtension when
implementing the Symfony\Component\Form\FormTypeExtensionInterface is deprecated
since Symfony 4.2. The method will be added to the interface in 5.0.

@xabbuh as you worked on this, I'd like to ask you if it's safe to add the static getExtendedTypes() method even in 1.x branch or if older Symfony versions won't like it. Thanks!

@yceruto
Copy link
Collaborator

yceruto commented Nov 28, 2018

I think we should have both methods getExtendedTypes() and getExtendedType(), but the new method should have the code now, so the old one calls to the new one keeping BC prior to 4.2 and removing the deprecation warning since 4.2.

I'm thinking in something like this:

public function getExtendedType(): string
{
    return current(self::getExtendedTypes());
}

public static function getExtendedTypes(): iterable
{
    return [FormType::class];
}

@xabbuh
Copy link
Collaborator

xabbuh commented Nov 28, 2018

@yceruto using current() on an iterable may not play well with static code analyser tools, but apart from that your suggestion looks like the way to go

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