-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash when useless default comment and statement indentation coll…
…ide (#37)
- Loading branch information
1 parent
199f1e5
commit 35232b3
Showing
6 changed files
with
53 additions
and
6 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
12 changes: 12 additions & 0 deletions
12
tests/Issues/Fixture/remove_useless_default_comment_and_statement_indentation.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,12 @@ | ||
<?php | ||
|
||
function foo(): void | ||
{ | ||
// TODO: Implement foo() method. | ||
} | ||
----- | ||
<?php | ||
|
||
function foo(): void | ||
{ | ||
} |
28 changes: 28 additions & 0 deletions
28
tests/Issues/RemoveUselessDefaultCommentAndStatementIndentationFixerTest.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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symplify\CodingStandard\Tests\Issues; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use Symplify\EasyCodingStandard\Testing\PHPUnit\AbstractCheckerTestCase; | ||
|
||
final class RemoveUselessDefaultCommentAndStatementIndentationFixerTest extends AbstractCheckerTestCase | ||
{ | ||
#[DataProvider('provideData')] | ||
public function test(string $filePath): void | ||
{ | ||
$this->doTestFile($filePath); | ||
} | ||
|
||
public static function provideData(): Iterator | ||
{ | ||
yield [__DIR__ . '/Fixture/remove_useless_default_comment_and_statement_indentation.php.inc']; | ||
} | ||
|
||
public function provideConfig(): string | ||
{ | ||
return __DIR__ . '/config/config_remove_useless_default_comment_and_statement_indentation.php'; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/Issues/config/config_remove_useless_default_comment_and_statement_indentation.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,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer; | ||
use Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDefaultCommentFixer; | ||
use Symplify\EasyCodingStandard\Config\ECSConfig; | ||
|
||
return static function (ECSConfig $ecsConfig): void { | ||
$ecsConfig->rule(RemoveUselessDefaultCommentFixer::class); | ||
$ecsConfig->rule(StatementIndentationFixer::class); | ||
}; |