mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
commit
60a138987b
@ -551,6 +551,8 @@ class TypeCombiner
|
||||
}
|
||||
|
||||
foreach ($type->type_params as $i => $type_param) {
|
||||
// See https://github.com/vimeo/psalm/pull/9439#issuecomment-1464563015
|
||||
/** @psalm-suppress PropertyTypeCoercion */
|
||||
$combination->array_type_params[$i] = Type::combineUnionTypes(
|
||||
$combination->array_type_params[$i] ?? null,
|
||||
$type_param,
|
||||
@ -599,6 +601,8 @@ class TypeCombiner
|
||||
|
||||
if ($type instanceof TClassStringMap) {
|
||||
foreach ([$type->getStandinKeyParam(), $type->value_param] as $i => $type_param) {
|
||||
// See https://github.com/vimeo/psalm/pull/9439#issuecomment-1464563015
|
||||
/** @psalm-suppress PropertyTypeCoercion */
|
||||
$combination->array_type_params[$i] = Type::combineUnionTypes(
|
||||
$combination->array_type_params[$i] ?? null,
|
||||
$type_param,
|
||||
|
@ -761,7 +761,7 @@ class Reconciler
|
||||
return null;
|
||||
}
|
||||
|
||||
$new_base_type_candidate = $existing_key_type_part->getGenericValueType();
|
||||
$new_base_type_candidate = $existing_key_type_part->getGenericValueType(true);
|
||||
} else {
|
||||
$array_properties = $existing_key_type_part->properties;
|
||||
|
||||
|
@ -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