1
0
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:
Matthew Brown 2019-11-13 01:13:29 -05:00
parent 7b719915f5
commit 975ff9250b
2 changed files with 11 additions and 10 deletions

View File

@ -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;
}
}

View File

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