Skip to content

adding new php tool docs #419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ description: The latest updates and changes to CodeRabbit.
sidebar_position: 13
---

## June 27, 2025

### Enhanced PHP Static Analysis: PHPMD and PHPCS Support

We're excited to announce enhanced PHP static analysis capabilities with two powerful new tools!

- [PHPMD](https://phpmd.org/) (PHP Mess Detector) is a static analysis tool that detects potential problems in your PHP code such as possible bugs, suboptimal code, overcomplicated expressions, and unused parameters, variables, methods, and classes.

- [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer) (PHP CodeSniffer) is a development tool that ensures your PHP code conforms to coding standards like PSR-1, PSR-2, PSR-12, and custom standards. It can automatically fix many coding standard violations.

See our [tools documentation](https://docs.coderabbit.ai/tools/) for more details.

## June 11, 2025

### Enhanced Static Analysis: HTMLHint and Checkmake Support
Expand Down
4 changes: 3 additions & 1 deletion docs/tools/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ For an overview of how CodeRabbit uses these tools when generating code reviews,
| Lua | [Luacheck][Luacheck] | Code Quality |
| Makefile | [Checkmake][Checkmake] | Code Quality |
| Markdown | [markdownlint][markdownlint], [LanguageTool][LanguageTool] | Code Quality, Grammar Checking |
| PHP | [PHPStan][PHPStan] | Code Quality |
| PHP | [PHPStan][PHPStan], [PHPMD][PHPMD], [PHPCS][PHPCS] | Code Quality |
| Plaintext | [LanguageTool][LanguageTool] | Grammar and Spell Checking |
| Java | [PMD][PMD] | Code Quality |
| Protobuf | [Buf][Buf] | Code Quality |
Expand Down Expand Up @@ -84,3 +84,5 @@ For an overview of how CodeRabbit uses these tools when generating code reviews,
[DotenvLinter]: /tools/dotenv.md
[HTMLHint]: /tools/htmlhint.md
[Checkmake]: /tools/checkmake.md
[PHPMD]: /tools/phpmd.md
[PHPCS]: /tools/phpcs.md
47 changes: 47 additions & 0 deletions docs/tools/phpcs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: PHPCS
sidebar_label: PHPCS
description: CodeRabbit's guide to PHPCS.
---

```mdx-code-block
import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx';

<ProPlanNotice />
```

[PHPCS](https://github.com/squizlabs/PHP_CodeSniffer) (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.

## 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

## Links

- [PHPCS GitHub Repository](https://github.com/squizlabs/PHP_CodeSniffer)
- [PHPCS Documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki)
- [Available Coding Standards](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standards)
- [Creating Custom Standards](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standards#creating-a-coding-standard)
37 changes: 37 additions & 0 deletions docs/tools/phpmd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: PHPMD
sidebar_label: PHPMD
description: CodeRabbit's guide to PHPMD.
---

```mdx-code-block
import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx';

<ProPlanNotice />
```

[PHPMD](https://phpmd.org/) (PHP Mess Detector) is a static analysis tool for PHP that detects potential problems in your code such as possible bugs, suboptimal code, overcomplicated expressions, and unused parameters, variables, methods, and classes.

## Files

PHPMD will run on files with the following extensions:

- `.php`

## Features

PHPMD can detect various code quality issues including:

- **Clean Code Rules**: Detects code smells and violations of clean code principles
- **Controversial Rules**: Identifies potentially problematic code patterns
- **Design Rules**: Finds design-related issues and architectural problems
- **Naming Rules**: Checks for naming convention violations
- **Unused Code Rules**: Detects unused variables, parameters, methods, and classes
- **Size Rules**: Identifies overly complex methods and classes

## Links

- [PHPMD Official Website](https://phpmd.org/)
- [PHPMD GitHub Repository](https://github.com/phpmd/phpmd)
- [PHPMD Documentation](https://phpmd.org/documentation/index.html)
- [Available Rules](https://phpmd.org/rules/index.html)