Skip to content

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

Open

Description

@Slamdunk

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?

Activity

  1. ondrejmirtes commented on Aug 22, 2019

    @ondrejmirtes
    Member
  2. Slamdunk commented on Aug 30, 2019

    @Slamdunk
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions