Skip to content

Commit

Permalink
fixed vimeo#9605 for function-like compounds
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomulik committed Mar 13, 2023
1 parent c945356 commit abc7ae1
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Psalm\Config;
use Psalm\Exception\InvalidMethodOverrideException;
use Psalm\Exception\TypeParseTreeException;
use Psalm\Internal\Analyzer\CommentAnalyzer;
use Psalm\Internal\Analyzer\NamespaceAnalyzer;
use Psalm\Internal\Scanner\FileScanner;
use Psalm\Internal\Scanner\FunctionDocblockComment;
Expand Down Expand Up @@ -1439,10 +1440,16 @@ private static function handleTemplates(

if ($template_map[1] !== null && $template_map[2] !== null) {
if (trim($template_map[2])) {
try {
$type_string = CommentAnalyzer::splitDocLine($template_map[2])[0];
} catch (DocblockParseException $e) {
throw new DocblockParseException($type_string . ' is not a valid type: '.$e->getMessage());
}
$type_string = CommentAnalyzer::sanitizeDocblockType($type_string);
try {
$template_type = TypeParser::parseTokens(
TypeTokenizer::getFullyQualifiedTokens(
$template_map[2],
$type_string,
$aliases,
$storage->template_types + ($template_types ?: []),
$type_aliases,
Expand Down

0 comments on commit abc7ae1

Please sign in to comment.