Skip to content

Commit 8624af2

Browse files
committed
Add warning for missing type hint.
1 parent 90456d4 commit 8624af2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

PhpCollective/Sniffs/Commenting/TypeHintSniff.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,14 @@ public function process(File $phpcsFile, $stackPtr): void
117117

118118
$tagComment = $phpcsFile->fixer->getTokenContent($tag + 2);
119119
$valueNode = static::getValueNode($tokens[$tag]['content'], $tagComment);
120+
121+
122+
120123
if ($valueNode instanceof InvalidTagValueNode || $valueNode instanceof TypelessParamTagValueNode) {
124+
if (!isset($valueNode->type)) {
125+
$phpcsFile->addWarning('%s type hint is missing', $tag, 'MissingParamType', [$tokens[$tag]['content']]);
126+
}
127+
121128
continue;
122129
}
123130

0 commit comments

Comments
 (0)