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

Skip to content

Remove array return type from Request::toArray() #38403

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

Merged
merged 1 commit into from
Oct 4, 2020
Merged

Remove array return type from Request::toArray() #38403

merged 1 commit into from
Oct 4, 2020

Conversation

GrahamCampbell
Copy link
Contributor

Q A
Branch? master
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #38400
License MIT
Doc PR -

Laravel already extends Symfony's Request class and defines it's own toArray method. #38224 added a new toArray method to this class with a different signature to the one that is in Laravel, causing fatal errors (laravel/framework#34660). I think the best course of action here is to remove the return type for now, and only add it in Symfony 6. This will allow Symfony 6.0 and Laravel 11 to synchronize adding the return type.

Older versions of Laravel can't just change their signature to add an array return type to them, because that would be a breaking change for Laravel users extending Laravel's request class. I'm thinking, in particular, API packages and the like, or just straight up application code.

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is more important to be pragmatic rather than correct here.

Thank you.

@pipisco
Copy link

pipisco commented Oct 4, 2020

Thank you very match! <3

@fabpot
Copy link
Member

fabpot commented Oct 4, 2020

Thank you @GrahamCampbell.

@fabpot fabpot merged commit c6a747d into symfony:master Oct 4, 2020
@xabbuh xabbuh added this to the next milestone Oct 4, 2020
@GrahamCampbell GrahamCampbell deleted the patch-1 branch October 4, 2020 10:16
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.2 Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

http-foundation - toArray() will break Laravel projects
8 participants