-
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.
feat: add inline-attributes option to PedroTroller/line_break_between…
…_method_arguments
- Loading branch information
1 parent
8376adf
commit b25f454
Showing
5 changed files
with
232 additions
and
4 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
98 changes: 98 additions & 0 deletions
98
tests/UseCase/LineBreakBetweenMethods/Regression/Case7.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,98 @@ | ||
<?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/169. | ||
*/ | ||
final class Case7 implements UseCase | ||
{ | ||
public function getFixers(): iterable | ||
{ | ||
$fixer = new LineBreakBetweenMethodArgumentsFixer(); | ||
|
||
$fixer->configure([ | ||
'inline-attributes' => false, | ||
]); | ||
|
||
yield $fixer; | ||
} | ||
|
||
public function getRawScript(): string | ||
{ | ||
return <<<'PHP' | ||
<?php | ||
use Doctrine\Orm\Mapping as ORM; | ||
class Foo { | ||
public function __construct( | ||
#[ORM\Id] | ||
#[ORM\Column(type: 'uuid')] | ||
private readonly UuidInterface $id, | ||
#[ORM\ManyToOne] | ||
#[ORM\JoinColumn(nullable: false)] | ||
private readonly AuthUser $authUser, | ||
#[ORM\Column(length: 40, nullable: false)] | ||
private readonly string $accessToken, | ||
#[ORM\Column(length: 256, nullable: false)] | ||
private readonly string $refreshToken, | ||
#[ORM\Column(length: 255, nullable: false)] | ||
private readonly string $deviceUserAgent, | ||
#[ORM\Column(length: 100)] | ||
private readonly string $deviceType, | ||
#[ORM\Column(length: 100)] | ||
private readonly string $deviceOs, | ||
#[ORM\Column(length: 100)] | ||
private readonly string $deviceBrowser | ||
) { | ||
} | ||
} | ||
PHP; | ||
} | ||
|
||
public function getExpectation(): string | ||
{ | ||
return <<<'PHP' | ||
<?php | ||
use Doctrine\Orm\Mapping as ORM; | ||
class Foo { | ||
public function __construct( | ||
#[ORM\Id] | ||
#[ORM\Column(type: 'uuid')] | ||
private readonly UuidInterface $id, | ||
#[ORM\ManyToOne] | ||
#[ORM\JoinColumn(nullable: false)] | ||
private readonly AuthUser $authUser, | ||
#[ORM\Column(length: 40, nullable: false)] | ||
private readonly string $accessToken, | ||
#[ORM\Column(length: 256, nullable: false)] | ||
private readonly string $refreshToken, | ||
#[ORM\Column(length: 255, nullable: false)] | ||
private readonly string $deviceUserAgent, | ||
#[ORM\Column(length: 100)] | ||
private readonly string $deviceType, | ||
#[ORM\Column(length: 100)] | ||
private readonly string $deviceOs, | ||
#[ORM\Column(length: 100)] | ||
private readonly string $deviceBrowser | ||
) { | ||
} | ||
} | ||
PHP; | ||
} | ||
|
||
public function getMinSupportedPhpVersion(): int | ||
{ | ||
return 80100; | ||
} | ||
} |
88 changes: 88 additions & 0 deletions
88
tests/UseCase/LineBreakBetweenMethods/Regression/Case8.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,88 @@ | ||
<?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/169. | ||
*/ | ||
final class Case8 implements UseCase | ||
{ | ||
public function getFixers(): iterable | ||
{ | ||
$fixer = new LineBreakBetweenMethodArgumentsFixer(); | ||
|
||
$fixer->configure([ | ||
'inline-attributes' => true, | ||
]); | ||
|
||
yield $fixer; | ||
} | ||
|
||
public function getRawScript(): string | ||
{ | ||
return <<<'PHP' | ||
<?php | ||
use Doctrine\Orm\Mapping as ORM; | ||
class Foo { | ||
public function __construct( | ||
#[ORM\Id] | ||
#[ORM\Column(type: 'uuid')] | ||
private readonly UuidInterface $id, | ||
#[ORM\ManyToOne] | ||
#[ORM\JoinColumn(nullable: false)] | ||
private readonly AuthUser $authUser, | ||
#[ORM\Column(length: 40, nullable: false)] | ||
private readonly string $accessToken, | ||
#[ORM\Column(length: 256, nullable: false)] | ||
private readonly string $refreshToken, | ||
#[ORM\Column(length: 255, nullable: false)] | ||
private readonly string $deviceUserAgent, | ||
#[ORM\Column(length: 100)] | ||
private readonly string $deviceType, | ||
#[ORM\Column(length: 100)] | ||
private readonly string $deviceOs, | ||
#[ORM\Column(length: 100)] | ||
private readonly string $deviceBrowser | ||
) { | ||
} | ||
} | ||
PHP; | ||
} | ||
|
||
public function getExpectation(): string | ||
{ | ||
return <<<'PHP' | ||
<?php | ||
use Doctrine\Orm\Mapping as ORM; | ||
class Foo { | ||
public function __construct( | ||
#[ORM\Id] #[ORM\Column(type: 'uuid')] private readonly UuidInterface $id, | ||
#[ORM\ManyToOne] #[ORM\JoinColumn(nullable: false)] private readonly AuthUser $authUser, | ||
#[ORM\Column(length: 40, nullable: false)] private readonly string $accessToken, | ||
#[ORM\Column(length: 256, nullable: false)] private readonly string $refreshToken, | ||
#[ORM\Column(length: 255, nullable: false)] private readonly string $deviceUserAgent, | ||
#[ORM\Column(length: 100)] private readonly string $deviceType, | ||
#[ORM\Column(length: 100)] private readonly string $deviceOs, | ||
#[ORM\Column(length: 100)] private readonly string $deviceBrowser | ||
) { | ||
} | ||
} | ||
PHP; | ||
} | ||
|
||
public function getMinSupportedPhpVersion(): int | ||
{ | ||
return 80100; | ||
} | ||
} |