From 28cb8c2dc4ea37177ed02630809776c2e7014e8d Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Sat, 18 Jul 2026 21:51:18 +0300 Subject: [PATCH 1/3] Cleanup GitHub workflows --- .github/workflows/bc.yml | 33 +++++++----------- .github/workflows/build.yml | 34 ++++++++----------- .../workflows/composer-require-checker.yml | 33 +++++++----------- .github/workflows/mutation.yml | 31 ++++++++--------- .github/workflows/rector-cs.yml | 2 ++ .github/workflows/static.yml | 33 +++++++----------- .github/workflows/zizmor.yml | 20 +++++------ 7 files changed, 77 insertions(+), 109 deletions(-) diff --git a/.github/workflows/bc.yml b/.github/workflows/bc.yml index b269391..e429e08 100644 --- a/.github/workflows/bc.yml +++ b/.github/workflows/bc.yml @@ -1,31 +1,22 @@ +name: backwards compatibility + on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - - 'psalm.xml' + paths: &paths + - 'src/**' + - 'composer.json' + - '.github/workflows/bc.yml' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - - 'psalm.xml' - -name: backwards compatibility + paths: *paths permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: roave_bc_check: uses: yiisoft/actions/.github/workflows/bc.yml@master @@ -33,4 +24,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.1'] + ['8.5'] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 699f7c5..d2490fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,35 +1,29 @@ +name: build + on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' - + paths: &paths + - 'src/**' + - 'tests/**' + - 'phpunit.xml.dist' + - 'composer.json' + - '.github/workflows/build.yml' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' - -name: build + paths: *paths permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: phpunit: uses: yiisoft/actions/.github/workflows/phpunit.yml@master secrets: - codecovToken: ${{ secrets.CODECOV_TOKEN }} + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: os: >- ['ubuntu-latest', 'windows-latest'] diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index 1685ae9..6a7360e 100644 --- a/.github/workflows/composer-require-checker.yml +++ b/.github/workflows/composer-require-checker.yml @@ -1,32 +1,23 @@ +name: Composer require checker + on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - - 'psalm.xml' - + paths: &paths + - 'src/**' + - 'tests/**' + - 'composer.json' + - '.github/workflows/composer-require-checker.yml' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - - 'psalm.xml' - -name: Composer require checker + paths: *paths permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: composer-require-checker: uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 7481fc4..3c39df6 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -1,28 +1,25 @@ +name: mutation test + on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'psalm.xml' - + paths: &paths + - 'src/**' + - 'tests/**' + - 'phpunit.xml.dist' + - 'infection.json.dist' + - 'composer.json' + - '.github/workflows/mutation.yml' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'psalm.xml' - -name: mutation test + paths: *paths permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: mutation: uses: yiisoft/actions/.github/workflows/roave-infection.yml@master diff --git a/.github/workflows/rector-cs.yml b/.github/workflows/rector-cs.yml index 6b98c18..c44347f 100644 --- a/.github/workflows/rector-cs.yml +++ b/.github/workflows/rector-cs.yml @@ -19,6 +19,8 @@ concurrency: jobs: rector: + permissions: + contents: write # Required to push style fixes back to the branch uses: yiisoft/actions/.github/workflows/rector-cs.yml@master with: php: '8.0' diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 4099d39..20477f8 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -1,30 +1,23 @@ +name: static analysis + on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - + paths: &paths + - 'src/**' + - 'psalm.xml' + - 'composer.json' + - '.github/workflows/static.yml' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - -name: static analysis + paths: *paths permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: psalm: uses: yiisoft/actions/.github/workflows/psalm.yml@master @@ -32,4 +25,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.0', '8.1', '8.2', '8.3', '8.4'] + ['8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml index 430255d..6ff2a77 100644 --- a/.github/workflows/zizmor.yml +++ b/.github/workflows/zizmor.yml @@ -1,21 +1,21 @@ name: GitHub Actions Security Analysis with zizmor 🌈 on: - push: - branches: - - master - - main - paths: - - '.github/**.yml' - - '.github/**.yaml' pull_request: - paths: + paths: &paths - '.github/**.yml' - '.github/**.yaml' + push: + branches: ['master'] + paths: *paths permissions: - actions: read # Required by zizmor when reading workflow metadata through the API. - contents: read # Required to read workflow files. + actions: read # Required by zizmor when reading workflow metadata through the API + contents: read # Required to read workflow files + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: zizmor: From 6cd5d8373db4465652ce9efb30f0210a046fff79 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Sat, 18 Jul 2026 21:55:10 +0300 Subject: [PATCH 2/3] cs --- .php-cs-fixer.dist.php | 21 ++++----------------- composer.json | 6 ++++-- rector.php | 4 ++++ 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index e9cea90..2477e66 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -2,33 +2,20 @@ declare(strict_types=1); -use PhpCsFixer\Config; use PhpCsFixer\Finder; use PhpCsFixer\Runner\Parallel\ParallelConfigFactory; +use Yiisoft\CodeStyle\ConfigBuilder; $finder = (new Finder())->in([ __DIR__ . '/src', __DIR__ . '/tests', ]); -return (new Config()) +return ConfigBuilder::build() ->setRiskyAllowed(true) ->setParallelConfig(ParallelConfigFactory::detect()) ->setRules([ - '@PER-CS3.0' => true, - 'no_unused_imports' => true, - 'ordered_class_elements' => true, - 'class_attributes_separation' => ['elements' => ['method' => 'one']], - 'declare_strict_types' => true, - 'native_function_invocation' => true, - 'native_constant_invocation' => true, - 'fully_qualified_strict_types' => [ - 'import_symbols' => true - ], - 'global_namespace_import' => [ - 'import_classes' => true, - 'import_constants' => true, - 'import_functions' => true, - ], + '@Yiisoft/Core' => true, + '@Yiisoft/Core:risky' => true, ]) ->setFinder($finder); diff --git a/composer.json b/composer.json index afbeb62..07ba025 100644 --- a/composer.json +++ b/composer.json @@ -32,13 +32,14 @@ "php": "8.0 - 8.5" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.66", + "friendsofphp/php-cs-fixer": "^3.95", "maglnet/composer-require-checker": "^4.4", "phpunit/phpunit": "^9.6.22", "rector/rector": "^2.0.8", "roave/infection-static-analysis-plugin": "^1.25", "spatie/phpunit-watcher": "^1.23.6", - "vimeo/psalm": "^4.30 || ^5.26.1 || ^6.5" + "vimeo/psalm": "^4.30 || ^5.26.1 || ^6.5", + "yiisoft/code-style": "^1.0" }, "autoload": { "psr-4": { @@ -59,6 +60,7 @@ }, "scripts": { "cs-fix": "php-cs-fixer fix", + "rector": "rector", "test": "phpunit --testdox --no-interaction", "test-watch": "phpunit-watcher watch" } diff --git a/rector.php b/rector.php index 32c8e91..c2226bf 100644 --- a/rector.php +++ b/rector.php @@ -4,6 +4,7 @@ use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; +use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector; return RectorConfig::configure() ->withPaths([ @@ -13,4 +14,7 @@ ->withPhpSets(php80: true) ->withRules([ InlineConstructorDefaultToPropertyRector::class, + ]) + ->withSkip([ + ClosureToArrowFunctionRector::class, ]); From 483d85ab3d1e264abb6ee126988356f57dcc3c76 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Sat, 18 Jul 2026 21:59:03 +0300 Subject: [PATCH 3/3] fix --- composer.json | 12 ++++++++++-- tools/.gitignore | 2 ++ tools/composer-require-checker/composer.json | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 tools/.gitignore create mode 100644 tools/composer-require-checker/composer.json diff --git a/composer.json b/composer.json index 07ba025..d3afbc5 100644 --- a/composer.json +++ b/composer.json @@ -32,8 +32,8 @@ "php": "8.0 - 8.5" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.9.1", "friendsofphp/php-cs-fixer": "^3.95", - "maglnet/composer-require-checker": "^4.4", "phpunit/phpunit": "^9.6.22", "rector/rector": "^2.0.8", "roave/infection-static-analysis-plugin": "^1.25", @@ -55,7 +55,15 @@ "sort-packages": true, "allow-plugins": { "infection/extension-installer": true, - "composer/package-versions-deprecated": true + "composer/package-versions-deprecated": true, + "bamarni/composer-bin-plugin": true + } + }, + "extra": { + "bamarni-bin": { + "bin-links": true, + "target-directory": "tools", + "forward-command": true } }, "scripts": { diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 0000000..cf452dc --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1,2 @@ +/*/vendor +/*/composer.lock diff --git a/tools/composer-require-checker/composer.json b/tools/composer-require-checker/composer.json new file mode 100644 index 0000000..498425c --- /dev/null +++ b/tools/composer-require-checker/composer.json @@ -0,0 +1,5 @@ +{ + "require-dev": { + "maglnet/composer-require-checker": "^4.4" + } +}