-
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.
Merge pull request #9 from asispts/comment
Disallow one-line property doc comment
- Loading branch information
Showing
8 changed files
with
76 additions
and
7 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
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
26 changes: 26 additions & 0 deletions
26
tests/Sniffs/Slevomat/DisallowOneLinePropertyDocCommentTest.php
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,26 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Ptscs\Tests\Sniffs\Slevomat; | ||
|
||
use Iterator; | ||
use Ptscs\Tests\SniffTestCase; | ||
use Ptscs\Tests\Utils\ErrorData; | ||
|
||
final class DisallowOneLinePropertyDocCommentTest extends SniffTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->appendExclude('Squiz.Classes.ClassFileName.NoMatch'); | ||
} | ||
|
||
public static function provideTestData(): Iterator | ||
{ | ||
yield[ | ||
[ | ||
// phpcs:ignore Generic.Files.LineLength.TooLong | ||
new ErrorData(7, 'SlevomatCodingStandard.Commenting.DisallowOneLinePropertyDocComment.OneLinePropertyComment'), | ||
], | ||
]; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/Sniffs/Slevomat/_data/DisallowOneLinePropertyDocComment.php.fixed
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,17 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace App; | ||
|
||
final class Foobar | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public $name; | ||
|
||
public function __invoke() | ||
{ | ||
/** @var string */ | ||
$foobar = 'Should not format this doc comment'; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/Sniffs/Slevomat/_data/DisallowOneLinePropertyDocComment.php.inc
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 App; | ||
|
||
final class Foobar | ||
{ | ||
/** @var string */ | ||
public $name; | ||
|
||
public function __invoke() | ||
{ | ||
/** @var string */ | ||
$foobar = 'Should not format this doc comment'; | ||
} | ||
} |
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