contao/easy-coding-standard
Composer 安装命令:
composer require contao/easy-coding-standard
包简介
EasyCodingStandard configurations for Contao
README 文档
README
This package includes the EasyCodingStandard configuration for Contao.
Installation
Add the package to your Contao installation via Composer:
composer require contao/easy-coding-standard --dev
Usage
Create a file named ecs.php in the root directory of your project.
<?php declare(strict_types=1); use Contao\EasyCodingStandard\Set\SetList; use Symplify\EasyCodingStandard\Config\ECSConfig; return ECSConfig::configure() ->withSets([SetList::CONTAO]) // Adjust the configuration according to your needs. ;
Then run the script like this:
vendor/bin/ecs check
What's inside?
The package contains the following custom fixers:
| Class | Description |
|---|---|
AssertEqualsFixer |
Replaces asserEquals() with assertSame() in unit tests unless the method is used to compare two objects. |
CaseCommentIndentationFixer |
Fixes the comment indentation before a case statement. |
ChainedMethodBlockFixer |
Adds an empty line after a block of chained method calls. |
CommentLengthFixer |
Adjusts the length of comments regardless of their indentation so that each line is about 80 characters long. |
ExpectsWithCallbackFixer |
Adjusts the indentation of $this->callback() calls inside the with() method of a unit test. |
FindByPkFixer |
Replaces findByPk() calls with findById(). |
FunctionCallWithMultilineArrayFixer |
Fixes the indentation of function calls with multi-line array arguments. |
InlinePhpdocCommentFixer |
Ensures that inline phpDoc comments are not converted to regular comments. |
IsArrayNotEmptyFixer |
Fixes the order of isset() and empty() calls in conjunction with is_array() checks. |
MockMethodChainingIndentationFixer |
Fixes the indentation of chained mock methods. |
MultiLineIfIndentationFixer |
Fixes the indentation of multi-line if statements. |
MultiLineLambdaFunctionArgumentsFixer |
Fixes the indentation of multi-line lambda function arguments. |
NoExpectsThisAnyFixer |
Removes the explicit any() assertion in unit tests. |
NoLineBreakBetweenMethodArgumentsFixer |
Fixes the indentation of method declarations. |
NoSemicolonAfterShortEchoTagFixer |
Removes the semicolon after short echo tag instructions. |
SingleLineConfigureCommandFixer |
Fixes the indentation of Symfony command arguments and options. |
TypeHintOrderFixer |
Fixes the type hint order in method declarations. |
The package contains the following custom sniffs:
| Class | Description |
|---|---|
ContaoFrameworkClassAliasSniff |
Prevents using aliased Contao classes instead of their originals. |
SetDefinitionCommandSniff |
Prevents using the setDefinition() method in Symfony commands. |
UseSprintfInExceptionsSniff |
Prevents using string interpolation in exception messages. |
License
Contao is licensed under the terms of the LGPLv3.
Getting support
Visit the support page to learn about the available support options.
contao/easy-coding-standard 适用场景与选型建议
contao/easy-coding-standard 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 228.64k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2020 年 01 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 contao/easy-coding-standard 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 contao/easy-coding-standard 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 228.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 23
- 依赖项目数: 272
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2020-01-05