Skip to content

Unnamed vargs type in callable/Closure phpdoc is silently ignored #125

Closed
@mvorisek

Description

@mvorisek

Bug report

Currently

@return \Closure(int ...$u, string): string

phpdoc works correctly, but

@return \Closure(...int, object): string

is silently ignored. No wrong phpdoc error, no error when this type does not match the type of the returned value.

Even if such type is not documented as supported - https://phpstan.org/writing-php-code/phpdoc-types#callables - I belive it should be supported as standard (non-vargs) unnamed parameters are supported.

Code snippet that reproduces the problem

https://phpstan.org/r/f3779e03-f24f-43e7-8d73-b27973bbd15c

Expected output

The 2nd phpdoc must emit a phpstan error, the type (return type of the Closure) does not match the result.

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