diff --git a/.github/workflows/release-on-milestone-closed-triggering-release-event.yml b/.github/workflows/release-on-milestone-closed-triggering-release-event.yaml similarity index 98% rename from .github/workflows/release-on-milestone-closed-triggering-release-event.yml rename to .github/workflows/release-on-milestone-closed-triggering-release-event.yaml index 0e5d54b..67fae35 100644 --- a/.github/workflows/release-on-milestone-closed-triggering-release-event.yml +++ b/.github/workflows/release-on-milestone-closed-triggering-release-event.yaml @@ -18,7 +18,7 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2" + uses: actions/checkout@v5 - name: "Release" uses: "laminas/automatic-releases@v1" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..2e8dba1 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,44 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +name: "Check Coding Standard" + +on: + pull_request: + push: + branches: + - "[0-9]+.[0-9]+.x" + - "renovate/*" + +jobs: + static-analysis-coding-standard: + name: "Static Analysis by patchlevel/coding-standard" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + dependencies: + - "locked" + php-version: + - "8.2" + operating-system: + - "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v5" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "pcov" + php-version: "${{ matrix.php-version }}" + ini-values: memory_limit=-1 + extensions: pdo_sqlite + + - uses: "ramsey/composer-install@3.1.1" + with: + dependency-versions: ${{ matrix.dependencies }} + + - name: "Coding Standard" + run: "vendor/bin/phpcs tests/fixed" diff --git a/composer.json b/composer.json index 6386c7f..b155b0a 100644 --- a/composer.json +++ b/composer.json @@ -28,11 +28,14 @@ ], "require": { "php": "^7.4 || ^8.0", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", - "slevomat/coding-standard": "^7.0.10", - "squizlabs/php_codesniffer": "^3.6.0" + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2 || ^1.0.0", + "slevomat/coding-standard": "^8.12.1", + "squizlabs/php_codesniffer": "^3.7.2" }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index bd6a1d6..31810b7 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -14,5 +14,5 @@ src - + diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..328c07b --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "local>patchlevel/.github:renovate-config" + ] +} diff --git a/src/PatchlevelCodingStandard/ruleset.xml b/src/PatchlevelCodingStandard/ruleset.xml index 7896faf..eff770b 100644 --- a/src/PatchlevelCodingStandard/ruleset.xml +++ b/src/PatchlevelCodingStandard/ruleset.xml @@ -48,12 +48,6 @@ - - - - - - @@ -108,20 +102,34 @@ error + + + + + + + + + + + + + + @@ -129,8 +137,25 @@ + + + + + + + + + + + + + + + + + @@ -150,6 +175,8 @@ + + @@ -172,8 +199,16 @@ @ODM\, @PHPCR\, "/> - - + + @@ -211,8 +246,6 @@ - - @@ -256,6 +289,8 @@ + + @@ -264,6 +299,8 @@ + + @@ -272,6 +309,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -358,7 +419,12 @@ - + + + + + + @@ -396,7 +462,6 @@ - @@ -407,8 +472,18 @@ + + + + + + + + + + @@ -426,6 +501,8 @@ + + @@ -448,6 +525,11 @@ + + + + + @@ -511,9 +593,6 @@ - - Variable "%s" not allowed in double quoted string; use sprintf() or concatenation instead - @@ -553,4 +632,4 @@ 5 - + \ No newline at end of file diff --git a/tests/fixed/Suit.php b/tests/fixed/Suit.php new file mode 100644 index 0000000..d266411 --- /dev/null +++ b/tests/fixed/Suit.php @@ -0,0 +1,13 @@ +