-
Notifications
You must be signed in to change notification settings - Fork 0
drupal analyze
Paulo Maia Carvalho edited this page May 20, 2026
·
1 revision
Run static analysis on your custom Drupal code using PHPStan and PHPCS (Drupal Coder).
/drupal-analyze
/drupal-analyze path=web/modules/custom/my_module
Checks code style against the Drupal and DrupalPractice standards:
- Indentation (2 spaces, no tabs)
- Doc comment format
- Naming conventions (hooks, classes, functions)
- PHP 8 compatibility patterns
- Drupal-specific patterns (hook implementations, render arrays)
Detects logic errors and type mismatches:
- Undefined variables and methods
- Incorrect return types
- Dead code
- Type incompatibilities
Default level: 5 (balanced between noise and thoroughness).
By default scans:
web/modules/custom/
web/themes/custom/
Pass path= to narrow the scope to a specific module or theme.
The tools must be installed in the project:
composer require --dev drupal/coder phpstan/phpstanThe skill checks for these and offers to install them if missing.
- drupal-fix — auto-fix the PHPCS issues that PHPCBF can correct
- drupal-module — scaffold a new module that starts clean