mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
add tests for #9433
This commit is contained in:
parent
44ffd5fb46
commit
fc402b1c95
@ -1153,6 +1153,25 @@ class IssetTest extends TestCase
|
||||
}',
|
||||
'error_message' => 'RedundantPropertyInitializationCheck',
|
||||
],
|
||||
'setArbitraryListElementAfterIsset' => [
|
||||
'code' => '<?php
|
||||
/** @param list<string> $list */
|
||||
function foo(array &$list, int $offset): void {
|
||||
if (isset($list[$offset])) {}
|
||||
$list[$offset] = "";
|
||||
}',
|
||||
'error_message' => 'ReferenceConstraintViolation'
|
||||
],
|
||||
'setArbitraryListWithinNotIsset' => [
|
||||
'code' => '<?php
|
||||
/** @param list<string> $list */
|
||||
function foo(array &$list, int $offset): void {
|
||||
if (!isset($list[$offset])) {
|
||||
$list[$offset] = "";
|
||||
}
|
||||
}',
|
||||
'error_message' => 'ReferenceConstraintViolation'
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user