-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add
SlevomatCodingStandard.Commenting.UselessInheritDocComment
Fixes #21
- Loading branch information
Showing
7 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
check: test lint | ||
|
||
test: | ||
bin/phpunit | ||
|
||
lint: codestyle static-analysis | ||
|
||
fix: | ||
bin/phpcbf | ||
|
||
codestyle: | ||
bin/phpcs | ||
|
||
static-analysis: | ||
bin/phpstan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PreviousNext\CodingStandard\Tests\Sniffs; | ||
|
||
use SlevomatCodingStandard\Sniffs\Commenting\UselessInheritDocCommentSniff; | ||
|
||
/** | ||
* @covers \SlevomatCodingStandard\Sniffs\Commenting\UselessInheritDocCommentSniff | ||
*/ | ||
final class UselessInheritDocCommentTest extends Base { | ||
|
||
public function testNoError(): void { | ||
$report = self::checkFile(__DIR__ . '/fixtures/UselessInheritDocCommentNoError.php'); | ||
self::assertNoSniffErrorInFile($report); | ||
} | ||
|
||
public function testMissing(): void { | ||
$report = self::checkFile(__DIR__ . '/fixtures/UselessInheritDocCommentError.php'); | ||
self::assertSame(1, $report->getErrorCount()); | ||
self::assertSniffError($report, 14, UselessInheritDocCommentSniff::CODE_USELESS_INHERIT_DOC_COMMENT); | ||
} | ||
|
||
protected static function getSniffName(): string { | ||
return 'SlevomatCodingStandard.Commenting.UselessInheritDocComment'; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sniffs\fixtures; | ||
|
||
use PreviousNext\CodingStandard\Tests\Sniffs\fixtures\UselessInheritDocCommentParent; | ||
|
||
/** | ||
* The class. | ||
*/ | ||
final class UselessInheritDocCommentError extends UselessInheritDocCommentParent { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function foo(): void { | ||
parent::foo(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PreviousNext\CodingStandard\Tests\Sniffs\fixtures; | ||
|
||
/** | ||
* The class. | ||
*/ | ||
final class UselessInheritDocCommentNoError extends UselessInheritDocCommentParent { | ||
|
||
/** | ||
* Foo. | ||
*/ | ||
public function foo(): void { | ||
parent::foo(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PreviousNext\CodingStandard\Tests\Sniffs\fixtures; | ||
|
||
/** | ||
* The parent class. | ||
*/ | ||
abstract class UselessInheritDocCommentParent { | ||
|
||
public function foo(): void { | ||
} | ||
|
||
} |