1
0
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:
Paweł Tomulik 2023-03-01 09:19:55 +01:00
parent 44ffd5fb46
commit fc402b1c95
No known key found for this signature in database
GPG Key ID: 383742B6D85FF3D5

View File

@ -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'
],
];
}
}