Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[META] Symfony 6 return type declarations #43021

Closed
@wouterj

Description

@wouterj

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.

  1. 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 thesymfony/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
  2. 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?).

  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp