diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php index 8f7bb8dcc..d17d5c3dc 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php @@ -491,6 +491,7 @@ class AssertionFinder && ($var_type = $source->node_data->getType($isset_var)) && !$var_type->isMixed() && !$var_type->possibly_undefined + && !$var_type->possibly_undefined_from_try && $var_name !== '$_SESSION' ) { $if_types[$var_name] = [['!null']]; diff --git a/tests/TryCatchTest.php b/tests/TryCatchTest.php index affa6e22e..8a154fd5a 100644 --- a/tests/TryCatchTest.php +++ b/tests/TryCatchTest.php @@ -465,6 +465,16 @@ class TryCatchTest extends TestCase [], '8.0' ], + 'issetInCatch' => [ + '