Skip to content

Commit 4b517b4

Browse files
committed
Refactor PHP linting configuration to streamline commands and improve consistency
1 parent 4b0f4cf commit 4b517b4

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

.github/workflows/reusable-php-lint.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ on:
1919
description: 'Run PHPMD checks'
2020
type: boolean
2121
default: true
22-
phpmd-targets:
23-
description: 'PHPMD targets'
24-
type: string
25-
default: 'wp-rest-blocks.php,src'
2622
run-composer-normalize:
2723
description: 'Run composer normalize check'
2824
type: boolean
@@ -52,13 +48,13 @@ jobs:
5248

5349
- name: Detect coding standard violations (PHPCS)
5450
if: ${{ inputs.run-phpcs }}
55-
run: vendor/bin/phpcs -q --report=checkstyle --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 | cs2pr --graceful-warnings
51+
run: composer lint -- --report=checkstyle | cs2pr --graceful-warnings
5652

5753
- name: Detect PHPStan issues
5854
if: ${{ inputs.run-phpstan }}
59-
run: vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr --graceful-warnings
55+
run: composer phpstan -- --error-format=checkstyle | cs2pr --graceful-warnings
6056

6157
- name: Detect PHP Mess Detector issues
6258
if: ${{ inputs.run-phpmd }}
63-
run: vendor/bin/phpmd ${{ inputs.phpmd-targets }} text phpmd.xml.dist
59+
run: composer phpmd
6460

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
"sort-packages": true
4949
},
5050
"scripts": {
51-
"phpcbf": "phpcbf",
52-
"phpcs": "phpcs",
51+
"lint": "phpcs .",
52+
"lint:fix": "phpcbf .",
5353
"phpmd": "phpmd wp-rest-blocks.php,src text phpmd.xml.dist --color",
5454
"phpstan": "phpstan analyse --memory-limit=2048M",
5555
"test": "phpunit"

0 commit comments

Comments
 (0)