1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix #1799 - support trailing commas in type aliases

This commit is contained in:
leightonthomas 2020-03-05 17:31:58 +00:00 committed by Matthew Brown
parent 8a1067e4e6
commit 06f7df9974
2 changed files with 13 additions and 0 deletions

View File

@ -281,6 +281,8 @@ class CommentAnalyzer
}
$var_line = preg_replace('/[ \t]+/', ' ', preg_replace('@^[ \t]*\*@m', '', $var_line));
$var_line = preg_replace('/,\n\s+\}/', '}', $var_line);
$var_line = str_replace("\n", '', $var_line);
$var_line_parts = preg_split('/( |=)/', $var_line, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);

View File

@ -989,6 +989,17 @@ class AnnotationTest extends TestCase
],
'allowClosingComma' => [
'<?php
/**
* @psalm-type _Alias=array{
* foo: string,
* bar: string,
* baz: array{
* a: int,
* },
* }
*/
class Foo { }
/**
* @param array{
* foo: string,