Skip to content

Commit

Permalink
UselessFunctionDocCommentSniff: Fixed internal error
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Dec 4, 2019
1 parent dc5a270 commit 85e3329
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use SlevomatCodingStandard\Helpers\SniffSettingsHelper;
use SlevomatCodingStandard\Helpers\SuppressHelper;
use SlevomatCodingStandard\Helpers\TokenHelper;
use function array_key_exists;
use function array_map;
use function in_array;
use function sprintf;
Expand Down Expand Up @@ -73,6 +74,10 @@ public function process(File $phpcsFile, $functionPointer): void
$parametersAnnotations = FunctionHelper::getValidParametersAnnotations($phpcsFile, $functionPointer);

foreach ($parametersAnnotations as $parameterName => $parameterAnnotation) {
if (!array_key_exists($parameterName, $parameterTypeHints)) {
return;
}

if (!AnnotationHelper::isAnnotationUseless($phpcsFile, $functionPointer, $parameterTypeHints[$parameterName], $parameterAnnotation, $this->getTraversableTypeHints())) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,13 @@ public function withAnotherAnnotation(int $a): bool
return true;
}

/**
* @param int $aaaaa
* @return bool
*/
public function wrongParameterNameInAnnotation(int $a): bool
{
return true;
}

}

0 comments on commit 85e3329

Please sign in to comment.