Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
proton-ab opened this issue Nov 16, 2024 · 1 comment

Comments

@proton-ab
Copy link

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

@VincentLanglet
Copy link
Contributor

Hi, thanks for the report ; I tried a fix in phpstan/phpstan-src#3637

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants