diff --git a/config/set/php-cs-fixer-custom.php b/config/set/php-cs-fixer-custom.php index 6d765ee..8b1770c 100644 --- a/config/set/php-cs-fixer-custom.php +++ b/config/set/php-cs-fixer-custom.php @@ -23,7 +23,7 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ElseifFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\StringNotation\NoBinaryStringFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Semicolon\NoEmptyStatementFixer::class); - $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ControlStructure\NoUnneededCurlyBracesFixer::class, [ + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ControlStructure\NoUnneededBracesFixer::class, [ 'namespaces' => true, ]); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Alias\NoAliasFunctionsFixer::class, [ @@ -34,7 +34,8 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\NoSuperfluousElseifFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Strict\StrictComparisonFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithBracesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithParenthesesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\ImplodeCallFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer::class, [ 'single_line' => true, @@ -74,6 +75,7 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocIndentFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Alias\BacktickToShellExecFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocAnnotationWithoutDotFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\LongToShorthandOperatorFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocTypesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\StandardizeIncrementFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ReturnNotation\SimplifiedNullReturnFixer::class); @@ -96,12 +98,6 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocNoPackageFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocReturnSelfReferenceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer::class); - $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer::class, [ - 'fix_built_in' => false, - 'include' => ['DIRECTORY_SEPARATOR', 'PHP_INT_SIZE', 'PHP_SAPI', 'PHP_VERSION_ID'], - 'scope' => 'namespaced', - 'strict' => true, - ]); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\FullyQualifiedStrictTypesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocLineSpanFixer::class); @@ -113,24 +109,29 @@ $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Operator\NoUselessConcatOperatorFixer::class, [ 'juggle_simple_strings' => true, ]); - $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocNoEmptyReturnFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveIssetsFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocNoEmptyReturnFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NullableTypeDeclarationForDefaultNullValueFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\CleanNamespaceFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoSpacesAfterFunctionNameFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SpacesInsideParenthesesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\CleanNamespaceFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Comment\NoEmptyCommentFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Semicolon\SemicolonAfterInstructionFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\NullableTypeDeclarationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureBracesFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\EmptyLoopConditionFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\NoUnneededImportAliasFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Comment\SingleLineCommentSpacingFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer::class, [ + 'fix_built_in' => false, + 'include' => ['DIRECTORY_SEPARATOR', 'PHP_INT_SIZE', 'PHP_SAPI', 'PHP_VERSION_ID'], + 'scope' => 'namespaced', + 'strict' => true, + ]); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\IsNullFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer::class, [ 'include' => ['@compiler_optimized'], @@ -146,6 +147,7 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Comment\MultilineCommentOpeningClosingFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Semicolon\MultilineWhitespaceBeforeSemicolonsFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\OrderedTypesFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Phpdoc\PhpdocTypesOrderFixer::class, [ 'null_adjustment' => 'always_last', 'sort_algorithm' => 'none', @@ -154,13 +156,17 @@ $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer::class, [ 'ensure_single_space' => true, ]); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypehintFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Operator\ConcatSpaceFixer::class, [ + 'spacing' => 'one', + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypeDeclarationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\ConstantCaseFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureContinuationPositionFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\LineEndingFixer::class); @@ -173,9 +179,6 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSemicolonToColonFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSpaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\ClassReferenceNameCasingFixer::class); - $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Operator\ConcatSpaceFixer::class, [ - 'spacing' => 'one', - ]); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\DeclareParenthesesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpTag\EchoTagSyntaxFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Import\GlobalNamespaceImportFixer::class, [ @@ -189,7 +192,7 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\MagicConstantCasingFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\MagicMethodCasingFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\NativeFunctionCasingFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\NativeFunctionTypeDeclarationCasingFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\NativeTypeDeclarationCasingFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Alias\NoAliasLanguageConstructCallFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\NoLeadingNamespaceWhitespaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\NoNullPropertyInitializationFixer::class); @@ -218,7 +221,6 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\TrimArraySpacesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoUnreachableDefaultArgumentValueFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitDataProviderNameFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer::class); @@ -244,19 +246,29 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitSetUpTearDownVisibilityFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Alias\SetTypeToCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\StringNotation\StringLineEndingFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\OrderedTypesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocParamOrderFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\NoMultipleStatementsPerLineFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Semicolon\SpaceAfterSemicolonFixer::class, [ 'remove_in_empty_for_expressions' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\TypesSpacesFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\CurlyBracesPositionFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\BracesPositionFixer::class, [ + 'allow_single_line_anonymous_functions' => true, + 'allow_single_line_empty_anonymous_classes' => true, + ]); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Phpdoc\PhpdocOrderFixer::class, [ 'order' => ['param', 'return', 'throws'], ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocSeparationFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Phpdoc\PhpdocSeparationFixer::class, [ + 'groups' => [ + ['Annotation', 'NamedArgumentConstructor', 'Target'], + ['author', 'copyright', 'license'], + ['category', 'package', 'subpackage'], + ['property', 'property-read', 'property-write'], + ['deprecated', 'link', 'see', 'since'], + ], + ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocTrimFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitConstructFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\NoShortBoolCastFixer::class); @@ -275,7 +287,6 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ReturnNotation\ReturnAssignmentFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ReturnNotation\NoUselessReturnFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer::class, [ 'tokens' => [ 'attribute', @@ -320,6 +331,7 @@ ]); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Import\OrderedImportsFixer::class, [ 'imports_order' => ['class', 'function', 'const'], + 'sort_algorithm' => 'alpha', ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Comment\SingleLineCommentStyleFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\BlankLinesBeforeNamespaceFixer::class); @@ -329,5 +341,6 @@ $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer::class, [ 'align' => 'left', ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SingleBlankLineAtEofFixer::class); }; diff --git a/config/set/php-cs-fixer/per-cs-risky.php b/config/set/php-cs-fixer/per-cs-risky.php new file mode 100644 index 0000000..7d01987 --- /dev/null +++ b/config/set/php-cs-fixer/per-cs-risky.php @@ -0,0 +1,10 @@ +rule(\PhpCsFixer\Fixer\StringNotation\NoTrailingWhitespaceInStringFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoUnreachableDefaultArgumentValueFixer::class); +}; diff --git a/config/set/php-cs-fixer/per-cs.php b/config/set/php-cs-fixer/per-cs.php new file mode 100644 index 0000000..480f0a9 --- /dev/null +++ b/config/set/php-cs-fixer/per-cs.php @@ -0,0 +1,79 @@ +rule(\PhpCsFixer\Fixer\Basic\EncodingFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\PhpTag\FullOpeningTagFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer::class, [ + 'order' => ['use_trait'], + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ClassNotation\SingleClassElementPerStatementFixer::class, [ + 'elements' => ['property'], + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\IndentationTypeFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ElseifFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithParenthesesFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer::class, [ + 'inline_constructor_arguments' => false, + 'space_before_parenthesis' => true, + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\SingleTraitInsertPerStatementFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer::class, [ + 'closure_fn_spacing' => 'none', + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoSpacesAfterFunctionNameFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SpacesInsideParenthesesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer::class, [ + 'group_to_single_imports' => false, + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureBracesFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Operator\ConcatSpaceFixer::class, [ + 'spacing' => 'one', + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypeDeclarationFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\ConstantCaseFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureContinuationPositionFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\LineEndingFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\LowercaseKeywordsFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\NoBreakCommentFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\PhpTag\NoClosingTagFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NoSpaceAroundDoubleColonFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoTrailingWhitespaceFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Comment\NoTrailingWhitespaceInCommentFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSemicolonToColonFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSpaceFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\NoMultipleStatementsPerLineFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\BracesPositionFixer::class, [ + 'allow_single_line_empty_anonymous_classes' => true, + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Import\SingleLineAfterImportsFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\SingleLineEmptyBodyFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\BlankLineAfterNamespaceFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Import\OrderedImportsFixer::class, [ + 'imports_order' => ['class', 'function', 'const'], + 'sort_algorithm' => 'none', + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\BlankLinesBeforeNamespaceFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer::class, [ + 'default' => 'at_least_single_space', + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\BlankLineBetweenImportGroupsFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SingleBlankLineAtEofFixer::class); +}; diff --git a/config/set/php-cs-fixer/per-cs10.php b/config/set/php-cs-fixer/per-cs10.php index f08197f..035a127 100644 --- a/config/set/php-cs-fixer/per-cs10.php +++ b/config/set/php-cs-fixer/per-cs10.php @@ -16,7 +16,7 @@ ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\IndentationTypeFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ElseifFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithBracesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithParenthesesFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer::class, [ 'inline_constructor_arguments' => false, 'space_before_parenthesis' => true, @@ -24,6 +24,7 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\SingleTraitInsertPerStatementFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class, [ + 'attribute_placement' => 'ignore', 'on_multiline' => 'ensure_fully_multiline', ]); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoSpacesAfterFunctionNameFixer::class); @@ -33,13 +34,14 @@ 'group_to_single_imports' => false, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureBracesFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypehintFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypeDeclarationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\ConstantCaseFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureContinuationPositionFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\LineEndingFixer::class); @@ -52,13 +54,12 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSemicolonToColonFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSpaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\NoMultipleStatementsPerLineFixer::class); - $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\CurlyBracesPositionFixer::class, [ + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\BracesPositionFixer::class, [ 'allow_single_line_empty_anonymous_classes' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\SingleLineAfterImportsFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\BlankLineAfterNamespaceFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Import\OrderedImportsFixer::class, [ @@ -70,5 +71,6 @@ 'default' => 'at_least_single_space', ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\BlankLineBetweenImportGroupsFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SingleBlankLineAtEofFixer::class); }; diff --git a/config/set/php-cs-fixer/per-cs20-risky.php b/config/set/php-cs-fixer/per-cs20-risky.php new file mode 100644 index 0000000..7d01987 --- /dev/null +++ b/config/set/php-cs-fixer/per-cs20-risky.php @@ -0,0 +1,10 @@ +rule(\PhpCsFixer\Fixer\StringNotation\NoTrailingWhitespaceInStringFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoUnreachableDefaultArgumentValueFixer::class); +}; diff --git a/config/set/php-cs-fixer/per-cs20.php b/config/set/php-cs-fixer/per-cs20.php new file mode 100644 index 0000000..867f227 --- /dev/null +++ b/config/set/php-cs-fixer/per-cs20.php @@ -0,0 +1,79 @@ +rule(\PhpCsFixer\Fixer\Basic\EncodingFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\PhpTag\FullOpeningTagFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer::class, [ + 'order' => ['use_trait'], + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ClassNotation\SingleClassElementPerStatementFixer::class, [ + 'elements' => ['property'], + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\IndentationTypeFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ElseifFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithParenthesesFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer::class, [ + 'inline_constructor_arguments' => false, + 'space_before_parenthesis' => true, + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\SingleTraitInsertPerStatementFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer::class, [ + 'closure_fn_spacing' => 'none', + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoSpacesAfterFunctionNameFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SpacesInsideParenthesesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer::class, [ + 'group_to_single_imports' => false, + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureBracesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypeDeclarationFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\ConstantCaseFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureContinuationPositionFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\LineEndingFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\LowercaseKeywordsFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\NoBreakCommentFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\PhpTag\NoClosingTagFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NoSpaceAroundDoubleColonFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoTrailingWhitespaceFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Comment\NoTrailingWhitespaceInCommentFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSemicolonToColonFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSpaceFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Operator\ConcatSpaceFixer::class, [ + 'spacing' => 'one', + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\NoMultipleStatementsPerLineFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\BracesPositionFixer::class, [ + 'allow_single_line_empty_anonymous_classes' => true, + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Import\SingleLineAfterImportsFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\SingleLineEmptyBodyFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\BlankLineAfterNamespaceFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Import\OrderedImportsFixer::class, [ + 'imports_order' => ['class', 'function', 'const'], + 'sort_algorithm' => 'none', + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\BlankLinesBeforeNamespaceFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer::class, [ + 'default' => 'at_least_single_space', + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\BlankLineBetweenImportGroupsFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SingleBlankLineAtEofFixer::class); +}; diff --git a/config/set/php-cs-fixer/per.php b/config/set/php-cs-fixer/per.php index f08197f..480f0a9 100644 --- a/config/set/php-cs-fixer/per.php +++ b/config/set/php-cs-fixer/per.php @@ -16,16 +16,16 @@ ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\IndentationTypeFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ElseifFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithBracesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithParenthesesFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer::class, [ 'inline_constructor_arguments' => false, 'space_before_parenthesis' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\SingleTraitInsertPerStatementFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer::class); - $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class, [ - 'on_multiline' => 'ensure_fully_multiline', + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer::class, [ + 'closure_fn_spacing' => 'none', ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoSpacesAfterFunctionNameFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SpacesInsideParenthesesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer::class); @@ -33,13 +33,17 @@ 'group_to_single_imports' => false, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureBracesFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypehintFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Operator\ConcatSpaceFixer::class, [ + 'spacing' => 'one', + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypeDeclarationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\ConstantCaseFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureContinuationPositionFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\LineEndingFixer::class); @@ -52,13 +56,13 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSemicolonToColonFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSpaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\NoMultipleStatementsPerLineFixer::class); - $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\CurlyBracesPositionFixer::class, [ + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\BracesPositionFixer::class, [ 'allow_single_line_empty_anonymous_classes' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\SingleLineAfterImportsFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\SingleLineEmptyBodyFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\BlankLineAfterNamespaceFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Import\OrderedImportsFixer::class, [ @@ -70,5 +74,6 @@ 'default' => 'at_least_single_space', ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\BlankLineBetweenImportGroupsFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SingleBlankLineAtEofFixer::class); }; diff --git a/config/set/php-cs-fixer/php-cs-fixer-risky.php b/config/set/php-cs-fixer/php-cs-fixer-risky.php index 05a8870..7d31956 100644 --- a/config/set/php-cs-fixer/php-cs-fixer-risky.php +++ b/config/set/php-cs-fixer/php-cs-fixer-risky.php @@ -20,16 +20,17 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\Strict\StrictParamFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Comment\CommentToPhpdocFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\NoUnsetOnPropertyFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\LongToShorthandOperatorFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitDataProviderReturnTypeFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\IsNullFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer::class, [ 'fix_built_in' => false, 'include' => ['DIRECTORY_SEPARATOR', 'PHP_INT_SIZE', 'PHP_SAPI', 'PHP_VERSION_ID'], 'scope' => 'namespaced', 'strict' => true, ]); - $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitDataProviderReturnTypeFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\IsNullFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer::class, [ 'include' => ['@compiler_optimized'], 'scope' => 'namespaced', diff --git a/config/set/php-cs-fixer/php-cs-fixer.php b/config/set/php-cs-fixer/php-cs-fixer.php index de7ce9d..73d32f5 100644 --- a/config/set/php-cs-fixer/php-cs-fixer.php +++ b/config/set/php-cs-fixer/php-cs-fixer.php @@ -22,13 +22,14 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ElseifFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\StringNotation\NoBinaryStringFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Semicolon\NoEmptyStatementFixer::class); - $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ControlStructure\NoUnneededCurlyBracesFixer::class, [ + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ControlStructure\NoUnneededBracesFixer::class, [ 'namespaces' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\EmptyLoopBodyFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\NoSuperfluousElseifFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithBracesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithParenthesesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer::class, [ 'single_line' => true, ]); @@ -84,28 +85,29 @@ ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocNoUselessInheritdocFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NoUselessConcatOperatorFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocNoEmptyReturnFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\CleanNamespaceFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveIssetsFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocNoEmptyReturnFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoSpacesAfterFunctionNameFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SpacesInsideParenthesesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\CleanNamespaceFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Comment\NoEmptyCommentFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Semicolon\SemicolonAfterInstructionFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureBracesFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\EmptyLoopConditionFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\NoUnneededImportAliasFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Comment\SingleLineCommentSpacingFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypehintFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\ConcatSpaceFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypeDeclarationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\ConstantCaseFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureContinuationPositionFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\LineEndingFixer::class); @@ -118,7 +120,6 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSemicolonToColonFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSpaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\ClassReferenceNameCasingFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\ConcatSpaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\DeclareParenthesesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpTag\EchoTagSyntaxFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Import\GlobalNamespaceImportFixer::class, [ @@ -132,7 +133,7 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\MagicConstantCasingFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\MagicMethodCasingFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\NativeFunctionCasingFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\NativeFunctionTypeDeclarationCasingFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\NativeTypeDeclarationCasingFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Alias\NoAliasLanguageConstructCallFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\NoLeadingNamespaceWhitespaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\NoNullPropertyInitializationFixer::class); @@ -162,7 +163,6 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\TrimArraySpacesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer::class, [ 'ensure_single_space' => true, ]); @@ -175,6 +175,7 @@ $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Semicolon\MultilineWhitespaceBeforeSemicolonsFixer::class, [ 'strategy' => 'new_line_for_chained_calls', ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\OrderedTypesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitTestClassRequiresCoversFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocVarAnnotationCorrectOrderFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\NoMultipleStatementsPerLineFixer::class); @@ -182,7 +183,7 @@ 'remove_in_empty_for_expressions' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\TypesSpacesFixer::class); - $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\CurlyBracesPositionFixer::class, [ + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\BracesPositionFixer::class, [ 'allow_single_line_anonymous_functions' => true, 'allow_single_line_empty_anonymous_classes' => true, ]); @@ -190,7 +191,15 @@ 'order' => ['param', 'return', 'throws'], ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocSeparationFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Phpdoc\PhpdocSeparationFixer::class, [ + 'groups' => [ + ['Annotation', 'NamedArgumentConstructor', 'Target'], + ['author', 'copyright', 'license'], + ['category', 'package', 'subpackage'], + ['property', 'property-read', 'property-write'], + ['deprecated', 'link', 'see', 'since'], + ], + ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocTrimFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\NoShortBoolCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitFqcnAnnotationFixer::class); @@ -205,7 +214,6 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ReturnNotation\ReturnAssignmentFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ReturnNotation\NoUselessReturnFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\SingleLineEmptyBodyFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\BlankLineAfterNamespaceFixer::class); @@ -259,5 +267,6 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\BlankLineBetweenImportGroupsFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocTrimConsecutiveBlankLineSeparationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SingleBlankLineAtEofFixer::class); }; diff --git a/config/set/php-cs-fixer/php73-migration.php b/config/set/php-cs-fixer/php73-migration.php index c1bd390..0e9b129 100644 --- a/config/set/php-cs-fixer/php73-migration.php +++ b/config/set/php-cs-fixer/php73-migration.php @@ -6,11 +6,11 @@ return static function (ECSConfig $ecsConfig): void { $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class, [ 'after_heredoc' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\TernaryToNullCoalescingFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer::class, [ 'after_heredoc' => true, diff --git a/config/set/php-cs-fixer/php74-migration.php b/config/set/php-cs-fixer/php74-migration.php index cb52a7d..d33aa83 100644 --- a/config/set/php-cs-fixer/php74-migration.php +++ b/config/set/php-cs-fixer/php74-migration.php @@ -6,11 +6,11 @@ return static function (ECSConfig $ecsConfig): void { $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class, [ 'after_heredoc' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer::class, [ 'after_heredoc' => true, ]); diff --git a/config/set/php-cs-fixer/php80-migration.php b/config/set/php-cs-fixer/php80-migration.php index d3d3c6a..9ba1499 100644 --- a/config/set/php-cs-fixer/php80-migration.php +++ b/config/set/php-cs-fixer/php80-migration.php @@ -6,12 +6,12 @@ return static function (ECSConfig $ecsConfig): void { $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class, [ 'after_heredoc' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\CleanNamespaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\NormalizeIndexBraceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer::class, [ diff --git a/config/set/php-cs-fixer/php81-migration.php b/config/set/php-cs-fixer/php81-migration.php index 75b81a3..89ccbf8 100644 --- a/config/set/php-cs-fixer/php81-migration.php +++ b/config/set/php-cs-fixer/php81-migration.php @@ -6,12 +6,12 @@ return static function (ECSConfig $ecsConfig): void { $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class, [ 'after_heredoc' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\CleanNamespaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\NoUnsetCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\NormalizeIndexBraceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer::class); diff --git a/config/set/php-cs-fixer/php82-migration.php b/config/set/php-cs-fixer/php82-migration.php index b3829f6..a16cf83 100644 --- a/config/set/php-cs-fixer/php82-migration.php +++ b/config/set/php-cs-fixer/php82-migration.php @@ -6,12 +6,12 @@ return static function (ECSConfig $ecsConfig): void { $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class, [ 'after_heredoc' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\CleanNamespaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\OctalNotationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\NoUnsetCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\NormalizeIndexBraceFixer::class); diff --git a/config/set/php-cs-fixer/php83-migration.php b/config/set/php-cs-fixer/php83-migration.php new file mode 100644 index 0000000..a16cf83 --- /dev/null +++ b/config/set/php-cs-fixer/php83-migration.php @@ -0,0 +1,29 @@ +rule(\PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class, [ + 'after_heredoc' => true, + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\CleanNamespaceFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\OctalNotationFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\NoUnsetCastFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\NormalizeIndexBraceFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer::class, [ + 'after_heredoc' => true, + ]); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer::class, [ + 'after_heredoc' => true, + ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\TernaryToNullCoalescingFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\AssignNullCoalescingToCoalesceEqualFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\StringNotation\SimpleToComplexStringVariableFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\HeredocIndentationFixer::class); +}; diff --git a/config/set/php-cs-fixer/psr12.php b/config/set/php-cs-fixer/psr12.php index 7c618af..ce5a956 100644 --- a/config/set/php-cs-fixer/psr12.php +++ b/config/set/php-cs-fixer/psr12.php @@ -16,7 +16,7 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\IndentationTypeFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ElseifFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithBracesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithParenthesesFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer::class, [ 'inline_constructor_arguments' => false, 'space_before_parenthesis' => true, @@ -24,6 +24,7 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\SingleTraitInsertPerStatementFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class, [ + 'attribute_placement' => 'ignore', 'on_multiline' => 'ensure_fully_multiline', ]); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoSpacesAfterFunctionNameFixer::class); @@ -44,21 +45,21 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\Comment\NoTrailingWhitespaceInCommentFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSemicolonToColonFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSpaceFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypehintFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypeDeclarationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\NoMultipleStatementsPerLineFixer::class); - $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\CurlyBracesPositionFixer::class, [ + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\BracesPositionFixer::class, [ 'allow_single_line_empty_anonymous_classes' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\SingleLineAfterImportsFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\BlankLineAfterNamespaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Import\OrderedImportsFixer::class, [ @@ -70,5 +71,6 @@ 'default' => 'at_least_single_space', ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\BlankLineBetweenImportGroupsFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SingleBlankLineAtEofFixer::class); }; diff --git a/config/set/php-cs-fixer/psr2.php b/config/set/php-cs-fixer/psr2.php index 28792b7..8494a6c 100644 --- a/config/set/php-cs-fixer/psr2.php +++ b/config/set/php-cs-fixer/psr2.php @@ -18,6 +18,7 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class, [ + 'attribute_placement' => 'ignore', 'on_multiline' => 'ensure_fully_multiline', ]); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoSpacesAfterFunctionNameFixer::class); @@ -36,7 +37,7 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSemicolonToColonFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\SwitchCaseSpaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\NoMultipleStatementsPerLineFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\CurlyBracesPositionFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\BracesPositionFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\SingleLineAfterImportsFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\BlankLineAfterNamespaceFixer::class); diff --git a/config/set/php-cs-fixer/symfony-risky.php b/config/set/php-cs-fixer/symfony-risky.php index 2940e05..fc9d430 100644 --- a/config/set/php-cs-fixer/symfony-risky.php +++ b/config/set/php-cs-fixer/symfony-risky.php @@ -14,13 +14,14 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\CombineNestedDirnameFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Alias\PowToExponentiationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\ModernizeTypesCastingFixer::class); - $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer::class, [ - 'strict' => false, - ]); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\LongToShorthandOperatorFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\GetClassToClassKeywordFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\IsNullFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer::class, [ + 'strict' => false, + ]); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer::class, [ 'include' => ['@compiler_optimized'], 'scope' => 'namespaced', diff --git a/config/set/php-cs-fixer/symfony.php b/config/set/php-cs-fixer/symfony.php index e6df691..4eca34d 100644 --- a/config/set/php-cs-fixer/symfony.php +++ b/config/set/php-cs-fixer/symfony.php @@ -22,13 +22,14 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ElseifFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\StringNotation\NoBinaryStringFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Semicolon\NoEmptyStatementFixer::class); - $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ControlStructure\NoUnneededCurlyBracesFixer::class, [ + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ControlStructure\NoUnneededBracesFixer::class, [ 'namespaces' => true, ]); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ControlStructure\EmptyLoopBodyFixer::class, [ 'style' => 'braces', ]); - $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithBracesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NewWithParenthesesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer::class, [ 'single_line' => true, ]); @@ -79,29 +80,29 @@ ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocNoUselessInheritdocFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\NoUselessConcatOperatorFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoSpacesAfterFunctionNameFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SpacesInsideParenthesesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\CleanNamespaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer::class); $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\FunctionNotation\NullableTypeDeclarationForDefaultNullValueFixer::class, [ 'use_nullable_type_declaration' => false, ]); - $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\NoSpacesAfterFunctionNameFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SpacesInsideParenthesesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Comment\NoEmptyCommentFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Semicolon\SemicolonAfterInstructionFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureBracesFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\EmptyLoopConditionFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\NoUnneededImportAliasFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Comment\SingleLineCommentSpacingFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypehintFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\CompactNullableTypeDeclarationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\ConstantCaseFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\ControlStructureContinuationPositionFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\LineEndingFixer::class); @@ -128,7 +129,7 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\MagicConstantCasingFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\MagicMethodCasingFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\NativeFunctionCasingFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\NativeFunctionTypeDeclarationCasingFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Casing\NativeTypeDeclarationCasingFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Alias\NoAliasLanguageConstructCallFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\NoLeadingNamespaceWhitespaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ClassNotation\NoNullPropertyInitializationFixer::class); @@ -161,7 +162,6 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\TrimArraySpacesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Basic\NoMultipleStatementsPerLineFixer::class); @@ -169,7 +169,7 @@ 'remove_in_empty_for_expressions' => true, ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\TypesSpacesFixer::class); - $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\CurlyBracesPositionFixer::class, [ + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Basic\BracesPositionFixer::class, [ 'allow_single_line_anonymous_functions' => true, 'allow_single_line_empty_anonymous_classes' => true, ]); @@ -177,7 +177,15 @@ 'order' => ['param', 'return', 'throws'], ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocSeparationFixer::class); + $ecsConfig->ruleWithConfiguration(\PhpCsFixer\Fixer\Phpdoc\PhpdocSeparationFixer::class, [ + 'groups' => [ + ['Annotation', 'NamedArgumentConstructor', 'Target'], + ['author', 'copyright', 'license'], + ['category', 'package', 'subpackage'], + ['property', 'property-read', 'property-write'], + ['deprecated', 'link', 'see', 'since'], + ], + ]); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocTrimFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\CastNotation\NoShortBoolCastFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\PhpUnit\PhpUnitFqcnAnnotationFixer::class); @@ -188,7 +196,6 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\StringNotation\SimpleToComplexStringVariableFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\SingleLineAfterImportsFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer::class); - $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\NamespaceNotation\BlankLineAfterNamespaceFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\NoBlankLinesAfterPhpdocFixer::class); @@ -222,5 +229,6 @@ $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\BlankLineBetweenImportGroupsFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocTrimConsecutiveBlankLineSeparationFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer::class); + $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer::class); $ecsConfig->rule(\PhpCsFixer\Fixer\Whitespace\SingleBlankLineAtEofFixer::class); }; diff --git a/config/set/php83.php b/config/set/php83.php new file mode 100644 index 0000000..c3d2904 --- /dev/null +++ b/config/set/php83.php @@ -0,0 +1,16 @@ +sets([ + PhpCsFixerSetList::PHP83_MIGRATION, + PhpCsFixerSetList::PHP80_MIGRATION_RISKY, + ]); +}; diff --git a/config/set/php_codesniffer/slevomat-coding-standard.php b/config/set/php_codesniffer/slevomat-coding-standard.php index 7319481..1ad6b5b 100644 --- a/config/set/php_codesniffer/slevomat-coding-standard.php +++ b/config/set/php_codesniffer/slevomat-coding-standard.php @@ -104,6 +104,7 @@ $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Functions\StrictCallSniff::class); $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Functions\RequireTrailingCommaInCallSniff::class); $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Functions\DisallowNamedArgumentsSniff::class); + $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Functions\NamedArgumentSpacingSniff::class); $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff::class); $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Functions\RequireArrowFunctionSniff::class); $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Functions\DisallowTrailingCommaInClosureUseSniff::class); diff --git a/config/set/slevomat-coding-standard.php b/config/set/slevomat-coding-standard.php index a23ad0f..482a422 100644 --- a/config/set/slevomat-coding-standard.php +++ b/config/set/slevomat-coding-standard.php @@ -80,6 +80,7 @@ $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Arrays\ArrayAccessSniff::class); $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Arrays\TrailingArrayCommaSniff::class); $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Functions\DisallowNamedArgumentsSniff::class); + $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Functions\NamedArgumentSpacingSniff::class); $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Functions\RequireArrowFunctionSniff::class); $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Functions\DisallowTrailingCommaInClosureUseSniff::class); $ecsConfig->rule(\SlevomatCodingStandard\Sniffs\Functions\UnusedInheritedVariablePassedToClosureSniff::class); diff --git a/src/CustomSet.php b/src/CustomSet.php index f0f6bcc..8489871 100644 --- a/src/CustomSet.php +++ b/src/CustomSet.php @@ -34,9 +34,6 @@ public function getRules(): array 'ordered_class_elements' => [ 'order' => ['use_trait', 'constant_public', 'constant_protected', 'constant_private'], ], - 'ordered_imports' => [ - 'imports_order' => ['class', 'function', 'const'], - ], 'phpdoc_align' => [ 'align' => 'left', ], @@ -50,29 +47,19 @@ public function getRules(): array 'null_adjustment' => 'always_last', 'sort_algorithm' => 'none', ], - 'yield_from_array_to_yields' => true, 'nullable_type_declaration' => true, 'php_unit_test_case_static_method_calls' => [ 'call_type' => 'this', ], - 'ordered_types' => true, 'phpdoc_param_order' => true, - 'logical_operators' => true, 'not_operator_with_successor_space' => true, 'simplified_null_return' => true, - 'control_structure_continuation_position' => true, - 'declare_parentheses' => true, 'nullable_type_declaration_for_default_null_value' => true, 'phpdoc_line_span' => true, - 'self_static_accessor' => true, 'simplified_if_return' => true, 'fopen_flags' => [ 'b_mode' => true, ], - 'statement_indentation' => true, - 'no_multiple_statements_per_line' => true, - 'curly_braces_position' => true, - 'control_structure_braces' => true, 'no_useless_concat_operator' => [ 'juggle_simple_strings' => true, ], diff --git a/src/PhpCsFixerRuleSetGenerator.php b/src/PhpCsFixerRuleSetGenerator.php index bf94f8e..c4a68cf 100644 --- a/src/PhpCsFixerRuleSetGenerator.php +++ b/src/PhpCsFixerRuleSetGenerator.php @@ -31,6 +31,7 @@ final class PhpCsFixerRuleSetGenerator '@PHP80Migration:risky' => 'php80-migration-risky.php', '@PHP81Migration' => 'php81-migration.php', '@PHP82Migration' => 'php82-migration.php', + '@PHP83Migration' => 'php83-migration.php', '@PHPUnit30Migration:risky' => 'phpunit30-migration-risky.php', '@PHPUnit32Migration:risky' => 'phpunit32-migration-risky.php', '@PHPUnit35Migration:risky' => 'phpunit35-migration-risky.php', @@ -48,8 +49,12 @@ final class PhpCsFixerRuleSetGenerator '@PHPUnit100Migration:risky' => 'phpunit100-migration-risky.php', '@PER' => 'per.php', '@PER:risky' => 'per-risky.php', + '@PER-CS' => 'per-cs.php', + '@PER-CS:risky' => 'per-cs-risky.php', '@PER-CS1.0' => 'per-cs10.php', '@PER-CS1.0:risky' => 'per-cs10-risky.php', + '@PER-CS2.0' => 'per-cs20.php', + '@PER-CS2.0:risky' => 'per-cs20-risky.php', '@PSR1' => 'psr1.php', '@PSR12' => 'psr12.php', '@PSR12:risky' => 'psr12-risky.php', diff --git a/src/Set/ECSSetList.php b/src/Set/ECSSetList.php index e66586f..76e89d9 100644 --- a/src/Set/ECSSetList.php +++ b/src/Set/ECSSetList.php @@ -145,4 +145,9 @@ final class ECSSetList * @var string */ public const PHP_82 = __DIR__ . '/../../config/set/php82.php'; + + /** + * @var string + */ + public const PHP_83 = __DIR__ . '/../../config/set/php83.php'; } diff --git a/src/Set/PhpCsFixerSetList.php b/src/Set/PhpCsFixerSetList.php index 280b198..1a629ec 100644 --- a/src/Set/PhpCsFixerSetList.php +++ b/src/Set/PhpCsFixerSetList.php @@ -76,6 +76,11 @@ final class PhpCsFixerSetList */ public const PHP82_MIGRATION = __DIR__ . '/../../config/set/php-cs-fixer/php82-migration.php'; + /** + * @var string + */ + public const PHP83_MIGRATION = __DIR__ . '/../../config/set/php-cs-fixer/php83-migration.php'; + /** * @var string */ @@ -86,6 +91,16 @@ final class PhpCsFixerSetList */ public const PER_RISKY = __DIR__ . '/../../config/set/php-cs-fixer/per-risky.php'; + /** + * @var string + */ + public const PER_CS = __DIR__ . '/../../config/set/php-cs-fixer/per-cs.php'; + + /** + * @var string + */ + public const PER_CS_RISKY = __DIR__ . '/../../config/set/php-cs-fixer/per-cs-risky.php'; + /** * @var string */ @@ -96,6 +111,16 @@ final class PhpCsFixerSetList */ public const PER_CS10_RISKY = __DIR__ . '/../../config/set/php-cs-fixer/per-cs10-risky.php'; + /** + * @var string + */ + public const PER_CS20 = __DIR__ . '/../../config/set/php-cs-fixer/per-cs20.php'; + + /** + * @var string + */ + public const PER_CS20_RISKY = __DIR__ . '/../../config/set/php-cs-fixer/per-cs20-risky.php'; + /** * @var string */