amateescu / mago-drupal
Mago extension for Drupal. Linter rules and analyzer plugins that know the Drupal conventions.
Requires
- php: ^8.1
- composer-runtime-api: ^2.0
- carthage-software/mago: ^1.58.0
- revolt/event-loop: ^1.0
- symfony/yaml: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- phpunit/phpunit: ^10.5 || ^11.5 || ^12.0 || ^13.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Important
This project has moved to drupal.org as Mago for Drupal.
The Composer package is now drupal/mago, and its namespace is DrupalMago\.
Code, issues and releases are there; this repository is archived and doesn't get updates.
The README below describes the last version released here, 0.9.5.
mago-drupal
A Mago extension that adds
Drupal's coding standards to the Mago
linter, and teaches the Mago analyzer what Drupal's services, entities, config and plugins hand
back. With mago format and Mago's own rules, it replaces phpcs and Coder for the PHP files of a
Drupal project. The parity target is
Coder 9.
Quick start
PHP 8.1 or later and Mago 1.58 or later are required.
composer require --dev carthage-software/mago amateescu/mago-drupal
Then create mago.toml next to vendor/:
extends = "vendor/amateescu/mago-drupal/drupal.mago.toml" # The lowest PHP version that the project supports. php-version = "8.3"
For a Drupal core checkout, extend drupal-core.mago.toml instead. Then run the linter and the
analyzer:
vendor/bin/mago lint vendor/bin/mago analyze
Documentation
- Setup: the install, what the config files set, the worker's arguments and the fix levels.
- Linter rules: every rule, with what it reports, what its fix does, the section of Drupal's coding standards or the source checked by the rule, and the Coder checks ported by the rule.
- Analyzer: what the
drupal,phpunitandphpstan-ignoresanalyzer plugins type and report, and their limits. - Coming from Coder: every sniff of Coder's
DrupalandDrupalPracticestandards, and what takes its place. - Coming from PHPStan: every rule and extension of phpstan-drupal, the
PHPStan identifiers reported by Mago too, how a
phpstan.neonmoves to Mago, and the issue codes that go with each PHPStan level. - Development: the checks, the test corpus and building the docs.
License
MIT.