← ClaudeAtlas

phpcs-standardslisted

Set up or verify PHP_CodeSniffer on a Dockerized, Makefile-driven PHP project (Drupal or PSR-12), then bring the custom code to zero violations. Use when the user mentions phpcs, phpcbf, coding standards, "normes de codage", drupal/coder, DrupalPractice, PSR-12, a sniff, a ruleset / phpcs.xml, "FAILED TO FIX", or wants the custom modules cleaned up before a review or a major upgrade. Asks which standard (Drupal vs PSR-12) and which severity (errors only vs errors + warnings), fixes module by module, and records every behaviour-changing fix as a manual UAT step in the merge request. IMPORTANT: all commands MUST go through Makefile targets; phpcbf can discard every fix for a file silently, so a run is only clean when phpcs prints "No violations were found".
JMAILLY/claude-migration-skills · ★ 0 · Code & Development · score 70
Install: claude install-skill JMAILLY/claude-migration-skills
# PHP_CodeSniffer: set up, verify, and clear the custom code Two jobs in one skill: 1. **Set up / verify** the toolchain — dependencies, `phpcs.xml`, Makefile targets — so `make phpcs` and `make phpcbf` are trustworthy. 2. **Clear the violations** module by module, without breaking the site. > ⚠️ **This is not a cosmetic-only task.** On a real Drupal codebase, the > `DrupalPractice` sniffs force dependency injection, method renames and > `t()` routing — changes that *can* break behaviour. Those are applied, but > **isolated in their own commit and paired with a mandatory manual UAT entry** > in the MR. See `references/risky-sniffs-uat.md`. ## Golden rule: everything goes through the Makefile Never run `phpcs`, `phpcbf`, `composer` or `drush` on the host. | Need | Make target | |---|---| | Check standards | `make phpcs c='<args>'` | | Autofix | `make phpcbf c='<args>'` | | Static analysis | `make phpstan` | | Add a dev dependency | `make composer-require <pkg> --dev` | | Generic Drush command | `make drush c='<cmd>'` | | Clear caches | `make cr` | | Shell in the PHP container | `make shell` | Many Makefiles end with a catch-all (`%:` / `@:`) that **swallows positional arguments**. So always pass phpcs arguments through a variable — `make phpcs c='web/modules/custom/foo'` — never `make phpcs web/modules/custom/foo`. ## Step 0 — Ask before running anything Ask these together, in one message, and remember the answers for the session: 1. **Which standard?** - `Drup