php-auto-fixerlisted
Install: claude install-skill nette/agent-plugins
# PHP Auto-Fixer
A PostToolUse hook runs `ecs fix` after Claude Code `Edit`/`Write` or Codex `apply_patch` operations. A patch may edit multiple PHP files; the hook processes each one. In Codex, hooks must first be reviewed and trusted via `/hooks`. Edits made through shell commands are not covered, so run the project's fixer explicitly after those edits.
## Editing Order for `use` Statements
The fixer removes any `use` statement not referenced in the file. A `use` added in one edit and the code that needs it in the next therefore loses the import in between.
Always add `use` statements in the same Edit as the code that references them, or add the code first and the `use` second. Never add `use` statements alone in a separate Edit before the code.
## What the Fixer Does
- Removes unused `use` statements and sorts the rest
- Fixes indentation, spacing and line breaks
- Enforces PSR-12 with Nette modifications (e.g., no space before parentheses in arrow functions)
When the hook is active, let the fixer handle formatting and removal or sorting of `use` statements. If the hook is unavailable or the edit was made through the shell, run the project's fixer explicitly.
## When the Fixer Reports Errors
When ECS cannot fix everything, the hook reports "Could not fix all coding standard issues in <file>" followed by the remaining violations; fix them by hand. A file that is not valid PHP is skipped without a report.
## Excluding Paths
To stop the fixer from touching certain