Skip to content

Commit

Permalink
PHP-CS-Fixer StyleCI Bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
soullivaneuh committed Jun 29, 2016
1 parent 62838c2 commit bb646cf
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/puli.json
/box.json
/.puli
/.php_cs.cache
35 changes: 35 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

require_once __DIR__.'/vendor/autoload.php';

use SLLH\StyleCIBridge\ConfigBridge;
use Symfony\CS\Fixer\Contrib\HeaderCommentFixer;

$header = <<<EOF
This file is part of the puli/cli package.
(c) Bernhard Schussek <[email protected]>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;

// PHP-CS-Fixer 1.x
if (method_exists('Symfony\CS\Fixer\Contrib\HeaderCommentFixer', 'getHeader')) {
HeaderCommentFixer::setHeader($header);
}

$config = ConfigBridge::create();
$config->setUsingCache(true);

// PHP-CS-Fixer 2.x
if (method_exists($config, 'setRules')) {
$config
->setRiskyAllowed(true)
->setRules(array_merge($config->getRules(), array(
'header_comment' => array('header' => $header)
)))
;
}

return $config;
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1",
"symfony/filesystem": "^2.3|^3.0"
"symfony/filesystem": "^2.3|^3.0",
"sllh/php-cs-fixer-styleci-bridge": "^2.1"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit bb646cf

Please sign in to comment.