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
Issues with phpdoc_to_return_type #4511
Comments
This PR was merged into the 2.15 branch. Discussion ---------- PhpdocToReturnType - Add support for Foo[][] fixes point two of #4511 backport of fixes done in #4583 by @jg-development , thanks! Commits ------- 35e96ed PhpdocToReturnType - Add support for Foo[][].
…nfalque, keradus) This PR was squashed before being merged into the 2.18 branch. Discussion ---------- Refactor conversion of PHPDoc to type declarations This PR: * refactors parts of `PhpdocToParamTypeFixer` and `PhpdocToReturnTypeFixer` to ease sharing common logic. * implements some points of #4511 Commits ------- 462260d Refactor conversion of PHPDoc to type declarations
checked off |
I looked at tests and I believe the only case missing is |
Since this issue has not had any activity within the last 90 days, I have marked it as stale. The purpose of this action is to enforce backlog review once in a while. This is mostly for maintainers and helps with keeping repository in good condition, because stale issues and PRs can accumulate over time and make it harder for others to find relevant information. It is also possible that some changes has been made to the repo already, and issue or PR became outdated, but wasn't closed for some reason. This action helps with periodic review and closing of such stale items in automated way. You may let maintainers handle this or verify current relevancy by yourself, to help with re-triage. Any activity will remove stale label so it won't be automatically closed at this point. I will close it if no further activity occurs within the next 30 days. |
@nicolas-grekas what's the current status from the Symfony side? I believe you don't need the support for PHP 7.1 ( |
Correct, thanks for the reminder. |
I'm playing with this rule on the Symfony codebase, here are some issues I found while doing so:
@return false
should become: bool
(PhpdocToReturnTypeFixer - Add support for true/false return type hints. #4580)@return object[][]
should become: array
(PhpdocToReturnType - Add support for Foo[][] #4589)@return string[]|int[]
should become: array
(Refactor conversion of PHPDoc to type declarations #4591)@return \Traversable|CacheItem[]
should become: iterable
(Refactor conversion of PHPDoc to type declarations #4591)@return iterable|VoterInterface[]
should become: iterable
(Refactor conversion of PHPDoc to type declarations #4591)@return $this
should become: object
(related to no_superfluous_phpdoc_tags fixer: return type self #3932), unless the method is final, in which case it should be: self
to allow using it on PHP 7.1@return static
should become: object
, unless the method is final, in which case it should be: self
to allow using it on PHP 7.1For the last two, we've decided it should be the rule for the Symfony codebase, so could be a separate rule maybe (forcing
: object
when areturn $this
/return static
annotation is found and a return type is found too)Note that I find a lot of false-positive editions related to return-type covariance: eg a child method declares
@return Foo[]
, which leads to: array
, while the parent says: iterable
. But I guess we're hitting the limit of the tool and that's fine, there must be some.The text was updated successfully, but these errors were encountered: