Development Workflow

Coding Standards with PHP_CodeSniffer and PHP-CS-Fixer

Automate formatting and coding-style checks so reviews focus on behavior rather than whitespace.

Overview

Consistent style makes code easier to scan and reduces unproductive review comments. PHP_CodeSniffer can detect coding-standard violations; PHP-CS-Fixer can apply configured formatting fixes.

Choose a standard

Adopt a documented standard such as PSR-12 where it fits the project. Add project-specific rules only when they improve consistency and can be explained.

Separate checking from fixing

Use a check command in CI that reports differences without silently rewriting contributor changes. Developers can run a separate fix command locally.

Pin versions

Keep tool versions in Composer's development dependencies. Tool upgrades can change formatting output, so review the diff and update the team's conventions deliberately.

Avoid style churn

Do not reformat the entire repository in the same change as a functional feature unless the work explicitly includes a style migration.

Share this page Help other developers discover this resource.