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:
commit
3a0adabf06
@ -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(
|
||||
|
@ -653,6 +653,14 @@ class TypeAnnotationTest extends TestCase
|
||||
'$output===' => 'list<1|2>',
|
||||
],
|
||||
],
|
||||
'handlesTypeWhichEndsWithRoundBracket' => [
|
||||
'code' => '<?php
|
||||
/**
|
||||
* @psalm-type Foo=(iterable<mixed>)
|
||||
*/
|
||||
class A {}
|
||||
',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user