diff --git a/CHANGELOG.md b/CHANGELOG.md index a12d0e2..73754e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,10 @@ The format of this change log follows the advice given at [Keep a CHANGELOG](htt ## [Unreleased] ### Added -- The existing `moodle.PHPUnit.TestCaseCovers` sniff now detects multiple uses of the `@coversDefaultClass` annotation. Only one is allowed by class. +- The existing `moodle.PHPUnit.TestCaseCovers` sniff now detects multiple uses of the `@coversDefaultClass` annotation. Only one is allowed by class. + +### Changed +- Made codes for `moodle.Commenting.MissingDocblock` more specific to the scenario (Fixes #154). ## [v3.4.7] - 2024-05-31 ### Added diff --git a/moodle/Sniffs/Commenting/MissingDocblockSniff.php b/moodle/Sniffs/Commenting/MissingDocblockSniff.php index 8999a59..083f700 100644 --- a/moodle/Sniffs/Commenting/MissingDocblockSniff.php +++ b/moodle/Sniffs/Commenting/MissingDocblockSniff.php @@ -101,7 +101,7 @@ protected function processScopes(File $phpcsFile, int $stackPtr): void { if ($fileblock === null) { $objectName = TokenUtil::getObjectName($phpcsFile, $stackPtr); - $phpcsFile->addError('Missing docblock for file %s', $stackPtr, 'Missing', [$objectName]); + $phpcsFile->addError('Missing docblock for file %s', $stackPtr, 'File', [$objectName]); } } @@ -110,7 +110,7 @@ protected function processScopes(File $phpcsFile, int $stackPtr): void { $objectName = TokenUtil::getObjectName($phpcsFile, $typePtr); $objectType = TokenUtil::getObjectType($phpcsFile, $typePtr); - $phpcsFile->addError('Missing docblock for %s %s', $typePtr, 'Missing', [$objectType, $objectName]); + $phpcsFile->addError('Missing docblock for %s %s', $typePtr, $objectType, [$objectType, $objectName]); } if ($artifactCount === 1) { @@ -208,7 +208,7 @@ protected function processFunctions(File $phpcsFile, int $stackPtr): void { ); } } else { - $phpcsFile->addError('Missing docblock for %s %s', $typePtr, 'Missing', [$objectType, $objectName]); + $phpcsFile->addError('Missing docblock for %s %s', $typePtr, $objectType, [$objectType, $objectName]); } } } @@ -255,14 +255,14 @@ protected function processConstants(File $phpcsFile, int $stackPtr): void { $phpcsFile->addError( 'Missing docblock for constant %s::%s', $typePtr, - 'Missing', + 'Constant', [$containerName, $objectName] ); } else { $phpcsFile->addError( 'Missing docblock for constant %s', $typePtr, - 'Missing', + 'Constant', [$objectName] ); }