pronamic/wp-coding-standards
最新稳定版本:v2.4.0
Composer 安装命令:
composer require pronamic/wp-coding-standards
包简介
Pronamic WordPress WordPress Coding Standards for PHP_CodeSniffer.
README 文档
README
Pronamic WordPress Coding Standards for PHP_CodeSniffer.
Versions
We try to provide support for the last 3 major releases of PHP and WordPress in our projects.
PHP
8.48.38.2
https://www.php.net/supported-versions.php
WordPress
6.86.76.6
https://codex.wordpress.org/WordPress_Versions
Other
- https://make.wordpress.org/core/handbook/best-practices/browser-support/
- https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/
PHP_CodeSniffer
https://github.com/PHPCSStandards/PHP_CodeSniffer
Arguments
https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Usage
colors
By default use colors in output.
<arg name="colors" />
extensions
By default only check files with php extension:
<arg name="extensions" value="php" />
parallel
By default use 8 parallel processes.
<arg name="parallel" value="8" />
squizlabs/PHP_CodeSniffer#1732
sp
By default show sniff codes in all reports. By default show progress of the run.
<arg value="sp" />
Rules
PHPCompatibilityWP
https://github.com/PHPCompatibility/PHPCompatibilityWP
By default this package test PHP 8.2 and higher via the following setting:
<config name="testVersion" value="8.2-"/>
PHPCompatibility
https://github.com/PHPCompatibility/PHPCompatibility
Required through PHPCompatibilityWP.
WordPress
https://github.com/WordPress/WordPress-Coding-Standards
By default the minimum WordPress version to check is set to 6.3 via the following setting:
<config name="minimum_supported_wp_version" value="6.5" />
WordPressVIPMinimum
https://github.com/Automattic/VIP-Coding-Standards
WordPress-VIP-Go
https://github.com/Automattic/VIP-Coding-Standards
VariableAnalysis
https://github.com/sirbrillig/phpcs-variable-analysis
Exclusions
WordPress.Files.FileName.InvalidClassFileName
According to the WordPress PHP Coding Standards:
Class file names should be based on the class name with
class-prepended and the underscores in the class name replaced with hyphens, for exampleWP_Errorbecomes:class-wp-error.php
Source: https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#naming-conventions
This sniff will check on this naming convention:
Class file names should be based on the class name with "class-" prepended. Expected class-test.php, but found Test.php.
We often use the PSR-4 autoloading mechanism and therefore deviate from it.
WordPress.Files.FileName.NotHyphenatedLowercase
According to the WordPress PHP Coding Standards:
Files should be named descriptively using lowercase letters. Hyphens should separate words.
my-plugin-name.php
Source: https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#naming-conventions
Filenames should be all lowercase with hyphens as word separators. Expected test.php, but found Test.php.
We often use the PSR-4 autoloading mechanism and therefore deviate from it.
Universal.Arrays.DisallowShortArraySyntax
According to the WordPress PHP Coding Standards:
Using long array syntax (
array( 1, 2, 3 )) for declaring arrays is generally more readable than short array syntax ([ 1, 2, 3 ]), particularly for those with vision difficulties. Additionally, it’s much more descriptive for beginners.Arrays must be declared using long array syntax.
Source: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#declaring-arrays
统计信息
- 总下载量: 99.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 1
- 依赖项目数: 74
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2021-06-24
