From 2cdfc4407b754e9d1d99d16937c9ac287f6149f6 Mon Sep 17 00:00:00 2001 From: dpi Date: Tue, 4 Jun 2024 18:37:05 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20`SlevomatCodingStandard.Comme?= =?UTF-8?q?nting.UselessInheritDocComment`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #21 --- Makefile | 15 ++++++++++ PreviousNextDrupal/ruleset.xml | 3 ++ README.md | 1 + tests/Sniffs/UselessInheritDocCommentTest.php | 29 +++++++++++++++++++ .../UselessInheritDocCommentError.php | 21 ++++++++++++++ .../UselessInheritDocCommentNoError.php | 19 ++++++++++++ .../UselessInheritDocCommentParent.php | 15 ++++++++++ 7 files changed, 103 insertions(+) create mode 100644 Makefile create mode 100644 tests/Sniffs/UselessInheritDocCommentTest.php create mode 100644 tests/Sniffs/fixtures/UselessInheritDocCommentError.php create mode 100644 tests/Sniffs/fixtures/UselessInheritDocCommentNoError.php create mode 100644 tests/Sniffs/fixtures/UselessInheritDocCommentParent.php diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ac90bcf --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +check: test lint + +test: + bin/phpunit + +lint: codestyle static-analysis + +fix: + bin/phpcbf + +codestyle: + bin/phpcs + +static-analysis: + bin/phpstan diff --git a/PreviousNextDrupal/ruleset.xml b/PreviousNextDrupal/ruleset.xml index 4139f57..3e140c8 100644 --- a/PreviousNextDrupal/ruleset.xml +++ b/PreviousNextDrupal/ruleset.xml @@ -33,6 +33,9 @@ + + + diff --git a/README.md b/README.md index e1d6ee8..aad81d2 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,7 @@ function doesAThing(array $data): int { #### PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose #### SlevomatCodingStandard.Classes.ClassStructure #### SlevomatCodingStandard.Classes.RequireMultiLineMethodSignature +#### SlevomatCodingStandard.Commenting.UselessInheritDocComment #### SlevomatCodingStandard.Functions.RequireTrailingCommaInCall #### SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration #### SlevomatCodingStandard.Functions.StaticClosure diff --git a/tests/Sniffs/UselessInheritDocCommentTest.php b/tests/Sniffs/UselessInheritDocCommentTest.php new file mode 100644 index 0000000..e924ea6 --- /dev/null +++ b/tests/Sniffs/UselessInheritDocCommentTest.php @@ -0,0 +1,29 @@ +getErrorCount()); + self::assertSniffError($report, 14, UselessInheritDocCommentSniff::CODE_USELESS_INHERIT_DOC_COMMENT); + } + + protected static function getSniffName(): string { + return 'SlevomatCodingStandard.Commenting.UselessInheritDocComment'; + } + +} diff --git a/tests/Sniffs/fixtures/UselessInheritDocCommentError.php b/tests/Sniffs/fixtures/UselessInheritDocCommentError.php new file mode 100644 index 0000000..d03f5c4 --- /dev/null +++ b/tests/Sniffs/fixtures/UselessInheritDocCommentError.php @@ -0,0 +1,21 @@ +