Skip to content

Commit

Permalink
Rename the sniff.
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-vlasenko authored and Anton Vlasenko committed Apr 10, 2024
1 parent 3b581d4 commit cc2586c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
</property>
</properties>
</rule>
<rule ref="Gutenberg.Commenting.FunctionCommentSinceTag">
<rule ref="Gutenberg.Commenting.SinceTag">
<!-- The sniff ensures that functions have a valid @since tag but skips checking experimental blocks. -->
<include-pattern>/packages/block-library/src/.+/*\.php$</include-pattern>
<include-pattern>/packages/block-serialization-default-parser/.+/*\.php$</include-pattern>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
use PHPCSUtils\Utils\Variables;

/**
* This sniff ensures that PHP functions have a valid `@since` tag in the docblock.
* The sniff skips checking files in __experimental block-library blocks.
* This sniff verifies the presence of valid `@since` tags in the docblocks of various PHP structures
* and WordPress hooks. Supported structures include classes, interfaces, traits, enums, functions, methods and properties.
* Files located within the __experimental block of the block-library are excluded from checks.
*/
class FunctionCommentSinceTagSniff implements Sniff {
class SinceTagSniff implements Sniff {

/**
* Disable the check for functions with a lower visibility than the value given.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

namespace GutenbergCS\Gutenberg\Tests\Commenting;

use GutenbergCS\Gutenberg\Sniffs\Commenting\FunctionCommentSinceTagSniff;
use GutenbergCS\Gutenberg\Sniffs\Commenting\SinceTagSniff;
use GutenbergCS\Gutenberg\Tests\AbstractSniffUnitTest;
use PHP_CodeSniffer\Sniffs\Sniff;

/**
* Unit test class for the FunctionCommentSinceTagSniff sniff.
* Unit test class for the SinceTagSniff sniff.
*/
final class FunctionCommentSinceTagUnitTest extends AbstractSniffUnitTest {
final class SinceTagUnitTest extends AbstractSniffUnitTest {

/**
* Returns the lines where errors should occur.
Expand Down Expand Up @@ -174,7 +174,7 @@ public function getWarningList() {
* @return string The fully qualified class name of the sniff.
*/
protected function get_sniff_fqcn() {
return FunctionCommentSinceTagSniff::class;
return SinceTagSniff::class;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/php/gutenberg-coding-standards/Gutenberg/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<rule ref="Gutenberg.CodeAnalysis.GuardedFunctionAndClassNames"/>
<rule ref="Gutenberg.CodeAnalysis.ForbiddenFunctionsAndClasses"/>
<rule ref="Gutenberg.NamingConventions.ValidBlockLibraryFunctionName"/>
<rule ref="Gutenberg.Commenting.FunctionCommentSinceTag" />
<rule ref="Gutenberg.Commenting.SinceTag" />

</ruleset>

0 comments on commit cc2586c

Please sign in to comment.