Skip to content

Commit afca162

Browse files
committed
Add php-cs-fixer config
1 parent 9fe232f commit afca162

File tree

6 files changed

+67
-2
lines changed

6 files changed

+67
-2
lines changed

.php_cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
$header = <<<'TAG'
4+
This file is part of nochso/html-compress-twig.
5+
6+
@copyright Copyright (c) 2015 Marcel Voigt <mv@noch.so>
7+
@license https://github.com/nochso/html-compress-twig/blob/master/LICENSE ISC
8+
@link https://github.com/nochso/html-compress-twig
9+
TAG;
10+
11+
$gitIgnoreLines = array_map(function ($line) {
12+
return rtrim($line, "\r\n\\/");
13+
}, file('.gitignore'));
14+
15+
$finder = Symfony\CS\Finder\DefaultFinder::create()
16+
->in(__DIR__)
17+
->exclude($gitIgnoreLines);
18+
19+
\Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);
20+
return \Symfony\CS\Config\Config::create()
21+
->level(\Symfony\CS\FixerInterface::SYMFONY_LEVEL)
22+
->fixers([
23+
'-psr0', // Does not play well with PSR-4
24+
'concat_with_spaces',
25+
'-concat_without_spaces',
26+
'-empty_return',
27+
'-phpdoc_no_empty_return',
28+
'-return',
29+
'-pre_increment',
30+
'header_comment',
31+
])
32+
->finder($finder);

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@
2020
"wyrihaximus/html-compress": "^1.1",
2121
"twig/twig": "^1.0",
2222
"phpunit/phpunit": "^4.8|^5.0"
23+
},
24+
"suggests": {
25+
"fabpot/php-cs-fixer": "Fix coding standards in PHP code"
2326
}
2427
}

src/Extension.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of nochso/html-compress-twig.
5+
*
6+
* @copyright Copyright (c) 2015 Marcel Voigt <mv@noch.so>
7+
* @license https://github.com/nochso/html-compress-twig/blob/master/LICENSE ISC
8+
* @link https://github.com/nochso/html-compress-twig
9+
*/
10+
311
namespace nochso\HtmlCompressTwig;
412

513
use Twig_Environment;
@@ -8,8 +16,6 @@
816
/**
917
* Extension.
1018
*
11-
* TODO Pass parser to constructor instead
12-
*
1319
* @author Marcel Voigt <mv@noch.so>
1420
* @copyright Copyright (c) 2015 Marcel Voigt <mv@noch.so>
1521
*/

src/MinifyHtmlNode.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of nochso/html-compress-twig.
5+
*
6+
* @copyright Copyright (c) 2015 Marcel Voigt <mv@noch.so>
7+
* @license https://github.com/nochso/html-compress-twig/blob/master/LICENSE ISC
8+
* @link https://github.com/nochso/html-compress-twig
9+
*/
10+
311
namespace nochso\HtmlCompressTwig;
412

513
use Twig_Node;

src/MinifyHtmlTokenParser.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of nochso/html-compress-twig.
5+
*
6+
* @copyright Copyright (c) 2015 Marcel Voigt <mv@noch.so>
7+
* @license https://github.com/nochso/html-compress-twig/blob/master/LICENSE ISC
8+
* @link https://github.com/nochso/html-compress-twig
9+
*/
10+
311
namespace nochso\HtmlCompressTwig;
412

513
use Twig_Token;

test/ExtensionTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of nochso/html-compress-twig.
5+
*
6+
* @copyright Copyright (c) 2015 Marcel Voigt <mv@noch.so>
7+
* @license https://github.com/nochso/html-compress-twig/blob/master/LICENSE ISC
8+
* @link https://github.com/nochso/html-compress-twig
9+
*/
10+
311
namespace nochso\HtmlCompressTwig\test;
412

513
use nochso\HtmlCompressTwig\Extension;

0 commit comments

Comments
 (0)