Skip to content

Closure($this) does not accept Closure($this) #9009

@mvorisek

Description

@mvorisek

Bug report

Same type must be always accepted.

According to the current error, it seems the Hook::addHook() method generalizes the phpdoc param type to Closure(Hook) instead of preserving the $this in the param type.

Code snippet that reproduces the problem

https://phpstan.org/r/80653301-2ea9-4ed5-917a-bb569483a02f

Expected output

no error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions