Skip to content

Commit 23c7792

Browse files
adding new php tool docs
1 parent 3c3a995 commit 23c7792

File tree

4 files changed

+99
-1
lines changed

4 files changed

+99
-1
lines changed

docs/changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ description: The latest updates and changes to CodeRabbit.
55
sidebar_position: 13
66
---
77

8+
## June 27, 2025
9+
10+
### Enhanced PHP Static Analysis: PHPMD and PHPCS Support
11+
12+
We're excited to announce enhanced PHP static analysis capabilities with two powerful new tools!
13+
14+
- [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.
15+
16+
- [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.
17+
18+
See our [tools documentation](https://docs.coderabbit.ai/tools/) for more details.
19+
820
## June 11, 2025
921

1022
### Enhanced Static Analysis: HTMLHint and Checkmake Support

docs/tools/list.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ For an overview of how CodeRabbit uses these tools when generating code reviews,
3232
| Lua | [Luacheck][Luacheck] | Code Quality |
3333
| Makefile | [Checkmake][Checkmake] | Code Quality |
3434
| Markdown | [markdownlint][markdownlint], [LanguageTool][LanguageTool] | Code Quality, Grammar Checking |
35-
| PHP | [PHPStan][PHPStan] | Code Quality |
35+
| PHP | [PHPStan][PHPStan], [PHPMD][PHPMD], [PHPCS][PHPCS] | Code Quality |
3636
| Plaintext | [LanguageTool][LanguageTool] | Grammar and Spell Checking |
3737
| Java | [PMD][PMD] | Code Quality |
3838
| Protobuf | [Buf][Buf] | Code Quality |
@@ -84,3 +84,5 @@ For an overview of how CodeRabbit uses these tools when generating code reviews,
8484
[DotenvLinter]: /tools/dotenv.md
8585
[HTMLHint]: /tools/htmlhint.md
8686
[Checkmake]: /tools/checkmake.md
87+
[PHPMD]: /tools/phpmd.md
88+
[PHPCS]: /tools/phpcs.md

docs/tools/phpcs.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: PHPCS
3+
sidebar_label: PHPCS
4+
description: CodeRabbit's guide to PHPCS.
5+
---
6+
7+
```mdx-code-block
8+
import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx';
9+
10+
<ProPlanNotice />
11+
```
12+
13+
[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.
14+
15+
## Files
16+
17+
PHPCS will run on files with the following extensions:
18+
19+
- `.php`
20+
21+
## Features
22+
23+
PHPCS can detect and fix various coding standard violations including:
24+
25+
- **PSR Standards**: Enforces PSR-1, PSR-2, PSR-12, and other coding standards
26+
- **Custom Standards**: Supports custom coding standards and rules
27+
- **Auto-fixing**: Can automatically fix many coding standard violations
28+
- **Custom Rules**: Allows creation of custom sniff rules
29+
- **Multiple Standards**: Can enforce multiple coding standards simultaneously
30+
31+
## Popular Standards
32+
33+
PHPCS supports many coding standards including:
34+
35+
- **PSR-1**: Basic Coding Standard
36+
- **PSR-2**: Coding Style Guide
37+
- **PSR-12**: Extended Coding Style
38+
- **Squiz**: Squiz Labs coding standard
39+
- **PEAR**: PEAR coding standard
40+
- **Zend**: Zend Framework coding standard
41+
42+
## Links
43+
44+
- [PHPCS GitHub Repository](https://github.com/squizlabs/PHP_CodeSniffer)
45+
- [PHPCS Documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki)
46+
- [Available Coding Standards](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standards)
47+
- [Creating Custom Standards](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standards#creating-a-coding-standard)

docs/tools/phpmd.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: PHPMD
3+
sidebar_label: PHPMD
4+
description: CodeRabbit's guide to PHPMD.
5+
---
6+
7+
```mdx-code-block
8+
import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx';
9+
10+
<ProPlanNotice />
11+
```
12+
13+
[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.
14+
15+
## Files
16+
17+
PHPMD will run on files with the following extensions:
18+
19+
- `.php`
20+
21+
## Features
22+
23+
PHPMD can detect various code quality issues including:
24+
25+
- **Clean Code Rules**: Detects code smells and violations of clean code principles
26+
- **Controversial Rules**: Identifies potentially problematic code patterns
27+
- **Design Rules**: Finds design-related issues and architectural problems
28+
- **Naming Rules**: Checks for naming convention violations
29+
- **Unused Code Rules**: Detects unused variables, parameters, methods, and classes
30+
- **Size Rules**: Identifies overly complex methods and classes
31+
32+
## Links
33+
34+
- [PHPMD Official Website](https://phpmd.org/)
35+
- [PHPMD GitHub Repository](https://github.com/phpmd/phpmd)
36+
- [PHPMD Documentation](https://phpmd.org/documentation/index.html)
37+
- [Available Rules](https://phpmd.org/rules/index.html)

0 commit comments

Comments
 (0)