-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
Bug report
If you check a variable multiple times with isset() then PHPStan thinks the variable is always defined. But that is not the case. An isset() call does not define a variable.
Code snippet that reproduces the problem
<?php
if (isset($_GET['x'])) {
$a = 1;
}
if (isset($a) === true) {
echo "hello";
}
if (isset($a) === true) {
echo "hello2";
}https://phpstan.org/r/4fab31fc-425c-45c9-984c-8ab9358a7d4a
Actual output
+------------------------------------------------------------------+
| Line | test.php |
+------------------------------------------------------------------+
| 11 | Variable $a in isset() always exists and is not nullable. |
+------------------------------------------------------------------+
[ERROR] Found 1 error
Expected output
No output, because there is no problem.
Reactions are currently unavailable