Skip to content

Commit a155e9b

Browse files
committed
update per PR
1 parent 9684318 commit a155e9b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

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

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

420420
// Check type hint for array and custom type.
421421
$suggestedTypeHint = '';
422-
if (preg_match('/^(.*)<.*>$/', $suggestedName, $matches)) {
423-
$suggestedTypeHint = $matches[1];
424-
} else if (strpos($suggestedName, 'array') !== false || substr($suggestedName, -2) === '[]') {
422+
if (strpos($suggestedName, 'array') !== false || substr($suggestedName, -2) === '[]') {
425423
$suggestedTypeHint = 'array';
426424
} else if (strpos($suggestedName, 'callable') !== false) {
427425
$suggestedTypeHint = 'callable';
428426
} else if (strpos($suggestedName, 'callback') !== false) {
429427
$suggestedTypeHint = 'callable';
428+
} else if (preg_match('/^([^<]+)<[^>]+>$/', $suggestedName, $matches)) {
429+
$suggestedTypeHint = $matches[1];
430430
} else if (in_array($suggestedName, Common::$allowedTypes, true) === false) {
431431
$suggestedTypeHint = $suggestedName;
432432
}

src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,6 @@ function throwCommentOneLine() {}
10551055
*
10561056
* @return void
10571057
*/
1058-
public function specifiedArray1(Collection $values) {
1058+
public function genericType(Collection $values) {
10591059

1060-
}// end specifiedArray1()
1060+
}// end genericType()

src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,6 @@ function throwCommentOneLine() {}
10551055
*
10561056
* @return void
10571057
*/
1058-
public function specifiedArray1(Collection $values) {
1058+
public function genericType(Collection $values) {
10591059

1060-
}// end specifiedArray1()
1060+
}// end genericType()

0 commit comments

Comments
 (0)