1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Merge pull request #9458 from pvandommelen/type_round_brackets

This commit is contained in:
Bruce Weirdan 2023-03-05 20:30:41 -04:00 committed by GitHub
commit 3a0adabf06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -1906,8 +1906,8 @@ class ClassLikeNodeScanner
$type_string = str_replace("\n", '', implode('', $var_line_parts));
$type_string = preg_replace('/>[^>^\}]*$/', '>', $type_string, 1);
$type_string = preg_replace('/\}[^>^\}]*$/', '}', $type_string, 1);
// Strip any remaining characters after the last grouping character >, } or )
$type_string = preg_replace('/(?<=[>})])[^>})]*$/', '', $type_string, 1);
try {
$type_tokens = TypeTokenizer::getFullyQualifiedTokens(

View File

@ -653,6 +653,14 @@ class TypeAnnotationTest extends TestCase
'$output===' => 'list<1|2>',
],
],
'handlesTypeWhichEndsWithRoundBracket' => [
'code' => '<?php
/**
* @psalm-type Foo=(iterable<mixed>)
*/
class A {}
',
],
];
}