Title: PHPCS analysis
Author: WordPress VIP Documentation
Published: August 2, 2021
Last modified: December 31, 2025

---

 1. [VIP Code Analysis Bot](https://docs.wpvip.com/vip-code-analysis-bot/)
 2. PHPCS analysis

#  PHPCS analysis

The Bot analyzes all PHP and JavaScript files altered or created in submitted pull
requests using [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) (
PHPCS). PHPCS is an independent utility that scans code using a variety of PHPCS
standards.  

The [VIP Code Analysis Bot](https://docs.wpvip.com/vip-code-analysis-bot/) is configured
to run PHPCS using two standards that are designed to reinforce the [VIP coding best practices](https://docs.wpvip.com/code-quality/)
for writing secure, performant, and future-friendly code:

 * [`WordPress-VIP-Go`](https://github.com/Automattic/VIP-Coding-Standards/tree/master/WordPress-VIP-Go):
   A standard developed by VIP
 * [`PHPCompatibilityWP`](https://github.com/phpcompatibility/phpcompatibilitywp/):
   A standard maintained by a third party, reviewed by VIP

By default, the Bot uses the PHPCS severity level of `1`, but this and other [options are configurable](https://docs.wpvip.com/customize-the-bot/).
Each PHPCS standard includes one or more PHPCS sniffs, which can be [enabled or disabled](https://docs.wpvip.com/customize-phpcs/).

A more detailed explanation of errors and warnings for each severity level is available
for [interpreting PHPCS feedback](https://docs.wpvip.com/vip-code-analysis-bot/phpcs-report/).

 PHPCS [feedback posted by the Bot](https://docs.wpvip.com/vip-code-analysis-bot/feedback/)
pertains only to the altered (or new) sections of each file submitted. Unaltered
files will _not_ be analyzed. 

![](https://docs.wpvip.com/wp-content/uploads/sites/2/2022/03/code-analysis-bot-
phpcs-issues.png)

An example of feedback from the Bot highlighting errors found by PHPCS scanning

## PHPCompatibilityWP PHPCS standard

By default, the Bot will ask the PHPCS `PHPCompatibilityWP` standard to evaluate
all code changes against the highest PHP version used by the environments to which
the repository being analyzed deploys. Versions are determined dynamically by the
PHPCS run-time option [`testVersion`](https://github.com/PHPCompatibility/PHPCompatibility#testversion-in-the-ruleset-versus-command-line),
which is provided to PHPCS on the command line during scanning.

**Note**

The `PHPCompatibilityWP` standard and its dependencies do not yet detect some PHP
8 incompatibilities. The [upcoming release version 10.0.0](https://github.com/PHPCompatibility/PHPCompatibility/issues/1236#issuecomment-708443602)
of the `PHPCompatibility` standard will remedy this.

### Applications running more than one PHP version

[Applications](https://docs.wpvip.com/application/) on VIP typically include multiple
[environments](https://docs.wpvip.com/vip-platform/environments/), which can run
different versions of PHP. If an application includes environments that are running
both PHP 8.1 and 8.2, the `testVersion` parameter will be set to `8.2-` (the highest
PHP version).

## Local PHPCS analysis

VIP recommends installing the [PHPCS utility](https://docs.wpvip.com/php_codesniffer/)
locally and using the PHPCS  `WordPress-VIP-Go` standard. Adding PHPCS scans to 
a local workflow helps developers learn VIP best practices, leads to better experiences
with the Bot, and fewer errors generated on submission to GitHub. Developers can
identify and address issues and minimize or suppress any remaining errors or warnings
before submitting a pull request.

---

Additions cannot be made to the available PHPCS standards, but suggestions for PHPCS
standards can be submitted through [VIP’s Feedback Portal](https://docs.wpvip.com/vip-support/vip-product-feedback/).

Last updated: December 31, 2025