diff --git a/composer.json b/composer.json index c2acd7c15..f10e677bb 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "require": { "php": ">=7.4", "rector/rector": "0.18.3", - "friendsofphp/php-cs-fixer": "3.27.0", + "friendsofphp/php-cs-fixer": "3.34.0", "redaxo/php-cs-fixer-config": "^1.0" }, "config": { diff --git a/composer.lock b/composer.lock index cd75fceeb..f93cbe171 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "828bdfac3160775162f2a3dd5df8b60d", + "content-hash": "e8b88e44e3ba6b0e7b07738b1a3de75f", "packages": [ { "name": "composer/pcre", @@ -226,16 +226,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.27.0", + "version": "v3.34.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "e73ccaae1208f017bb7860986eebb3da48bd25d6" + "reference": "7c7a4ad2ed8fe50df3e25528218b13d383608f23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/e73ccaae1208f017bb7860986eebb3da48bd25d6", - "reference": "e73ccaae1208f017bb7860986eebb3da48bd25d6", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7c7a4ad2ed8fe50df3e25528218b13d383608f23", + "reference": "7c7a4ad2ed8fe50df3e25528218b13d383608f23", "shasum": "" }, "require": { @@ -256,6 +256,9 @@ "symfony/process": "^5.4 || ^6.0", "symfony/stopwatch": "^5.4 || ^6.0" }, + "conflict": { + "stevebauman/unfinalize": "*" + }, "require-dev": { "facile-it/paraunit": "^1.3 || ^2.0", "justinrainbow/json-schema": "^5.2", @@ -309,7 +312,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.27.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.34.0" }, "funding": [ { @@ -317,20 +320,20 @@ "type": "github" } ], - "time": "2023-09-17T14:37:54+00:00" + "time": "2023-09-29T15:34:26+00:00" }, { "name": "phpstan/phpstan", - "version": "1.10.35", + "version": "1.10.36", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3" + "reference": "ffa3089511121a672e62969404e4fddc753f9b15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e730e5facb75ffe09dfb229795e8c01a459f26c3", - "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa3089511121a672e62969404e4fddc753f9b15", + "reference": "ffa3089511121a672e62969404e4fddc753f9b15", "shasum": "" }, "require": { @@ -379,7 +382,7 @@ "type": "tidelift" } ], - "time": "2023-09-19T15:27:56+00:00" + "time": "2023-09-29T14:07:45+00:00" }, { "name": "psr/container", diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 2646c9830..9794e0803 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -64,6 +64,7 @@ 'PhpCsFixer\\ConfigurationException\\InvalidForEnvFixerConfigurationException' => $vendorDir . '/friendsofphp/php-cs-fixer/src/ConfigurationException/InvalidForEnvFixerConfigurationException.php', 'PhpCsFixer\\ConfigurationException\\RequiredFixerConfigurationException' => $vendorDir . '/friendsofphp/php-cs-fixer/src/ConfigurationException/RequiredFixerConfigurationException.php', 'PhpCsFixer\\Console\\Application' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Console/Application.php', + 'PhpCsFixer\\Console\\Command\\CheckCommand' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Console/Command/CheckCommand.php', 'PhpCsFixer\\Console\\Command\\DescribeCommand' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Console/Command/DescribeCommand.php', 'PhpCsFixer\\Console\\Command\\DescribeNameNotFoundException' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Console/Command/DescribeNameNotFoundException.php', 'PhpCsFixer\\Console\\Command\\DocumentationCommand' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Console/Command/DocumentationCommand.php', @@ -172,7 +173,9 @@ 'PhpCsFixer\\Fixer\\ArrayNotation\\TrimArraySpacesFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/TrimArraySpacesFixer.php', 'PhpCsFixer\\Fixer\\ArrayNotation\\WhitespaceAfterCommaInArrayFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/WhitespaceAfterCommaInArrayFixer.php', 'PhpCsFixer\\Fixer\\ArrayNotation\\YieldFromArrayToYieldsFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/YieldFromArrayToYieldsFixer.php', + 'PhpCsFixer\\Fixer\\AttributeNotation\\AttributeEmptyParenthesesFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/AttributeNotation/AttributeEmptyParenthesesFixer.php', 'PhpCsFixer\\Fixer\\Basic\\BracesFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Basic/BracesFixer.php', + 'PhpCsFixer\\Fixer\\Basic\\BracesPositionFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Basic/BracesPositionFixer.php', 'PhpCsFixer\\Fixer\\Basic\\CurlyBracesPositionFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Basic/CurlyBracesPositionFixer.php', 'PhpCsFixer\\Fixer\\Basic\\EncodingFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Basic/EncodingFixer.php', 'PhpCsFixer\\Fixer\\Basic\\NoMultipleStatementsPerLineFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Basic/NoMultipleStatementsPerLineFixer.php', @@ -190,6 +193,7 @@ 'PhpCsFixer\\Fixer\\Casing\\MagicMethodCasingFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Casing/MagicMethodCasingFixer.php', 'PhpCsFixer\\Fixer\\Casing\\NativeFunctionCasingFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeFunctionCasingFixer.php', 'PhpCsFixer\\Fixer\\Casing\\NativeFunctionTypeDeclarationCasingFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeFunctionTypeDeclarationCasingFixer.php', + 'PhpCsFixer\\Fixer\\Casing\\NativeTypeDeclarationCasingFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeTypeDeclarationCasingFixer.php', 'PhpCsFixer\\Fixer\\CastNotation\\CastSpacesFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/CastNotation/CastSpacesFixer.php', 'PhpCsFixer\\Fixer\\CastNotation\\LowercaseCastFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/CastNotation/LowercaseCastFixer.php', 'PhpCsFixer\\Fixer\\CastNotation\\ModernizeTypesCastingFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/CastNotation/ModernizeTypesCastingFixer.php', @@ -235,6 +239,7 @@ 'PhpCsFixer\\Fixer\\ControlStructure\\NoBreakCommentFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoBreakCommentFixer.php', 'PhpCsFixer\\Fixer\\ControlStructure\\NoSuperfluousElseifFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoSuperfluousElseifFixer.php', 'PhpCsFixer\\Fixer\\ControlStructure\\NoTrailingCommaInListCallFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoTrailingCommaInListCallFixer.php', + 'PhpCsFixer\\Fixer\\ControlStructure\\NoUnneededBracesFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUnneededBracesFixer.php', 'PhpCsFixer\\Fixer\\ControlStructure\\NoUnneededControlParenthesesFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUnneededControlParenthesesFixer.php', 'PhpCsFixer\\Fixer\\ControlStructure\\NoUnneededCurlyBracesFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUnneededCurlyBracesFixer.php', 'PhpCsFixer\\Fixer\\ControlStructure\\NoUselessElseFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUselessElseFixer.php', @@ -314,6 +319,7 @@ 'PhpCsFixer\\Fixer\\Operator\\LogicalOperatorsFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/LogicalOperatorsFixer.php', 'PhpCsFixer\\Fixer\\Operator\\LongToShorthandOperatorFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/LongToShorthandOperatorFixer.php', 'PhpCsFixer\\Fixer\\Operator\\NewWithBracesFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithBracesFixer.php', + 'PhpCsFixer\\Fixer\\Operator\\NewWithParenthesesFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithParenthesesFixer.php', 'PhpCsFixer\\Fixer\\Operator\\NoSpaceAroundDoubleColonFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/NoSpaceAroundDoubleColonFixer.php', 'PhpCsFixer\\Fixer\\Operator\\NoUselessConcatOperatorFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/NoUselessConcatOperatorFixer.php', 'PhpCsFixer\\Fixer\\Operator\\NoUselessNullsafeOperatorFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/NoUselessNullsafeOperatorFixer.php', @@ -410,6 +416,7 @@ 'PhpCsFixer\\Fixer\\Whitespace\\ArrayIndentationFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/ArrayIndentationFixer.php', 'PhpCsFixer\\Fixer\\Whitespace\\BlankLineBeforeStatementFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/BlankLineBeforeStatementFixer.php', 'PhpCsFixer\\Fixer\\Whitespace\\BlankLineBetweenImportGroupsFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/BlankLineBetweenImportGroupsFixer.php', + 'PhpCsFixer\\Fixer\\Whitespace\\CompactNullableTypeDeclarationFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypeDeclarationFixer.php', 'PhpCsFixer\\Fixer\\Whitespace\\CompactNullableTypehintFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypehintFixer.php', 'PhpCsFixer\\Fixer\\Whitespace\\HeredocIndentationFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/HeredocIndentationFixer.php', 'PhpCsFixer\\Fixer\\Whitespace\\IndentationTypeFixer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/IndentationTypeFixer.php', @@ -453,6 +460,8 @@ 'PhpCsFixer\\RuleSet\\Sets\\PERCS1x0Set' => $vendorDir . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS1x0Set.php', 'PhpCsFixer\\RuleSet\\Sets\\PERCS2x0RiskySet' => $vendorDir . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS2x0RiskySet.php', 'PhpCsFixer\\RuleSet\\Sets\\PERCS2x0Set' => $vendorDir . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS2x0Set.php', + 'PhpCsFixer\\RuleSet\\Sets\\PERCSRiskySet' => $vendorDir . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSRiskySet.php', + 'PhpCsFixer\\RuleSet\\Sets\\PERCSSet' => $vendorDir . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSSet.php', 'PhpCsFixer\\RuleSet\\Sets\\PERRiskySet' => $vendorDir . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERRiskySet.php', 'PhpCsFixer\\RuleSet\\Sets\\PERSet' => $vendorDir . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERSet.php', 'PhpCsFixer\\RuleSet\\Sets\\PHP54MigrationSet' => $vendorDir . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP54MigrationSet.php', @@ -534,9 +543,9 @@ 'PhpCsFixer\\Tokenizer\\Transformer\\ArrayTypehintTransformer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ArrayTypehintTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\AttributeTransformer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/AttributeTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\BraceClassInstantiationTransformer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/BraceClassInstantiationTransformer.php', + 'PhpCsFixer\\Tokenizer\\Transformer\\BraceTransformer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/BraceTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\ClassConstantTransformer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ClassConstantTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\ConstructorPromotionTransformer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ConstructorPromotionTransformer.php', - 'PhpCsFixer\\Tokenizer\\Transformer\\CurlyBraceTransformer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/CurlyBraceTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\DisjunctiveNormalFormTypeParenthesisTransformer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/DisjunctiveNormalFormTypeParenthesisTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\FirstClassCallableTransformer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/FirstClassCallableTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\ImportTransformer' => $vendorDir . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ImportTransformer.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 276699c25..5a3eba4df 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -222,6 +222,7 @@ class ComposerStaticInit432d9322d3d4193d52e9a1d1ec2ff418 'PhpCsFixer\\ConfigurationException\\InvalidForEnvFixerConfigurationException' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/ConfigurationException/InvalidForEnvFixerConfigurationException.php', 'PhpCsFixer\\ConfigurationException\\RequiredFixerConfigurationException' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/ConfigurationException/RequiredFixerConfigurationException.php', 'PhpCsFixer\\Console\\Application' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Console/Application.php', + 'PhpCsFixer\\Console\\Command\\CheckCommand' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Console/Command/CheckCommand.php', 'PhpCsFixer\\Console\\Command\\DescribeCommand' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Console/Command/DescribeCommand.php', 'PhpCsFixer\\Console\\Command\\DescribeNameNotFoundException' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Console/Command/DescribeNameNotFoundException.php', 'PhpCsFixer\\Console\\Command\\DocumentationCommand' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Console/Command/DocumentationCommand.php', @@ -330,7 +331,9 @@ class ComposerStaticInit432d9322d3d4193d52e9a1d1ec2ff418 'PhpCsFixer\\Fixer\\ArrayNotation\\TrimArraySpacesFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/TrimArraySpacesFixer.php', 'PhpCsFixer\\Fixer\\ArrayNotation\\WhitespaceAfterCommaInArrayFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/WhitespaceAfterCommaInArrayFixer.php', 'PhpCsFixer\\Fixer\\ArrayNotation\\YieldFromArrayToYieldsFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/YieldFromArrayToYieldsFixer.php', + 'PhpCsFixer\\Fixer\\AttributeNotation\\AttributeEmptyParenthesesFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/AttributeNotation/AttributeEmptyParenthesesFixer.php', 'PhpCsFixer\\Fixer\\Basic\\BracesFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Basic/BracesFixer.php', + 'PhpCsFixer\\Fixer\\Basic\\BracesPositionFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Basic/BracesPositionFixer.php', 'PhpCsFixer\\Fixer\\Basic\\CurlyBracesPositionFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Basic/CurlyBracesPositionFixer.php', 'PhpCsFixer\\Fixer\\Basic\\EncodingFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Basic/EncodingFixer.php', 'PhpCsFixer\\Fixer\\Basic\\NoMultipleStatementsPerLineFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Basic/NoMultipleStatementsPerLineFixer.php', @@ -348,6 +351,7 @@ class ComposerStaticInit432d9322d3d4193d52e9a1d1ec2ff418 'PhpCsFixer\\Fixer\\Casing\\MagicMethodCasingFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Casing/MagicMethodCasingFixer.php', 'PhpCsFixer\\Fixer\\Casing\\NativeFunctionCasingFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeFunctionCasingFixer.php', 'PhpCsFixer\\Fixer\\Casing\\NativeFunctionTypeDeclarationCasingFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeFunctionTypeDeclarationCasingFixer.php', + 'PhpCsFixer\\Fixer\\Casing\\NativeTypeDeclarationCasingFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeTypeDeclarationCasingFixer.php', 'PhpCsFixer\\Fixer\\CastNotation\\CastSpacesFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/CastNotation/CastSpacesFixer.php', 'PhpCsFixer\\Fixer\\CastNotation\\LowercaseCastFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/CastNotation/LowercaseCastFixer.php', 'PhpCsFixer\\Fixer\\CastNotation\\ModernizeTypesCastingFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/CastNotation/ModernizeTypesCastingFixer.php', @@ -393,6 +397,7 @@ class ComposerStaticInit432d9322d3d4193d52e9a1d1ec2ff418 'PhpCsFixer\\Fixer\\ControlStructure\\NoBreakCommentFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoBreakCommentFixer.php', 'PhpCsFixer\\Fixer\\ControlStructure\\NoSuperfluousElseifFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoSuperfluousElseifFixer.php', 'PhpCsFixer\\Fixer\\ControlStructure\\NoTrailingCommaInListCallFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoTrailingCommaInListCallFixer.php', + 'PhpCsFixer\\Fixer\\ControlStructure\\NoUnneededBracesFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUnneededBracesFixer.php', 'PhpCsFixer\\Fixer\\ControlStructure\\NoUnneededControlParenthesesFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUnneededControlParenthesesFixer.php', 'PhpCsFixer\\Fixer\\ControlStructure\\NoUnneededCurlyBracesFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUnneededCurlyBracesFixer.php', 'PhpCsFixer\\Fixer\\ControlStructure\\NoUselessElseFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUselessElseFixer.php', @@ -472,6 +477,7 @@ class ComposerStaticInit432d9322d3d4193d52e9a1d1ec2ff418 'PhpCsFixer\\Fixer\\Operator\\LogicalOperatorsFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/LogicalOperatorsFixer.php', 'PhpCsFixer\\Fixer\\Operator\\LongToShorthandOperatorFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/LongToShorthandOperatorFixer.php', 'PhpCsFixer\\Fixer\\Operator\\NewWithBracesFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithBracesFixer.php', + 'PhpCsFixer\\Fixer\\Operator\\NewWithParenthesesFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithParenthesesFixer.php', 'PhpCsFixer\\Fixer\\Operator\\NoSpaceAroundDoubleColonFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/NoSpaceAroundDoubleColonFixer.php', 'PhpCsFixer\\Fixer\\Operator\\NoUselessConcatOperatorFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/NoUselessConcatOperatorFixer.php', 'PhpCsFixer\\Fixer\\Operator\\NoUselessNullsafeOperatorFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Operator/NoUselessNullsafeOperatorFixer.php', @@ -568,6 +574,7 @@ class ComposerStaticInit432d9322d3d4193d52e9a1d1ec2ff418 'PhpCsFixer\\Fixer\\Whitespace\\ArrayIndentationFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/ArrayIndentationFixer.php', 'PhpCsFixer\\Fixer\\Whitespace\\BlankLineBeforeStatementFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/BlankLineBeforeStatementFixer.php', 'PhpCsFixer\\Fixer\\Whitespace\\BlankLineBetweenImportGroupsFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/BlankLineBetweenImportGroupsFixer.php', + 'PhpCsFixer\\Fixer\\Whitespace\\CompactNullableTypeDeclarationFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypeDeclarationFixer.php', 'PhpCsFixer\\Fixer\\Whitespace\\CompactNullableTypehintFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypehintFixer.php', 'PhpCsFixer\\Fixer\\Whitespace\\HeredocIndentationFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/HeredocIndentationFixer.php', 'PhpCsFixer\\Fixer\\Whitespace\\IndentationTypeFixer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/IndentationTypeFixer.php', @@ -611,6 +618,8 @@ class ComposerStaticInit432d9322d3d4193d52e9a1d1ec2ff418 'PhpCsFixer\\RuleSet\\Sets\\PERCS1x0Set' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS1x0Set.php', 'PhpCsFixer\\RuleSet\\Sets\\PERCS2x0RiskySet' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS2x0RiskySet.php', 'PhpCsFixer\\RuleSet\\Sets\\PERCS2x0Set' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS2x0Set.php', + 'PhpCsFixer\\RuleSet\\Sets\\PERCSRiskySet' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSRiskySet.php', + 'PhpCsFixer\\RuleSet\\Sets\\PERCSSet' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSSet.php', 'PhpCsFixer\\RuleSet\\Sets\\PERRiskySet' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERRiskySet.php', 'PhpCsFixer\\RuleSet\\Sets\\PERSet' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERSet.php', 'PhpCsFixer\\RuleSet\\Sets\\PHP54MigrationSet' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP54MigrationSet.php', @@ -692,9 +701,9 @@ class ComposerStaticInit432d9322d3d4193d52e9a1d1ec2ff418 'PhpCsFixer\\Tokenizer\\Transformer\\ArrayTypehintTransformer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ArrayTypehintTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\AttributeTransformer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/AttributeTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\BraceClassInstantiationTransformer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/BraceClassInstantiationTransformer.php', + 'PhpCsFixer\\Tokenizer\\Transformer\\BraceTransformer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/BraceTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\ClassConstantTransformer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ClassConstantTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\ConstructorPromotionTransformer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ConstructorPromotionTransformer.php', - 'PhpCsFixer\\Tokenizer\\Transformer\\CurlyBraceTransformer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/CurlyBraceTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\DisjunctiveNormalFormTypeParenthesisTransformer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/DisjunctiveNormalFormTypeParenthesisTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\FirstClassCallableTransformer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/FirstClassCallableTransformer.php', 'PhpCsFixer\\Tokenizer\\Transformer\\ImportTransformer' => __DIR__ . '/..' . '/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ImportTransformer.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 8077a4a84..00a678fb4 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -229,17 +229,17 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.27.0", - "version_normalized": "3.27.0.0", + "version": "v3.34.0", + "version_normalized": "3.34.0.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "e73ccaae1208f017bb7860986eebb3da48bd25d6" + "reference": "7c7a4ad2ed8fe50df3e25528218b13d383608f23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/e73ccaae1208f017bb7860986eebb3da48bd25d6", - "reference": "e73ccaae1208f017bb7860986eebb3da48bd25d6", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7c7a4ad2ed8fe50df3e25528218b13d383608f23", + "reference": "7c7a4ad2ed8fe50df3e25528218b13d383608f23", "shasum": "" }, "require": { @@ -260,6 +260,9 @@ "symfony/process": "^5.4 || ^6.0", "symfony/stopwatch": "^5.4 || ^6.0" }, + "conflict": { + "stevebauman/unfinalize": "*" + }, "require-dev": { "facile-it/paraunit": "^1.3 || ^2.0", "justinrainbow/json-schema": "^5.2", @@ -281,7 +284,7 @@ "ext-dom": "For handling output formats in XML", "ext-mbstring": "For handling non-UTF8 characters." }, - "time": "2023-09-17T14:37:54+00:00", + "time": "2023-09-29T15:34:26+00:00", "bin": [ "php-cs-fixer" ], @@ -315,7 +318,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.27.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.34.0" }, "funding": [ { @@ -327,17 +330,17 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.35", - "version_normalized": "1.10.35.0", + "version": "1.10.36", + "version_normalized": "1.10.36.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3" + "reference": "ffa3089511121a672e62969404e4fddc753f9b15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e730e5facb75ffe09dfb229795e8c01a459f26c3", - "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa3089511121a672e62969404e4fddc753f9b15", + "reference": "ffa3089511121a672e62969404e4fddc753f9b15", "shasum": "" }, "require": { @@ -346,7 +349,7 @@ "conflict": { "phpstan/phpstan-shim": "*" }, - "time": "2023-09-19T15:27:56+00:00", + "time": "2023-09-29T14:07:45+00:00", "bin": [ "phpstan", "phpstan.phar" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 6023ff70c..e536d3241 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'f7efcece768b9d79075cc9831266426a589d7ddd', + 'reference' => '13ad0f8b7f6b5907a321acd981de10867a5aac02', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'f7efcece768b9d79075cc9831266426a589d7ddd', + 'reference' => '13ad0f8b7f6b5907a321acd981de10867a5aac02', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -47,18 +47,18 @@ 'dev_requirement' => false, ), 'friendsofphp/php-cs-fixer' => array( - 'pretty_version' => 'v3.27.0', - 'version' => '3.27.0.0', - 'reference' => 'e73ccaae1208f017bb7860986eebb3da48bd25d6', + 'pretty_version' => 'v3.34.0', + 'version' => '3.34.0.0', + 'reference' => '7c7a4ad2ed8fe50df3e25528218b13d383608f23', 'type' => 'application', 'install_path' => __DIR__ . '/../friendsofphp/php-cs-fixer', 'aliases' => array(), 'dev_requirement' => false, ), 'phpstan/phpstan' => array( - 'pretty_version' => '1.10.35', - 'version' => '1.10.35.0', - 'reference' => 'e730e5facb75ffe09dfb229795e8c01a459f26c3', + 'pretty_version' => '1.10.36', + 'version' => '1.10.36.0', + 'reference' => 'ffa3089511121a672e62969404e4fddc753f9b15', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpstan', 'aliases' => array(), diff --git a/vendor/friendsofphp/php-cs-fixer/CHANGELOG.md b/vendor/friendsofphp/php-cs-fixer/CHANGELOG.md index a4e69c1c3..d899343c1 100644 --- a/vendor/friendsofphp/php-cs-fixer/CHANGELOG.md +++ b/vendor/friendsofphp/php-cs-fixer/CHANGELOG.md @@ -3,6 +3,61 @@ CHANGELOG for PHP CS Fixer This file contains changelogs for stable releases only. +Changelog for v3.34.0 +--------------------- + +* feat: Introduce `check` command (alias for `fix --dry-run`) (#7322) + +Changelog for v3.33.0 +--------------------- + +* feat: Introduce `native_type_declaration_casing` fixer (#7330) + +Changelog for v3.32.0 +--------------------- + +* deps: Prevent using PHPCSFixer along with `unfinalize` package (#7343) +* feat: Deprecate `CompactNullableTypehintFixer` and proxy to `CompactNullableTypeDeclarationFixer` (#7339) +* feat: Deprecate `CurlyBracesPositionFixer` and proxy to `BracesPositionFixer` (#7334) +* feat: Deprecate `NewWithBracesFixer` and proxy to `NewWithParenthesesFixer` (#7331) +* feat: Deprecate `NoUnneededCurlyBracesFixer` and proxy to `NoUnneededBracesFixer` (#7335) +* feat: Rename `CurlyBraceTransformer` to `BraceTransformer` (#7333) + +Changelog for v3.31.0 +--------------------- + +* chore: Use type declaration instead of type hint (#7338) +* feat: Introduce `attribute_placement` option for `MethodArgumentSpaceFixer` (#7320) +* fix: Adjust wording related to deprecations (#7332) +* fix: Correct deprecation header in rules' docs (#7337) +* fix: Replace mention of bracket with parenthesis (#7336) +* fix: `FunctionToConstantFixer` should run before `NativeConstantInvocationFixer` (#7344) + +Changelog for v3.30.0 +--------------------- + +* feat: Introduce `AttributeEmptyParenthesesFixer` (#7284) +* fix(method_argument_space): inject new line after trailing space on current line (#7327) +* fix(`YodaStyleFixer`): do not touch `require(_once)`, `include(_once)` and `yield from` statements (#7325) +* fix: illegal offset type on file-wide return in `ReturnToYieldFromFixer` (#7318) + +Changelog for v3.29.0 +--------------------- + +* chore: fix TODO tasks about T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG support (#7316) +* feat(`@PhpCsFixer:risky`): use newest `@PER-CS:risky` instead of locked `@PER-CS2.0:risky` (#7323) +* feat: Introduce `@PER-CS` ruleset (#7321) +* fix: priority issue between array_syntax and space after rules (#7324) + +Changelog for v3.28.0 +--------------------- + +* chore(prlint): allow for 'deps' type (#7304) +* CI(prlint): allow for special chars in parentheses (#7308) +* deps(dev-tools): update dev-tools (#7309) +* DX: Bump XDebug version in Docker services (#7300) +* feat(`@PER-CS2.0`): Add `concat_space` to the ruleset (#7302) + Changelog for v3.27.0 --------------------- diff --git a/vendor/friendsofphp/php-cs-fixer/ci-integration.sh b/vendor/friendsofphp/php-cs-fixer/ci-integration.sh index 2521e2494..6ede4fd53 100644 --- a/vendor/friendsofphp/php-cs-fixer/ci-integration.sh +++ b/vendor/friendsofphp/php-cs-fixer/ci-integration.sh @@ -5,4 +5,4 @@ IFS=' ' CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "${COMMIT_RANGE}") if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php-cs-fixer(\\.dist)?\\.php|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi -vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --stop-on-violation --using-cache=no ${EXTRA_ARGS} +vendor/bin/php-cs-fixer check --config=.php-cs-fixer.dist.php -v --stop-on-violation --using-cache=no ${EXTRA_ARGS} diff --git a/vendor/friendsofphp/php-cs-fixer/composer.json b/vendor/friendsofphp/php-cs-fixer/composer.json index 388e4e7c4..2012ded1d 100644 --- a/vendor/friendsofphp/php-cs-fixer/composer.json +++ b/vendor/friendsofphp/php-cs-fixer/composer.json @@ -54,6 +54,9 @@ "symfony/phpunit-bridge": "^6.2.3", "symfony/yaml": "^5.4 || ^6.0" }, + "conflict": { + "stevebauman/unfinalize": "*" + }, "suggest": { "ext-dom": "For handling output formats in XML", "ext-mbstring": "For handling non-UTF8 characters." @@ -81,7 +84,7 @@ "post-autoload-dump": [ "@install-tools" ], - "cs:check": "@php php-cs-fixer fix --dry-run --diff", + "cs:check": "@php php-cs-fixer check --diff", "cs:fix": "@php php-cs-fixer fix", "cs:fix:parallel": "echo '🔍 Will run in batches of 50 files.'; if [[ -f .php-cs-fixer.php ]]; then FIXER_CONFIG=.php-cs-fixer.php; else FIXER_CONFIG=.php-cs-fixer.dist.php; fi; php php-cs-fixer list-files --config=$FIXER_CONFIG | xargs -n 50 -P 8 php php-cs-fixer fix --config=$FIXER_CONFIG --path-mode intersection 2> /dev/null", "docs": "@php dev-tools/doc.php", diff --git a/vendor/friendsofphp/php-cs-fixer/src/Console/Application.php b/vendor/friendsofphp/php-cs-fixer/src/Console/Application.php index ccfcc5648..2e2ffa32d 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Console/Application.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Console/Application.php @@ -14,6 +14,7 @@ namespace PhpCsFixer\Console; +use PhpCsFixer\Console\Command\CheckCommand; use PhpCsFixer\Console\Command\DescribeCommand; use PhpCsFixer\Console\Command\FixCommand; use PhpCsFixer\Console\Command\HelpCommand; @@ -39,8 +40,8 @@ */ final class Application extends BaseApplication { - public const VERSION = '3.27.0'; - public const VERSION_CODENAME = 'Jump & Run'; + public const VERSION = '3.34.0'; + public const VERSION_CODENAME = 'BerSzcz Saturnalia'; private ToolInfo $toolInfo; @@ -52,6 +53,7 @@ public function __construct() // in alphabetical order $this->add(new DescribeCommand()); + $this->add(new CheckCommand($this->toolInfo)); $this->add(new FixCommand($this->toolInfo)); $this->add(new ListFilesCommand($this->toolInfo)); $this->add(new ListSetsCommand()); diff --git a/vendor/friendsofphp/php-cs-fixer/src/Console/Command/CheckCommand.php b/vendor/friendsofphp/php-cs-fixer/src/Console/Command/CheckCommand.php new file mode 100644 index 000000000..d5c83b72c --- /dev/null +++ b/vendor/friendsofphp/php-cs-fixer/src/Console/Command/CheckCommand.php @@ -0,0 +1,63 @@ + + * Dariusz RumiƄski + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace PhpCsFixer\Console\Command; + +use PhpCsFixer\ToolInfoInterface; +use Symfony\Component\Console\Attribute\AsCommand; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; + +/** + * @author Greg Korba + * + * @internal + */ +#[AsCommand(name: 'check', description: 'Checks if configured files/directories comply with configured rules.')] +final class CheckCommand extends FixCommand +{ + protected static $defaultName = 'check'; + protected static $defaultDescription = 'Checks if configured files/directories comply with configured rules.'; + + public function __construct(ToolInfoInterface $toolInfo) + { + parent::__construct($toolInfo); + } + + public function getHelp(): string + { + $help = explode('--dry-run', parent::getHelp()); + + return substr($help[0], 0, strrpos($help[0], "\n") - 1) + .substr($help[1], strpos($help[1], "\n")); + } + + protected function configure(): void + { + parent::configure(); + + $this->setDefinition([ + ...array_values($this->getDefinition()->getArguments()), + ...array_values(array_filter( + $this->getDefinition()->getOptions(), + static fn (InputOption $option): bool => 'dry-run' !== $option->getName() + )), + ]); + } + + protected function isDryRun(InputInterface $input): bool + { + return true; + } +} diff --git a/vendor/friendsofphp/php-cs-fixer/src/Console/Command/DescribeCommand.php b/vendor/friendsofphp/php-cs-fixer/src/Console/Command/DescribeCommand.php index 571ce6f1d..2b5f9c3b5 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Console/Command/DescribeCommand.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Console/Command/DescribeCommand.php @@ -155,7 +155,7 @@ private function describeRule(OutputInterface $output, string $name): void if ($fixer instanceof DeprecatedFixerInterface) { $successors = $fixer->getSuccessorsNames(); $message = [] === $successors - ? 'will be removed on next major version' + ? 'will be removed in the next major version' : sprintf('use %s instead', Utils::naturalLanguageJoinWithBackticks($successors)); $message = Preg::replace('/(`.+?`)/', '$1', $message); $summary .= sprintf(' DEPRECATED: %s.', $message); diff --git a/vendor/friendsofphp/php-cs-fixer/src/Console/Command/FixCommand.php b/vendor/friendsofphp/php-cs-fixer/src/Console/Command/FixCommand.php index a2ccff872..65c408fde 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Console/Command/FixCommand.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Console/Command/FixCommand.php @@ -43,12 +43,15 @@ * @author Fabien Potencier * @author Dariusz RumiƄski * + * @final + * * @internal */ -#[AsCommand(name: 'fix')] -final class FixCommand extends Command +#[AsCommand(name: 'fix', description: 'Fixes a directory or a file.')] +/* final */ class FixCommand extends Command { protected static $defaultName = 'fix'; + protected static $defaultDescription = 'Fixes a directory or a file.'; private EventDispatcherInterface $eventDispatcher; @@ -82,7 +85,7 @@ public function __construct(ToolInfoInterface $toolInfo) public function getHelp(): string { return <<<'EOF' - The %command.name% command tries to fix as much coding standards + The %command.name% command tries to %command.name% as much coding standards problems as possible on a given file or files in a given directory and its subdirectories: $ php %command.full_name% /path/to/dir @@ -159,7 +162,7 @@ public function getHelp(): string $ php %command.full_name% --verbose --show-progress=dots - By using --using-cache option with `yes` or `no` you can set if the caching + By using --using-cache option with `yes` or `no` you can set if the caching mechanism should be used. The command can also read from standard input, in which case it won't @@ -175,7 +178,7 @@ public function getHelp(): string Exit code --------- - Exit code of the fix command is built using following bit flags: + Exit code of the `%command.name%` command is built using following bit flags: * 0 - OK. * 1 - General error (or PHP minimal requirement not matched). @@ -190,25 +193,22 @@ public function getHelp(): string protected function configure(): void { - $this - ->setDefinition( - [ - new InputArgument('path', InputArgument::IS_ARRAY, 'The path.'), - new InputOption('path-mode', '', InputOption::VALUE_REQUIRED, 'Specify path mode (can be override or intersection).', ConfigurationResolver::PATH_MODE_OVERRIDE), - new InputOption('allow-risky', '', InputOption::VALUE_REQUIRED, 'Are risky fixers allowed (can be yes or no).'), - new InputOption('config', '', InputOption::VALUE_REQUIRED, 'The path to a .php-cs-fixer.php file.'), - new InputOption('dry-run', '', InputOption::VALUE_NONE, 'Only shows which files would have been modified.'), - new InputOption('rules', '', InputOption::VALUE_REQUIRED, 'The rules.'), - new InputOption('using-cache', '', InputOption::VALUE_REQUIRED, 'Does cache should be used (can be yes or no).'), - new InputOption('cache-file', '', InputOption::VALUE_REQUIRED, 'The path to the cache file.'), - new InputOption('diff', '', InputOption::VALUE_NONE, 'Also produce diff for each file.'), - new InputOption('format', '', InputOption::VALUE_REQUIRED, 'To output results in other formats.'), - new InputOption('stop-on-violation', '', InputOption::VALUE_NONE, 'Stop execution on first violation.'), - new InputOption('show-progress', '', InputOption::VALUE_REQUIRED, 'Type of progress indicator (none, dots).'), - ] - ) - ->setDescription('Fixes a directory or a file.') - ; + $this->setDefinition( + [ + new InputArgument('path', InputArgument::IS_ARRAY, 'The path(s) that rules will be run against (each path can be a file or directory).'), + new InputOption('path-mode', '', InputOption::VALUE_REQUIRED, 'Specify path mode (can be `override` or `intersection`).', ConfigurationResolver::PATH_MODE_OVERRIDE), + new InputOption('allow-risky', '', InputOption::VALUE_REQUIRED, 'Are risky fixers allowed (can be `yes` or `no`).'), + new InputOption('config', '', InputOption::VALUE_REQUIRED, 'The path to a config file.'), + new InputOption('dry-run', '', InputOption::VALUE_NONE, 'Only shows which files would have been modified.'), + new InputOption('rules', '', InputOption::VALUE_REQUIRED, 'List of rules that should be run against configured paths.'), + new InputOption('using-cache', '', InputOption::VALUE_REQUIRED, 'Does cache should be used (can be `yes` or `no`).'), + new InputOption('cache-file', '', InputOption::VALUE_REQUIRED, 'The path to the cache file.'), + new InputOption('diff', '', InputOption::VALUE_NONE, 'Prints diff for each file.'), + new InputOption('format', '', InputOption::VALUE_REQUIRED, 'To output results in other formats.'), + new InputOption('stop-on-violation', '', InputOption::VALUE_NONE, 'Stop execution on first violation.'), + new InputOption('show-progress', '', InputOption::VALUE_REQUIRED, 'Type of progress indicator (none, dots).'), + ] + ); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -227,7 +227,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int [ 'allow-risky' => $input->getOption('allow-risky'), 'config' => $passedConfig, - 'dry-run' => $input->getOption('dry-run'), + 'dry-run' => $this->isDryRun($input), 'rules' => $passedRules, 'path' => $input->getArgument('path'), 'path-mode' => $input->getOption('path-mode'), @@ -351,4 +351,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int \count($lintErrors) > 0 ); } + + protected function isDryRun(InputInterface $input): bool + { + return $input->getOption('dry-run'); + } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Documentation/FixerDocumentGenerator.php b/vendor/friendsofphp/php-cs-fixer/src/Documentation/FixerDocumentGenerator.php index d642746c0..2533d7d4e 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Documentation/FixerDocumentGenerator.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Documentation/FixerDocumentGenerator.php @@ -76,8 +76,8 @@ public function generateFixerDocumentation(FixerInterface $fixer): string if ($fixer instanceof DeprecatedFixerInterface) { $deprecationDescription = <<<'RST' - This rule is deprecated and will be removed on next major version - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + This rule is deprecated and will be removed in the next major version + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RST; $alternatives = $fixer->getSuccessorsNames(); @@ -135,13 +135,13 @@ public function generateFixerDocumentation(FixerInterface $fixer): string if ($option instanceof DeprecatedFixerOptionInterface) { $deprecationMessage = RstUtils::toRst($option->getDeprecationMessage()); - $optionInfo .= "\n\n.. warning:: This option is deprecated and will be removed on next major version. {$deprecationMessage}"; + $optionInfo .= "\n\n.. warning:: This option is deprecated and will be removed in the next major version. {$deprecationMessage}"; } $optionInfo .= "\n\n".RstUtils::toRst($option->getDescription()); if ($option instanceof AliasedFixerOption) { - $optionInfo .= "\n\n.. note:: The previous name of this option was ``{$option->getAlias()}`` but it is now deprecated and will be removed on next major version."; + $optionInfo .= "\n\n.. note:: The previous name of this option was ``{$option->getAlias()}`` but it is now deprecated and will be removed in the next major version."; } $allowed = HelpCommand::getDisplayableAllowedValues($option); diff --git a/vendor/friendsofphp/php-cs-fixer/src/Documentation/ListDocumentGenerator.php b/vendor/friendsofphp/php-cs-fixer/src/Documentation/ListDocumentGenerator.php index b2da04890..979619f0e 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Documentation/ListDocumentGenerator.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Documentation/ListDocumentGenerator.php @@ -95,11 +95,11 @@ public function generateListingDocumentation(array $fixers): string if ($option instanceof DeprecatedFixerOptionInterface) { $deprecationMessage = RstUtils::toRst($option->getDeprecationMessage(), 3); - $documentation .= "\n | warning:: This option is deprecated and will be removed on next major version. {$deprecationMessage}"; + $documentation .= "\n | warning:: This option is deprecated and will be removed in the next major version. {$deprecationMessage}"; } if ($option instanceof AliasedFixerOption) { - $documentation .= "\n | note:: The previous name of this option was ``{$option->getAlias()}`` but it is now deprecated and will be removed on next major version."; + $documentation .= "\n | note:: The previous name of this option was ``{$option->getAlias()}`` but it is now deprecated and will be removed in the next major version."; } $allowed = HelpCommand::getDisplayableAllowedValues($option); diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Alias/EregToPregFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Alias/EregToPregFixer.php index 9c749e0ec..c93662942 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Alias/EregToPregFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Alias/EregToPregFixer.php @@ -97,7 +97,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void // findSequence also returns the tokens, but we're only interested in the indices, i.e.: // 0 => function name, - // 1 => bracket "(" + // 1 => parenthesis "(" // 2 => quoted string passed as 1st parameter $match = array_keys($match); diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/ArraySyntaxFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/ArraySyntaxFixer.php index f762d99a3..a7b0b20f6 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/ArraySyntaxFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/ArraySyntaxFixer.php @@ -70,11 +70,11 @@ public function getDefinition(): FixerDefinitionInterface /** * {@inheritdoc} * - * Must run before BinaryOperatorSpacesFixer, TernaryOperatorSpacesFixer. + * Must run before BinaryOperatorSpacesFixer, SingleSpaceAfterConstructFixer, SingleSpaceAroundConstructFixer, TernaryOperatorSpacesFixer. */ public function getPriority(): int { - return 1; + return 37; } public function isCandidate(Tokens $tokens): bool diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/ReturnToYieldFromFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/ReturnToYieldFromFixer.php index 47a6c7da1..4b130a278 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/ReturnToYieldFromFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ArrayNotation/ReturnToYieldFromFixer.php @@ -82,8 +82,8 @@ private function shouldBeFixed(Tokens $tokens, int $returnIndex): bool $functionEndIndex = $arrayEndIndex; do { $functionEndIndex = $tokens->getNextMeaningfulToken($functionEndIndex); - } while ($tokens[$functionEndIndex]->equals(';')); - if (!$tokens[$functionEndIndex]->equals('}')) { + } while (null !== $functionEndIndex && $tokens[$functionEndIndex]->equals(';')); + if (null === $functionEndIndex || !$tokens[$functionEndIndex]->equals('}')) { return false; } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/AttributeNotation/AttributeEmptyParenthesesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/AttributeNotation/AttributeEmptyParenthesesFixer.php new file mode 100644 index 000000000..cba060464 --- /dev/null +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/AttributeNotation/AttributeEmptyParenthesesFixer.php @@ -0,0 +1,123 @@ + + * Dariusz RumiƄski + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace PhpCsFixer\Fixer\AttributeNotation; + +use PhpCsFixer\AbstractFixer; +use PhpCsFixer\Fixer\ConfigurableFixerInterface; +use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver; +use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface; +use PhpCsFixer\FixerConfiguration\FixerOptionBuilder; +use PhpCsFixer\FixerDefinition\CodeSample; +use PhpCsFixer\FixerDefinition\FixerDefinition; +use PhpCsFixer\FixerDefinition\FixerDefinitionInterface; +use PhpCsFixer\Tokenizer\CT; +use PhpCsFixer\Tokenizer\Token; +use PhpCsFixer\Tokenizer\Tokens; + +/** + * @author HypeMC + */ +final class AttributeEmptyParenthesesFixer extends AbstractFixer implements ConfigurableFixerInterface +{ + public function getDefinition(): FixerDefinitionInterface + { + return new FixerDefinition( + 'PHP attributes declared without arguments must (not) be followed by empty parentheses.', + [ + new CodeSample(" true] + ), + ] + ); + } + + public function isCandidate(Tokens $tokens): bool + { + return \defined('T_ATTRIBUTE') && $tokens->isTokenKindFound(T_ATTRIBUTE); + } + + protected function createConfigurationDefinition(): FixerConfigurationResolverInterface + { + return new FixerConfigurationResolver([ + (new FixerOptionBuilder('use_parentheses', 'Whether attributes should be followed by parentheses or not.')) + ->setAllowedTypes(['bool']) + ->setDefault(false) + ->getOption(), + ]); + } + + protected function applyFix(\SplFileInfo $file, Tokens $tokens): void + { + $index = 0; + + while (null !== $index = $tokens->getNextTokenOfKind($index, [[T_ATTRIBUTE]])) { + $nextIndex = $index; + + do { + $parenthesesIndex = $tokens->getNextTokenOfKind($nextIndex, ['(', ',', [CT::T_ATTRIBUTE_CLOSE]]); + + if (true === $this->configuration['use_parentheses']) { + $this->ensureParenthesesAt($tokens, $parenthesesIndex); + } else { + $this->ensureNoParenthesesAt($tokens, $parenthesesIndex); + } + + $nextIndex = $tokens->getNextTokenOfKind($nextIndex, ['(', ',', [CT::T_ATTRIBUTE_CLOSE]]); + + // Find closing parentheses, we need to do this in case there's a comma inside the parentheses + if ($tokens[$nextIndex]->equals('(')) { + $nextIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $nextIndex); + $nextIndex = $tokens->getNextTokenOfKind($nextIndex, [',', [CT::T_ATTRIBUTE_CLOSE]]); + } + + // In case there's a comma right before T_ATTRIBUTE_CLOSE + if (!$tokens[$nextIndex]->isGivenKind(CT::T_ATTRIBUTE_CLOSE)) { + $nextIndex = $tokens->getNextMeaningfulToken($nextIndex); + } + } while (!$tokens[$nextIndex]->isGivenKind(CT::T_ATTRIBUTE_CLOSE)); + } + } + + private function ensureParenthesesAt(Tokens $tokens, int $index): void + { + if ($tokens[$index]->equals('(')) { + return; + } + + $tokens->insertAt( + $tokens->getPrevMeaningfulToken($index) + 1, + [new Token('('), new Token(')')] + ); + } + + private function ensureNoParenthesesAt(Tokens $tokens, int $index): void + { + if (!$tokens[$index]->equals('(')) { + return; + } + + $closingIndex = $tokens->getNextMeaningfulToken($index); + + // attribute has arguments - parentheses can not be removed + if (!$tokens[$closingIndex]->equals(')')) { + return; + } + + $tokens->clearTokenAndMergeSurroundingWhitespace($closingIndex); + $tokens->clearTokenAndMergeSurroundingWhitespace($index); + } +} diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/BracesPositionFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/BracesPositionFixer.php new file mode 100644 index 000000000..4812308a8 --- /dev/null +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/BracesPositionFixer.php @@ -0,0 +1,410 @@ + + * Dariusz RumiƄski + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace PhpCsFixer\Fixer\Basic; + +use PhpCsFixer\AbstractFixer; +use PhpCsFixer\Fixer\ConfigurableFixerInterface; +use PhpCsFixer\Fixer\Indentation; +use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface; +use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver; +use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface; +use PhpCsFixer\FixerConfiguration\FixerOptionBuilder; +use PhpCsFixer\FixerDefinition\CodeSample; +use PhpCsFixer\FixerDefinition\FixerDefinition; +use PhpCsFixer\FixerDefinition\FixerDefinitionInterface; +use PhpCsFixer\Preg; +use PhpCsFixer\Tokenizer\CT; +use PhpCsFixer\Tokenizer\Token; +use PhpCsFixer\Tokenizer\Tokens; +use PhpCsFixer\Tokenizer\TokensAnalyzer; + +final class BracesPositionFixer extends AbstractFixer implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface +{ + use Indentation; + + /** + * @internal + */ + public const NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END = 'next_line_unless_newline_at_signature_end'; + + /** + * @internal + */ + public const SAME_LINE = 'same_line'; + + public function getDefinition(): FixerDefinitionInterface + { + return new FixerDefinition( + 'Braces must be placed as configured.', + [ + new CodeSample( + ' self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END] + ), + new CodeSample( + ' self::SAME_LINE] + ), + new CodeSample( + ' self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END] + ), + new CodeSample( + ' self::SAME_LINE] + ), + new CodeSample( + ' self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END] + ), + new CodeSample( + ' true] + ), + new CodeSample( + ' true] + ), + ] + ); + } + + public function isCandidate(Tokens $tokens): bool + { + return $tokens->isTokenKindFound('{'); + } + + /** + * {@inheritdoc} + * + * Must run before SingleLineEmptyBodyFixer, StatementIndentationFixer. + * Must run after ControlStructureBracesFixer, NoMultipleStatementsPerLineFixer. + */ + public function getPriority(): int + { + return -2; + } + + protected function applyFix(\SplFileInfo $file, Tokens $tokens): void + { + $classyTokens = Token::getClassyTokenKinds(); + $controlStructureTokens = [T_DECLARE, T_DO, T_ELSE, T_ELSEIF, T_FINALLY, T_FOR, T_FOREACH, T_IF, T_WHILE, T_TRY, T_CATCH, T_SWITCH]; + // @TODO: drop condition when PHP 8.0+ is required + if (\defined('T_MATCH')) { + $controlStructureTokens[] = T_MATCH; + } + + $tokensAnalyzer = new TokensAnalyzer($tokens); + + $allowSingleLineUntil = null; + + foreach ($tokens as $index => $token) { + $allowSingleLine = false; + $allowSingleLineIfEmpty = false; + + if ($token->isGivenKind($classyTokens)) { + $openBraceIndex = $tokens->getNextTokenOfKind($index, ['{']); + + if ($tokensAnalyzer->isAnonymousClass($index)) { + $allowSingleLineIfEmpty = $this->configuration['allow_single_line_empty_anonymous_classes']; + $positionOption = 'anonymous_classes_opening_brace'; + } else { + $positionOption = 'classes_opening_brace'; + } + } elseif ($token->isGivenKind(T_FUNCTION)) { + $openBraceIndex = $tokens->getNextTokenOfKind($index, ['{', ';']); + + if ($tokens[$openBraceIndex]->equals(';')) { + continue; + } + + if ($tokensAnalyzer->isLambda($index)) { + $allowSingleLine = $this->configuration['allow_single_line_anonymous_functions']; + $positionOption = 'anonymous_functions_opening_brace'; + } else { + $positionOption = 'functions_opening_brace'; + } + } elseif ($token->isGivenKind($controlStructureTokens)) { + $parenthesisEndIndex = $this->findParenthesisEnd($tokens, $index); + $openBraceIndex = $tokens->getNextMeaningfulToken($parenthesisEndIndex); + + if (!$tokens[$openBraceIndex]->equals('{')) { + continue; + } + + $positionOption = 'control_structures_opening_brace'; + } else { + continue; + } + + $closeBraceIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $openBraceIndex); + + $addNewlinesInsideBraces = true; + if ($allowSingleLine || $allowSingleLineIfEmpty || $index < $allowSingleLineUntil) { + $addNewlinesInsideBraces = false; + + for ($indexInsideBraces = $openBraceIndex + 1; $indexInsideBraces < $closeBraceIndex; ++$indexInsideBraces) { + $tokenInsideBraces = $tokens[$indexInsideBraces]; + + if ( + ($allowSingleLineIfEmpty && !$tokenInsideBraces->isWhitespace() && !$tokenInsideBraces->isComment()) + || ($tokenInsideBraces->isWhitespace() && Preg::match('/\R/', $tokenInsideBraces->getContent())) + ) { + $addNewlinesInsideBraces = true; + + break; + } + } + + if (!$addNewlinesInsideBraces && null === $allowSingleLineUntil) { + $allowSingleLineUntil = $closeBraceIndex; + } + } + + if ( + $addNewlinesInsideBraces + && !$this->isFollowedByNewLine($tokens, $openBraceIndex) + && !$this->hasCommentOnSameLine($tokens, $openBraceIndex) + && !$tokens[$tokens->getNextMeaningfulToken($openBraceIndex)]->isGivenKind(T_CLOSE_TAG) + ) { + $whitespace = $this->whitespacesConfig->getLineEnding().$this->getLineIndentation($tokens, $openBraceIndex); + if ($tokens->ensureWhitespaceAtIndex($openBraceIndex + 1, 0, $whitespace)) { + ++$closeBraceIndex; + } + } + + $whitespace = ' '; + if (self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END === $this->configuration[$positionOption]) { + $whitespace = $this->whitespacesConfig->getLineEnding().$this->getLineIndentation($tokens, $index); + + $previousTokenIndex = $openBraceIndex; + do { + $previousTokenIndex = $tokens->getPrevMeaningfulToken($previousTokenIndex); + } while ($tokens[$previousTokenIndex]->isGivenKind([CT::T_TYPE_COLON, CT::T_NULLABLE_TYPE, T_STRING, T_NS_SEPARATOR, CT::T_ARRAY_TYPEHINT, T_STATIC, CT::T_TYPE_ALTERNATION, CT::T_TYPE_INTERSECTION, T_CALLABLE, CT::T_DISJUNCTIVE_NORMAL_FORM_TYPE_PARENTHESIS_OPEN, CT::T_DISJUNCTIVE_NORMAL_FORM_TYPE_PARENTHESIS_CLOSE])); + + if ($tokens[$previousTokenIndex]->equals(')')) { + if ($tokens[--$previousTokenIndex]->isComment()) { + --$previousTokenIndex; + } + if ( + $tokens[$previousTokenIndex]->isWhitespace() + && Preg::match('/\R/', $tokens[$previousTokenIndex]->getContent()) + ) { + $whitespace = ' '; + } + } + } + + $moveBraceToIndex = null; + + if (' ' === $whitespace) { + $previousMeaningfulIndex = $tokens->getPrevMeaningfulToken($openBraceIndex); + for ($indexBeforeOpenBrace = $openBraceIndex - 1; $indexBeforeOpenBrace > $previousMeaningfulIndex; --$indexBeforeOpenBrace) { + if (!$tokens[$indexBeforeOpenBrace]->isComment()) { + continue; + } + + $tokenBeforeOpenBrace = $tokens[--$indexBeforeOpenBrace]; + if ($tokenBeforeOpenBrace->isWhitespace()) { + $moveBraceToIndex = $indexBeforeOpenBrace; + } elseif ($indexBeforeOpenBrace === $previousMeaningfulIndex) { + $moveBraceToIndex = $previousMeaningfulIndex + 1; + } + } + } elseif (!$tokens[$openBraceIndex - 1]->isWhitespace() || !Preg::match('/\R/', $tokens[$openBraceIndex - 1]->getContent())) { + for ($indexAfterOpenBrace = $openBraceIndex + 1; $indexAfterOpenBrace < $closeBraceIndex; ++$indexAfterOpenBrace) { + if ($tokens[$indexAfterOpenBrace]->isWhitespace() && Preg::match('/\R/', $tokens[$indexAfterOpenBrace]->getContent())) { + break; + } + + if ($tokens[$indexAfterOpenBrace]->isComment() && !str_starts_with($tokens[$indexAfterOpenBrace]->getContent(), '/*')) { + $moveBraceToIndex = $indexAfterOpenBrace + 1; + } + } + } + + if (null !== $moveBraceToIndex) { + /** @var Token $movedToken */ + $movedToken = clone $tokens[$openBraceIndex]; + + $delta = $openBraceIndex < $moveBraceToIndex ? 1 : -1; + + if ($tokens[$openBraceIndex + $delta]->isWhitespace()) { + if (-1 === $delta && Preg::match('/\R/', $tokens[$openBraceIndex - 1]->getContent())) { + $content = Preg::replace('/^(\h*?\R)?\h*/', '', $tokens[$openBraceIndex + 1]->getContent()); + if ('' !== $content) { + $tokens[$openBraceIndex + 1] = new Token([T_WHITESPACE, $content]); + } else { + $tokens->clearAt($openBraceIndex + 1); + } + } elseif ($tokens[$openBraceIndex - 1]->isWhitespace()) { + $tokens->clearAt($openBraceIndex - 1); + } + } + + for (; $openBraceIndex !== $moveBraceToIndex; $openBraceIndex += $delta) { + /** @var Token $siblingToken */ + $siblingToken = $tokens[$openBraceIndex + $delta]; + $tokens[$openBraceIndex] = $siblingToken; + } + + $tokens[$openBraceIndex] = $movedToken; + + $openBraceIndex = $moveBraceToIndex; + } + + if ($tokens->ensureWhitespaceAtIndex($openBraceIndex - 1, 1, $whitespace)) { + ++$closeBraceIndex; + if (null !== $allowSingleLineUntil) { + ++$allowSingleLineUntil; + } + } + + if ( + !$addNewlinesInsideBraces + || $tokens[$tokens->getPrevMeaningfulToken($closeBraceIndex)]->isGivenKind(T_OPEN_TAG) + ) { + continue; + } + + for ($prevIndex = $closeBraceIndex - 1; $tokens->isEmptyAt($prevIndex); --$prevIndex); + + $prevToken = $tokens[$prevIndex]; + if ($prevToken->isWhitespace() && Preg::match('/\R/', $prevToken->getContent())) { + continue; + } + + $whitespace = $this->whitespacesConfig->getLineEnding().$this->getLineIndentation($tokens, $openBraceIndex); + $tokens->ensureWhitespaceAtIndex($prevIndex, 1, $whitespace); + } + } + + protected function createConfigurationDefinition(): FixerConfigurationResolverInterface + { + return new FixerConfigurationResolver([ + (new FixerOptionBuilder('control_structures_opening_brace', 'The position of the opening brace of control structures‘ body.')) + ->setAllowedValues([self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END, self::SAME_LINE]) + ->setDefault(self::SAME_LINE) + ->getOption(), + (new FixerOptionBuilder('functions_opening_brace', 'The position of the opening brace of functions‘ body.')) + ->setAllowedValues([self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END, self::SAME_LINE]) + ->setDefault(self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END) + ->getOption(), + (new FixerOptionBuilder('anonymous_functions_opening_brace', 'The position of the opening brace of anonymous functions‘ body.')) + ->setAllowedValues([self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END, self::SAME_LINE]) + ->setDefault(self::SAME_LINE) + ->getOption(), + (new FixerOptionBuilder('classes_opening_brace', 'The position of the opening brace of classes‘ body.')) + ->setAllowedValues([self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END, self::SAME_LINE]) + ->setDefault(self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END) + ->getOption(), + (new FixerOptionBuilder('anonymous_classes_opening_brace', 'The position of the opening brace of anonymous classes‘ body.')) + ->setAllowedValues([self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END, self::SAME_LINE]) + ->setDefault(self::SAME_LINE) + ->getOption(), + (new FixerOptionBuilder('allow_single_line_empty_anonymous_classes', 'Allow anonymous classes to have opening and closing braces on the same line.')) + ->setAllowedTypes(['bool']) + ->setDefault(true) + ->getOption(), + (new FixerOptionBuilder('allow_single_line_anonymous_functions', 'Allow anonymous functions to have opening and closing braces on the same line.')) + ->setAllowedTypes(['bool']) + ->setDefault(true) + ->getOption(), + ]); + } + + private function findParenthesisEnd(Tokens $tokens, int $structureTokenIndex): int + { + $nextIndex = $tokens->getNextMeaningfulToken($structureTokenIndex); + $nextToken = $tokens[$nextIndex]; + + // return if next token is not opening parenthesis + if (!$nextToken->equals('(')) { + return $structureTokenIndex; + } + + return $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $nextIndex); + } + + private function isFollowedByNewLine(Tokens $tokens, int $index): bool + { + for (++$index, $max = \count($tokens) - 1; $index < $max; ++$index) { + $token = $tokens[$index]; + if (!$token->isComment()) { + return $token->isWhitespace() && Preg::match('/\R/', $token->getContent()); + } + } + + return false; + } + + private function hasCommentOnSameLine(Tokens $tokens, int $index): bool + { + $token = $tokens[$index + 1]; + + if ($token->isWhitespace() && !Preg::match('/\R/', $token->getContent())) { + $token = $tokens[$index + 2]; + } + + return $token->isComment(); + } +} diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/CurlyBracesPositionFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/CurlyBracesPositionFixer.php index 3f36f84cd..324d07538 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/CurlyBracesPositionFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/CurlyBracesPositionFixer.php @@ -14,23 +14,19 @@ namespace PhpCsFixer\Fixer\Basic; -use PhpCsFixer\AbstractFixer; +use PhpCsFixer\AbstractProxyFixer; use PhpCsFixer\Fixer\ConfigurableFixerInterface; +use PhpCsFixer\Fixer\DeprecatedFixerInterface; use PhpCsFixer\Fixer\Indentation; use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface; -use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver; use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface; -use PhpCsFixer\FixerConfiguration\FixerOptionBuilder; -use PhpCsFixer\FixerDefinition\CodeSample; use PhpCsFixer\FixerDefinition\FixerDefinition; use PhpCsFixer\FixerDefinition\FixerDefinitionInterface; -use PhpCsFixer\Preg; -use PhpCsFixer\Tokenizer\CT; -use PhpCsFixer\Tokenizer\Token; -use PhpCsFixer\Tokenizer\Tokens; -use PhpCsFixer\Tokenizer\TokensAnalyzer; -final class CurlyBracesPositionFixer extends AbstractFixer implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface +/** + * @deprecated + */ +final class CurlyBracesPositionFixer extends AbstractProxyFixer implements ConfigurableFixerInterface, DeprecatedFixerInterface, WhitespacesAwareFixerInterface { use Indentation; @@ -44,93 +40,32 @@ final class CurlyBracesPositionFixer extends AbstractFixer implements Configurab */ public const SAME_LINE = 'same_line'; - public function getDefinition(): FixerDefinitionInterface - { - return new FixerDefinition( - 'Curly braces must be placed as configured.', - [ - new CodeSample( - 'bracesPositionFixer = new BracesPositionFixer(); -$foo = function() -{ -}; + parent::__construct(); + } -if (foo()) -{ - bar(); -} + public function getDefinition(): FixerDefinitionInterface + { + $fixerDefinition = $this->bracesPositionFixer->getDefinition(); -$foo = new class -{ -}; -' - ), - new CodeSample( - ' self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END] - ), - new CodeSample( - ' self::SAME_LINE] - ), - new CodeSample( - ' self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END] - ), - new CodeSample( - ' self::SAME_LINE] - ), - new CodeSample( - ' self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END] - ), - new CodeSample( - ' true] - ), - new CodeSample( - ' true] - ), - ] + return new FixerDefinition( + 'Curly braces must be placed as configured.', + $fixerDefinition->getCodeSamples(), + $fixerDefinition->getDescription(), + $fixerDefinition->getRiskyDescription() ); } - public function isCandidate(Tokens $tokens): bool + public function configure(array $configuration): void { - return $tokens->isTokenKindFound('{'); + $this->bracesPositionFixer->configure($configuration); + + parent::configure($configuration); } /** @@ -141,270 +76,25 @@ public function isCandidate(Tokens $tokens): bool */ public function getPriority(): int { - return -2; - } - - protected function applyFix(\SplFileInfo $file, Tokens $tokens): void - { - $classyTokens = Token::getClassyTokenKinds(); - $controlStructureTokens = [T_DECLARE, T_DO, T_ELSE, T_ELSEIF, T_FINALLY, T_FOR, T_FOREACH, T_IF, T_WHILE, T_TRY, T_CATCH, T_SWITCH]; - // @TODO: drop condition when PHP 8.0+ is required - if (\defined('T_MATCH')) { - $controlStructureTokens[] = T_MATCH; - } - - $tokensAnalyzer = new TokensAnalyzer($tokens); - - $allowSingleLineUntil = null; - - foreach ($tokens as $index => $token) { - $allowSingleLine = false; - $allowSingleLineIfEmpty = false; - - if ($token->isGivenKind($classyTokens)) { - $openBraceIndex = $tokens->getNextTokenOfKind($index, ['{']); - - if ($tokensAnalyzer->isAnonymousClass($index)) { - $allowSingleLineIfEmpty = $this->configuration['allow_single_line_empty_anonymous_classes']; - $positionOption = 'anonymous_classes_opening_brace'; - } else { - $positionOption = 'classes_opening_brace'; - } - } elseif ($token->isGivenKind(T_FUNCTION)) { - $openBraceIndex = $tokens->getNextTokenOfKind($index, ['{', ';']); - - if ($tokens[$openBraceIndex]->equals(';')) { - continue; - } - - if ($tokensAnalyzer->isLambda($index)) { - $allowSingleLine = $this->configuration['allow_single_line_anonymous_functions']; - $positionOption = 'anonymous_functions_opening_brace'; - } else { - $positionOption = 'functions_opening_brace'; - } - } elseif ($token->isGivenKind($controlStructureTokens)) { - $parenthesisEndIndex = $this->findParenthesisEnd($tokens, $index); - $openBraceIndex = $tokens->getNextMeaningfulToken($parenthesisEndIndex); - - if (!$tokens[$openBraceIndex]->equals('{')) { - continue; - } - - $positionOption = 'control_structures_opening_brace'; - } else { - continue; - } - - $closeBraceIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $openBraceIndex); - - $addNewlinesInsideBraces = true; - if ($allowSingleLine || $allowSingleLineIfEmpty || $index < $allowSingleLineUntil) { - $addNewlinesInsideBraces = false; - - for ($indexInsideBraces = $openBraceIndex + 1; $indexInsideBraces < $closeBraceIndex; ++$indexInsideBraces) { - $tokenInsideBraces = $tokens[$indexInsideBraces]; - - if ( - ($allowSingleLineIfEmpty && !$tokenInsideBraces->isWhitespace() && !$tokenInsideBraces->isComment()) - || ($tokenInsideBraces->isWhitespace() && Preg::match('/\R/', $tokenInsideBraces->getContent())) - ) { - $addNewlinesInsideBraces = true; - - break; - } - } - - if (!$addNewlinesInsideBraces && null === $allowSingleLineUntil) { - $allowSingleLineUntil = $closeBraceIndex; - } - } - - if ( - $addNewlinesInsideBraces - && !$this->isFollowedByNewLine($tokens, $openBraceIndex) - && !$this->hasCommentOnSameLine($tokens, $openBraceIndex) - && !$tokens[$tokens->getNextMeaningfulToken($openBraceIndex)]->isGivenKind(T_CLOSE_TAG) - ) { - $whitespace = $this->whitespacesConfig->getLineEnding().$this->getLineIndentation($tokens, $openBraceIndex); - if ($tokens->ensureWhitespaceAtIndex($openBraceIndex + 1, 0, $whitespace)) { - ++$closeBraceIndex; - } - } - - $whitespace = ' '; - if (self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END === $this->configuration[$positionOption]) { - $whitespace = $this->whitespacesConfig->getLineEnding().$this->getLineIndentation($tokens, $index); - - $previousTokenIndex = $openBraceIndex; - do { - $previousTokenIndex = $tokens->getPrevMeaningfulToken($previousTokenIndex); - } while ($tokens[$previousTokenIndex]->isGivenKind([CT::T_TYPE_COLON, CT::T_NULLABLE_TYPE, T_STRING, T_NS_SEPARATOR, CT::T_ARRAY_TYPEHINT, T_STATIC, CT::T_TYPE_ALTERNATION, CT::T_TYPE_INTERSECTION, T_CALLABLE, CT::T_DISJUNCTIVE_NORMAL_FORM_TYPE_PARENTHESIS_OPEN, CT::T_DISJUNCTIVE_NORMAL_FORM_TYPE_PARENTHESIS_CLOSE])); - - if ($tokens[$previousTokenIndex]->equals(')')) { - if ($tokens[--$previousTokenIndex]->isComment()) { - --$previousTokenIndex; - } - if ( - $tokens[$previousTokenIndex]->isWhitespace() - && Preg::match('/\R/', $tokens[$previousTokenIndex]->getContent()) - ) { - $whitespace = ' '; - } - } - } - - $moveBraceToIndex = null; - - if (' ' === $whitespace) { - $previousMeaningfulIndex = $tokens->getPrevMeaningfulToken($openBraceIndex); - for ($indexBeforeOpenBrace = $openBraceIndex - 1; $indexBeforeOpenBrace > $previousMeaningfulIndex; --$indexBeforeOpenBrace) { - if (!$tokens[$indexBeforeOpenBrace]->isComment()) { - continue; - } - - $tokenBeforeOpenBrace = $tokens[--$indexBeforeOpenBrace]; - if ($tokenBeforeOpenBrace->isWhitespace()) { - $moveBraceToIndex = $indexBeforeOpenBrace; - } elseif ($indexBeforeOpenBrace === $previousMeaningfulIndex) { - $moveBraceToIndex = $previousMeaningfulIndex + 1; - } - } - } elseif (!$tokens[$openBraceIndex - 1]->isWhitespace() || !Preg::match('/\R/', $tokens[$openBraceIndex - 1]->getContent())) { - for ($indexAfterOpenBrace = $openBraceIndex + 1; $indexAfterOpenBrace < $closeBraceIndex; ++$indexAfterOpenBrace) { - if ($tokens[$indexAfterOpenBrace]->isWhitespace() && Preg::match('/\R/', $tokens[$indexAfterOpenBrace]->getContent())) { - break; - } - - if ($tokens[$indexAfterOpenBrace]->isComment() && !str_starts_with($tokens[$indexAfterOpenBrace]->getContent(), '/*')) { - $moveBraceToIndex = $indexAfterOpenBrace + 1; - } - } - } - - if (null !== $moveBraceToIndex) { - /** @var Token $movedToken */ - $movedToken = clone $tokens[$openBraceIndex]; - - $delta = $openBraceIndex < $moveBraceToIndex ? 1 : -1; - - if ($tokens[$openBraceIndex + $delta]->isWhitespace()) { - if (-1 === $delta && Preg::match('/\R/', $tokens[$openBraceIndex - 1]->getContent())) { - $content = Preg::replace('/^(\h*?\R)?\h*/', '', $tokens[$openBraceIndex + 1]->getContent()); - if ('' !== $content) { - $tokens[$openBraceIndex + 1] = new Token([T_WHITESPACE, $content]); - } else { - $tokens->clearAt($openBraceIndex + 1); - } - } elseif ($tokens[$openBraceIndex - 1]->isWhitespace()) { - $tokens->clearAt($openBraceIndex - 1); - } - } - - for (; $openBraceIndex !== $moveBraceToIndex; $openBraceIndex += $delta) { - /** @var Token $siblingToken */ - $siblingToken = $tokens[$openBraceIndex + $delta]; - $tokens[$openBraceIndex] = $siblingToken; - } - - $tokens[$openBraceIndex] = $movedToken; - - $openBraceIndex = $moveBraceToIndex; - } - - if ($tokens->ensureWhitespaceAtIndex($openBraceIndex - 1, 1, $whitespace)) { - ++$closeBraceIndex; - if (null !== $allowSingleLineUntil) { - ++$allowSingleLineUntil; - } - } - - if ( - !$addNewlinesInsideBraces - || $tokens[$tokens->getPrevMeaningfulToken($closeBraceIndex)]->isGivenKind(T_OPEN_TAG) - ) { - continue; - } - - for ($prevIndex = $closeBraceIndex - 1; $tokens->isEmptyAt($prevIndex); --$prevIndex); - - $prevToken = $tokens[$prevIndex]; - if ($prevToken->isWhitespace() && Preg::match('/\R/', $prevToken->getContent())) { - continue; - } - - $whitespace = $this->whitespacesConfig->getLineEnding().$this->getLineIndentation($tokens, $openBraceIndex); - $tokens->ensureWhitespaceAtIndex($prevIndex, 1, $whitespace); - } - } - - protected function createConfigurationDefinition(): FixerConfigurationResolverInterface - { - return new FixerConfigurationResolver([ - (new FixerOptionBuilder('control_structures_opening_brace', 'The position of the opening brace of control structures‘ body.')) - ->setAllowedValues([self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END, self::SAME_LINE]) - ->setDefault(self::SAME_LINE) - ->getOption(), - (new FixerOptionBuilder('functions_opening_brace', 'The position of the opening brace of functions‘ body.')) - ->setAllowedValues([self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END, self::SAME_LINE]) - ->setDefault(self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END) - ->getOption(), - (new FixerOptionBuilder('anonymous_functions_opening_brace', 'The position of the opening brace of anonymous functions‘ body.')) - ->setAllowedValues([self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END, self::SAME_LINE]) - ->setDefault(self::SAME_LINE) - ->getOption(), - (new FixerOptionBuilder('classes_opening_brace', 'The position of the opening brace of classes‘ body.')) - ->setAllowedValues([self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END, self::SAME_LINE]) - ->setDefault(self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END) - ->getOption(), - (new FixerOptionBuilder('anonymous_classes_opening_brace', 'The position of the opening brace of anonymous classes‘ body.')) - ->setAllowedValues([self::NEXT_LINE_UNLESS_NEWLINE_AT_SIGNATURE_END, self::SAME_LINE]) - ->setDefault(self::SAME_LINE) - ->getOption(), - (new FixerOptionBuilder('allow_single_line_empty_anonymous_classes', 'Allow anonymous classes to have opening and closing braces on the same line.')) - ->setAllowedTypes(['bool']) - ->setDefault(true) - ->getOption(), - (new FixerOptionBuilder('allow_single_line_anonymous_functions', 'Allow anonymous functions to have opening and closing braces on the same line.')) - ->setAllowedTypes(['bool']) - ->setDefault(true) - ->getOption(), - ]); + return $this->bracesPositionFixer->getPriority(); } - private function findParenthesisEnd(Tokens $tokens, int $structureTokenIndex): int + public function getSuccessorsNames(): array { - $nextIndex = $tokens->getNextMeaningfulToken($structureTokenIndex); - $nextToken = $tokens[$nextIndex]; - - // return if next token is not opening parenthesis - if (!$nextToken->equals('(')) { - return $structureTokenIndex; - } - - return $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $nextIndex); + return [ + $this->bracesPositionFixer->getName(), + ]; } - private function isFollowedByNewLine(Tokens $tokens, int $index): bool + protected function createProxyFixers(): array { - for (++$index, $max = \count($tokens) - 1; $index < $max; ++$index) { - $token = $tokens[$index]; - if (!$token->isComment()) { - return $token->isWhitespace() && Preg::match('/\R/', $token->getContent()); - } - } - - return false; + return [ + $this->bracesPositionFixer, + ]; } - private function hasCommentOnSameLine(Tokens $tokens, int $index): bool + protected function createConfigurationDefinition(): FixerConfigurationResolverInterface { - $token = $tokens[$index + 1]; - - if ($token->isWhitespace() && !Preg::match('/\R/', $token->getContent())) { - $token = $tokens[$index + 2]; - } - - return $token->isComment(); + return $this->bracesPositionFixer->createConfigurationDefinition(); } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/NoMultipleStatementsPerLineFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/NoMultipleStatementsPerLineFixer.php index d5c0b1498..fcd9d2925 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/NoMultipleStatementsPerLineFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/NoMultipleStatementsPerLineFixer.php @@ -41,7 +41,7 @@ public function getDefinition(): FixerDefinitionInterface /** * {@inheritdoc} * - * Must run before CurlyBracesPositionFixer. + * Must run before BracesPositionFixer, CurlyBracesPositionFixer. * Must run after ControlStructureBracesFixer, NoEmptyStatementFixer, YieldFromArrayToYieldsFixer. */ public function getPriority(): int diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/SingleLineEmptyBodyFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/SingleLineEmptyBodyFixer.php index 8f87e0c3c..c3a817694 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/SingleLineEmptyBodyFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Basic/SingleLineEmptyBodyFixer.php @@ -39,7 +39,7 @@ public function getDefinition(): FixerDefinitionInterface /** * {@inheritdoc} * - * Must run after ClassDefinitionFixer, CurlyBracesPositionFixer, NoUselessReturnFixer. + * Must run after BracesPositionFixer, ClassDefinitionFixer, CurlyBracesPositionFixer, NoUselessReturnFixer. */ public function getPriority(): int { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeFunctionTypeDeclarationCasingFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeFunctionTypeDeclarationCasingFixer.php index 75ed54191..2b2d5094f 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeFunctionTypeDeclarationCasingFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeFunctionTypeDeclarationCasingFixer.php @@ -14,84 +14,21 @@ namespace PhpCsFixer\Fixer\Casing; -use PhpCsFixer\AbstractFixer; +use PhpCsFixer\AbstractProxyFixer; +use PhpCsFixer\Fixer\DeprecatedFixerInterface; use PhpCsFixer\FixerDefinition\CodeSample; use PhpCsFixer\FixerDefinition\FixerDefinition; use PhpCsFixer\FixerDefinition\FixerDefinitionInterface; -use PhpCsFixer\Tokenizer\Analyzer\Analysis\TypeAnalysis; -use PhpCsFixer\Tokenizer\Analyzer\FunctionsAnalyzer; -use PhpCsFixer\Tokenizer\Token; -use PhpCsFixer\Tokenizer\Tokens; -final class NativeFunctionTypeDeclarationCasingFixer extends AbstractFixer +/** + * @deprecated in favor of NativeTypeDeclarationCasingFixer + */ +final class NativeFunctionTypeDeclarationCasingFixer extends AbstractProxyFixer implements DeprecatedFixerInterface { - /** - * https://secure.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration. - * - * self PHP 5.0 - * array PHP 5.1 - * callable PHP 5.4 - * bool PHP 7.0 - * float PHP 7.0 - * int PHP 7.0 - * string PHP 7.0 - * iterable PHP 7.1 - * void PHP 7.1 - * object PHP 7.2 - * static PHP 8.0 (return type only) - * mixed PHP 8.0 - * false PHP 8.0 (union return type only) - * null PHP 8.0 (union return type only) - * never PHP 8.1 (return type only) - * true PHP 8.2 (standalone type: https://wiki.php.net/rfc/true-type) - * false PHP 8.2 (standalone type: https://wiki.php.net/rfc/null-false-standalone-types) - * null PHP 8.2 (standalone type: https://wiki.php.net/rfc/null-false-standalone-types) - * - * @var array - */ - private array $hints; - - private FunctionsAnalyzer $functionsAnalyzer; - - public function __construct() - { - parent::__construct(); - - $this->hints = [ - 'array' => true, - 'bool' => true, - 'callable' => true, - 'float' => true, - 'int' => true, - 'iterable' => true, - 'object' => true, - 'self' => true, - 'string' => true, - 'void' => true, - ]; - - if (\PHP_VERSION_ID >= 8_00_00) { - $this->hints['false'] = true; - $this->hints['mixed'] = true; - $this->hints['null'] = true; - $this->hints['static'] = true; - } - - if (\PHP_VERSION_ID >= 8_01_00) { - $this->hints['never'] = true; - } - - if (\PHP_VERSION_ID >= 8_02_00) { - $this->hints['true'] = true; - } - - $this->functionsAnalyzer = new FunctionsAnalyzer(); - } - public function getDefinition(): FixerDefinitionInterface { return new FixerDefinition( - 'Native type hints for functions should use the correct case.', + 'Native type declarations for functions should use the correct case.', [ new CodeSample("isAnyTokenKindsFound([T_FUNCTION, T_FN]); + return array_keys($this->proxyFixers); } - protected function applyFix(\SplFileInfo $file, Tokens $tokens): void + protected function createProxyFixers(): array { - for ($index = $tokens->count() - 1; $index >= 0; --$index) { - if ($tokens[$index]->isGivenKind([T_FUNCTION, T_FN])) { - $this->fixFunctionReturnType($tokens, $index); - $this->fixFunctionArgumentTypes($tokens, $index); - } - } - } - - private function fixFunctionArgumentTypes(Tokens $tokens, int $index): void - { - foreach ($this->functionsAnalyzer->getFunctionArguments($tokens, $index) as $argument) { - $this->fixArgumentType($tokens, $argument->getTypeAnalysis()); - } - } - - private function fixFunctionReturnType(Tokens $tokens, int $index): void - { - $this->fixArgumentType($tokens, $this->functionsAnalyzer->getFunctionReturnType($tokens, $index)); - } - - private function fixArgumentType(Tokens $tokens, ?TypeAnalysis $type = null): void - { - if (null === $type) { - return; - } - - for ($index = $type->getStartIndex(); $index <= $type->getEndIndex(); ++$index) { - if ($tokens[$tokens->getNextMeaningfulToken($index)]->isGivenKind(T_NS_SEPARATOR)) { - continue; - } - - $lowerCasedName = strtolower($tokens[$index]->getContent()); - - if (!isset($this->hints[$lowerCasedName])) { - continue; - } + $fixer = new NativeTypeDeclarationCasingFixer(); - $tokens[$index] = new Token([$tokens[$index]->getId(), $lowerCasedName]); - } + return [$fixer]; } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeTypeDeclarationCasingFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeTypeDeclarationCasingFixer.php new file mode 100644 index 000000000..c0e8aa321 --- /dev/null +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Casing/NativeTypeDeclarationCasingFixer.php @@ -0,0 +1,360 @@ + + * Dariusz RumiƄski + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace PhpCsFixer\Fixer\Casing; + +use PhpCsFixer\AbstractFixer; +use PhpCsFixer\FixerDefinition\CodeSample; +use PhpCsFixer\FixerDefinition\FixerDefinition; +use PhpCsFixer\FixerDefinition\FixerDefinitionInterface; +use PhpCsFixer\FixerDefinition\VersionSpecification; +use PhpCsFixer\FixerDefinition\VersionSpecificCodeSample; +use PhpCsFixer\Tokenizer\Analyzer\Analysis\TypeAnalysis; +use PhpCsFixer\Tokenizer\Analyzer\FunctionsAnalyzer; +use PhpCsFixer\Tokenizer\CT; +use PhpCsFixer\Tokenizer\Token; +use PhpCsFixer\Tokenizer\Tokens; +use PhpCsFixer\Tokenizer\TokensAnalyzer; + +final class NativeTypeDeclarationCasingFixer extends AbstractFixer +{ + /* + * https://wiki.php.net/rfc/typed_class_constants + * Supported types + * Class constant type declarations support all type declarations supported by PHP, + * except `void`, `callable`, `never`. + * + * array + * bool + * callable + * float + * int + * iterable + * object + * mixed + * parent + * self + * string + * any class or interface name -> not native, so not applicable for this Fixer + * ?type -> not native, `?` has no casing, so not applicable for this Fixer + * + * Not in the list referenced but supported: + * null + * static + */ + private const CLASS_CONST_SUPPORTED_HINTS = [ + 'array' => true, + 'bool' => true, + 'float' => true, + 'int' => true, + 'iterable' => true, + 'mixed' => true, + 'null' => true, + 'object' => true, + 'parent' => true, + 'self' => true, + 'string' => true, + 'static' => true, + ]; + + private const CLASS_PROPERTY_SUPPORTED_HINTS = [ + 'array' => true, + 'bool' => true, + 'float' => true, + 'int' => true, + 'iterable' => true, + 'mixed' => true, + 'null' => true, + 'object' => true, + 'parent' => true, + 'self' => true, + 'static' => true, + 'string' => true, + ]; + + private const TYPE_SEPARATION_TYPES = [ + CT::T_TYPE_ALTERNATION, + CT::T_TYPE_INTERSECTION, + CT::T_DISJUNCTIVE_NORMAL_FORM_TYPE_PARENTHESIS_OPEN, + CT::T_DISJUNCTIVE_NORMAL_FORM_TYPE_PARENTHESIS_CLOSE, + ]; + + /** + * https://secure.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration. + * + * self PHP 5.0 + * array PHP 5.1 + * callable PHP 5.4 + * bool PHP 7.0 + * float PHP 7.0 + * int PHP 7.0 + * string PHP 7.0 + * iterable PHP 7.1 + * void PHP 7.1 + * object PHP 7.2 + * static PHP 8.0 (return type only) + * mixed PHP 8.0 + * false PHP 8.0 (union return type only) + * null PHP 8.0 (union return type only) + * never PHP 8.1 (return type only) + * true PHP 8.2 (standalone type: https://wiki.php.net/rfc/true-type) + * false PHP 8.2 (standalone type: https://wiki.php.net/rfc/null-false-standalone-types) + * null PHP 8.2 (standalone type: https://wiki.php.net/rfc/null-false-standalone-types) + * + * @var array + */ + private array $functionTypeHints; + + private FunctionsAnalyzer $functionsAnalyzer; + + /** + * @var list> + */ + private array $propertyTypeModifiers; + + public function __construct() + { + parent::__construct(); + + $this->propertyTypeModifiers = [[T_PRIVATE], [T_PROTECTED], [T_PUBLIC]]; + + $this->functionTypeHints = [ + 'array' => true, + 'bool' => true, + 'callable' => true, + 'float' => true, + 'int' => true, + 'iterable' => true, + 'object' => true, + 'self' => true, + 'string' => true, + 'void' => true, + ]; + + if (\PHP_VERSION_ID >= 8_00_00) { + $this->functionTypeHints['false'] = true; + $this->functionTypeHints['mixed'] = true; + $this->functionTypeHints['null'] = true; + $this->functionTypeHints['static'] = true; + } + + if (\PHP_VERSION_ID >= 8_01_00) { + $this->functionTypeHints['never'] = true; + + $this->propertyTypeModifiers[] = [T_READONLY]; + } + + if (\PHP_VERSION_ID >= 8_02_00) { + $this->functionTypeHints['true'] = true; + } + + $this->functionsAnalyzer = new FunctionsAnalyzer(); + } + + public function getDefinition(): FixerDefinitionInterface + { + return new FixerDefinition( + 'Native type declarations should be used in the correct case.', + [ + new CodeSample( + "isAnyTokenKindsFound(Token::getClassyTokenKinds()); + + return + $tokens->isAnyTokenKindsFound([T_FUNCTION, T_FN]) + || ($classyFound && $tokens->isTokenKindFound(T_STRING)) + || ( + \PHP_VERSION_ID >= 8_03_00 + && $tokens->isTokenKindFound(T_CONST) + && $classyFound + ); + } + + protected function applyFix(\SplFileInfo $file, Tokens $tokens): void + { + $this->fixFunctions($tokens); + $this->fixClassConstantsAndProperties($tokens); + } + + private function fixFunctions(Tokens $tokens): void + { + for ($index = $tokens->count() - 1; $index >= 0; --$index) { + if ($tokens[$index]->isGivenKind([T_FUNCTION, T_FN])) { + $this->fixFunctionReturnType($tokens, $index); + $this->fixFunctionArgumentTypes($tokens, $index); + } + } + } + + private function fixFunctionArgumentTypes(Tokens $tokens, int $index): void + { + foreach ($this->functionsAnalyzer->getFunctionArguments($tokens, $index) as $argument) { + $this->fixArgumentType($tokens, $argument->getTypeAnalysis()); + } + } + + private function fixFunctionReturnType(Tokens $tokens, int $index): void + { + $this->fixArgumentType($tokens, $this->functionsAnalyzer->getFunctionReturnType($tokens, $index)); + } + + private function fixArgumentType(Tokens $tokens, ?TypeAnalysis $type = null): void + { + if (null === $type) { + return; + } + + for ($index = $type->getStartIndex(); $index <= $type->getEndIndex(); ++$index) { + if ($tokens[$tokens->getNextMeaningfulToken($index)]->isGivenKind(T_NS_SEPARATOR)) { + continue; + } + + $this->fixCasing($this->functionTypeHints, $tokens, $index); + } + } + + private function fixClassConstantsAndProperties(Tokens $tokens): void + { + $analyzer = new TokensAnalyzer($tokens); + $elements = array_reverse($analyzer->getClassyElements(), true); + + foreach ($elements as $index => $element) { + if ('const' === $element['type']) { + if (\PHP_VERSION_ID >= 8_03_00 && !$this->isConstWithoutType($tokens, $index)) { + foreach ($this->getNativeTypeHintCandidatesForConstant($tokens, $index) as $nativeTypeHintIndex) { + $this->fixCasing($this::CLASS_CONST_SUPPORTED_HINTS, $tokens, $nativeTypeHintIndex); + } + } + + continue; + } + + if ('property' === $element['type']) { + foreach ($this->getNativeTypeHintCandidatesForProperty($tokens, $index) as $nativeTypeHintIndex) { + $this->fixCasing($this::CLASS_PROPERTY_SUPPORTED_HINTS, $tokens, $nativeTypeHintIndex); + } + } + } + } + + /** @return iterable */ + private function getNativeTypeHintCandidatesForConstant(Tokens $tokens, int $index): iterable + { + $constNameIndex = $this->getConstNameIndex($tokens, $index); + $index = $this->getFirstIndexOfType($tokens, $index); + + do { + $typeEnd = $this->getTypeEnd($tokens, $index, $constNameIndex); + + if ($typeEnd === $index) { + yield $index; + } + + do { + $index = $tokens->getNextMeaningfulToken($index); + } while ($tokens[$index]->isGivenKind(self::TYPE_SEPARATION_TYPES)); + } while ($index < $constNameIndex); + } + + private function isConstWithoutType(Tokens $tokens, int $index): bool + { + $index = $tokens->getNextMeaningfulToken($index); + + return $tokens[$index]->isGivenKind(T_STRING) && $tokens[$tokens->getNextMeaningfulToken($index)]->equals('='); + } + + private function getConstNameIndex(Tokens $tokens, int $index): int + { + return $tokens->getPrevMeaningfulToken( + $tokens->getNextTokenOfKind($index, ['=']), + ); + } + + /** @return iterable */ + private function getNativeTypeHintCandidatesForProperty(Tokens $tokens, int $index): iterable + { + $propertyNameIndex = $index; + $index = $tokens->getPrevTokenOfKind($index, $this->propertyTypeModifiers); + + $index = $this->getFirstIndexOfType($tokens, $index); + + do { + $typeEnd = $this->getTypeEnd($tokens, $index, $propertyNameIndex); + + if ($typeEnd === $index) { + yield $index; + } + + do { + $index = $tokens->getNextMeaningfulToken($index); + } while ($tokens[$index]->isGivenKind(self::TYPE_SEPARATION_TYPES)); + } while ($index < $propertyNameIndex); + + return []; + } + + private function getFirstIndexOfType(Tokens $tokens, int $index): int + { + $index = $tokens->getNextMeaningfulToken($index); + + if ($tokens[$index]->isGivenKind(CT::T_NULLABLE_TYPE)) { + $index = $tokens->getNextMeaningfulToken($index); + } + + if ($tokens[$index]->isGivenKind(CT::T_DISJUNCTIVE_NORMAL_FORM_TYPE_PARENTHESIS_OPEN)) { + $index = $tokens->getNextMeaningfulToken($index); + } + + return $index; + } + + private function getTypeEnd(Tokens $tokens, int $index, int $upperLimit): int + { + if (!$tokens[$index]->isGivenKind([T_STRING, T_NS_SEPARATOR])) { + return $index; // callable, array, self, static, etc. + } + + $endIndex = $index; + while ($tokens[$index]->isGivenKind([T_STRING, T_NS_SEPARATOR]) && $index < $upperLimit) { + $endIndex = $index; + $index = $tokens->getNextMeaningfulToken($index); + } + + return $endIndex; + } + + /** + * @param array $supportedTypeHints + */ + private function fixCasing(array $supportedTypeHints, Tokens $tokens, int $index): void + { + $typeContent = $tokens[$index]->getContent(); + $typeContentLower = strtolower($typeContent); + + if (isset($supportedTypeHints[$typeContentLower]) && $typeContent !== $typeContentLower) { + $tokens[$index] = new Token([$tokens[$index]->getId(), $typeContentLower]); + } + } +} diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ClassNotation/ClassDefinitionFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ClassNotation/ClassDefinitionFixer.php index b0e226e4b..6be1745b1 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ClassNotation/ClassDefinitionFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ClassNotation/ClassDefinitionFixer.php @@ -102,7 +102,7 @@ interface Bar extends * {@inheritdoc} * * Must run before BracesFixer, SingleLineEmptyBodyFixer. - * Must run after NewWithBracesFixer. + * Must run after NewWithBracesFixer, NewWithParenthesesFixer. */ public function getPriority(): int { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ConstantNotation/NativeConstantInvocationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ConstantNotation/NativeConstantInvocationFixer.php index fcdabac81..ed767cf05 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ConstantNotation/NativeConstantInvocationFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ConstantNotation/NativeConstantInvocationFixer.php @@ -96,10 +96,11 @@ public function getDefinition(): FixerDefinitionInterface * {@inheritdoc} * * Must run before GlobalNamespaceImportFixer. + * Must run after FunctionToConstantFixer. */ public function getPriority(): int { - return 10; + return 1; } public function isCandidate(Tokens $tokens): bool diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/ControlStructureBracesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/ControlStructureBracesFixer.php index 0fd0d264a..f89d959ad 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/ControlStructureBracesFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/ControlStructureBracesFixer.php @@ -40,7 +40,7 @@ public function isCandidate(Tokens $tokens): bool /** * {@inheritdoc} * - * Must run before ControlStructureContinuationPositionFixer, CurlyBracesPositionFixer, NoMultipleStatementsPerLineFixer. + * Must run before BracesPositionFixer, ControlStructureContinuationPositionFixer, CurlyBracesPositionFixer, NoMultipleStatementsPerLineFixer. */ public function getPriority(): int { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/IncludeFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/IncludeFixer.php index 6ad136038..a0bd5accb 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/IncludeFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/IncludeFixer.php @@ -32,7 +32,7 @@ final class IncludeFixer extends AbstractFixer public function getDefinition(): FixerDefinitionInterface { return new FixerDefinition( - 'Include/Require and file path should be divided with a single space. File path should not be placed under brackets.', + 'Include/Require and file path should be divided with a single space. File path should not be placed within parentheses.', [ new CodeSample( ' + * Dariusz RumiƄski + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace PhpCsFixer\Fixer\ControlStructure; + +use PhpCsFixer\AbstractFixer; +use PhpCsFixer\Fixer\ConfigurableFixerInterface; +use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver; +use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface; +use PhpCsFixer\FixerConfiguration\FixerOptionBuilder; +use PhpCsFixer\FixerDefinition\CodeSample; +use PhpCsFixer\FixerDefinition\FixerDefinition; +use PhpCsFixer\FixerDefinition\FixerDefinitionInterface; +use PhpCsFixer\Tokenizer\Token; +use PhpCsFixer\Tokenizer\Tokens; + +final class NoUnneededBracesFixer extends AbstractFixer implements ConfigurableFixerInterface +{ + public function getDefinition(): FixerDefinitionInterface + { + return new FixerDefinition( + 'Removes unneeded braces that are superfluous and aren\'t part of a control structure\'s body.', + [ + new CodeSample( + ' true] + ), + ] + ); + } + + /** + * {@inheritdoc} + * + * Must run before NoUselessElseFixer, NoUselessReturnFixer, ReturnAssignmentFixer, SimplifiedIfReturnFixer. + */ + public function getPriority(): int + { + return 40; + } + + public function isCandidate(Tokens $tokens): bool + { + return $tokens->isTokenKindFound('}'); + } + + protected function applyFix(\SplFileInfo $file, Tokens $tokens): void + { + foreach ($this->findBraceOpen($tokens) as $index) { + if ($this->isOverComplete($tokens, $index)) { + $this->clearOverCompleteBraces($tokens, $index, $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $index)); + } + } + + if (true === $this->configuration['namespaces']) { + $this->clearIfIsOverCompleteNamespaceBlock($tokens); + } + } + + protected function createConfigurationDefinition(): FixerConfigurationResolverInterface + { + return new FixerConfigurationResolver([ + (new FixerOptionBuilder('namespaces', 'Remove unneeded braces from bracketed namespaces.')) + ->setAllowedTypes(['bool']) + ->setDefault(false) + ->getOption(), + ]); + } + + /** + * @param int $openIndex index of `{` token + * @param int $closeIndex index of `}` token + */ + private function clearOverCompleteBraces(Tokens $tokens, int $openIndex, int $closeIndex): void + { + $tokens->clearTokenAndMergeSurroundingWhitespace($closeIndex); + $tokens->clearTokenAndMergeSurroundingWhitespace($openIndex); + } + + /** + * @return iterable + */ + private function findBraceOpen(Tokens $tokens): iterable + { + for ($i = \count($tokens) - 1; $i > 0; --$i) { + if ($tokens[$i]->equals('{')) { + yield $i; + } + } + } + + /** + * @param int $index index of `{` token + */ + private function isOverComplete(Tokens $tokens, int $index): bool + { + static $include = ['{', '}', [T_OPEN_TAG], ':', ';']; + + return $tokens[$tokens->getPrevMeaningfulToken($index)]->equalsAny($include); + } + + private function clearIfIsOverCompleteNamespaceBlock(Tokens $tokens): void + { + if (1 !== $tokens->countTokenKind(T_NAMESPACE)) { + return; // fast check, we never fix if multiple namespaces are defined + } + + $index = $tokens->getNextTokenOfKind(0, [[T_NAMESPACE]]); + + do { + $index = $tokens->getNextMeaningfulToken($index); + } while ($tokens[$index]->isGivenKind([T_STRING, T_NS_SEPARATOR])); + + if (!$tokens[$index]->equals('{')) { + return; // `;` + } + + $closeIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $index); + $afterCloseIndex = $tokens->getNextMeaningfulToken($closeIndex); + + if (null !== $afterCloseIndex && (!$tokens[$afterCloseIndex]->isGivenKind(T_CLOSE_TAG) || null !== $tokens->getNextMeaningfulToken($afterCloseIndex))) { + return; + } + + // clear up + $tokens->clearTokenAndMergeSurroundingWhitespace($closeIndex); + $tokens[$index] = new Token(';'); + + if ($tokens[$index - 1]->isWhitespace(" \t") && !$tokens[$index - 2]->isComment()) { + $tokens->clearTokenAndMergeSurroundingWhitespace($index - 1); + } + } +} diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUnneededCurlyBracesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUnneededCurlyBracesFixer.php index fbe15ee7b..b71c524ba 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUnneededCurlyBracesFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUnneededCurlyBracesFixer.php @@ -14,48 +14,48 @@ namespace PhpCsFixer\Fixer\ControlStructure; -use PhpCsFixer\AbstractFixer; +use PhpCsFixer\AbstractProxyFixer; use PhpCsFixer\Fixer\ConfigurableFixerInterface; +use PhpCsFixer\Fixer\DeprecatedFixerInterface; use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver; use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface; use PhpCsFixer\FixerConfiguration\FixerOptionBuilder; -use PhpCsFixer\FixerDefinition\CodeSample; use PhpCsFixer\FixerDefinition\FixerDefinition; use PhpCsFixer\FixerDefinition\FixerDefinitionInterface; -use PhpCsFixer\Tokenizer\Token; -use PhpCsFixer\Tokenizer\Tokens; -final class NoUnneededCurlyBracesFixer extends AbstractFixer implements ConfigurableFixerInterface +/** + * @deprecated + */ +final class NoUnneededCurlyBracesFixer extends AbstractProxyFixer implements ConfigurableFixerInterface, DeprecatedFixerInterface { + private NoUnneededBracesFixer $noUnneededBracesFixer; + + public function __construct() + { + $this->noUnneededBracesFixer = new NoUnneededBracesFixer(); + + parent::__construct(); + } + public function getDefinition(): FixerDefinitionInterface { + $fixerDefinition = $this->noUnneededBracesFixer->getDefinition(); + return new FixerDefinition( 'Removes unneeded curly braces that are superfluous and aren\'t part of a control structure\'s body.', - [ - new CodeSample( - ' true] - ), - ] + $fixerDefinition->getCodeSamples(), + $fixerDefinition->getDescription(), + $fixerDefinition->getRiskyDescription() ); } + public function configure(array $configuration): void + { + $this->noUnneededBracesFixer->configure($configuration); + + parent::configure($configuration); + } + /** * {@inheritdoc} * @@ -63,25 +63,14 @@ function Bar(){} */ public function getPriority(): int { - return 40; + return $this->noUnneededBracesFixer->getPriority(); } - public function isCandidate(Tokens $tokens): bool + public function getSuccessorsNames(): array { - return $tokens->isTokenKindFound('}'); - } - - protected function applyFix(\SplFileInfo $file, Tokens $tokens): void - { - foreach ($this->findCurlyBraceOpen($tokens) as $index) { - if ($this->isOverComplete($tokens, $index)) { - $this->clearOverCompleteBraces($tokens, $index, $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $index)); - } - } - - if (true === $this->configuration['namespaces']) { - $this->clearIfIsOverCompleteNamespaceBlock($tokens); - } + return [ + $this->noUnneededBracesFixer->getName(), + ]; } protected function createConfigurationDefinition(): FixerConfigurationResolverInterface @@ -94,67 +83,10 @@ protected function createConfigurationDefinition(): FixerConfigurationResolverIn ]); } - /** - * @param int $openIndex index of `{` token - * @param int $closeIndex index of `}` token - */ - private function clearOverCompleteBraces(Tokens $tokens, int $openIndex, int $closeIndex): void + protected function createProxyFixers(): array { - $tokens->clearTokenAndMergeSurroundingWhitespace($closeIndex); - $tokens->clearTokenAndMergeSurroundingWhitespace($openIndex); - } - - /** - * @return iterable - */ - private function findCurlyBraceOpen(Tokens $tokens): iterable - { - for ($i = \count($tokens) - 1; $i > 0; --$i) { - if ($tokens[$i]->equals('{')) { - yield $i; - } - } - } - - /** - * @param int $index index of `{` token - */ - private function isOverComplete(Tokens $tokens, int $index): bool - { - static $include = ['{', '}', [T_OPEN_TAG], ':', ';']; - - return $tokens[$tokens->getPrevMeaningfulToken($index)]->equalsAny($include); - } - - private function clearIfIsOverCompleteNamespaceBlock(Tokens $tokens): void - { - if (1 !== $tokens->countTokenKind(T_NAMESPACE)) { - return; // fast check, we never fix if multiple namespaces are defined - } - - $index = $tokens->getNextTokenOfKind(0, [[T_NAMESPACE]]); - - do { - $index = $tokens->getNextMeaningfulToken($index); - } while ($tokens[$index]->isGivenKind([T_STRING, T_NS_SEPARATOR])); - - if (!$tokens[$index]->equals('{')) { - return; // `;` - } - - $closeIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $index); - $afterCloseIndex = $tokens->getNextMeaningfulToken($closeIndex); - - if (null !== $afterCloseIndex && (!$tokens[$afterCloseIndex]->isGivenKind(T_CLOSE_TAG) || null !== $tokens->getNextMeaningfulToken($afterCloseIndex))) { - return; - } - - // clear up - $tokens->clearTokenAndMergeSurroundingWhitespace($closeIndex); - $tokens[$index] = new Token(';'); - - if ($tokens[$index - 1]->isWhitespace(" \t") && !$tokens[$index - 2]->isComment()) { - $tokens->clearTokenAndMergeSurroundingWhitespace($index - 1); - } + return [ + $this->noUnneededBracesFixer, + ]; } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUselessElseFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUselessElseFixer.php index 0542d348a..9b2d1cce1 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUselessElseFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/NoUselessElseFixer.php @@ -41,7 +41,7 @@ public function getDefinition(): FixerDefinitionInterface * {@inheritdoc} * * Must run before BlankLineBeforeStatementFixer, BracesFixer, CombineConsecutiveUnsetsFixer, NoBreakCommentFixer, NoExtraBlankLinesFixer, NoTrailingWhitespaceFixer, NoUselessReturnFixer, NoWhitespaceInBlankLineFixer, SimplifiedIfReturnFixer, StatementIndentationFixer. - * Must run after NoAlternativeSyntaxFixer, NoEmptyStatementFixer, NoUnneededCurlyBracesFixer. + * Must run after NoAlternativeSyntaxFixer, NoEmptyStatementFixer, NoUnneededBracesFixer, NoUnneededCurlyBracesFixer. */ public function getPriority(): int { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/SimplifiedIfReturnFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/SimplifiedIfReturnFixer.php index 6c3a0c2c3..9710a9fda 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/SimplifiedIfReturnFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/SimplifiedIfReturnFixer.php @@ -72,7 +72,7 @@ public function getDefinition(): FixerDefinitionInterface * {@inheritdoc} * * Must run before MultilineWhitespaceBeforeSemicolonsFixer, NoSinglelineWhitespaceBeforeSemicolonsFixer. - * Must run after NoSuperfluousElseifFixer, NoUnneededCurlyBracesFixer, NoUselessElseFixer, SemicolonAfterInstructionFixer. + * Must run after NoSuperfluousElseifFixer, NoUnneededBracesFixer, NoUnneededCurlyBracesFixer, NoUselessElseFixer, SemicolonAfterInstructionFixer. */ public function getPriority(): int { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/YodaStyleFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/YodaStyleFixer.php index 10b57fbcd..0a2674652 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/YodaStyleFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ControlStructure/YodaStyleFixer.php @@ -347,13 +347,14 @@ private function fixTokensComparePart(Tokens $tokens, int $start, int $end): Tok private function getCompareFixableInfo(Tokens $tokens, int $index, bool $yoda): ?array { - $left = $this->getLeftSideCompareFixableInfo($tokens, $index); $right = $this->getRightSideCompareFixableInfo($tokens, $index); if (!$yoda && $this->isOfLowerPrecedenceAssignment($tokens[$tokens->getNextMeaningfulToken($right['end'])])) { return null; } + $left = $this->getLeftSideCompareFixableInfo($tokens, $index); + if ($this->isListStatement($tokens, $left['start'], $left['end']) || $this->isListStatement($tokens, $right['start'], $right['end'])) { return null; // do not fix lists assignment inside statements } @@ -440,6 +441,11 @@ private function isOfLowerPrecedence(Token $token): bool T_THROW, // throw T_COALESCE, T_YIELD, // yield + T_YIELD_FROM, + T_REQUIRE, + T_REQUIRE_ONCE, + T_INCLUDE, + T_INCLUDE_ONCE, ]; } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php index be006cf48..5f47784e7 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php @@ -72,6 +72,27 @@ public function getDefinition(): FixerDefinitionInterface 'keep_multiple_spaces_after_comma' => false, ] ), + new CodeSample( + " 'ensure_fully_multiline', + 'attribute_placement' => 'ignore', + ] + ), + new CodeSample( + " 'ensure_fully_multiline', + 'attribute_placement' => 'same_line', + ] + ), + new CodeSample( + " 'ensure_fully_multiline', + 'attribute_placement' => 'standalone', + ] + ), new CodeSample( <<<'SAMPLE' setAllowedTypes(['bool']) ->setDefault(false) ->getOption(), + (new FixerOptionBuilder( + 'attribute_placement', + 'Defines how to handle argument attributes when function definition is multiline.' + )) + ->setAllowedValues(['ignore', 'same_line', 'standalone']) + ->setDefault('standalone') + ->getOption(), ]); } @@ -327,17 +355,24 @@ private function ensureFunctionFullyMultiline(Tokens $tokens, int $startFunction continue; } - $isAttribute = $token->isGivenKind(CT::T_ATTRIBUTE_CLOSE); - - if ( - ($token->equals(',') || $isAttribute) - && !$tokens[$tokens->getNextMeaningfulToken($index)]->equals(')') - ) { - $this->fixNewline($tokens, $index, $indentation); + if ($tokens[$tokens->getNextMeaningfulToken($index)]->equals(')')) { + continue; + } - if ($isAttribute) { - $index = $tokens->findBlockStart(Tokens::BLOCK_TYPE_ATTRIBUTE, $index); + if ($token->isGivenKind(CT::T_ATTRIBUTE_CLOSE)) { + if ('standalone' === $this->configuration['attribute_placement']) { + $this->fixNewline($tokens, $index, $indentation); + } elseif ('same_line' === $this->configuration['attribute_placement']) { + $this->ensureSingleLine($tokens, $index + 1); + $tokens->ensureWhitespaceAtIndex($index + 1, 0, ' '); } + $index = $tokens->findBlockStart(Tokens::BLOCK_TYPE_ATTRIBUTE, $index); + + continue; + } + + if ($token->equals(',')) { + $this->fixNewline($tokens, $index, $indentation); } } @@ -345,7 +380,7 @@ private function ensureFunctionFullyMultiline(Tokens $tokens, int $startFunction } /** - * Method to insert newline after comma or opening parenthesis. + * Method to insert newline after comma, attribute or opening parenthesis. * * @param int $index index of a comma * @param string $indentation the indentation that should be used @@ -360,6 +395,10 @@ private function fixNewline(Tokens $tokens, int $index, string $indentation, boo if ($tokens[$index + 2]->isComment()) { $nextMeaningfulTokenIndex = $tokens->getNextMeaningfulToken($index + 2); if (!$this->isNewline($tokens[$nextMeaningfulTokenIndex - 1])) { + if ($tokens[$nextMeaningfulTokenIndex - 1]->isWhitespace()) { + $tokens->clearAt($nextMeaningfulTokenIndex - 1); + } + $tokens->ensureWhitespaceAtIndex($nextMeaningfulTokenIndex, 0, $this->whitespacesConfig->getLineEnding().$indentation); } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/FunctionNotation/NoSpacesAfterFunctionNameFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/FunctionNotation/NoSpacesAfterFunctionNameFixer.php index e435b782a..9549b45a8 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/FunctionNotation/NoSpacesAfterFunctionNameFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/FunctionNotation/NoSpacesAfterFunctionNameFixer.php @@ -45,7 +45,7 @@ public function getDefinition(): FixerDefinitionInterface */ public function getPriority(): int { - return 2; + return 3; } public function isCandidate(Tokens $tokens): bool diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/FunctionNotation/NullableTypeDeclarationForDefaultNullValueFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/FunctionNotation/NullableTypeDeclarationForDefaultNullValueFixer.php index 49eebf9a5..a8cec92c2 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/FunctionNotation/NullableTypeDeclarationForDefaultNullValueFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/FunctionNotation/NullableTypeDeclarationForDefaultNullValueFixer.php @@ -32,7 +32,7 @@ use PhpCsFixer\Tokenizer\Tokens; /** - * @author HypeMC + * @author HypeMC */ final class NullableTypeDeclarationForDefaultNullValueFixer extends AbstractFixer implements ConfigurableFixerInterface { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/CombineConsecutiveIssetsFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/CombineConsecutiveIssetsFixer.php index b768c0bd2..10e19180f 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/CombineConsecutiveIssetsFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/CombineConsecutiveIssetsFixer.php @@ -38,7 +38,7 @@ public function getDefinition(): FixerDefinitionInterface */ public function getPriority(): int { - return 3; + return 4; } public function isCandidate(Tokens $tokens): bool diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/FunctionToConstantFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/FunctionToConstantFixer.php index 7423504ff..0c81c54d2 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/FunctionToConstantFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/FunctionToConstantFixer.php @@ -96,12 +96,12 @@ public function getDefinition(): FixerDefinitionInterface /** * {@inheritdoc} * - * Must run before NativeFunctionCasingFixer, NoExtraBlankLinesFixer, NoSinglelineWhitespaceBeforeSemicolonsFixer, NoTrailingWhitespaceFixer, NoWhitespaceInBlankLineFixer, SelfStaticAccessorFixer. + * Must run before NativeConstantInvocationFixer, NativeFunctionCasingFixer, NoExtraBlankLinesFixer, NoSinglelineWhitespaceBeforeSemicolonsFixer, NoTrailingWhitespaceFixer, NoWhitespaceInBlankLineFixer, SelfStaticAccessorFixer. * Must run after NoSpacesAfterFunctionNameFixer, NoSpacesInsideParenthesisFixer, SpacesInsideParenthesesFixer. */ public function getPriority(): int { - return 1; + return 2; } public function isCandidate(Tokens $tokens): bool diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixer.php index 89986cd60..229049a32 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/SingleSpaceAfterConstructFixer.php @@ -168,7 +168,7 @@ public function getDefinition(): FixerDefinitionInterface * {@inheritdoc} * * Must run before BracesFixer, FunctionDeclarationFixer. - * Must run after ModernizeStrposFixer. + * Must run after ArraySyntaxFixer, ModernizeStrposFixer. */ public function getPriority(): int { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/SingleSpaceAroundConstructFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/SingleSpaceAroundConstructFixer.php index afcfbafd8..29d395f99 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/SingleSpaceAroundConstructFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/LanguageConstruct/SingleSpaceAroundConstructFixer.php @@ -256,7 +256,7 @@ function foo() { yield from baz(); } * {@inheritdoc} * * Must run before BracesFixer, FunctionDeclarationFixer, NullableTypeDeclarationFixer. - * Must run after ModernizeStrposFixer. + * Must run after ArraySyntaxFixer, ModernizeStrposFixer. */ public function getPriority(): int { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithBracesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithBracesFixer.php index 2dbc2f941..1fad4c76c 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithBracesFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithBracesFixer.php @@ -14,38 +14,38 @@ namespace PhpCsFixer\Fixer\Operator; -use PhpCsFixer\AbstractFixer; +use PhpCsFixer\AbstractProxyFixer; use PhpCsFixer\Fixer\ConfigurableFixerInterface; -use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver; +use PhpCsFixer\Fixer\DeprecatedFixerInterface; use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface; -use PhpCsFixer\FixerConfiguration\FixerOptionBuilder; -use PhpCsFixer\FixerDefinition\CodeSample; use PhpCsFixer\FixerDefinition\FixerDefinition; use PhpCsFixer\FixerDefinition\FixerDefinitionInterface; -use PhpCsFixer\Tokenizer\CT; -use PhpCsFixer\Tokenizer\Token; -use PhpCsFixer\Tokenizer\Tokens; /** * @author Dariusz RumiƄski + * + * @deprecated */ -final class NewWithBracesFixer extends AbstractFixer implements ConfigurableFixerInterface +final class NewWithBracesFixer extends AbstractProxyFixer implements ConfigurableFixerInterface, DeprecatedFixerInterface { + private NewWithParenthesesFixer $newWithParenthesesFixer; + + public function __construct() + { + $this->newWithParenthesesFixer = new NewWithParenthesesFixer(); + + parent::__construct(); + } + public function getDefinition(): FixerDefinitionInterface { + $fixerDefinition = $this->newWithParenthesesFixer->getDefinition(); + return new FixerDefinition( 'All instances created with `new` keyword must (not) be followed by braces.', - [ - new CodeSample(" false] - ), - new CodeSample( - " false] - ), - ] + $fixerDefinition->getCodeSamples(), + $fixerDefinition->getDescription(), + $fixerDefinition->getRiskyDescription(), ); } @@ -56,145 +56,32 @@ public function getDefinition(): FixerDefinitionInterface */ public function getPriority(): int { - return 37; + return $this->newWithParenthesesFixer->getPriority(); } - public function isCandidate(Tokens $tokens): bool + public function configure(array $configuration): void { - return $tokens->isTokenKindFound(T_NEW); - } - - protected function applyFix(\SplFileInfo $file, Tokens $tokens): void - { - static $nextTokenKinds = null; - - if (null === $nextTokenKinds) { - $nextTokenKinds = [ - '?', - ';', - ',', - '(', - ')', - '[', - ']', - ':', - '<', - '>', - '+', - '-', - '*', - '/', - '%', - '&', - '^', - '|', - [T_CLASS], - [T_IS_SMALLER_OR_EQUAL], - [T_IS_GREATER_OR_EQUAL], - [T_IS_EQUAL], - [T_IS_NOT_EQUAL], - [T_IS_IDENTICAL], - [T_IS_NOT_IDENTICAL], - [T_CLOSE_TAG], - [T_LOGICAL_AND], - [T_LOGICAL_OR], - [T_LOGICAL_XOR], - [T_BOOLEAN_AND], - [T_BOOLEAN_OR], - [T_SL], - [T_SR], - [T_INSTANCEOF], - [T_AS], - [T_DOUBLE_ARROW], - [T_POW], - [T_SPACESHIP], - [CT::T_ARRAY_SQUARE_BRACE_OPEN], - [CT::T_ARRAY_SQUARE_BRACE_CLOSE], - [CT::T_BRACE_CLASS_INSTANTIATION_OPEN], - [CT::T_BRACE_CLASS_INSTANTIATION_CLOSE], - ]; - - if (\defined('T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG')) { // @TODO: drop condition when PHP 8.1+ is required - $nextTokenKinds[] = [T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG]; - $nextTokenKinds[] = [T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG]; - } - } - - for ($index = $tokens->count() - 3; $index > 0; --$index) { - if (!$tokens[$index]->isGivenKind(T_NEW)) { - continue; - } + $this->newWithParenthesesFixer->configure($configuration); - $nextIndex = $tokens->getNextTokenOfKind($index, $nextTokenKinds); - - // new anonymous class definition - if ($tokens[$nextIndex]->isGivenKind(T_CLASS)) { - $nextIndex = $tokens->getNextMeaningfulToken($nextIndex); - - if ($this->configuration['anonymous_class']) { - $this->ensureBracesAt($tokens, $nextIndex); - } else { - $this->ensureNoBracesAt($tokens, $nextIndex); - } - - continue; - } - - // entrance into array index syntax - need to look for exit - - while ($tokens[$nextIndex]->equals('[') || $tokens[$nextIndex]->isGivenKind(CT::T_ARRAY_INDEX_CURLY_BRACE_OPEN)) { - $nextIndex = $tokens->findBlockEnd(Tokens::detectBlockType($tokens[$nextIndex])['type'], $nextIndex); - $nextIndex = $tokens->getNextMeaningfulToken($nextIndex); - } - - if ($this->configuration['named_class']) { - $this->ensureBracesAt($tokens, $nextIndex); - } else { - $this->ensureNoBracesAt($tokens, $nextIndex); - } - } + parent::configure($configuration); } - protected function createConfigurationDefinition(): FixerConfigurationResolverInterface + public function getSuccessorsNames(): array { - return new FixerConfigurationResolver([ - (new FixerOptionBuilder('named_class', 'Whether named classes should be followed by parentheses.')) - ->setAllowedTypes(['bool']) - ->setDefault(true) - ->getOption(), - (new FixerOptionBuilder('anonymous_class', 'Whether anonymous classes should be followed by parentheses.')) - ->setAllowedTypes(['bool']) - ->setDefault(true) - ->getOption(), - ]); + return [ + $this->newWithParenthesesFixer->getName(), + ]; } - private function ensureBracesAt(Tokens $tokens, int $index): void + protected function createProxyFixers(): array { - $token = $tokens[$index]; - - if (!$token->equals('(') && !$token->isObjectOperator()) { - $tokens->insertAt( - $tokens->getPrevMeaningfulToken($index) + 1, - [new Token('('), new Token(')')] - ); - } + return [ + $this->newWithParenthesesFixer, + ]; } - private function ensureNoBracesAt(Tokens $tokens, int $index): void + protected function createConfigurationDefinition(): FixerConfigurationResolverInterface { - if (!$tokens[$index]->equals('(')) { - return; - } - - $closingIndex = $tokens->getNextMeaningfulToken($index); - - // constructor has arguments - braces can not be removed - if (!$tokens[$closingIndex]->equals(')')) { - return; - } - - $tokens->clearTokenAndMergeSurroundingWhitespace($closingIndex); - $tokens->clearTokenAndMergeSurroundingWhitespace($index); + return $this->newWithParenthesesFixer->createConfigurationDefinition(); } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithParenthesesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithParenthesesFixer.php new file mode 100644 index 000000000..9c9d7aab7 --- /dev/null +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithParenthesesFixer.php @@ -0,0 +1,200 @@ + + * Dariusz RumiƄski + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace PhpCsFixer\Fixer\Operator; + +use PhpCsFixer\AbstractFixer; +use PhpCsFixer\Fixer\ConfigurableFixerInterface; +use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver; +use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface; +use PhpCsFixer\FixerConfiguration\FixerOptionBuilder; +use PhpCsFixer\FixerDefinition\CodeSample; +use PhpCsFixer\FixerDefinition\FixerDefinition; +use PhpCsFixer\FixerDefinition\FixerDefinitionInterface; +use PhpCsFixer\Tokenizer\CT; +use PhpCsFixer\Tokenizer\Token; +use PhpCsFixer\Tokenizer\Tokens; + +/** + * @author Dariusz RumiƄski + */ +final class NewWithParenthesesFixer extends AbstractFixer implements ConfigurableFixerInterface +{ + public function getDefinition(): FixerDefinitionInterface + { + return new FixerDefinition( + 'All instances created with `new` keyword must (not) be followed by parentheses.', + [ + new CodeSample(" false] + ), + new CodeSample( + " false] + ), + ] + ); + } + + /** + * {@inheritdoc} + * + * Must run before ClassDefinitionFixer. + */ + public function getPriority(): int + { + return 37; + } + + public function isCandidate(Tokens $tokens): bool + { + return $tokens->isTokenKindFound(T_NEW); + } + + protected function applyFix(\SplFileInfo $file, Tokens $tokens): void + { + static $nextTokenKinds = null; + + if (null === $nextTokenKinds) { + $nextTokenKinds = [ + '?', + ';', + ',', + '(', + ')', + '[', + ']', + ':', + '<', + '>', + '+', + '-', + '*', + '/', + '%', + '&', + '^', + '|', + [T_CLASS], + [T_IS_SMALLER_OR_EQUAL], + [T_IS_GREATER_OR_EQUAL], + [T_IS_EQUAL], + [T_IS_NOT_EQUAL], + [T_IS_IDENTICAL], + [T_IS_NOT_IDENTICAL], + [T_CLOSE_TAG], + [T_LOGICAL_AND], + [T_LOGICAL_OR], + [T_LOGICAL_XOR], + [T_BOOLEAN_AND], + [T_BOOLEAN_OR], + [T_SL], + [T_SR], + [T_INSTANCEOF], + [T_AS], + [T_DOUBLE_ARROW], + [T_POW], + [T_SPACESHIP], + [CT::T_ARRAY_SQUARE_BRACE_OPEN], + [CT::T_ARRAY_SQUARE_BRACE_CLOSE], + [CT::T_BRACE_CLASS_INSTANTIATION_OPEN], + [CT::T_BRACE_CLASS_INSTANTIATION_CLOSE], + ]; + + if (\defined('T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG')) { // @TODO: drop condition when PHP 8.1+ is required + $nextTokenKinds[] = [T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG]; + $nextTokenKinds[] = [T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG]; + } + } + + for ($index = $tokens->count() - 3; $index > 0; --$index) { + if (!$tokens[$index]->isGivenKind(T_NEW)) { + continue; + } + + $nextIndex = $tokens->getNextTokenOfKind($index, $nextTokenKinds); + + // new anonymous class definition + if ($tokens[$nextIndex]->isGivenKind(T_CLASS)) { + $nextIndex = $tokens->getNextMeaningfulToken($nextIndex); + + if ($this->configuration['anonymous_class']) { + $this->ensureParenthesesAt($tokens, $nextIndex); + } else { + $this->ensureNoParenthesesAt($tokens, $nextIndex); + } + + continue; + } + + // entrance into array index syntax - need to look for exit + + while ($tokens[$nextIndex]->equals('[') || $tokens[$nextIndex]->isGivenKind(CT::T_ARRAY_INDEX_CURLY_BRACE_OPEN)) { + $nextIndex = $tokens->findBlockEnd(Tokens::detectBlockType($tokens[$nextIndex])['type'], $nextIndex); + $nextIndex = $tokens->getNextMeaningfulToken($nextIndex); + } + + if ($this->configuration['named_class']) { + $this->ensureParenthesesAt($tokens, $nextIndex); + } else { + $this->ensureNoParenthesesAt($tokens, $nextIndex); + } + } + } + + protected function createConfigurationDefinition(): FixerConfigurationResolverInterface + { + return new FixerConfigurationResolver([ + (new FixerOptionBuilder('named_class', 'Whether named classes should be followed by parentheses.')) + ->setAllowedTypes(['bool']) + ->setDefault(true) + ->getOption(), + (new FixerOptionBuilder('anonymous_class', 'Whether anonymous classes should be followed by parentheses.')) + ->setAllowedTypes(['bool']) + ->setDefault(true) + ->getOption(), + ]); + } + + private function ensureParenthesesAt(Tokens $tokens, int $index): void + { + $token = $tokens[$index]; + + if (!$token->equals('(') && !$token->isObjectOperator()) { + $tokens->insertAt( + $tokens->getPrevMeaningfulToken($index) + 1, + [new Token('('), new Token(')')] + ); + } + } + + private function ensureNoParenthesesAt(Tokens $tokens, int $index): void + { + if (!$tokens[$index]->equals('(')) { + return; + } + + $closingIndex = $tokens->getNextMeaningfulToken($index); + + // constructor has arguments - parentheses can not be removed + if (!$tokens[$closingIndex]->equals(')')) { + return; + } + + $tokens->clearTokenAndMergeSurroundingWhitespace($closingIndex); + $tokens->clearTokenAndMergeSurroundingWhitespace($index); + } +} diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/NoUselessReturnFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/NoUselessReturnFixer.php index 1aac27c8a..aba3072c5 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/NoUselessReturnFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/NoUselessReturnFixer.php @@ -50,7 +50,7 @@ function example($b) { * {@inheritdoc} * * Must run before BlankLineBeforeStatementFixer, NoExtraBlankLinesFixer, NoWhitespaceInBlankLineFixer, SingleLineCommentStyleFixer, SingleLineEmptyBodyFixer. - * Must run after NoEmptyStatementFixer, NoUnneededCurlyBracesFixer, NoUselessElseFixer, SimplifiedNullReturnFixer. + * Must run after NoEmptyStatementFixer, NoUnneededBracesFixer, NoUnneededCurlyBracesFixer, NoUselessElseFixer, SimplifiedNullReturnFixer. */ public function getPriority(): int { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/ReturnAssignmentFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/ReturnAssignmentFixer.php index 291f9705d..1e883382b 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/ReturnAssignmentFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/ReturnAssignmentFixer.php @@ -39,7 +39,7 @@ public function getDefinition(): FixerDefinitionInterface * {@inheritdoc} * * Must run before BlankLineBeforeStatementFixer. - * Must run after NoEmptyStatementFixer, NoUnneededCurlyBracesFixer. + * Must run after NoEmptyStatementFixer, NoUnneededBracesFixer, NoUnneededCurlyBracesFixer. */ public function getPriority(): int { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/MultilineWhitespaceBeforeSemicolonsFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/MultilineWhitespaceBeforeSemicolonsFixer.php index fbf5f5b9f..f92ced5c9 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/MultilineWhitespaceBeforeSemicolonsFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/MultilineWhitespaceBeforeSemicolonsFixer.php @@ -136,7 +136,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void $content = $previous->getContent(); if (str_starts_with($content, $lineEnding) && $tokens[$index - 2]->isComment()) { - // if there is comment between closing bracket and semicolon + // if there is comment between closing parenthesis and semicolon // unset whitespace and semicolon $tokens->clearAt($previousIndex); diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypeDeclarationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypeDeclarationFixer.php new file mode 100644 index 000000000..e1af647ef --- /dev/null +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypeDeclarationFixer.php @@ -0,0 +1,72 @@ + + * Dariusz RumiƄski + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace PhpCsFixer\Fixer\Whitespace; + +use PhpCsFixer\AbstractFixer; +use PhpCsFixer\FixerDefinition\CodeSample; +use PhpCsFixer\FixerDefinition\FixerDefinition; +use PhpCsFixer\FixerDefinition\FixerDefinitionInterface; +use PhpCsFixer\Tokenizer\CT; +use PhpCsFixer\Tokenizer\Tokens; + +/** + * @author Jack Cherng + */ +final class CompactNullableTypeDeclarationFixer extends AbstractFixer +{ + public function getDefinition(): FixerDefinitionInterface + { + return new FixerDefinition( + 'Remove extra spaces in a nullable type declaration.', + [ + new CodeSample( + "isTokenKindFound(CT::T_NULLABLE_TYPE); + } + + protected function applyFix(\SplFileInfo $file, Tokens $tokens): void + { + static $typehintKinds = [ + CT::T_ARRAY_TYPEHINT, + T_CALLABLE, + T_NS_SEPARATOR, + T_STATIC, + T_STRING, + ]; + + for ($index = $tokens->count() - 1; $index >= 0; --$index) { + if (!$tokens[$index]->isGivenKind(CT::T_NULLABLE_TYPE)) { + continue; + } + + // remove whitespaces only if there are only whitespaces + // between '?' and the variable type + if ( + $tokens[$index + 1]->isWhitespace() + && $tokens[$index + 2]->isGivenKind($typehintKinds) + ) { + $tokens->removeTrailingWhitespace($index); + } + } + } +} diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypehintFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypehintFixer.php index f3681419e..89c4ec654 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypehintFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypehintFixer.php @@ -14,59 +14,50 @@ namespace PhpCsFixer\Fixer\Whitespace; -use PhpCsFixer\AbstractFixer; -use PhpCsFixer\FixerDefinition\CodeSample; +use PhpCsFixer\AbstractProxyFixer; +use PhpCsFixer\Fixer\DeprecatedFixerInterface; use PhpCsFixer\FixerDefinition\FixerDefinition; use PhpCsFixer\FixerDefinition\FixerDefinitionInterface; -use PhpCsFixer\Tokenizer\CT; -use PhpCsFixer\Tokenizer\Tokens; /** * @author Jack Cherng + * + * @deprecated */ -final class CompactNullableTypehintFixer extends AbstractFixer +final class CompactNullableTypehintFixer extends AbstractProxyFixer implements DeprecatedFixerInterface { + private CompactNullableTypeDeclarationFixer $compactNullableTypeDeclarationFixer; + + public function __construct() + { + $this->compactNullableTypeDeclarationFixer = new CompactNullableTypeDeclarationFixer(); + + parent::__construct(); + } + public function getDefinition(): FixerDefinitionInterface { + $fixerDefinition = $this->compactNullableTypeDeclarationFixer->getDefinition(); + return new FixerDefinition( 'Remove extra spaces in a nullable typehint.', - [ - new CodeSample( - "getCodeSamples(), + $fixerDefinition->getDescription(), + $fixerDefinition->getRiskyDescription(), ); } - public function isCandidate(Tokens $tokens): bool + public function getSuccessorsNames(): array { - return $tokens->isTokenKindFound(CT::T_NULLABLE_TYPE); + return [ + $this->compactNullableTypeDeclarationFixer->getName(), + ]; } - protected function applyFix(\SplFileInfo $file, Tokens $tokens): void + protected function createProxyFixers(): array { - static $typehintKinds = [ - CT::T_ARRAY_TYPEHINT, - T_CALLABLE, - T_NS_SEPARATOR, - T_STATIC, - T_STRING, + return [ + $this->compactNullableTypeDeclarationFixer, ]; - - for ($index = $tokens->count() - 1; $index >= 0; --$index) { - if (!$tokens[$index]->isGivenKind(CT::T_NULLABLE_TYPE)) { - continue; - } - - // remove whitespaces only if there are only whitespaces - // between '?' and the variable type - if ( - $tokens[$index + 1]->isWhitespace() - && $tokens[$index + 2]->isGivenKind($typehintKinds) - ) { - $tokens->removeTrailingWhitespace($index); - } - } } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoSpacesInsideParenthesisFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoSpacesInsideParenthesisFixer.php index 588d70e37..d85075124 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoSpacesInsideParenthesisFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoSpacesInsideParenthesisFixer.php @@ -55,7 +55,7 @@ function foo( \$bar, \$baz ) */ public function getPriority(): int { - return 2; + return 3; } public function getSuccessorsNames(): array diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/SpacesInsideParenthesesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/SpacesInsideParenthesesFixer.php index fadf64317..cf862876f 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/SpacesInsideParenthesesFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/SpacesInsideParenthesesFixer.php @@ -71,7 +71,7 @@ function foo(\$bar, \$baz) */ public function getPriority(): int { - return 2; + return 3; } public function isCandidate(Tokens $tokens): bool diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/StatementIndentationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/StatementIndentationFixer.php index 40e4971be..5d77f44aa 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/StatementIndentationFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/StatementIndentationFixer.php @@ -64,7 +64,7 @@ public function getDefinition(): FixerDefinitionInterface * {@inheritdoc} * * Must run before HeredocIndentationFixer. - * Must run after ClassAttributesSeparationFixer, CurlyBracesPositionFixer, MethodArgumentSpaceFixer, NoUselessElseFixer, YieldFromArrayToYieldsFixer. + * Must run after BracesPositionFixer, ClassAttributesSeparationFixer, CurlyBracesPositionFixer, MethodArgumentSpaceFixer, NoUselessElseFixer, YieldFromArrayToYieldsFixer. */ public function getPriority(): int { diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS2x0Set.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS2x0Set.php index 81a9ee122..419b1a388 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS2x0Set.php +++ b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS2x0Set.php @@ -34,6 +34,8 @@ public function getRules(): array { return [ '@PER-CS1.0' => true, + 'concat_space' => ['spacing' => 'one'], + 'method_argument_space' => true, 'single_line_empty_body' => true, ]; } diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSRiskySet.php new file mode 100644 index 000000000..6e6f7908c --- /dev/null +++ b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSRiskySet.php @@ -0,0 +1,40 @@ + + * Dariusz RumiƄski + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace PhpCsFixer\RuleSet\Sets; + +use PhpCsFixer\RuleSet\AbstractRuleSetDescription; + +/** + * @internal + */ +final class PERCSRiskySet extends AbstractRuleSetDescription +{ + public function getName(): string + { + return '@PER-CS:risky'; + } + + public function getRules(): array + { + return [ + '@PER-CS2.0:risky' => true, + ]; + } + + public function getDescription(): string + { + return 'Alias for the latest revision of PER-CS risky rules. Use it if you always want to be in sync with newest PER-CS standard.'; + } +} diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSSet.php new file mode 100644 index 000000000..0fe593499 --- /dev/null +++ b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSSet.php @@ -0,0 +1,40 @@ + + * Dariusz RumiƄski + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace PhpCsFixer\RuleSet\Sets; + +use PhpCsFixer\RuleSet\AbstractRuleSetDescription; + +/** + * @internal + */ +final class PERCSSet extends AbstractRuleSetDescription +{ + public function getName(): string + { + return '@PER-CS'; + } + + public function getRules(): array + { + return [ + '@PER-CS2.0' => true, + ]; + } + + public function getDescription(): string + { + return 'Alias for the latest revision of PER-CS rules. Use it if you always want to be in sync with newest PER-CS standard.'; + } +} diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR12Set.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR12Set.php index 659e274f0..04236c5c2 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR12Set.php +++ b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR12Set.php @@ -31,18 +31,18 @@ public function getRules(): array 'blank_line_after_opening_tag' => true, 'blank_line_between_import_groups' => true, 'blank_lines_before_namespace' => true, + 'braces_position' => [ + 'allow_single_line_empty_anonymous_classes' => true, + ], 'class_definition' => [ 'inline_constructor_arguments' => false, // handled by method_argument_space fixer 'space_before_parenthesis' => true, // defined in PSR12 ¶8. Anonymous Classes ], - 'compact_nullable_typehint' => true, - 'curly_braces_position' => [ - 'allow_single_line_empty_anonymous_classes' => true, - ], + 'compact_nullable_type_declaration' => true, 'declare_equal_normalize' => true, 'lowercase_cast' => true, 'lowercase_static_reference' => true, - 'new_with_braces' => true, + 'new_with_parentheses' => true, 'no_blank_lines_after_class_opening' => true, 'no_leading_import_slash' => true, 'no_whitespace_in_blank_line' => true, diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR2Set.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR2Set.php index c2eb31ca7..19d023d79 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR2Set.php +++ b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR2Set.php @@ -26,17 +26,18 @@ public function getRules(): array return [ '@PSR1' => true, 'blank_line_after_namespace' => true, + 'braces_position' => true, 'class_definition' => true, 'constant_case' => true, 'control_structure_braces' => true, 'control_structure_continuation_position' => true, - 'curly_braces_position' => true, 'elseif' => true, 'function_declaration' => true, 'indentation_type' => true, 'line_ending' => true, 'lowercase_keywords' => true, 'method_argument_space' => [ + 'attribute_placement' => 'ignore', 'on_multiline' => 'ensure_fully_multiline', ], 'no_break_comment' => true, diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PhpCsFixerRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PhpCsFixerRiskySet.php index 4a3e25594..b90dcbad6 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PhpCsFixerRiskySet.php +++ b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PhpCsFixerRiskySet.php @@ -24,7 +24,7 @@ final class PhpCsFixerRiskySet extends AbstractRuleSetDescription public function getRules(): array { return [ - '@PER-CS2.0:risky' => true, + '@PER-CS:risky' => true, '@Symfony:risky' => true, 'comment_to_phpdoc' => true, 'final_internal_class' => true, diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PhpCsFixerSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PhpCsFixerSet.php index 6e6392a68..0bd66ffe1 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PhpCsFixerSet.php +++ b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PhpCsFixerSet.php @@ -24,7 +24,7 @@ final class PhpCsFixerSet extends AbstractRuleSetDescription public function getRules(): array { return [ - '@PER-CS2.0' => true, + '@PER-CS' => true, '@Symfony' => true, 'array_indentation' => true, 'blank_line_before_statement' => [ diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/SymfonySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/SymfonySet.php index 1bacfe0e0..bd61e2661 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/SymfonySet.php +++ b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/SymfonySet.php @@ -34,6 +34,10 @@ public function getRules(): array 'return', ], ], + 'braces_position' => [ + 'allow_single_line_anonymous_functions' => true, + 'allow_single_line_empty_anonymous_classes' => true, + ], 'cast_spaces' => true, 'class_attributes_separation' => [ 'elements' => [ @@ -46,10 +50,6 @@ public function getRules(): array 'class_reference_name_casing' => true, 'clean_namespace' => true, 'concat_space' => true, - 'curly_braces_position' => [ - 'allow_single_line_anonymous_functions' => true, - 'allow_single_line_empty_anonymous_classes' => true, - ], 'declare_parentheses' => true, 'echo_tag_syntax' => true, 'empty_loop_body' => ['style' => 'braces'], @@ -77,7 +77,7 @@ public function getRules(): array 'on_multiline' => 'ignore', ], 'native_function_casing' => true, - 'native_function_type_declaration_casing' => true, + 'native_type_declaration_casing' => true, 'no_alias_language_construct_call' => true, 'no_alternative_syntax' => true, 'no_binary_string' => true, @@ -111,6 +111,9 @@ public function getRules(): array 'remove_inheritdoc' => true, ], 'no_trailing_comma_in_singleline' => true, + 'no_unneeded_braces' => [ + 'namespaces' => true, + ], 'no_unneeded_control_parentheses' => [ 'statements' => [ 'break', @@ -124,9 +127,6 @@ public function getRules(): array 'yield_from', ], ], - 'no_unneeded_curly_braces' => [ - 'namespaces' => true, - ], 'no_unneeded_import_alias' => true, 'no_unset_cast' => true, 'no_unused_imports' => true, diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Token.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Token.php index 58399d805..1009717cb 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Token.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Token.php @@ -136,7 +136,7 @@ public static function getObjectOperatorKinds(): array */ public function equals($other, bool $caseSensitive = true): bool { - if (\defined('T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG')) { // @TODO: drop condition with new MAJOR release 4.0 + if (\defined('T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG')) { // @TODO: drop condition when PHP 8.1+ is required if ('&' === $other) { return '&' === $this->content && (null === $this->id || $this->isGivenKind([T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG, T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG])); } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/CurlyBraceTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/BraceTransformer.php similarity index 99% rename from vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/CurlyBraceTransformer.php rename to vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/BraceTransformer.php index ff2226609..e4f374ad6 100644 --- a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/CurlyBraceTransformer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/BraceTransformer.php @@ -34,7 +34,7 @@ * * @internal */ -final class CurlyBraceTransformer extends AbstractTransformer +final class BraceTransformer extends AbstractTransformer { public function getRequiredPhpVersionId(): int { diff --git a/vendor/phpstan/phpstan/phpstan.phar b/vendor/phpstan/phpstan/phpstan.phar index 226ea192c..b5e3894e0 100755 Binary files a/vendor/phpstan/phpstan/phpstan.phar and b/vendor/phpstan/phpstan/phpstan.phar differ diff --git a/vendor/phpstan/phpstan/phpstan.phar.asc b/vendor/phpstan/phpstan/phpstan.phar.asc index 6f75fb28a..d09166bf5 100644 --- a/vendor/phpstan/phpstan/phpstan.phar.asc +++ b/vendor/phpstan/phpstan/phpstan.phar.asc @@ -1,16 +1,16 @@ -----BEGIN PGP SIGNATURE----- -iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmUJveMACgkQUcZzBf/C -5cDJpw/9HY+cS4w3C3NI/NIuIDkMOwID2fyF3jGp89+HylnvRgdnM6DNWiF1smRX -NuQUI55L6q6x9gamVOG+8VVaPdJO8fBbHx1uHqW4Kx+q8XShjCdGm0HiMkDceEZP -GQFp06iPY/O+Nqz9ofNfJMR++SkaVQnrgDLws18+fhp29mkkGxAW3M2hcCz6kC/X -yAjw12VsJErpCvtlYdXu3geBYiqfS095mTyjj9xmyYojzVDwiNI2nYhWvw1gzsM6 -PMb1k8HhkMThRsqxG+7kkZe1klWJ3KHQXsHyB4mQqUHzL0SYbSFtWOx4IsEZ90eb -/Bm5GHfYso1pE5NzWcYzfyNKxRkcV8jPWu5YzzdkX6ncMR6sZ78CEFrhkYG9zhIy -rfaU9Bccuy9jAmec8WHtpaHo+b23tzn/vpfnY4VboggpEsJWyiCKQnBLK/qlesbw -UN41jPlXvzrWZZJNFZnDzFn/0rAma0qqiM3tz5BKwLtGZuHugwJ4RJ40MlrqYHN8 -CeazXTcEqeVywh1y6gRKTPoFf9WdFi46COwcU71av5V/9VewNzz6rzik51ryS/2m -6sIlRWVYi31OTUkLyRmu6drYJSNjkrN/WOB935SyvFDVHpNH8OQbSP/HqOniCz/S -h0eAWSJUbrDslJSc87rbdm/WA3jftbwI0w5ymKit7wqm/Dn5Q20= -=rQp6 +iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmUW2hQACgkQUcZzBf/C +5cAX+g/8DLEpwgjbRjXNPaPoL9y2lbhYuOAkFuTLElmFTNRvmUgOrqI3pGdfWves +tFCRVdzefPnbi8PX7Y0u14bKY/YieSgeXEwqaZfllPdan7TJ7gdu8ZvOxZeiOvT5 +Ns7Bnn7F+TyK7Z9gFn9pSt4bopLXgoGM3Xw4yg//HWQIb2gYzP/OEUwzF6vj1N88 +x7GyXKhuNClh8DOYLPdw/Mp5C+Z4wEqUpxFFZ6nMZN239gOC4kxz2IfbMj1Lb1jR +5diFq+lAB9IfmqlRqJnlkRDmM3jt6G6+i4YNIdk8iRN3ppMJWT0Ck9cSiRSPhImB +n/fo4AA+fhomI6aXBECmYRud78ul0nm411KVM+a/cCnVD9nYrab6eC3K6KBeuWOw +2SNTdKSY+Al5y6mwjwzLCwrOLR7WxCTMkdO8pcbCj62IuKKyxWtS4xI/oxZE+z1S +2o4arkHhv103JQiF9NkbRWnUQakt2IhjWDjZmz051jMjijHfSW3j4WpZ8sjwk5mY +GKO/jQMgJ0M/4h46q+pFawMljBgK+7ECHF1nEAuoF2e+5v8VJ+XRJ+VC6rdvjQWC +StcsiFDznyRJgosaOePn39mLt6E0wOBc6Ko8OIoBrSDP7l5Wh+H6yIzpCiPLCm9C +8sx9U+LB0Jt+BHpWYReQcHrdbek5H7Iu4h8s/F8YYZFEeI0O9tc= +=Y8DE -----END PGP SIGNATURE-----