-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve handling of comments in line_break_between_method_argume…
…nts (#215)
- Loading branch information
1 parent
68613e1
commit 4fc4686
Showing
2 changed files
with
63 additions
and
1 deletion.
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
52 changes: 52 additions & 0 deletions
52
tests/UseCase/LineBreakBetweenMethods/Regression/Case10.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,52 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace tests\UseCase\LineBreakBetweenMethods\Regression; | ||
|
||
use PedroTroller\CS\Fixer\CodingStyle\LineBreakBetweenMethodArgumentsFixer; | ||
use tests\UseCase; | ||
|
||
/** | ||
* https://github.com/PedroTroller/PhpCSFixer-Custom-Fixers/issues/208 | ||
* https://github.com/PedroTroller/PhpCSFixer-Custom-Fixers/issues/214. | ||
*/ | ||
final class Case10 implements UseCase | ||
{ | ||
public function getFixers(): iterable | ||
{ | ||
yield new LineBreakBetweenMethodArgumentsFixer(); | ||
} | ||
|
||
public function getRawScript(): string | ||
{ | ||
return <<<'PHP' | ||
<?php | ||
class Foo | ||
{ | ||
public function __construct( | ||
// simple comment | ||
public ?string $simpleCommentAbove = null, | ||
// public string|null $commentedOutLine = null, | ||
public ?string $detailAndEdit = null, | ||
/** | ||
* @var list<string> | ||
*/ | ||
public array $groups = []) | ||
{ | ||
} | ||
} | ||
PHP; | ||
} | ||
|
||
public function getExpectation(): string | ||
{ | ||
return $this->getRawScript(); | ||
} | ||
|
||
public function getMinSupportedPhpVersion(): int | ||
{ | ||
return 80000; | ||
} | ||
} |