Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Description
Symfony 6 comes (almost) fully typed. If you're an open source package maintainer, adding a return type might cause BC breaks (as it forces your users to add the type as well if they implement or override the method).
We might consider,on a case by case basis, whether it's worth to postpone adding a type declaration for a specific method to Symfony 7. This might help you, as a maintainer, to release a new minor instead of a new major version to add support for Symfony 6.
In order to properly judge this, we ask you toinstall 5.4-dev in your package and run thetype patch utility twice (also temporarily install the
symfony/error-handler
component if it's not available already):$ SYMFONY_PATCH_TYPE_DECLARATIONS=force=1 ./vendor/bin/patch-type-declarations$ SYMFONY_PATCH_TYPE_DECLARATIONS=force=1 ./vendor/bin/patch-type-declarations
This script patches any methods that are private, final,
@internal
or tests.Please double check if the unpatched methods should not be final or internal (i.e. should a user really extend or use this class?).If thesecond runproduces any deprecations in the output for methods that must be considered public/protected, please copy paste them as a comment to this issue (including a link to the package). E.g:
https://github.com/wouterj/WouterJEloquentBundle
WouterJ\EloquentBundle\Command\SeedCommandMethod "Symfony\Component\Console\Command\Command::execute()" might add "int" as a native return type declaration in the future. Do the same in child class "WouterJ\EloquentBundle\Command\SeedCommand" now to avoid errors or add an explicit @return annotation to suppress this message.
Note that the current 6.0 branch reflects which types are not going to be included in that release. These still produce deprecations in 5.4+, which can be resolved by adding the
@return
PHPdoc.(please only post deprecations mentioning classes from Symfony, other deprecations should be reported in the relevant package issue tracker)
We don't promise anything, but we might postpone some types based on the feedback inthis issue. For instance, we already did for theCommand::execute(): int
method shown in the example.