Skip to content
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

Conditional return type is not supported in MissingTraversableTypeHintSpecification #1159

Closed
simPod opened this issue Feb 4, 2021 · 6 comments

Comments

@simPod
Copy link
Contributor

simPod commented Feb 4, 2021

/**
 * @return (true is true ? array<int> : array<string>)
 */
function a(): array
{
    return [];
}

gives

SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification

@kukulich
Copy link
Contributor

kukulich commented Feb 4, 2021

I think there's no support for this in https://github.com/phpstan/phpdoc-parser

@simPod
Copy link
Contributor Author

simPod commented Feb 4, 2021

Ah so the reason is phpstan parser don't know conditional types yet?

@kukulich
Copy link
Contributor

kukulich commented Feb 4, 2021

Yes. The support has to be added to parser first, then to this repository.

@simPod
Copy link
Contributor Author

simPod commented Feb 4, 2021

Might be related to phpstan/phpstan#3853 I guess

@kukulich
Copy link
Contributor

Implemented in be7898d

@kukulich kukulich added this to the 7.1 milestone Mar 29, 2022
@github-actions
Copy link

github-actions bot commented May 1, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants