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

False positive with isset when exception is thrown before assignment #4821

Closed
hbrecht opened this issue Apr 7, 2021 · 2 comments
Closed

Comments

@hbrecht
Copy link

hbrecht commented Apr 7, 2021

Bug report

Using latest version!

When a new object is assigned to a new variable and during construction of the object an exception is thrown, phpstan still assumes that the variable is assigned (set) and therefore isset would always return true. At least this is true for below snippet. However, this code works fine:
https://phpstan.org/r/a757f959-eecc-484b-ad70-22caab81bc16

Code snippet that reproduces the problem

https://phpstan.org/r/3e472af1-0c34-4873-8b5f-7923419afef1

Expected output

No issue should be reported

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@b48fd77

@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

2 participants