diff --git a/src/Barryvdh/Reflection/DocBlock/Tag/MethodTag.php b/src/Barryvdh/Reflection/DocBlock/Tag/MethodTag.php index 5674c94..32982c5 100644 --- a/src/Barryvdh/Reflection/DocBlock/Tag/MethodTag.php +++ b/src/Barryvdh/Reflection/DocBlock/Tag/MethodTag.php @@ -80,10 +80,12 @@ class MethodTag extends ReturnTag (?:[\w\|_\\\\]*\$this[\w\|_\\\\]*) | (?: - (?:[\w\|_\\\\]+) + (?:[\w\|_\\\\]+(?:<[\s\S]*>)?) # array notation (?:\[\])* )* + | + (?:\([\s\S]*\))? ) \s+ )? diff --git a/tests/Barryvdh/Reflection/DocBlock/Tag/MethodTagTest.php b/tests/Barryvdh/Reflection/DocBlock/Tag/MethodTagTest.php index 32f7ea4..c9056bd 100644 --- a/tests/Barryvdh/Reflection/DocBlock/Tag/MethodTagTest.php +++ b/tests/Barryvdh/Reflection/DocBlock/Tag/MethodTagTest.php @@ -142,7 +142,25 @@ class MethodTagTest extends TestCase array( 'static static foo()', true, 'foo', 'static', true, 0, '' - ) + ), + + // generic array + array( + 'array foo()', + true, 'foo', 'array', false, 0, '' + ), + + // nested generics + array( + 'array> foo()', + true, 'foo', 'array>', false, 0, '' + ), + + // closure + array( + '(\Closure(int, string): bool) foo()', + true, 'foo', '(\Closure(int, string): bool)', false, 0, '' + ), ); } }