From 3c7b402b7ffda71ab38153858f581737d32b6a37 Mon Sep 17 00:00:00 2001 From: othillo Date: Sat, 16 Jun 2018 13:46:43 +0200 Subject: [PATCH] initial version --- .docheader.dist | 8 ++++++++ .gitignore | 1 + .php_cs.dist | 11 ++++++++++ README.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ composer.json | 7 +++++-- 5 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 .docheader.dist create mode 100644 .php_cs.dist diff --git a/.docheader.dist b/.docheader.dist new file mode 100644 index 0000000..e501164 --- /dev/null +++ b/.docheader.dist @@ -0,0 +1,8 @@ +/* + * This file is part of the broadway/broadway package. + * + * (c) Qandidate.com + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ diff --git a/.gitignore b/.gitignore index 57872d0..3a9875b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /vendor/ +composer.lock diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 0000000..ebacf5d --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,11 @@ +in(__DIR__); + +return PhpCsFixer\Config::create() + ->setRules([ + '@Symfony' => true, + 'declare_strict_types' => true, + ]) + ->setFinder($finder); diff --git a/README.md b/README.md index e69de29..a36c7b4 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,54 @@ +broadway/coding-standard +======================== + +The coding standard of the Broadway project. + +# Installation + +``` +$ composer require --dev broadway/coding-standard +``` + +# Configuration + +## PHP CS fixer + +1. create a `.php_cs` file referencing the `.php_cs.dist` template: + +```php +# .php_cs + +setFinder( + \PhpCsFixer\Finder::create() + ->in([ + __DIR__ . '/src', + __DIR__ . '/test', + ]) +); + +return $config; + +``` + +2. add `.php_cs.cache` to your `.gitignore`. + +## docheader + +1. copy the `.docheader.dist` template: + +``` +cp vendor/broadway/coding-standard/.docheader.dist ./.docheader +``` + +2. modify the `.docheader` file is necessary. + +# Usage + +``` +$ vendor/bin/php-cs-fixer fix --config=".php_cs" --allow-risky=yes --diff --verbose +$ vendor/bin/docheader check {src,test} +``` diff --git a/composer.json b/composer.json index 035858e..fd37947 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "broadway/coding-standard", "description": "The coding standard of the Broadway project.", - "type": "metapackage", + "type": "library", "license": "MIT", "authors": [ { @@ -9,5 +9,8 @@ "email": "othillo@othillo.nl" } ], - "require": {} + "require": { + "friendsofphp/php-cs-fixer": "^2.0", + "malukenho/docheader": "^0.1.7" + } }