diff --git a/.github/workflows/along_with_symfony_deprecations.yaml b/.github/workflows/along_with_symfony_deprecations.yaml index 454ac68502..daba87dba4 100644 --- a/.github/workflows/along_with_symfony_deprecations.yaml +++ b/.github/workflows/along_with_symfony_deprecations.yaml @@ -13,7 +13,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none - run: mkdir nested-dir diff --git a/.github/workflows/buid_release.yaml b/.github/workflows/buid_release.yaml index 6ffb1f0da5..1b286c716c 100644 --- a/.github/workflows/buid_release.yaml +++ b/.github/workflows/buid_release.yaml @@ -20,7 +20,7 @@ jobs: - uses: "shivammathur/setup-php@v2" with: - php-version: 8.3 + php-version: 8.4 coverage: none # invoke patches diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 5867996af2..63bb03f82c 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -44,7 +44,7 @@ jobs: # see https://github.com/shivammathur/setup-php - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none # composer install cache - https://github.com/ramsey/composer-install diff --git a/.github/workflows/version_command.yaml b/.github/workflows/version_command.yaml index 28b95f4e6b..a0144274ee 100644 --- a/.github/workflows/version_command.yaml +++ b/.github/workflows/version_command.yaml @@ -23,7 +23,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none - run: mkdir nested-dir diff --git a/CLAUDE.md b/CLAUDE.md index 40a9cc5b8b..e3bcfea113 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ Guidance for Claude Code when working in this repository. **Symplify EasyCodingStandard (ECS)** — a unified runner for PHP-CS-Fixer and PHP_CodeSniffer. Users configure rules through a fluent PHP API (`ECSConfig::configure()->with...()`) instead of dealing with each tool's native config format. -- PHP `>=8.3` +- PHP `>=8.4` - Entry binary: `bin/ecs` - PSR-4: `Symplify\EasyCodingStandard\` → `src/` - Tests PSR-4: `Symplify\EasyCodingStandard\Tests\` → `tests/` diff --git a/composer.json b/composer.json index cfba02408c..c5222e3d55 100644 --- a/composer.json +++ b/composer.json @@ -12,36 +12,36 @@ "bin/ecs" ], "require": { - "php": ">=8.3", + "php": ">=8.4", "composer/pcre": "^3.3.2", "composer/xdebug-handler": "^3.0.5", - "entropy/entropy": "dev-main", - "friendsofphp/php-cs-fixer": "^3.95.1|^4.0", + "entropy/entropy": "^0.3", + "friendsofphp/php-cs-fixer": "^3.95.5", "illuminate/container": "12.39.*", - "nette/utils": "4.0.8", - "sebastian/diff": "^6.0|^7.0", + "nette/utils": "^4.1", + "sebastian/diff": "^9.0", "squizlabs/php_codesniffer": "^4.0.1", "symfony/console": "^6.4.24", "symfony/finder": "^7.4", - "symplify/coding-standard": "^13.0", - "symplify/easy-parallel": "^11.2.2", - "webmozart/assert": "^2.3" + "symplify/coding-standard": "^13.1", + "symplify/easy-parallel": "^11.2", + "webmozart/assert": "^2.4" }, "require-dev": { "phpstan/extension-installer": "^1.4.3", - "phpstan/phpstan": "^2.1.54", + "phpstan/phpstan": "^2.2", "phpstan/phpstan-phpunit": "^2.0.16", "phpstan/phpstan-webmozart-assert": "^2.0", - "phpunit/phpunit": "^12.5.4", + "phpunit/phpunit": "^13.0", "rector/jack": "^1.0", "rector/rector": "^2.4", "rector/type-perfect": "^2.1", - "symplify/phpstan-extensions": "^12.0", + "symplify/phpstan-rules": "^14.11", "symplify/vendor-patches": "^11.5", - "tomasvotruba/class-leak": "^2.1", + "tomasvotruba/class-leak": "^2.1.6", "tomasvotruba/type-coverage": "^2.1", - "tomasvotruba/unused-public": "^2.1|^3.0", - "tracy/tracy": "^2.11|^3.0" + "tomasvotruba/unused-public": "^2.2", + "tracy/tracy": "^2.12" }, "autoload": { "psr-4": { diff --git a/phpstan.neon b/phpstan.neon index 51f9c79ec5..db893ee7f9 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,6 +6,9 @@ parameters: # requires exact closure types checkMissingCallableSignature: true + # symplify - see https://github.com/symplify/phpstan-rules#usage + pathStrings: true + paths: - src - tests diff --git a/rector.php b/rector.php index 3e079631dc..a0d1005185 100644 --- a/rector.php +++ b/rector.php @@ -4,6 +4,7 @@ use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\ConstFetch\RemovePhpVersionIdCheckRector; +use Rector\Php84\Rector\Class_\DeprecatedAnnotationToDeprecatedAttributeRector; return RectorConfig::configure() ->withPhpSets() @@ -28,4 +29,10 @@ // conditional checks RemovePhpVersionIdCheckRector::class, + + DeprecatedAnnotationToDeprecatedAttributeRector::class => [ + // avoid runtime reporting in output, only for the user + __DIR__ . '/src/ValueObject/Option.php', + __DIR__ . '/src/ValueObject/Set/SetList.php', + ], ]); diff --git a/src/Configuration/ConfigInitializer.php b/src/Configuration/ConfigInitializer.php index cfdb7d6001..41a417d026 100644 --- a/src/Configuration/ConfigInitializer.php +++ b/src/Configuration/ConfigInitializer.php @@ -21,13 +21,7 @@ public function __construct( public function areSomeCheckersRegistered(): bool { $fileProcessors = $this->fileProcessorCollector->getFileProcessors(); - foreach ($fileProcessors as $fileProcessor) { - if ($fileProcessor->getCheckers()) { - return true; - } - } - - return false; + return array_any($fileProcessors, fn ($fileProcessor): bool => $fileProcessor->getCheckers() !== []); } public function createConfig(string $projectDirectory): void diff --git a/src/Configuration/ECSConfigBuilder.php b/src/Configuration/ECSConfigBuilder.php index ea4985cf56..753baa9d7b 100644 --- a/src/Configuration/ECSConfigBuilder.php +++ b/src/Configuration/ECSConfigBuilder.php @@ -216,7 +216,8 @@ public function withSkip(array $skip): self */ public function withRootFiles(): self { - $rootPhpFilesFinder = (new Finder())->files() + $rootPhpFilesFinder = new Finder() + ->files() ->in(getcwd()) ->depth(0) ->name('*.php'); @@ -887,7 +888,8 @@ private function applyEditorConfigSettings(): void * * @see \Symplify\EasyCodingStandard\DependencyInjection\CompilerPass\RemoveMutualCheckersCompilerPass */ - $editorConfig = (new EditorConfigFactory())->load(); + $editorConfig = new EditorConfigFactory() + ->load(); if ($editorConfig->indentStyle !== null) { $this->indentation = match ($editorConfig->indentStyle) { diff --git a/src/Skipper/Matcher/FileInfoMatcher.php b/src/Skipper/Matcher/FileInfoMatcher.php index 9af38ce74b..f38f880dff 100644 --- a/src/Skipper/Matcher/FileInfoMatcher.php +++ b/src/Skipper/Matcher/FileInfoMatcher.php @@ -23,13 +23,10 @@ public function __construct( */ public function doesFileInfoMatchPatterns(SplFileInfo | string $fileInfo, array $filePatterns): bool { - foreach ($filePatterns as $filePattern) { - if ($this->doesFileInfoMatchPattern($fileInfo, $filePattern)) { - return true; - } - } - - return false; + return array_any( + $filePatterns, + fn (string $filePattern): bool => $this->doesFileInfoMatchPattern($fileInfo, $filePattern) + ); } /** diff --git a/tests/Configuration/EditorConfig/EditorConfigFactoryTest.php b/tests/Configuration/EditorConfig/EditorConfigFactoryTest.php index 03939edc2d..149a91fefe 100644 --- a/tests/Configuration/EditorConfig/EditorConfigFactoryTest.php +++ b/tests/Configuration/EditorConfig/EditorConfigFactoryTest.php @@ -56,8 +56,9 @@ public function testParsingInvalidIniFile(): void public function testLoadsExpectedSections(): void { $this->assertEquals( - (new EditorConfigFactory())->parse( - <<parse( + <<assertEquals( - (new EditorConfigFactory())->parse(''), + new EditorConfigFactory() + ->parse(''), new EditorConfig( indentStyle: null, endOfLine: null, @@ -96,12 +98,12 @@ public function testEmpty(): void public function testIndentStyleSpaces(): void { $this->assertEquals( - (new EditorConfigFactory())->parse( - <<parse(<<assertEquals( - (new EditorConfigFactory())->parse( - <<parse(<<assertEquals( - (new EditorConfigFactory())->parse( - <<parse(<<assertEquals( - (new EditorConfigFactory())->parse( - <<parse(<<assertEquals( - (new EditorConfigFactory())->parse( - <<parse(<<assertEquals( - (new EditorConfigFactory())->parse( - <<parse( + <<assertEquals( - (new EditorConfigFactory())->parse( - <<parse( + <<assertEquals( - (new EditorConfigFactory())->parse( - <<parse(<<assertEquals( - (new EditorConfigFactory())->parse( - <<parse( + <<assertEquals( - (new EditorConfigFactory())->parse( - <<parse(<<assertEquals( - (new EditorConfigFactory())->parse( - <<parse(<<assertEquals( - (new EditorConfigFactory())->parse( - <<parse(<<assertEquals( - (new EditorConfigFactory())->parse( - <<parse(<<