Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Skip to main content
🐰 New: Triage — a self-updating cross-repository queue that prioritizes pull requests by value and risk, so you always know what to review next. Now in beta! Explore Triage →
CodeRabbit’s guide to PHPCS.
PHPCS (PHP CodeSniffer) is a development tool that ensures your code conforms to a coding standard. It is an essential tool for any development team that wants to ensure their code is consistent and follows best practices. CodeRabbit runs PHP CodeSniffer version 3.13.6.
Files
PHPCS will run on files with the following extensions:.php
Features
PHPCS can detect and fix various coding standard violations including:- PSR Standards: Enforces PSR-1, PSR-2, PSR-12, and other coding standards
- Custom Standards: Supports custom coding standards and rules
- Auto-fixing: Can automatically fix many coding standard violations
- Custom Rules: Allows creation of custom sniff rules
- Multiple Standards: Can enforce multiple coding standards simultaneously
Popular Standards
PHPCS supports many coding standards including:- PSR-1: Basic Coding Standard
- PSR-2: Coding Style Guide
- PSR-12: Extended Coding Style
- Squiz: Squiz Labs coding standard
- PEAR: PEAR coding standard
- Zend: Zend Framework coding standard
Configuration
PHPCS requires a configuration file to run. CodeRabbit will only run PHPCS if one of the following configuration files is found:phpcs.xml- XML configuration filephpcs.xml.dist- Distributed XML configuration file
When we skip PHPCS
CodeRabbit will skip running PHPCS when:- PHPCS is disabled in the review profile (only runs in Assertive mode).
- No config file is found (
phpcs.xmlorphpcs.xml.dist). - The config file does not appear to be a valid PHPCS ruleset (missing
<rulesetor<?xmltags).
Profile behavior
PHPCS only runs in Assertive mode. In Chill mode, PHPCS is skipped entirely.Links
Was this page helpful?
