You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider Mago as an all-in-one replacement for PHPCS, PHPStan and parallel-lint #433
Describe your use case and the problem you are facing
wp-cli-tests runs four separate PHP tools: php-parallel-lint, PHPCS (WPCS and PHPCompatibility), PHPStan with several extensions, and a separate formatter where a project uses one. Each tool has its own config, version constraints and stubs. They are all Composer dev dependencies, so their constraints have to resolve together across every command repo.
Mago is a single Rust binary that formats, lints and runs static analysis. We use it on a WordPress theme (mago format --check, mago lint, mago analyze), and one config file replaces three tools there. It's also much faster than running PHPCS and PHPStan one after the other.
Is there any plan, or interest, in evaluating Mago for WP-CLI?
Describe the solution you'd like
Not a drop-in switch. A first step could be an optional composer mago script in wp-cli-tests, running next to the current checks, to compare their results on a few command repos. Mago is stable (1.61.0) and installs as a Composer dev dependency (carthage-software/mago), so it fits the current setup.
Drawbacks I can see:
Mago has no equivalent of WPCS's WordPress-specific sniffs (escaping, nonces, i18n) or of PHPCompatibility, so PHPCS would probably still be needed for those.
PHPStan baselines and extensions (phpstan-wordpress, phpstan-strict-rules) don't carry over, so switching analyzers means rebuilding baselines in each repo.
The carthage-software/mago Composer package requires PHP 8.1+, but wp-cli-tests supports PHP 7.2.24+. Mago would need to run only in a PHP 8.1+ lint job, or be installed outside Composer, rather than being a normal require-dev entry. Mago can still analyze code that targets older PHP versions.
At the moment I don't really see a need to switch. The current toolchain works well for us and is fast enough. We also benefit from the ongoing PHPStan improvements in WordPress core.
Activity
swissspidy commentedon Nov 25, 2026
Thanks for bringing this up.
At the moment I don't really see a need to switch. The current toolchain works well for us and is fast enough. We also benefit from the ongoing PHPStan improvements in WordPress core.