diff --git a/.github/workflows/bc.yml b/.github/workflows/bc.yml index 0577a84..2557a8c 100644 --- a/.github/workflows/bc.yml +++ b/.github/workflows/bc.yml @@ -1,27 +1,14 @@ +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/**' + - '.github/workflows/bc.yml' + - 'composer.json' 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 @@ -30,7 +17,5 @@ jobs: roave_bc_check: uses: yiisoft/actions/.github/workflows/bc.yml@master with: - os: >- - ['ubuntu-latest'] php: >- - ['8.4'] + ['8.1'] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46a87c9..67d90b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,30 +1,24 @@ +name: build + on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'psalm.xml' - + paths: &paths + - 'src/**' + - 'tests/**' + - '.github/workflows/build.yml' + - 'composer.json' + - 'phpunit.xml.dist' 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 diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index 1a56fef..b15f534 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/**' + - 'config/**' + - '.github/workflows/composer-require-checker.yml' + - 'composer.json' 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 ce83871..3c05e1c 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -1,24 +1,17 @@ +name: mutation test + on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'psalm.xml' - + paths: &paths + - 'src/**' + - 'tests/**' + - '.github/workflows/mutation.yml' + - 'composer.json' + - 'infection.json.dist' + - 'phpunit.xml.dist' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'psalm.xml' - -name: mutation test + paths: *paths permissions: contents: read diff --git a/.github/workflows/rector-cs.yml b/.github/workflows/rector-cs.yml index 5707806..0361220 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 commit automated Rector and CS fixes uses: yiisoft/actions/.github/workflows/rector-cs.yml@master with: php: '7.4' diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 6687465..ff82dca 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -1,30 +1,24 @@ +name: static analysis + on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - + paths: &paths + - 'src/**' + - 'config/**' + - '.github/workflows/static.yml' + - 'psalm*.xml' + - 'composer.json' 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 diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml index 430255d..7534234 100644 --- a/.github/workflows/zizmor.yml +++ b/.github/workflows/zizmor.yml @@ -1,21 +1,17 @@ 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 jobs: zizmor: diff --git a/composer.json b/composer.json index 92a49fc..72b1ecf 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "friendsofphp/php-cs-fixer": "^3.93", "maglnet/composer-require-checker": "^3.8 || ^4.2", "phpunit/phpunit": "^9.6.22", - "rector/rector": "^2.0.8", + "rector/rector": "^2.5.5", "spatie/phpunit-watcher": "^1.23.6", "yiisoft/code-style": "^1.0" }, @@ -65,8 +65,9 @@ } }, "scripts": { + "cs-fix": "php-cs-fixer fix", + "rector": "rector", "test": "phpunit --testdox --no-interaction", - "test-watch": "phpunit-watcher watch", - "cs-fix": "php-cs-fixer fix" + "test-watch": "phpunit-watcher watch" } } diff --git a/rector.php b/rector.php index b4b9e11..d47a8b0 100644 --- a/rector.php +++ b/rector.php @@ -5,23 +5,17 @@ use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector; -use Rector\Set\ValueObject\LevelSetList; -return static function (RectorConfig $rectorConfig): void { - $rectorConfig->paths([ +return RectorConfig::configure() + ->withPaths([ __DIR__ . '/src', __DIR__ . '/tests', - ]); - - // register a single rule - $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); - - // define sets of rules - $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_74, - ]); - - $rectorConfig->skip([ + ]) + ->withPhp74Sets() + ->withRules([ + InlineConstructorDefaultToPropertyRector::class, + ]) + ->withSkip([ ClosureToArrowFunctionRector::class, - ]); -}; + ]) + ->withSkipPath('tests/TestEnvironments');