ddev-drupal-core-dev
ddev-drupal-core-dev copied to clipboard
PHPStan is not a linter
I like these handy shortcut commands introduced by this DDEV extension but I think calling PHPStan a linter is semantically incorrect, it is a static code analyzer. PHPCS is somewhere in between, it depends how it is configured.
For reference, these are my usual Composer scripts on Drupal projects:
"scripts": {
"lint:check": [
"@lint:composer:check # todo check composer.json-s in modules",
"@lint:php:check web/modules/custom"
],
"lint:composer:check": [
"@composer validate",
"@composer normalize --dry-run"
],
"lint:composer:fix": [
"@composer normalize # todo check composer.json-s in modules"
],
"lint:fix": [
"@lint:composer:fix # todo check composer.json-s in modules",
"@lint:php:fix web/modules/custom"
],
"lint:php:check": "phpcs --standard=phpcs.xml.dist --parallel=\"$( (nproc || sysctl -n hw.logicalcpu || echo 4) 2>/dev/null)\"",
"lint:php:fix": "phpcbf --standard=phpcs.xml.dist --parallel=\"$( (nproc || sysctl -n hw.logicalcpu || echo 4) 2>/dev/null)\"",
"static:check": [
"@static:phpstan"
],
"static:phpstan": [
"Composer\\Config::disableProcessTimeout",
"vendor/bin/phpstan"
],
"test": [
"@test:phpunit web/modules/custom --debug"
],
"test:phpunit": [
"Composer\\Config::disableProcessTimeout",
"vendor/bin/phpunit -c web/core"
]
}