Skip to content

Commit ebc0025

Browse files
committed
SlevomatCodingStandard.TypeHints.ParameterTypeHint: Type alias should not be reported as "missing traversable type hint specification"
1 parent d1051a3 commit ebc0025

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

SlevomatCodingStandard/Sniffs/TypeHints/ParameterTypeHintSniff.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,14 @@ private function checkTraversableTypeHintSpecification(
447447
continue;
448448
}
449449

450+
if (TypeHintHelper::isTypeDefinedInAnnotation(
451+
$phpcsFile,
452+
$functionPointer,
453+
(string) $parametersAnnotations[$parameterName]->getType()
454+
)) {
455+
continue;
456+
}
457+
450458
$parameterTypeNode = $parametersAnnotations[$parameterName]->getType();
451459

452460
if (

tests/Sniffs/TypeHints/data/parameterTypeHintNoErrors.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,4 +292,11 @@ public function withAlias($withAlias1, $withAlias2, $withAlias3)
292292
{
293293
}
294294

295+
/**
296+
* @param SomeAlias1 $array
297+
*/
298+
public function withArrayAlias(array $array)
299+
{
300+
}
301+
295302
}

0 commit comments

Comments
 (0)