Skip to content

Commit

Permalink
Prevent TypeParseException when dealing with nested template in asser…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
muglug committed Feb 17, 2021
1 parent 7b24552 commit 196f24a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,9 @@ private static function getAssertionParts(
$self_fqcln,
null,
true
)
),
null,
$function_template_types + $class_template_types
);
} catch (TypeParseTreeException $e) {
$storage->docblock_issues[] = new InvalidDocblock(
Expand Down
11 changes: 11 additions & 0 deletions tests/Template/FunctionTemplateAssertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,17 @@ function validateUsername(string $username): void {
}
}'
],
'noCrashWhenAssertingTemplatedKeyOf' => [
'<?php
/**
* @template TArray as array
* @template TCandidateKey as array-key
* @param TArray $arr
* @param array-key $key
* @psalm-assert key-of<TArray> $key
*/
function keyExists(array $arr, $key) : void {}'
],
];
}

Expand Down

0 comments on commit 196f24a

Please sign in to comment.