← 返回命令列表

Linux command

phpcs 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Check file

phpcs [file.php]

Check directory

phpcs [src/]

Use specific standard

phpcs --standard=PSR12 [file.php]

Show summary only

phpcs --report=summary [src/]

Generate report

phpcs --report-file=[report.txt] [src/]

说明

phpcs is PHP CodeSniffer. Detects coding standard violations. The tool checks code style. Supports PSR, PEAR, and custom standards.

参数

--standard _NAME_
Coding standard.
--report _TYPE_
Report format.
--report-file _FILE_
Save report to file.
-n
Ignore warnings.
--help
Display help.

FAQ

What is the phpcs command used for?

phpcs is PHP CodeSniffer. Detects coding standard violations. The tool checks code style. Supports PSR, PEAR, and custom standards.

How do I run a basic phpcs example?

Run `phpcs [file.php]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --standard _NAME_ do in phpcs?

Coding standard.