addiks/more-php-cs-fixers
Composer 安装命令:
composer require addiks/more-php-cs-fixers
包简介
Extension for PHP-CS-Fixer with more fixers
README 文档
README
More PHP-CS-Fixer's
This repository contains a few additional fixers for the PHP-CS-Fixer project:
- Add a blank line before doc-comments
- Add a blank line before else- and elseif-codeblocks
- Add a blank line before catch- and finally-codeblocks
Setup
1. Install package via composer:
composer require addiks/more-php-cs-fixers
2. Register fixers in PHP-CS-Fixer configuration (file .php_cs).:
<?php +use Addiks\MorePhpCsFixers\Whitespace\BlankLineBeforeCatchBlockFixer; +use Addiks\MorePhpCsFixers\Whitespace\BlankLineBeforeElseBlockFixer; +use Addiks\MorePhpCsFixers\Whitespace\BlankLineBeforeDocCommentFixer; $config = PhpCsFixer\Config::create(); +$config->registerCustomFixers([ + new BlankLineBeforeCatchBlockFixer(), + new BlankLineBeforeElseBlockFixer(), + new BlankLineBeforeDocCommentFixer(), +]); +$config->setRules([ + 'Addiks/blank_line_before_catch_block': true, + 'Addiks/blank_line_before_else_block': true, + 'Addiks/blank_line_before_doccomment': true, +]); return $config;
The fixers
Addiks/blank_line_before_catch_block
<?php
try {
foo();
+
} catch (\Exception $b) {
bar();
+
} finally {
baz();
}
Addiks/blank_line_before_else_block
<?php
if ($a) {
foo();
+
} elseif ($b) {
bar();
+
} else {
baz();
}
Addiks/blank_line_before_doccomment
<?php
/** @var string $foo */
$foo = "Lorem ipsum";
+
/** @var string $bar */
$bar = "dolor sit amet";
Addiks/correct_order_in_var_doccomment
<?php -/** @var $foo string */ +/** @var string $foo */
Addiks/nullable_in_doccomment
<?php -/** @var ?string $foo */ +/** @var string|null $foo */
Addiks/array_in_doccomment
<?php -/** @var string[] $foo */ +/** @var array<string> $foo */
addiks/more-php-cs-fixers 适用场景与选型建议
addiks/more-php-cs-fixers 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.65k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 10 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 addiks/more-php-cs-fixers 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 addiks/more-php-cs-fixers 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.65k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-22