achttienvijftien/building-techniques
最新稳定版本:1.1.0
Composer 安装命令:
composer require achttienvijftien/building-techniques
包简介
Building techniques for WordPress
README 文档
README
This package contains the building techniques (=code style) used in WordPress projects.
About
This package provides a ruleset for PHP_CodeSniffer that extends the ruleset for Timber, which is composed of the WordPress coding standard with some added exceptions. The deviations from the WordPress coding standard are:
- Class filenames should adhere to PSR-4.
- Classnames should use StudlyCaps.
- Lines should be 100 chars long maximum (triggers warning),
- Lines should in no case exceed 120 characters (triggers error).
- Allow
/as word delimiter in hook names. - Allow short array syntax (
[]).
Prerequisites
Install Composer to add this package to your project.
Installing
Install the package using composer:
composer require --dev achttienvijftien/building-techniques
After the installation, the phpcs and phpcbf scripts are available in the vendor/bin folder.
We recommend also installing phpcodesniffer-composer-installer to automatically register the coding standard with PHP_CodeSniffer:
composer require --dev dealerdirect/phpcodesniffer-composer-installer
Now, the coding standard should be available for use when running phpcs. You can check the installed coding standards by running:
./vendor/bin/phpcs -i
The list should contain 1815BuildingTechniques.
Usage
To run PHP_CodeSniffer with the appropriate coding standard:
./vendor/bin/phpcs --standard=1815BuildingTechniques path/to/file-or-directory
To fix code style violations that can be corrected automatically:
./vendor/bin/phpcbf --standard=1815BuildingTechniques path/to/file-or-directory
Adding composer scripts
Composer scripts for phpcs and phpcbf can be added to composer.json for convenience.
{
"scripts": {
"format": "phpcbf --standard=1815BuildingTechniques --report-summary --report-source",
"lint": "phpcs --standard=1815BuildingTechniques"
}
}
IDE Support
Please refer to the Wiki for guides on integrating PHP_Codesniffer with IDEs like PhpStorm.
统计信息
- 总下载量: 1.83k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 11
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2022-11-11