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

Invalid always-true analysis in catch-block with call_user_func inside try-block #4820

Closed
janedbal opened this issue Apr 6, 2021 · 5 comments

Comments

@janedbal
Copy link
Contributor

janedbal commented Apr 6, 2021

Bug report

  • Seems like phpstan does not expect call_user_func to contain anything that may throw exception, see snippet
  • Used latest phpstan 0.12.83

Code snippet that reproduces the problem

Expected output

  • No error produced
@malarzm
Copy link

malarzm commented Apr 12, 2021

I'd expand the title a bit: PHPStan seems to not expect any excpetion from a called method, even if the method is annotated with @throws: https://phpstan.org/r/60d942db-e04b-4af4-9a4c-a3617588a4fd. Probably this is somewhat related to #4821

@ondrejmirtes
Copy link
Member

@malarzm In your case PHPStan is correct. I commented on your code: https://phpstan.org/r/93caf15f-aceb-423e-919b-338e71b5658f

@malarzm
Copy link

malarzm commented Apr 12, 2021

@ondrejmirtes thanks for the quick reply. Indeed you're right, my bad! :)

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@54a204e

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants