Skip to content

Closure is final, it is certain it cannot implement any interface #9006

@mvorisek

Description

@mvorisek

Bug report

In the code snippet there are 3 methods:

  1. onSingleTypeCl - class parameter type correctly rejects Closure type - ✔️
  2. onSingleTypeIface - interface parameter does NOT reject Closure type, although Closure is final class, thus the interface cannot ever be implemented/satisfied by the argument - ❌
  3. onSingleTypeClosure - Closure parameter mismatch - ✔️

Code snippet that reproduces the problem

https://phpstan.org/r/034b664d-b337-4acf-9a59-c40b0a85796a

Expected output

3x error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions