Skip to content

Commit a5f31ac

Browse files
b1rdexondrejmirtes
authored andcommitted
Mark $_SESSION as nullable
1 parent c7a674d commit a5f31ac

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Rules/Variables/VariableCertaintyInIssetRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function processNode(Node $node, Scope $scope): array
3939
$isSubNode = true;
4040
}
4141

42-
if (!$var instanceof Node\Expr\Variable || !is_string($var->name)) {
42+
if (!$var instanceof Node\Expr\Variable || !is_string($var->name) || $var->name === '_SESSION') {
4343
continue;
4444
}
4545

tests/PHPStan/Rules/Variables/data/variable-certainty-isset.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,8 @@ function () {
226226

227227
}
228228
};
229+
230+
function () {
231+
isset($_SESSION);
232+
isset($_SESSION['foo']);
233+
};

0 commit comments

Comments
 (0)