Skip to content

Commit 33c6012

Browse files
committed
Squiz FileCommentSniff now uses tags names inside the error codes for many messages
1 parent c5b10f8 commit 33c6012

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

CodeSniffer/Standards/Squiz/Sniffs/Commenting/FileCommentSniff.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ protected function processTags($commentStart, $commentEnd)
324324
if (in_array($tag, $foundTags) === false) {
325325
$error = 'Missing @%s tag in file comment';
326326
$data = array($tag);
327-
$this->currentFile->addError($error, $commentEnd, 'MissingTag', $data);
327+
$this->currentFile->addError($error, $commentEnd, 'Missing'.ucfirst($tag).'Tag', $data);
328328
continue;
329329
}
330330

@@ -351,7 +351,7 @@ protected function processTags($commentStart, $commentEnd)
351351
if (count($foundIndexes) > 1) {
352352
$error = 'Only 1 @%s tag is allowed in file comment';
353353
$data = array($tag);
354-
$this->currentFile->addError($error, $errorPos, 'DuplicateTag', $data);
354+
$this->currentFile->addError($error, $errorPos, 'Duplicate'.ucfirst($tag).'Tag', $data);
355355
}
356356

357357
// Check tag order.
@@ -363,7 +363,7 @@ protected function processTags($commentStart, $commentEnd)
363363
$tag,
364364
$orderText,
365365
);
366-
$this->currentFile->addError($error, $errorPos, 'TagOrder', $data);
366+
$this->currentFile->addError($error, $errorPos, ucfirst($tag).'TagOrder', $data);
367367
}
368368

369369
// Store the indentation of each tag.
@@ -403,7 +403,7 @@ protected function processTags($commentStart, $commentEnd)
403403
$expected,
404404
$space,
405405
);
406-
$this->currentFile->addError($error, $indentInfo['errorPos'], 'TagIndent', $data);
406+
$this->currentFile->addError($error, $indentInfo['errorPos'], ucfirst($indentInfo['tag']).'TagIndent', $data);
407407
}
408408
}
409409

package.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
3232
- Squiz BlockCommentSniff and InlineCommentSniff no longer report errors for trait block comments
3333
- Squiz SelfMemberReferenceSniff now supports namespaces
3434
-- Thanks to Andy Grunwald for the patch
35+
- Squiz FileCommentSniff now uses tags names inside the error codes for many messages
36+
-- This allows you to exclude specific missing, out of order etc., tags
3537
- Fixed an incorrect error in Squiz OperatorSpacingSniff for default values inside a closure definition
3638
- Fixed bug #19691 : SubversionPropertiesSniff fails to find missing properties
3739
-- Thanks to Kevin Winahradsky for the patch

0 commit comments

Comments
 (0)