-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Description
Bug report
When trying to ignore a few specific lines within an array I noticed that // @phpstan-ignore-line was not working if my array contained only one key or if the key I was trying to ignore was the last one.
Code snippet that reproduces the problem
Last key not ignored
The following code where $a & $c dont exist on $device
[
'a' => $device->a, // @phpstan-ignore-line
'b' => $device->b,
'c' => $device->c, // @phpstan-ignore-line
];
PHPStan only ignores $a while $c should also have been ignored.
------ -----------------------------------------------------------
Line MyClass.php
------ -----------------------------------------------------------
188 Access to an undefined property App\Models\Device::$c.
Only key not ignored
[
'a' => $device->a, // @phpstan-ignore-line
];
PHPStan reports :
------ -----------------------------------------------------------
Line MyClass.php
------ -----------------------------------------------------------
186 Access to an undefined property App\Models\Device::$a.
Expected output
PHPStan shouldn't have reported the ignored lines.
Reactions are currently unavailable