-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Description
I originally hijacked #351 because I was testing the new @var type $this support present in v0.12.30. It may or may not be related to this change.
Defininig a variable besides $this using an @var PHPDoc annotation does not make PHPStan think the variable exists for the rest of the file:
https://phpstan.org/r/17f3c263-543f-44ae-9f96-45e2ff5221ee
However, once you define and use $this via an @var PHPDoc annotation this error will disappear entirely:
https://phpstan.org/r/337c0f49-8b85-4044-be0a-e014fbae63ea
I expect the variable definition to be honored regardless of whether I have defined and used $this beforehand. Note that trying to use the variable before using $this in the previous snippet will also yield the error:
Reactions are currently unavailable