-
-
Notifications
You must be signed in to change notification settings - Fork 221
Add required return types to MigrationsCollector for Symfony 8 compatibility #644
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
base: 3.7.x
Are you sure you want to change the base?
Conversation
Update `MigrationsCollector::reset()` to `MigrationsCollector::reset():void`. For compatibiity with `Symfony\Component\HttpKernel\DataCollector\reset()` 8.x,
|
I'm requiring @stof's review because he was not OK with this kind of thing for the bundle. Maybe the right thing here would be to release 4.0.0, but maybe things are different here since we (wrongly) published 3.x versions of this bundle that allow Symfony 8. I'll attempt to address that last point in #644 @stof, with the above in mind, are you OK with this PR? If not, would you be OK with a PR that would use a trait to add the return types iff |
| use function count; | ||
| use function get_class; | ||
|
|
||
| /** @final */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class is annotated @final, but that annotation was added in 3.5.0 (see 25b672a)
|
@greg0ire regarding your suggestion of possibly using a trait to add the return types iff In projects of mine being upgraded to symfony 8, I've been preemptively applying a patch to add the return types. This is for projects already on symfony 7.4. Adding return types where none are present in an interface seems to be fine from a syntactic correctness perspective. |
It is a breaking change for any class extending the class where you add types (but then again the class is annotated with |
|
Gotcha, thanks for the clarification. |
Method signatures in
MigrationsCollectorrequire updating to be compatible with base classes and interfaces in Symfony 8.voidreturn type toMigrationsCollector::collect()voidreturn type toMigrationsCollector::reset()stringreturn type toMigrationsCollector::getName()The
stringandvoidreturn types were added in PHP 7.0 and 7.1, respectively. As the latest version of this package supports a minimum PHP version of 7.2 I see no backwards compatibility issues or breaking changes.I'm looking to merge this into
3.7.xpurely to allow for the soonest possible release. Please adjust if this is not what I should be doing.