Skip to content

Commit 223ec03

Browse files
committed
Generic/Todo-Fixme: make the sniffs more selective
The sniffs as-they-were, would sniff all comment related tokens, including `T_DOC_COMMENT_STAR`, `T_DOC_COMMENT_WHITESPACE` etc. Sniffing those tokens is redundant and makes the sniffs slower than is needed. Fixed now by making the tokens being registered by the sniffs more selective/targetted.
1 parent b0d171b commit 223ec03

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/Standards/Generic/Sniffs/Commenting/FixmeSniff.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ class FixmeSniff implements Sniff
3535
*/
3636
public function register()
3737
{
38-
return array_diff(Tokens::$commentTokens, Tokens::$phpcsCommentTokens);
38+
return [
39+
T_COMMENT,
40+
T_DOC_COMMENT,
41+
T_DOC_COMMENT_TAG,
42+
T_DOC_COMMENT_STRING,
43+
];
3944

4045
}//end register()
4146

src/Standards/Generic/Sniffs/Commenting/TodoSniff.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ class TodoSniff implements Sniff
3434
*/
3535
public function register()
3636
{
37-
return array_diff(Tokens::$commentTokens, Tokens::$phpcsCommentTokens);
37+
return [
38+
T_COMMENT,
39+
T_DOC_COMMENT,
40+
T_DOC_COMMENT_TAG,
41+
T_DOC_COMMENT_STRING,
42+
];
3843

3944
}//end register()
4045

0 commit comments

Comments
 (0)