Skip to content

Commit

Permalink
#25 - configure NoExtraBlankLinesFixer (#36)
Browse files Browse the repository at this point in the history
* #25 - configure NoExtraBlankLinesFixer

* Update tests/codestyle/fixtures/noExtraBlankLines/actual.php

Co-authored-by: Krzysztof Rewak <krzysztof.rewak@blumilk.pl>

Co-authored-by: Krzysztof Rewak <krzysztof.rewak@blumilk.pl>
  • Loading branch information
Baakoma and krzysztofrewak authored Oct 8, 2021
1 parent 9462c48 commit e96f41e
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/Configuration/Defaults/CommonAdditionalRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ class CommonAdditionalRules extends Rules implements AdditionalRules
"author",
],
],
NoExtraBlankLinesFixer::class => null,
NoExtraBlankLinesFixer::class => [
"tokens" => [
"extra",
"curly_brace_block",
"parenthesis_brace_block",
"square_brace_block",
],
],
OperatorSpacingSniff::class => null,
TrailingCommaInMultilineFixer::class => [
"elements" => [
Expand Down
37 changes: 37 additions & 0 deletions tests/codestyle/fixtures/noExtraBlankLines/actual.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

$a = [
1,
2,

];

function b(): int
{
$a = 1;

return $a;

}

function c(int $a, int $b, int $c): int
{

return $a + $b + $c;






}

$d = c(

1,
2,
3,

);
26 changes: 26 additions & 0 deletions tests/codestyle/fixtures/noExtraBlankLines/expected.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

$a = [
1,
2,
];

function b(): int
{
$a = 1;

return $a;
}

function c(int $a, int $b, int $c): int
{
return $a + $b + $c;
}

$d = c(
1,
2,
3,
);
36 changes: 32 additions & 4 deletions tests/unit/AdditionalRulesConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ public function testAdditionalRulesConfiguration(): void
"author",
],
],
NoExtraBlankLinesFixer::class => null,
NoExtraBlankLinesFixer::class => [
"tokens" => [
"extra",
"curly_brace_block",
"parenthesis_brace_block",
"square_brace_block",
],
],
OperatorSpacingSniff::class => null,
TrailingCommaInMultilineFixer::class => [
"elements" => [
Expand Down Expand Up @@ -100,7 +107,14 @@ public function testFilteringAdditionalRulesConfiguration(): void
"author",
],
],
NoExtraBlankLinesFixer::class => null,
NoExtraBlankLinesFixer::class => [
"tokens" => [
"extra",
"curly_brace_block",
"parenthesis_brace_block",
"square_brace_block",
],
],
OperatorSpacingSniff::class => null,
TrailingCommaInMultilineFixer::class => [
"elements" => [
Expand Down Expand Up @@ -144,7 +158,14 @@ public function testExtendingAdditionalRulesConfiguration(): void
"author",
],
],
NoExtraBlankLinesFixer::class => null,
NoExtraBlankLinesFixer::class => [
"tokens" => [
"extra",
"curly_brace_block",
"parenthesis_brace_block",
"square_brace_block",
],
],
OperatorSpacingSniff::class => null,
TrailingCommaInMultilineFixer::class => [
"elements" => [
Expand Down Expand Up @@ -196,7 +217,14 @@ public function testExtendingWithOptionsAdditionalRulesConfiguration(): void
"author",
],
],
NoExtraBlankLinesFixer::class => null,
NoExtraBlankLinesFixer::class => [
"tokens" => [
"extra",
"curly_brace_block",
"parenthesis_brace_block",
"square_brace_block",
],
],
OperatorSpacingSniff::class => null,
TrailingCommaInMultilineFixer::class => [
"elements" => [
Expand Down

0 comments on commit e96f41e

Please sign in to comment.