Skip to content

Commit a6cc34d

Browse files
committed
Make .php_cs compatible with PHP-CS-Fixer v2
1 parent d2a0739 commit a6cc34d

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

.php_cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,18 @@ For the full copyright and license information, please view the LICENSE
1414
file that was distributed with this source code.
1515
EOF;
1616

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

19-
return ConfigBridge::create()
20-
->setUsingCache(true)
21-
;
22+
$config = ConfigBridge::create();
23+
24+
// PHP-CS-Fixer 2.x
25+
if (method_exists($config, 'setRules')) {
26+
$config->setRules(array_merge($config->getRules(), array(
27+
'header_comment' => array('header' => $header)
28+
)));
29+
}
30+
31+
return $config;

0 commit comments

Comments
 (0)