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

Closure: report missing function parameter typehint and missing return type #87

Open
Slamdunk opened this issue Aug 22, 2019 · 2 comments

Comments

@Slamdunk
Copy link

Hi, I would like to enable for Closures the two rules already present for normal functions, MissingFunctionParameterTypehintRule and MissingFunctionReturnTypehintRule.

I found that master branch has this commit 491540d which already enabled PHPStan\Rules\Missing\MissingClosureNativeReturnTypehintRule, so I guess only the parameter typehint is still missing.

May I propose a PR for a MissingClosureParameterTypehintRule?

@ondrejmirtes
Copy link
Member

ondrejmirtes commented Aug 22, 2019 via email

@Slamdunk
Copy link
Author

Slamdunk commented Aug 30, 2019

PHPStan currently does not read docblocks for closures

Ok then, I'll wait for a PR.

For those who don't want to wait, don't use docblocks for closures and don't handle mixed types, a simple rule like this can be added to the project:

https://github.com/Slamdunk/phpstan-extensions/blob/v3.6.0/lib/MissingClosureParameterTypehintRule.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants