I'd like to use HeaderCommentFixer
provided by PHP-CS-Fixer
but I don't understand how to.
I tried to do something like this:
$headerCommentFixer = new HeaderCommentFixer();
$headerCommentFixer->setHeader('test this');
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::NONE_LEVEL)
->setUsingCache(false)
->fixers([
...
$headerCommentFixer,
...
])
->finder($finder);
But I get this error:
[ErrorException] strpos() expects parameter 1 to be string, object given
So, how can I configure it? I also checked the test, but this unfortunately didn't helped me.
For version 1.x
:
// Configure the fixer
$header = 'test this';
Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header)
return Symfony\CS\Config\Config::create()
->fixers(array(
'header_comment' // Enable the fixer as rule
));
For newer (2.x
or dev-master
):
$header = 'test this';
return Symfony\CS\Config\Config::create()
->setRules(array(
'header_comment' => array('header' => $header)
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With