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

Add PHP types to private methods and functions#49348

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@wouterj
Copy link
Member

@wouterjwouterj commentedFeb 12, 2023
edited
Loading

QA
Branch?6.3
Bug fix?no
New feature?no
Deprecations?yes
TicketsRef#47551, continues#49342
LicenseMIT
Doc PR-

This PR adds real PHP types to private, internal or final (excluding@final) methods based on Psalm's type inference. Many more return types are missing still, but let's do them in other contributions.

This change can result in BC breaks in multiple ways, so we should carefully review the changes:

  • A method may wrongly be considered "safe" by Psalter. If the method is unsafe (e.g.@final, but not yet realfinal), we should instead add a PHPdoc return type (seeAdd many missing PHPdoc return types #49349)
  • Psalm may not infer the correct set of return types. If an unexpected type is returned, this will result in a PHP error.

nicolas-grekas added a commit that referenced this pull requestFeb 13, 2023
This PR was merged into the 6.3 branch.Discussion----------Add many missing PHPdoc return types| Q             | A| ------------- | ---| Branch?       | 6.3| Bug fix?      | no| New feature?  | no| Deprecations? | yes| Tickets       | Ref#47551, continues#49342| License       | MIT| Doc PR        | -This PR adds lots of ``@return`` PHPdoc that we missed in the 5.4 branch. These will produce new deprecation warnings, if applications override one of these methods. It will not break backwards compatibility.Adding these PHPdoc in 6.3 already allow the community to test all these annotations for 6 months in stable version, before committing to adding them as PHP types in 7.0. This way, I hope we patch out any wrong type.This PR is done using a slightly modified Psalter script, based on Psalm's type inference. See#49348 for the counter PR adding real PHP types to private, final or internal methods.Commits-------e23d8be Add missing PHPdoc return types
@nicolas-grekasnicolas-grekasforce-pushed theissue-47551/return-types-php branch from02325f2 to384c9a6CompareFebruary 13, 2023 09:15
@nicolas-grekas
Copy link
Member

Thank you@wouterj.

@nicolas-grekasnicolas-grekas merged commit394ae7f intosymfony:6.3Feb 13, 2023
@wouterjwouterj deleted the issue-47551/return-types-php branchFebruary 13, 2023 09:45
nicolas-grekas added a commit that referenced this pull requestMar 2, 2023
…(fancyweb)This PR was merged into the 6.3 branch.Discussion----------[TwigBridge] Fix TwigDataCollector::getTime() return type| Q             | A| ------------- | ---| Branch?       | 6.3| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -Ref#49348It generates implicit incompatible float to int conversion deprecations.Commits-------29e2e13 [TwigBridge] Fix TwigDataCollector::getTime() return type
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@xabbuhxabbuhAwaiting requested review from xabbuhxabbuh is a code owner

@lyrixxlyrixxAwaiting requested review from lyrixxlyrixx is a code owner

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

@ycerutoycerutoAwaiting requested review from ycerutoyceruto is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

6.3

Development

Successfully merging this pull request may close these issues.

3 participants

@wouterj@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp