Skip to content
Permalink
Browse files

Fix #2328 - don’t crash on unexpected divider

  • Loading branch information
muglug committed Nov 13, 2019
1 parent 7b71991 commit 975ff9250b5005463ee4cdbded4e589a77817c4c
Showing with 11 additions and 10 deletions.
  1. +1 −10 src/Psalm/Type/Reconciler.php
  2. +10 −0 tests/TypeReconciliationTest.php
@@ -136,7 +136,7 @@ public static function reconcileKeyedTypes(
$base_key = $new_base_key;
} else {
throw new \InvalidArgumentException('Unexpected divider ' . $divider);
break;
}
if (!$key_parts) {
@@ -598,15 +598,6 @@ private static function getValueForKey(
$base_key = $new_base_key;
} else {
if ($code_location) {
IssueBuffer::add(
new PsalmInternalError(
'Unexpected divider ' . $divider,
$code_location
)
);
}
return null;
}
}
@@ -1507,6 +1507,16 @@ function foo() : array {
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])) {}
}',
],
];
}

0 comments on commit 975ff92

Please sign in to comment.
You can’t perform that action at this time.