mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 10:07:12 +00:00
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\|_\\\\]*\$this[\w\|_\\\\]*)
|
||||||
|
|
|
|
||||||
(?:
|
(?:
|
||||||
(?:[\w\|_\\\\]+)
|
(?:[\w\|_\\\\]+(?:<[\s\S]*>)?)
|
||||||
# array notation
|
# array notation
|
||||||
(?:\[\])*
|
(?:\[\])*
|
||||||
)*
|
)*
|
||||||
|
|
|
||||||
|
(?:\([\s\S]*\))?
|
||||||
)
|
)
|
||||||
\s+
|
\s+
|
||||||
)?
|
)?
|
||||||
|
|||||||
@@ -142,7 +142,25 @@ class MethodTagTest extends TestCase
|
|||||||
array(
|
array(
|
||||||
'static static foo()',
|
'static static foo()',
|
||||||
true, 'foo', 'static', true, 0, ''
|
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