diff --git a/CHANGELOG.md b/CHANGELOG.md index 22a400c..9af3294 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Changelog --------- +## [1.3.0] - TBA +- Drop support for Symfony below 5.4 (#72) +- Require PHP-CS-Fixer 3.53+ (#72) + ## [1.2.0] - 2024-01-22 - Add new `numeric_literal_separator` rule (#65) - Map new heredoc rules as "to be discussed" (`heredoc_closing_marker`, `multiline_string_to_heredoc`) diff --git a/composer.json b/composer.json index 49ad097..721effa 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,8 @@ "php": "^7.4 || ^8.0", "ext-json": "*", "composer-plugin-api": "^1.1 || ^2.0", - "friendsofphp/php-cs-fixer": "^3.4", - "symfony/console": "^4.0 || ^5.0 || ^6.0 || ^7.0", + "friendsofphp/php-cs-fixer": "^3.53", + "symfony/console": "^5.4 || ^6.0 || ^7.0", "symfony/polyfill-php80": "^1.0" }, "require-dev": { diff --git a/src/AutoloadPathProvider.php b/src/AutoloadPathProvider.php index 0147be9..61aa743 100644 --- a/src/AutoloadPathProvider.php +++ b/src/AutoloadPathProvider.php @@ -107,7 +107,7 @@ private function reduceAutoload(array $autoload): array return array_reduce( $autoload, \Closure::fromCallable([$this, 'autoloadReducer']), - [] + [], ); } diff --git a/src/Installer/Command/CreateConfigCommand.php b/src/Installer/Command/CreateConfigCommand.php index ffca5a5..5e29e3a 100644 --- a/src/Installer/Command/CreateConfigCommand.php +++ b/src/Installer/Command/CreateConfigCommand.php @@ -47,7 +47,7 @@ protected function configure(): void ->setHelp( <<<'HELP' Write config file in .php-cs-fixer.dist.php. - HELP + HELP, ) ; } @@ -59,7 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $configWriter->writeConfigFile( '.php-cs-fixer.dist.php', (bool) $input->getOption('no-dev'), - (bool) $input->getOption('no-risky') + (bool) $input->getOption('no-risky'), ); return 0; diff --git a/src/Installer/Installer.php b/src/Installer/Installer.php index 539910b..a51e621 100644 --- a/src/Installer/Installer.php +++ b/src/Installer/Installer.php @@ -51,7 +51,7 @@ public function __construct( Composer $composer, ?string $projectRoot = null, ?string $composerPath = null, - ?PhpCsConfigWriterInterface $phpCsWriter = null + ?PhpCsConfigWriterInterface $phpCsWriter = null, ) { $this->io = $io; // Get composer.json location @@ -100,7 +100,7 @@ public function checkUpgrade(PackageInterface $currentPackage, PackageInterface ' You are upgrading "' . $currentPackage->getPrettyName() . '" with possible BC breaks.', sprintf( ' %s', - 'Do you want to write the new configuration? (Y/n)' + 'Do you want to write the new configuration? (Y/n)', ), ]; @@ -170,7 +170,7 @@ public function requestCreateCsConfig(): void $question = [ sprintf( " %s\n", - 'Do you want to create the CS configuration in your project root? (Y/n)' + 'Do you want to create the CS configuration in your project root? (Y/n)', ), ' It will create a .php-cs-fixer.dist.php file in your project root directory. ', ]; @@ -205,7 +205,7 @@ public function requestAddComposerScripts(): void $question = [ sprintf( " %s\n", - 'Do you want to add scripts to composer.json? (Y/n)' + 'Do you want to add scripts to composer.json? (Y/n)', ), ' It will add two scripts:', ' - cs-check', diff --git a/src/Rules/DefaultRulesProvider.php b/src/Rules/DefaultRulesProvider.php index ba9754b..f20bc43 100644 --- a/src/Rules/DefaultRulesProvider.php +++ b/src/Rules/DefaultRulesProvider.php @@ -141,9 +141,6 @@ public function getRules(): array 'standardize_not_equals' => true, 'switch_continue_to_break' => true, 'ternary_to_null_coalescing' => true, - 'trailing_comma_in_multiline' => [ - 'elements' => ['arrays'], - ], 'trim_array_spaces' => true, 'type_declaration_spaces' => true, 'types_spaces' => true, diff --git a/tests/AutoloadPathProviderTest.php b/tests/AutoloadPathProviderTest.php index 52be0e7..5794d99 100644 --- a/tests/AutoloadPathProviderTest.php +++ b/tests/AutoloadPathProviderTest.php @@ -44,7 +44,7 @@ public function testGetPathsWithDevOn(): void $provider = new AutoloadPathProvider( $this->composerFilePath, $this->projectRoot, - true + true, ); $expected = ['src/', 'tests/']; @@ -56,7 +56,7 @@ public function testGetPathsWithDevOff(): void $provider = new AutoloadPathProvider( $this->composerFilePath, $this->projectRoot, - false + false, ); $expected = ['src/']; @@ -86,7 +86,7 @@ public function testGetPathsWithInvalidComposerJson(): void $provider = new AutoloadPathProvider( $this->composerFilePath, $this->projectRoot, - false + false, ); file_put_contents($this->composerFilePath, ''); diff --git a/tests/Installer/Command/CreateConfigCommandTest.php b/tests/Installer/Command/CreateConfigCommandTest.php index 953bfe6..ae24598 100644 --- a/tests/Installer/Command/CreateConfigCommandTest.php +++ b/tests/Installer/Command/CreateConfigCommandTest.php @@ -44,7 +44,7 @@ public function testExecute(array $args, bool $noDev, bool $noRisky): void $writer->writeConfigFile( '.php-cs-fixer.dist.php', $noDev, - $noRisky + $noRisky, ) ->shouldBeCalled(); diff --git a/tests/Installer/InstallerTest.php b/tests/Installer/InstallerTest.php index 62ee527..aac0dc2 100644 --- a/tests/Installer/InstallerTest.php +++ b/tests/Installer/InstallerTest.php @@ -92,7 +92,7 @@ public function testCheckUpgradeTestNotNecessary(array $currentPackageV, array $ $composer->reveal(), $this->projectRoot, $this->composerFilePath, - $phpCsWriter->reveal() + $phpCsWriter->reveal(), ); $io->isInteractive() @@ -123,7 +123,7 @@ public function testCheckUpgradeTestNecessary(array $currentPackageV, array $tar $composer->reveal(), $this->projectRoot, $this->composerFilePath, - $phpCsWriter->reveal() + $phpCsWriter->reveal(), ); $io->isInteractive() @@ -149,7 +149,7 @@ public function testCheckUpgrade(): void $composer->reveal(), $this->projectRoot, $this->composerFilePath, - $phpCsWriter->reveal() + $phpCsWriter->reveal(), ); $io->isInteractive() @@ -179,7 +179,7 @@ public function testCheckUpgradeShouldntWriteWithNoInteractiveInput(): void $composer->reveal(), $this->projectRoot, $this->composerFilePath, - $phpCsWriter->reveal() + $phpCsWriter->reveal(), ); $io->isInteractive() @@ -215,7 +215,7 @@ public function testRequestCreateCsConfigWithAlreadyExistingFile(): void $composer->reveal(), $this->projectRoot, $this->composerFilePath, - $phpCsWriter->reveal() + $phpCsWriter->reveal(), ); $installer->requestCreateCsConfig(); } @@ -238,7 +238,7 @@ public function testRequestCreateCsConfigWithAnswerNo(): void $composer->reveal(), $this->projectRoot, $this->composerFilePath, - $phpCsWriter->reveal() + $phpCsWriter->reveal(), ); $installer->requestCreateCsConfig(); @@ -264,7 +264,7 @@ public function testRequestCreateCsConfig(): void $composer->reveal(), $this->projectRoot, $this->composerFilePath, - $phpCsWriter->reveal() + $phpCsWriter->reveal(), ); $installer->requestCreateCsConfig(); diff --git a/tests/Rules/AbstractRulesProviderTest.php b/tests/Rules/AbstractRulesProviderTest.php index 1601339..ad11219 100644 --- a/tests/Rules/AbstractRulesProviderTest.php +++ b/tests/Rules/AbstractRulesProviderTest.php @@ -33,7 +33,7 @@ public function testRuleAreRiskyAsExpected(string $ruleName): void $this->assertSame( $this->shouldBeRisky(), $fixer->isRisky(), - sprintf('Fixer %s is %s as expected', $ruleName, $this->shouldBeRisky() ? 'risky' : 'NOT risky') + sprintf('Fixer %s is %s as expected', $ruleName, $this->shouldBeRisky() ? 'risky' : 'NOT risky'), ); } @@ -49,7 +49,7 @@ public function testRuleSetsAreRiskyAsExpected(string $ruleSetName): void $this->assertSame( $this->shouldBeRisky(), $fixer->isRisky(), - sprintf('Ruleset %s includes %s rules, such as %s', $ruleSetName, $this->shouldBeRisky() ? 'risky' : 'NOT risky', $ruleName) + sprintf('Ruleset %s includes %s rules, such as %s', $ruleSetName, $this->shouldBeRisky() ? 'risky' : 'NOT risky', $ruleName), ); } } @@ -148,18 +148,18 @@ private function assertConfigurationIsSameAsRuleSet(RuleSet $ruleSet, string $ru $this->assertEquals($defaultConfiguration, $ruleConfiguration, sprintf( 'Ruleset relies on default configuration for rule %s, but it is being overridden', - $ruleName + $ruleName, )); } elseif ($ruleConfiguration === true) { $this->assertEquals($ruleSetConfiguration, $defaultConfiguration, sprintf( 'Ruleset does not use the default config for rule %s, and it is being overridden with "true" in %s', $ruleName, - \get_class($rulesProvider) + \get_class($rulesProvider), )); } else { $this->assertEquals($ruleSetConfiguration, $ruleConfiguration, sprintf( 'Rule %s has a different configuration from the one from ruleset', - $ruleName + $ruleName, )); } }