Loading coder_sniffer/Drupal/Sniffs/Commenting/VariableCommentSniff.php +6 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,12 @@ class VariableCommentSniff extends AbstractVariableSniff // The @var tag is the only one we require. if ($foundVar === null) { // If there's an inline type argument then you may omit the @var comment. // Check if there's a type between the variable name and the comment end. if ($phpcsFile->findPrevious([T_STRING], $stackPtr, $commentEnd) !== false) { return; } $error = 'Missing @var tag in member variable comment'; $phpcsFile->addError($error, $commentEnd, 'MissingVar'); return; Loading tests/Drupal/Commenting/VariableCommentUnitTest.inc +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ class Test { protected $missingComment; /** * A typed property should still contain a variable comment. * A variable comment is optional for a typed property. */ public ?Bar $bar; Loading tests/Drupal/Commenting/VariableCommentUnitTest.inc.fixed +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ class Test { protected $missingComment; /** * A typed property should still contain a variable comment. * A variable comment is optional for a typed property. */ public ?Bar $bar; Loading tests/Drupal/Commenting/VariableCommentUnitTest.php +0 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ class VariableCommentUnitTest extends CoderSniffUnitTest 42 => 1, 45 => 1, 47 => 1, 51 => 1, ]; }//end getErrorList() Loading tests/Drupal/good/good.php +5 −0 Original line number Diff line number Diff line Loading @@ -613,6 +613,11 @@ class Bar { */ public ?Bar $bar; /** * A typed property may omit @var. */ public Bar $baz; /** * Public static variables use camelCase, too. * Loading Loading
coder_sniffer/Drupal/Sniffs/Commenting/VariableCommentSniff.php +6 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,12 @@ class VariableCommentSniff extends AbstractVariableSniff // The @var tag is the only one we require. if ($foundVar === null) { // If there's an inline type argument then you may omit the @var comment. // Check if there's a type between the variable name and the comment end. if ($phpcsFile->findPrevious([T_STRING], $stackPtr, $commentEnd) !== false) { return; } $error = 'Missing @var tag in member variable comment'; $phpcsFile->addError($error, $commentEnd, 'MissingVar'); return; Loading
tests/Drupal/Commenting/VariableCommentUnitTest.inc +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ class Test { protected $missingComment; /** * A typed property should still contain a variable comment. * A variable comment is optional for a typed property. */ public ?Bar $bar; Loading
tests/Drupal/Commenting/VariableCommentUnitTest.inc.fixed +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ class Test { protected $missingComment; /** * A typed property should still contain a variable comment. * A variable comment is optional for a typed property. */ public ?Bar $bar; Loading
tests/Drupal/Commenting/VariableCommentUnitTest.php +0 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ class VariableCommentUnitTest extends CoderSniffUnitTest 42 => 1, 45 => 1, 47 => 1, 51 => 1, ]; }//end getErrorList() Loading
tests/Drupal/good/good.php +5 −0 Original line number Diff line number Diff line Loading @@ -613,6 +613,11 @@ class Bar { */ public ?Bar $bar; /** * A typed property may omit @var. */ public Bar $baz; /** * Public static variables use camelCase, too. * Loading