phpstan: Incorrect variable always exists

Summary of a problem or a feature request

PHPStan incorrectly reports that a variable always exists in some cases.

Code snippet that reproduces the problem

https://phpstan.org/r/b0e37609338d0c49645295f039a0e73d

Expected output

PHPStan complains that Variable $handle in isset() always exists and is not nullable.. However, https://3v4l.org/nUfFW shows the actual output is ko, which means the isset gets evaluated to false.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (15 by maintainers)

Commits related to this issue

Most upvoted comments

You can try to do it. You’ll see which test cases will fail and we’ll probably have to decide which behaviour is better/less annoying 😃

@lookyman Please submit this as a new issue next time, this makes issue management harder 😊 I will look into it.