---
name: phpcs
description: "Use when adopting PHPCS to assess this standard: Enforce a PHP coding standard"
---

# Apply PHPCS

Select a coding standard such as PSR-12 in the repository ruleset. Check source paths and report the sniff responsible for every violation.

## Procedure

1. Inspect the repository configuration and identify the files or targets covered by PHPCS.
2. Use PHPCS in this repository to meet this standard: Enforce a PHP coding standard. Select a coding standard such as PSR-12 in the repository ruleset. Check source paths and report the sniff responsible for every violation. Inspect the repository configuration, record the baseline and exact reproduction steps, then add the smallest repeatable check that detects a regression.
3. Record the tool version, configuration, scope and findings. Explain any checks that could not run.
4. Use the same invocation after changes and compare the evidence against the baseline.

Refer to [the upstream documentation](https://github.com/PHPCSStandards/PHP_CodeSniffer) for configuration and prerequisites.

## Tool invocation

```
vendor/bin/phpcs
```
