mirror of
https://github.com/danog/psalm.git
synced 2024-12-04 02:27:59 +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;
|
$was_inside_unset = $context->inside_unset;
|
||||||
$context->inside_unset = false;
|
$context->inside_unset = false;
|
||||||
|
|
||||||
|
$was_inside_isset = $context->inside_isset;
|
||||||
|
$context->inside_isset = false;
|
||||||
|
|
||||||
if (ExpressionAnalyzer::analyze($statements_analyzer, $stmt->dim, $context) === false) {
|
if (ExpressionAnalyzer::analyze($statements_analyzer, $stmt->dim, $context) === false) {
|
||||||
|
$context->inside_isset = $was_inside_isset;
|
||||||
$context->inside_unset = $was_inside_unset;
|
$context->inside_unset = $was_inside_unset;
|
||||||
$context->inside_general_use = $was_inside_general_use;
|
$context->inside_general_use = $was_inside_general_use;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$context->inside_isset = $was_inside_isset;
|
||||||
|
|
||||||
$context->inside_unset = $was_inside_unset;
|
$context->inside_unset = $was_inside_unset;
|
||||||
|
|
||||||
$context->inside_general_use = $was_inside_general_use;
|
$context->inside_general_use = $was_inside_general_use;
|
||||||
|
@ -1281,6 +1281,11 @@ class ArrayAccessTest extends TestCase
|
|||||||
echo $a[0];',
|
echo $a[0];',
|
||||||
'error_message' => 'PossiblyInvalidArrayAccess',
|
'error_message' => 'PossiblyInvalidArrayAccess',
|
||||||
],
|
],
|
||||||
|
'insideIssetDisabledForDim' => [
|
||||||
|
'code' => '<?php
|
||||||
|
isset($a[$b]);',
|
||||||
|
'error_message' => 'UndefinedGlobalVariable',
|
||||||
|
],
|
||||||
'mixedArrayAccess' => [
|
'mixedArrayAccess' => [
|
||||||
'code' => '<?php
|
'code' => '<?php
|
||||||
/** @var mixed */
|
/** @var mixed */
|
||||||
|
Loading…
Reference in New Issue
Block a user