Skip to content

Commit

Permalink
Merge pull request #10123 from weirdan/fix-crash-with-removed-assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Aug 17, 2023
2 parents 28f5b1e + ed9dacf commit bf8e150
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 1 addition & 3 deletions psalm-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="dev-master@841cccd693a15da70c034a55eb05ee7ed8fdbc22">
<files psalm-version="5.x-dev@9bc98ecd47a4b83a663783c5a4744d48605d3eba">
<file src="examples/TemplateChecker.php">
<PossiblyUndefinedIntArrayOffset>
<code><![CDATA[$comment_block->tags['variablesfrom'][0]]]></code>
Expand Down Expand Up @@ -601,8 +601,6 @@
<file src="src/Psalm/Type/Reconciler.php">
<PossiblyUndefinedIntArrayOffset>
<code>$const_name</code>
<code>$type[0]</code>
<code>$type[0][0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Type/TypeNode.php">
Expand Down
4 changes: 4 additions & 0 deletions src/Psalm/Type/Reconciler.php
Expand Up @@ -424,6 +424,10 @@ private static function addNestedAssertions(array $new_types, array $existing_ty
{
foreach ($new_types as $nk => $type) {
if (strpos($nk, '[') || strpos($nk, '->')) {
$type = array_values($type);
if (!isset($type[0][0])) {
continue;
}
if ($type[0][0] instanceof IsEqualIsset
|| $type[0][0] instanceof IsIsset
|| $type[0][0] instanceof NonEmpty
Expand Down

0 comments on commit bf8e150

Please sign in to comment.