Skip to content

Call to function is_callable() with array{...} will always evaluate to true #12063

@proton-ab

Description

@proton-ab

Bug report

An error is reported stating that call to is_callable will always resolve to true, however provided array of callables contains function that does not exist within callable class?

Code snippet that reproduces the problem

https://phpstan.org/r/9d6b9c24-6a61-49d1-b47b-811a2cc2a980

Expected output

After fixing this specific issue, PHPStan will report that function will always throw.

Realistically - no error should be reported here. I consider this kind of runtime check to be quite important and I am not convinced we should actively discourage from having them and relying only on PHPStan ability to catch this in CI (as shown in this issue, it is prone to failure).

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions