From 7cc0f65f114a170eb6c085695e7902654ff0b3b0 Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Wed, 2 Dec 2020 01:47:49 -0500 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20do=20new=20isset=20conversion?= =?UTF-8?q?=20on=20try-set=20vars?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Analyzer/Statements/Expression/AssertionFinder.php | 1 + tests/TryCatchTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+) 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' => [ + '