Skip to content

Commit bb646cf

Browse files
committed
PHP-CS-Fixer StyleCI Bridge
1 parent 62838c2 commit bb646cf

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
/puli.json
88
/box.json
99
/.puli
10+
/.php_cs.cache

.php_cs

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
require_once __DIR__.'/vendor/autoload.php';
4+
5+
use SLLH\StyleCIBridge\ConfigBridge;
6+
use Symfony\CS\Fixer\Contrib\HeaderCommentFixer;
7+
8+
$header = <<<EOF
9+
This file is part of the puli/cli package.
10+
11+
(c) Bernhard Schussek <[email protected]>
12+
13+
For the full copyright and license information, please view the LICENSE
14+
file that was distributed with this source code.
15+
EOF;
16+
17+
// PHP-CS-Fixer 1.x
18+
if (method_exists('Symfony\CS\Fixer\Contrib\HeaderCommentFixer', 'getHeader')) {
19+
HeaderCommentFixer::setHeader($header);
20+
}
21+
22+
$config = ConfigBridge::create();
23+
$config->setUsingCache(true);
24+
25+
// PHP-CS-Fixer 2.x
26+
if (method_exists($config, 'setRules')) {
27+
$config
28+
->setRiskyAllowed(true)
29+
->setRules(array_merge($config->getRules(), array(
30+
'header_comment' => array('header' => $header)
31+
)))
32+
;
33+
}
34+
35+
return $config;

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"require-dev": {
2626
"phpunit/phpunit": "^4.6",
2727
"sebastian/version": "^1.0.1",
28-
"symfony/filesystem": "^2.3|^3.0"
28+
"symfony/filesystem": "^2.3|^3.0",
29+
"sllh/php-cs-fixer-styleci-bridge": "^2.1"
2930
},
3031
"autoload": {
3132
"psr-4": {

0 commit comments

Comments
 (0)