Skip to content

Commit 4afb939

Browse files
committed
Support generics in docblock
1 parent 1359e17 commit 4afb939

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,9 @@ protected function processParams(File $phpcsFile, $stackPtr, $commentStart)
419419

420420
// Check type hint for array and custom type.
421421
$suggestedTypeHint = '';
422-
if (strpos($suggestedName, 'array') !== false || substr($suggestedName, -2) === '[]') {
422+
if (preg_match('/^(.*)<.*>$/', $suggestedTypeHint, $matches)) {
423+
$suggestedTypeHint = $matches[1];
424+
} else if (strpos($suggestedName, 'array') !== false || substr($suggestedName, -2) === '[]') {
423425
$suggestedTypeHint = 'array';
424426
} else if (strpos($suggestedName, 'callable') !== false) {
425427
$suggestedTypeHint = 'callable';

0 commit comments

Comments
 (0)