Loading coder_sniffer/Drupal/Sniffs/Commenting/VariableCommentSniff.php +14 −6 Original line number Diff line number Diff line Loading @@ -40,13 +40,21 @@ class VariableCommentSniff extends AbstractVariableSniff public function processMemberVar(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $commentToken = [ T_COMMENT, T_DOC_COMMENT_CLOSE_TAG, $ignore = [ T_PUBLIC, T_PRIVATE, T_PROTECTED, T_VAR, T_STATIC, T_WHITESPACE, ]; $commentEnd = $phpcsFile->findPrevious($commentToken, $stackPtr); if ($commentEnd === false) { $commentEnd = $phpcsFile->findPrevious($ignore, ($stackPtr - 1), null, true); if ($commentEnd === false || ($tokens[$commentEnd]['code'] !== T_DOC_COMMENT_CLOSE_TAG && $tokens[$commentEnd]['code'] !== T_COMMENT) ) { $phpcsFile->addError('Missing member variable doc comment', $stackPtr, 'Missing'); return; } Loading coder_sniffer/Drupal/Test/Commenting/VariableCommentUnitTest.inc +2 −0 Original line number Diff line number Diff line Loading @@ -44,4 +44,6 @@ class Test { // Wrong style with var keyword. var $varStyle; protected $missingComment; } coder_sniffer/Drupal/Test/Commenting/VariableCommentUnitTest.inc.fixed +2 −0 Original line number Diff line number Diff line Loading @@ -48,4 +48,6 @@ class Test { */ public $varStyle; protected $missingComment; } coder_sniffer/Drupal/Test/Commenting/VariableCommentUnitTest.php +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ class VariableCommentUnitTest extends CoderSniffUnitTest 37 => 1, 42 => 1, 45 => 1, 47 => 1, ]; }//end getErrorList() Loading coder_sniffer/Drupal/Test/good/good.php +5 −0 Original line number Diff line number Diff line Loading @@ -1353,6 +1353,11 @@ class NodeType extends ConfigEntityBundleBase { */ class OperatorTest { /** * Seen IDs. * * @var array */ protected static $seenIds; /** Loading Loading
coder_sniffer/Drupal/Sniffs/Commenting/VariableCommentSniff.php +14 −6 Original line number Diff line number Diff line Loading @@ -40,13 +40,21 @@ class VariableCommentSniff extends AbstractVariableSniff public function processMemberVar(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $commentToken = [ T_COMMENT, T_DOC_COMMENT_CLOSE_TAG, $ignore = [ T_PUBLIC, T_PRIVATE, T_PROTECTED, T_VAR, T_STATIC, T_WHITESPACE, ]; $commentEnd = $phpcsFile->findPrevious($commentToken, $stackPtr); if ($commentEnd === false) { $commentEnd = $phpcsFile->findPrevious($ignore, ($stackPtr - 1), null, true); if ($commentEnd === false || ($tokens[$commentEnd]['code'] !== T_DOC_COMMENT_CLOSE_TAG && $tokens[$commentEnd]['code'] !== T_COMMENT) ) { $phpcsFile->addError('Missing member variable doc comment', $stackPtr, 'Missing'); return; } Loading
coder_sniffer/Drupal/Test/Commenting/VariableCommentUnitTest.inc +2 −0 Original line number Diff line number Diff line Loading @@ -44,4 +44,6 @@ class Test { // Wrong style with var keyword. var $varStyle; protected $missingComment; }
coder_sniffer/Drupal/Test/Commenting/VariableCommentUnitTest.inc.fixed +2 −0 Original line number Diff line number Diff line Loading @@ -48,4 +48,6 @@ class Test { */ public $varStyle; protected $missingComment; }
coder_sniffer/Drupal/Test/Commenting/VariableCommentUnitTest.php +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ class VariableCommentUnitTest extends CoderSniffUnitTest 37 => 1, 42 => 1, 45 => 1, 47 => 1, ]; }//end getErrorList() Loading
coder_sniffer/Drupal/Test/good/good.php +5 −0 Original line number Diff line number Diff line Loading @@ -1353,6 +1353,11 @@ class NodeType extends ConfigEntityBundleBase { */ class OperatorTest { /** * Seen IDs. * * @var array */ protected static $seenIds; /** Loading