diff --git a/.github/workflows/rector.yaml b/.github/workflows/rector.yaml new file mode 100644 index 000000000..2a80321cd --- /dev/null +++ b/.github/workflows/rector.yaml @@ -0,0 +1,35 @@ +name: "Coding Standards" + +on: + pull_request: + push: + branches: + - "master" + +jobs: + coding-standards: + name: "Coding Standards" + runs-on: "ubuntu-20.04" + + strategy: + matrix: + php-version: + - "7.4" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "${{ matrix.php-version }}" + tools: "cs2pr" + extensions: pdo_sqlite + + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v1" + + - name: "Run PHP_CodeSniffer" + run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr" diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml index cbda4cc36..c1d5d635c 100644 --- a/.github/workflows/static-analysis.yaml +++ b/.github/workflows/static-analysis.yaml @@ -38,3 +38,7 @@ jobs: - name: "Run a static analysis with phpstan/phpstan" run: "vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr" + + - name: "Run a static analysis with rector/rector" + run: "vendor/bin/rector --dry-run" + if: ${{ matrix.php-version == 8.2 }} diff --git a/composer.json b/composer.json index 857e77617..4d754518e 100644 --- a/composer.json +++ b/composer.json @@ -41,6 +41,7 @@ "phpstan/phpstan": "^1.0.2", "phpunit/phpunit": "^9.0 || ^10.0", "psr/container": "^1.0 || ^2.0", + "rector/rector": "^0.18.13", "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", "symfony/expression-language": "^5.4 || ^6.0 || ^7.0", "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", diff --git a/rector.php b/rector.php new file mode 100644 index 000000000..6cc8584b1 --- /dev/null +++ b/rector.php @@ -0,0 +1,13 @@ +paths([ + __DIR__ . '/src', + ]); + $rectorConfig->sets([LevelSetList::UP_TO_PHP_74]); +};