diff --git a/PhpCollective/Sniffs/Commenting/DocBlockSniff.php b/PhpCollective/Sniffs/Commenting/DocBlockSniff.php index bd73ead..92fb7bb 100644 --- a/PhpCollective/Sniffs/Commenting/DocBlockSniff.php +++ b/PhpCollective/Sniffs/Commenting/DocBlockSniff.php @@ -134,6 +134,20 @@ protected function checkConstructorAndDestructor(File $phpcsFile, int $stackPtr) return; } + // If all parameters are fully typed (including promoted properties), no docblock is needed + $allTyped = true; + foreach ($methodSignature as $param) { + if (empty($param['typehint'])) { + $allTyped = false; + + break; + } + } + + if ($allTyped) { + return; + } + $phpcsFile->addError('Missing doc block for method', $stackPtr, 'ConstructDesctructMissingDocBlock'); }