Skip to content

Commit

Permalink
#67 - empty lines at the file header (#76)
Browse files Browse the repository at this point in the history
* #74 - object operator spacing

* #67 - empty lines at the file header
  • Loading branch information
krzysztofrewak authored Jun 10, 2022
1 parent bc7c99f commit 717b521
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/Configuration/Defaults/CommonRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use PhpCsFixer\Fixer\ClassNotation\SingleTraitInsertPerStatementFixer;
use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use PhpCsFixer\Fixer\Comment\NoTrailingWhitespaceInCommentFixer;
use PhpCsFixer\Fixer\Comment\SingleLineCommentSpacingFixer;
use PhpCsFixer\Fixer\ControlStructure\NoUnneededControlParenthesesFixer;
use PhpCsFixer\Fixer\ControlStructure\NoUnneededCurlyBracesFixer;
use PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer;
Expand All @@ -42,10 +43,12 @@
use PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer;
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
use PhpCsFixer\Fixer\Import\SingleLineAfterImportsFixer;
use PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer;
use PhpCsFixer\Fixer\LanguageConstruct\ExplicitIndirectVariableFixer;
use PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer;
use PhpCsFixer\Fixer\LanguageConstruct\IsNullFixer;
use PhpCsFixer\Fixer\NamespaceNotation\BlankLineAfterNamespaceFixer;
use PhpCsFixer\Fixer\NamespaceNotation\CleanNamespaceFixer;
use PhpCsFixer\Fixer\NamespaceNotation\NoLeadingNamespaceWhitespaceFixer;
use PhpCsFixer\Fixer\NamespaceNotation\SingleBlankLineBeforeNamespaceFixer;
Expand Down Expand Up @@ -241,5 +244,8 @@ class CommonRules extends Rules
FunctionDeclarationFixer::class => [
"closure_function_spacing" => "none",
],
SingleLineAfterImportsFixer::class => true,
SingleLineCommentSpacingFixer::class => true,
BlankLineAfterNamespaceFixer::class => true,
];
}
3 changes: 2 additions & 1 deletion tests/codestyle/CodestyleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ public function testPhp80Fixtures(): void
"unionTypes",
"references",
"classAttributesSeparation",
"noUselessParenthesisFixer",
"uselessParenthesis",
"laravelMigrations",
"phpdocs",
"yodaStyle",
"objectOperators",
"anonymousFunctions",
"namespaces",
];

foreach ($fixtures as $fixture) {
Expand Down
6 changes: 6 additions & 0 deletions tests/codestyle/fixtures/namespaces/actual.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
declare(strict_types=1);
namespace Test;
class Test
{
}
9 changes: 9 additions & 0 deletions tests/codestyle/fixtures/namespaces/expected.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace Test;

class Test
{
}

0 comments on commit 717b521

Please sign in to comment.