mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Fix #2328 - don’t crash on unexpected divider
This commit is contained in:
parent
7b719915f5
commit
975ff9250b
@ -136,7 +136,7 @@ class Reconciler
|
||||
|
||||
$base_key = $new_base_key;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Unexpected divider ' . $divider);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$key_parts) {
|
||||
@ -598,15 +598,6 @@ class Reconciler
|
||||
|
||||
$base_key = $new_base_key;
|
||||
} else {
|
||||
if ($code_location) {
|
||||
IssueBuffer::add(
|
||||
new PsalmInternalError(
|
||||
'Unexpected divider ' . $divider,
|
||||
$code_location
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1507,6 +1507,16 @@ class TypeReconciliationTest extends TestCase
|
||||
return filter_input_array(INPUT_POST) ?? [];
|
||||
}',
|
||||
],
|
||||
'noCrashOnWeirdArrayKeys' => [
|
||||
'<?php
|
||||
/**
|
||||
* @psalm-suppress MixedPropertyFetch
|
||||
* @psalm-suppress MixedArrayOffset
|
||||
*/
|
||||
function foo(array $a, array $b) : void {
|
||||
if (isset($a[$b[0]->id])) {}
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user