mirror of
https://github.com/danog/psalm.git
synced 2024-12-11 16:59:45 +01:00
Set inside_isset false when analyzing ArrayDimFetch dim
This commit is contained in:
parent
71707e6c4e
commit
10ed0f3cd6
@ -120,13 +120,19 @@ final class ArrayFetchAnalyzer
|
||||
$was_inside_unset = $context->inside_unset;
|
||||
$context->inside_unset = false;
|
||||
|
||||
$was_inside_isset = $context->inside_isset;
|
||||
$context->inside_isset = false;
|
||||
|
||||
if (ExpressionAnalyzer::analyze($statements_analyzer, $stmt->dim, $context) === false) {
|
||||
$context->inside_isset = $was_inside_isset;
|
||||
$context->inside_unset = $was_inside_unset;
|
||||
$context->inside_general_use = $was_inside_general_use;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$context->inside_isset = $was_inside_isset;
|
||||
|
||||
$context->inside_unset = $was_inside_unset;
|
||||
|
||||
$context->inside_general_use = $was_inside_general_use;
|
||||
|
@ -1281,6 +1281,11 @@ class ArrayAccessTest extends TestCase
|
||||
echo $a[0];',
|
||||
'error_message' => 'PossiblyInvalidArrayAccess',
|
||||
],
|
||||
'insideIssetDisabledForDim' => [
|
||||
'code' => '<?php
|
||||
isset($a[$b]);',
|
||||
'error_message' => 'UndefinedGlobalVariable',
|
||||
],
|
||||
'mixedArrayAccess' => [
|
||||
'code' => '<?php
|
||||
/** @var mixed */
|
||||
|
Loading…
Reference in New Issue
Block a user