phpstan/phpstan-strict-rules

Closure: report missing function parameter typehint and missing return type

Slamdunk opened this issue · 2 comments

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?

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