Skip to content

Commit 9dba927

Browse files
committed
ci(lint): Use multi file argument in lint
Since PHP 8.3 the linting command "php -l" can consume multiple files at once. This drastically speeds up the time necessary for the linting from ~3 minutes to few seconds. By also running the linting on multiple cores, the time can be dropped to < 1s Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent cf22cbe commit 9dba927

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@
6161
],
6262
"cs:fix": "php-cs-fixer fix",
6363
"cs:check": "php-cs-fixer fix --dry-run --diff",
64-
"lint": "find . -name \\*.php -not -path './lib/composer/*' -not -path './build/stubs/*' -print0 | xargs -0 -n1 php -l",
64+
"lint": [
65+
"@lint-8.2-or-earlier",
66+
"@lint-8.3-or-later"
67+
],
68+
"lint-8.2-or-earlier": "[ $(php -r \"echo PHP_VERSION_ID;\") -ge 80300 ] || find . -type f -name '*.php' -not -path './3rdparty/*' -not -path '*/composer/*' -not -path '*/stubs/*' -not -path '*/vendor-bin/*' -not -path '*/vendor/*' | xargs -n1 -P$(nproc) php -l",
69+
"lint-8.3-or-later": "[ $(php -r \"echo PHP_VERSION_ID;\") -lt 80300 ] || find . -type f -name '*.php' -not -path './3rdparty/*' -not -path '*/composer/*' -not -path '*/stubs/*' -not -path '*/vendor-bin/*' -not -path '*/vendor/*' | xargs -n200 -P$(nproc) php -l",
6570
"psalm": "psalm --no-cache --threads=$(nproc)",
6671
"psalm:ocp": "psalm --no-cache --threads=$(nproc) -c psalm-ocp.xml",
6772
"psalm:ncu": "psalm --no-cache --threads=$(nproc) -c psalm-ncu.xml",

0 commit comments

Comments
 (0)