cwd/phpcs

此包已被弃用,不再维护。作者建议使用 friendsofphp/php-cs-fixer 包代替。

cwd.at GmbH 的项目编码标准

维护者

详细信息

gitlab.cwd.at/cwd/phpcs.git

dev-master 2016-11-28 10:37 UTC

This package is auto-updated.

Last update: 2022-02-01 13:02:48 UTC


README

这是 cwd.at GmbH 开发的项目的编码标准。您可以通过运行 PHP-CS-Fixer 自动强制执行编码标准。

安装

使用 Composer 安装编码标准

$ composer require --dev cwd/phpcs:dev-master

用法

将以下 .php_cs 文件放置在您项目的根目录中

<?php

$finder = Symfony\CS\Finder::create()
    ->in([__DIR__.'/src', __DIR__.'/tests'])
;

Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader(<<<EOF
This file is part of the <package name>.

(c) cwd.at GmbH <office@cwd.at>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF
);

return Symfony\CS\Config::create()
    ->setUsingCache(true)
    ->addCustomFixers(Cwd\PhpCs\CodingStandard::getCustomFixers())
    ->fixers(Cwd\PhpCs\CodingStandard::PHP5_FIXERS)
    ->finder($finder)
;

提供两组不同的修复程序

  • Cwd\PhpCs\CodingStandard::PHP5_FIXERS (适用于 PHP 5.4+)
  • Cwd\PhpCs\CodingStandard::PHP7_FIXERS (适用于 PHP 7.0+)

运行 PHP-CS-Fixer 以强制执行编码风格

$ vendor/bin/php-cs-fixer fix

问题

问题跟踪器 上报告问题。