mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Don’t do new isset conversion on try-set vars
This commit is contained in:
parent
0aeb0ef990
commit
7cc0f65f11
@ -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']];
|
||||
|
@ -465,6 +465,16 @@ class TryCatchTest extends TestCase
|
||||
[],
|
||||
'8.0'
|
||||
],
|
||||
'issetInCatch' => [
|
||||
'<?php
|
||||
function foo() : void {
|
||||
try {
|
||||
$a = 0;
|
||||
} catch (Exception $e) {
|
||||
echo isset($a) ? $a : 1;
|
||||
}
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user