mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-17 17:47:13 +00:00
Merge pull request #18 from KentarouTakeda/fix-generics-and-closures-return-type
Fixed incorrect parsing of return types for generics and closures
This commit is contained in:
@@ -80,10 +80,12 @@ class MethodTag extends ReturnTag
|
||||
(?:[\w\|_\\\\]*\$this[\w\|_\\\\]*)
|
||||
|
|
||||
(?:
|
||||
(?:[\w\|_\\\\]+)
|
||||
(?:[\w\|_\\\\]+(?:<[\s\S]*>)?)
|
||||
# array notation
|
||||
(?:\[\])*
|
||||
)*
|
||||
|
|
||||
(?:\([\s\S]*\))?
|
||||
)
|
||||
\s+
|
||||
)?
|
||||
|
||||
@@ -142,7 +142,25 @@ class MethodTagTest extends TestCase
|
||||
array(
|
||||
'static static foo()',
|
||||
true, 'foo', 'static', true, 0, ''
|
||||
)
|
||||
),
|
||||
|
||||
// generic array
|
||||
array(
|
||||
'array<int, string> foo()',
|
||||
true, 'foo', 'array<int, string>', false, 0, ''
|
||||
),
|
||||
|
||||
// nested generics
|
||||
array(
|
||||
'array<int, array<string, mixed>> foo()',
|
||||
true, 'foo', 'array<int, array<string, mixed>>', false, 0, ''
|
||||
),
|
||||
|
||||
// closure
|
||||
array(
|
||||
'(\Closure(int, string): bool) foo()',
|
||||
true, 'foo', '(\Closure(int, string): bool)', false, 0, ''
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user