chi-teck/drupal-coder-extension
Composer 安装命令:
composer require chi-teck/drupal-coder-extension
包简介
An extension of Drupal coding standards.
README 文档
README
This project offers a set of preconfigured rules for PHP Code Sniffer mainly related to new PHP features that are not covered by Drupal coding standards yet.
System Requirements
PHP 8.1+
Installation
Install the standard locally through Composer.
composer require --dev chi-teck/drupal-coder-extension
Add DrupalExtended standard to your project's phpcs.xml.
<?xml version="1.0"?> <ruleset name="Drupal Extended" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../vendor/squizlabs/php_codesniffer/phpcs.xsd"> <rule ref="DrupalExtended"> <!-- Sniffs to exclude. --> </rule> <!-- Override settings for enabled rules or enable that excluded. --> <rule ref="SlevomatCodingStandard.Classes.RequireAbstractOrFinal.ClassNeitherAbstractNorFinal"> <exclude-pattern>./src/Exception</exclude-pattern> </rule> <rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit"/> </ruleset>
A complete example of phpcs.xml:
<?xml version="1.0"?> <ruleset name="Drupal Extended" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../vendor/squizlabs/php_codesniffer/phpcs.xsd"> <description>PHP Code Sniffer configuration for My Project.</description> <arg name="colors"/> <arg name="extensions" value="php,module,inc,install,theme,info,txt,md,yml"/> <!-- Paths to scan for problems recursively. --> <file>./web/modules/custom</file> <file>./web/themes/custom</file> <file>./tests</file> <!-- Exclude vendors. --> <exclude-pattern>./docroot/themes/custom/example/node_modules</exclude-pattern> <rule ref="DrupalExtended"/> </ruleset>
Usage
Run the phpcs script to check custom code.
./vendor/bin/phpcs -ps --standard=phpcs.xml
Run the phpcbf script to automatically correct coding standard violations.
./vendor/bin/phpcbf
You also can put this command into projects composer.json:
{
…
"scripts": {
"phpcs": "vendor/bin/phpcs -ps"
}
}
Then you can use it like
composer phpcs
Links
License
GNU General Public License, version 2 or later.
chi-teck/drupal-coder-extension 适用场景与选型建议
chi-teck/drupal-coder-extension 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 86.71k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2020 年 05 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 chi-teck/drupal-coder-extension 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chi-teck/drupal-coder-extension 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 86.71k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 16
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2020-05-02