diff --git a/src/Configuration/Defaults/CommonRules.php b/src/Configuration/Defaults/CommonRules.php index 02a2713..bb61967 100644 --- a/src/Configuration/Defaults/CommonRules.php +++ b/src/Configuration/Defaults/CommonRules.php @@ -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; @@ -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; @@ -241,5 +244,8 @@ class CommonRules extends Rules FunctionDeclarationFixer::class => [ "closure_function_spacing" => "none", ], + SingleLineAfterImportsFixer::class => true, + SingleLineCommentSpacingFixer::class => true, + BlankLineAfterNamespaceFixer::class => true, ]; } diff --git a/tests/codestyle/CodestyleTest.php b/tests/codestyle/CodestyleTest.php index 2e35648..3ae01a2 100644 --- a/tests/codestyle/CodestyleTest.php +++ b/tests/codestyle/CodestyleTest.php @@ -35,12 +35,13 @@ public function testPhp80Fixtures(): void "unionTypes", "references", "classAttributesSeparation", - "noUselessParenthesisFixer", + "uselessParenthesis", "laravelMigrations", "phpdocs", "yodaStyle", "objectOperators", "anonymousFunctions", + "namespaces", ]; foreach ($fixtures as $fixture) { diff --git a/tests/codestyle/fixtures/namespaces/actual.php b/tests/codestyle/fixtures/namespaces/actual.php new file mode 100644 index 0000000..ca4ac50 --- /dev/null +++ b/tests/codestyle/fixtures/namespaces/actual.php @@ -0,0 +1,6 @@ +