johnatas-x / angry-bearded
Pre-configured GrumPHP code quality toolkit for Drupal 12 projects.
Package info
github.com/johnatas-x/angry-bearded
Language:Shell
pkg:composer/johnatas-x/angry-bearded
Requires
- php: >=8.5
- carthage-software/mago: 1.64.0
- drupal/coder: 9.0.1
- drupal/mago: 1.0.0-beta1
- ekino/phpstan-banned-code: 3.2.0
- ergebnis/composer-normalize: 2.59.0
- friendsoftwig/twigcs: 6.7.0
- johnatas-x/grumphp-phpa: 2.27.1
- johnatas-x/phpcpd: 6.0.5
- mglaman/phpstan-drupal: 2.5.0
- php-parallel-lint/php-parallel-lint: 1.4.0
- phpcompatibility/php-compatibility: 10.0.0-alpha3
- phpmd/phpmd: 3.0.0
- phpro/grumphp: 2.27.2
- phpstan/extension-installer: 1.4.4
- phpstan/phpstan: 2.4.0
- phpstan/phpstan-deprecation-rules: 2.0.7
- phpstan/phpstan-strict-rules: 2.1.3
- povils/phpmnd: 3.6.2
- shipmonk/dead-code-detector: 1.5.0
- slevomat/coding-standard: 8.32.0
- squizlabs/php_codesniffer: 4.0.4
- vincentlanglet/twig-cs-fixer: 4.2.0
Requires (Dev)
- roave/security-advisories: dev-latest
Suggests
- drupal/core-composer-scaffold: Scaffold relevant files in project root. Add johnatas-x/angry-bearded to extra.drupal-scaffold.allowed-packages.
- maglnet/composer-require-checker: Checks that your custom code only uses declared dependencies (composer_require_checker task).
Provides
None
Conflicts
None
Replaces
None
- dev-main / 4.x-dev
- 4.0.0-rc1
- 3.x-dev
- 3.15.0
- 3.14.2
- 3.14.1
- 3.14.0
- 3.13.4
- 3.13.3
- 3.13.2
- 3.13.1
- 3.13.0
- 3.12.0
- 3.11.0
- 3.10.7
- 3.10.6
- 3.10.5
- 3.10.4
- 3.10.3
- 3.10.2
- 3.10.1
- 3.10.0
- 3.9.1
- 3.9.0
- 3.8.4
- 3.8.3
- 3.8.2
- 3.8.1
- 3.8.0
- 3.8.0-rc5
- 3.8.0-rc4
- 3.8.0-rc3
- 3.8.0-rc2
- 3.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12-05 22:43:50 UTC
README
A pre-configured GrumPHP for Drupal projects: one composer require brings
PHPStan (level 10), PHP_CodeSniffer (Drupal + Slevomat), PHPMD, Mago, Twig linters and more, wired to your Git hooks.
The base configuration is intentionally strict. Your project extends it and only keeps its own adjustments.
π¦ Which version?
| Version | Drupal | PHP | Branch | Tested in CI with |
|---|---|---|---|---|
^4 |
12 | 8.5+ [ΒΉ] | main |
Drupal 12.0 on PHP 8.5 and 8.6 |
^3 |
11.3+ | 8.4+ [ΒΉ] | 3.x |
Drupal 11.3 / PHP 8.4, 11.4 / PHP 8.5 and 8.6 |
^2 |
10.5+, 11 | 8.3+ | 2.x |
Drupal 10.6 and 11.3 / PHP 8.3, 11.4 / PHP 8.4 |
^1 |
10.5+ | 8.1, 8.2 | 1.x |
Drupal 10.6 on PHP 8.1 and 8.2 |
All four branches are maintained: dependencies are updated automatically, and each combination above is installed and checked against a real Drupal project on every change (see Maintenance).
[ΒΉ]: PHP 8.6 is experimental, see Known issues.
π§ Included tools
| GrumPHP task | Tool | Default |
|---|---|---|
phpstan |
PHPStan level 10, phpstan-drupal, strict, deprecation and banned code rules, dead code detector | β |
phpcs |
PHP_CodeSniffer, Drupal Coder, Slevomat, PHPCompatibility | β |
phpmd3 (phpmd in 1.x) |
PHPMD | β |
mago_format, mago_lint |
Mago, with Mago for Drupal in 4.x. Lint is non-blocking. Not in 1.x. | β |
mago_analyze, mago_guard |
Mago | β |
phpcpd |
PHP Copy/Paste Detector | β |
phpmnd |
PHP Magic Number Detector | β |
phpa |
PHP Assumptions (via grumphp-phpa) | β |
phplint |
PHP Parallel Lint | β |
twigcs, twigcsfixer |
Twigcs, Twig CS Fixer | β |
composer, composer_normalize |
composer validate, composer-normalize |
β |
securitychecker_composeraudit |
composer audit |
β |
phpversion |
Fails when the running PHP version is older than the project's or end of life (warns only in 1.x) | β |
jsonlint, yamllint, xmllint |
GrumPHP linters | β |
git_branch_name, git_commit_message |
Branch and commit message conventions. The JIRA-123 pattern is an example: adapt it |
β |
composer_require_checker |
ComposerRequireChecker: needs an autoload section in your composer.json. Suggested (not installed) in 3.x and 4.x |
β |
phpdd |
PhpDeprecationDetector: deprecated (PHP β€ 8.1 only, PHPCompatibility covers it), removed in 4.0 | β |
git_blacklist, phpunit |
GrumPHP | β |
π Installation
Requirements
- A Composer-based Drupal project:
web/docroot, custom code inweb/modules/customandweb/themes/custom. - PHP extension
bcmath(included in DDEV and Docksal images).
1. Require the package
Some tools have no stable release yet: your project must accept these pre-releases explicitly
(not needed if your minimum-stability is already dev). -W lets Composer adjust shared dependencies.
# Drupal 12 composer require --dev -W johnatas-x/angry-bearded:^4 "phpcompatibility/php-compatibility:*@alpha" "drupal/mago:*@beta" # Drupal 11.3+ composer require --dev -W johnatas-x/angry-bearded:^3 phpcompatibility/php-compatibility:dev-develop # Drupal 10.5+ / 11 on PHP 8.3+ composer require --dev -W johnatas-x/angry-bearded:^2 "phpcompatibility/php-compatibility:*@alpha" # Drupal 10.5+ on PHP 8.1 / 8.2 composer require --dev -W johnatas-x/angry-bearded:^1 "phpcompatibility/php-compatibility:*@alpha"
If GrumPHP asks to create a grumphp.yml file, answer no.
2. Add the project configuration files
The package ships two kinds of files:
config/: the base configuration of each tool. It is updated with the package: don't edit it.*.distat the package root: small project files extending the base configuration, with commented examples.
Copy the project files to your project root without the .dist extension, then commit them:
for file in vendor/johnatas-x/angry-bearded/*.dist vendor/johnatas-x/angry-bearded/.*.dist; do cp "$file" "$(basename "$file" .dist)" done
| Project file | Extends config/β¦ |
Tool |
|---|---|---|
grumphp.yml |
grumphp.yml |
GrumPHP tasks |
phpstan.neon |
phpstan.neon |
PHPStan (the base includes phpstan-drupal.neon) |
phpstan-drupal-deprecated.neon |
phpstan-drupal-deprecated.neon |
Soft alternative: Drupal and Symfony deprecations only |
phpcs.xml |
phpcs.xml |
PHP_CodeSniffer |
phpmd.xml |
phpmd.xml |
PHPMD |
mago.toml |
mago.toml |
Mago (2.x and up; 4.x also extends Mago for Drupal) |
.twig-cs-fixer.php |
twig-cs-fixer.php |
Twig CS Fixer |
.editorconfig |
β | Editors |
qodana.yaml |
β | Qodana template |
Delete the files you don't need (e.g. qodana.yaml, phpstan-drupal-deprecated.neon).
Tip
Want full control instead? Copy the files of vendor/johnatas-x/angry-bearded/config/ (renaming twig-cs-fixer.php
to .twig-cs-fixer.php): they work as standalone configurations, but you won't get the package updates anymore.
Optional: scaffolding
With drupal/core-composer-scaffold (present in projects created from
drupal/recommended-project), the package can copy the .dist project files to your project root on each Composer
operation, as a reference to compare your files with. Your own files are never touched.
{
"extra": {
"drupal-scaffold": {
"allowed-packages": ["johnatas-x/angry-bearded"]
}
}
}
Add /*.dist and /.*.dist to your .gitignore.
To skip some files, see "Excluding scaffold files".
π§ Usage
Git hooks are installed by GrumPHP on composer install. If they don't trigger, run vendor/bin/grumphp git:init.
vendor/bin/grumphp run # Check the whole project. vendor/bin/grumphp run --tasks=phpstan,phpcs # Run some tasks only. vendor/bin/mago lint # Details of mago_lint issues (GrumPHP only shows a summary).
Each tool also works on its own (vendor/bin/phpstan analyse, vendor/bin/phpcs, β¦) with the same configuration.
See GrumPHP's documentation for more commands.
π Customising
Add your changes to your project files: the .dist templates contain commented examples.
How each tool combines your file with the base configuration:
| File | Your changes⦠|
|---|---|
grumphp.yml |
Override the base settings. A task declared here replaces the base task entirely: copy its whole block from config/grumphp.yml, then edit it. |
phpstan.neon |
Override parameters; lists (paths, ignoreErrorsβ¦) are merged with the base ones. |
phpcs.xml |
Add rules, exclusions, properties, files and paths on top of the base ruleset. |
phpmd.xml |
Add rules; to tune a base rule, exclude it from the base reference and add it back with your properties. |
mago.toml |
Tables are merged into the base ones, arrays are appended. |
.twig-cs-fixer.php |
Change the $config object returned by the base file. |
Local environment
Hooks run GrumPHP inside your container through grumphp.git_hook_variables.EXEC_GRUMPHP_COMMAND:
| Environment | Value |
|---|---|
| DDEV (default) | ddev exec php |
| Docksal | fin exec |
| PHP on your machine | exec |
Run vendor/bin/grumphp git:init after changing it. If your composer.json sets config.bin-dir, set
parameters.bin_dir accordingly.
Commit message and branch name
git_commit_message and git_branch_name require a JIRA-123 issue key and forbid committing on master / develop.
Set your own conventions, or disable them:
# grumphp.yml grumphp: tasks: git_commit_message: enforce_capitalized_subject: true enforce_no_subject_trailing_period: true max_subject_width: 60 matchers: Must contain issue number: /PROJ-\d+/ git_branch_name: whitelist: - '/^(feature|bugfix|hotfix)\/PROJ-\d+/' blacklist: - main
Run some tasks only locally, or only in CI
Toggle tasks with environment variables, defaulting to false:
# grumphp.yml parameters: env(IS_DDEV_PROJECT): 'false' env(IS_CI): 'false' grumphp: fixer: enabled: '%env(bool:IS_DDEV_PROJECT)%' tasks: phpunit: metadata: enabled: '%env(bool:IS_CI)%'
Paths
Custom code paths are web/modules/custom and web/themes/custom; tests directories are excluded.
For custom install profiles, add web/profiles/custom to phpstan.neon (parameters.paths), phpcs.xml (<file>),
mago.toml (source.paths) and .twig-cs-fixer.php.
Deprecations only (soft mode)
For legacy projects, point the phpstan task to the soft configuration, which only reports Drupal and Symfony deprecations:
# grumphp.yml grumphp: tasks: phpstan: configuration: phpstan-drupal-deprecated.neon memory_limit: "-1" use_grumphp_paths: false
Mago
In 4.x, mago.toml extends the Mago for Drupal preset, which brings Drupal coding
standards rules (aiming for parity with Coder) and analyzer plugins aware of Drupal services, entities and plugins.
In 2.x and 3.x, the base configuration follows the same settings without the extension. To use it:
composer require --dev "drupal/mago:*@beta", then set extends = ["vendor/drupal/mago/drupal.mago.toml", "vendor/johnatas-x/angry-bearded/config/mago.toml"]
in your mago.toml.
Commit banners
The Drupal logo celebrates successful runs, the grumpy one scolds failures (resources/happy.txt is also available).
Use your own file, or disable them:
# grumphp.yml grumphp: ascii: succeeded: .ddev/files/my-banner.txt failed: ~
ComposerRequireChecker
Disabled by default: it only works if your root composer.json declares an autoload section covering your custom code.
In 3.x and 4.x, install it first: composer require --dev maglnet/composer-require-checker.
π§ͺ PHPUnit
PHPUnit and drupal/core-dev are not bundled: their versions depend on your Drupal core.
- Require
drupal/core-dev(same version as your Drupal core) as a dev dependency. 3.x only:drupal/core-dev11 requires Coder 8 while 3.x ships Coder 9 (for PHP_CodeSniffer 4). Alias it first (Coder 9 is backward compatible):"require-dev": { "drupal/coder": "9.0.1 as 8.3.31" }
- Add your
phpunit.xmlat the project root. - Enable (and configure) the
phpunittask in yourgrumphp.yml.
β¬οΈ Upgrading
To 1.8 / 2.9 / 3.15 / 4.0
Your files are never overwritten, so nothing breaks, but you can now replace your full copies with the small project
files: copy the new .dist templates (see Installation), then re-add only
your own adjustments (compare your old files with vendor/johnatas-x/angry-bearded/config/). From then on, the base
configuration improves with each update.
Notable base configuration changes:
phpcs:standard: [ ](PHP_CodeSniffer findsphpcs.xmlitself).phpa:path: web/modules/custom(it crashed on missing directories).twigcsfixer:paths: [ ], paths now live in.twig-cs-fixer.php(missing directories are skipped).composer_require_checker,phpdd: disabled. Before upgrading to 4.0, remove thephpddtask and theGrumphpPhpdd\ExtensionLoaderextension from yourgrumphp.yml.composer_require_checker(3.x, 4.x): no longer installed, see ComposerRequireChecker.process_timeout: 360,web/profiles/customremoved from paths, tests excluded from PHPStan.phpcs.xml: lowercase{@inheritdoc}enforced, untyped parameters allowed in OOP hooks (*/Hook/*Hooks.php).- Mago: the configuration is actually read now (
mago.toml.distnever was), aligned with the Mago for Drupal preset.
From 1.x β€ 1.7 or 2.x β€ 2.1 (PHPStan 1 era)
drupal-checkis replaced by PHPStan + phpstan-drupal: removeGrumphpDrupalCheck\ExtensionLoaderand thedrupal_checktask fromgrumphp.yml.- PHPStan 2: remove
checkMissingIterableValueTypeandcheckGenericClassInNonGenericObjectTypefromphpstan.neon(see the PHPStan 2 upgrade guide). phpcs.xml:SlevomatCodingStandard.Files.FunctionLengthis nowSlevomatCodingStandard.Functions.FunctionLength.- Expect new findings from up-to-date Coder and Slevomat rules; most are fixed by
vendor/bin/phpcbf.
β οΈ Known issues
- PHP 8.6 + PHPMD: PHPMD's parallel workers crash on a deprecation raised by PDepend
(pdepend/pdepend#996, phpmd/phpmd#1370).
Until fixed upstream, disable the
phpmd3task or hide deprecations (error_reporting = E_ALL & ~E_DEPRECATED). - Drupal 12 + Drush: no stable Drush release supports Drupal 12 yet.
- PHP 8.1 is end of life: 1.x keeps working, but
phpversionwarns androave/security-advisoriesrefuses PHP 8.1.
π Maintenance
- One branch per major:
main(4.x),3.x,2.x,1.x. Fix the oldest affected branch first, then port upward. - Dependencies are pinned and updated by Renovate on all branches, automerged when CI passes. Per-branch caps keep each branch compatible with its Drupal / PHP versions.
- CI (
ci.yml) installs the package in a real Drupal project for each supported combination, copies the project files as documented above, then checks that GrumPHP passes on clean code and catches known violations. - Run the same test locally with Docker (
tests/docker.sh <php> <drupal constraint>), e.g. onmain:EXTRA_REQS='phpcompatibility/php-compatibility:*@alpha drupal/mago:*@beta' tests/docker.sh 8.5 '^12@rc'
