Custom fixers for PHP-CS-Fixer
composer require --dev juliangut/php-cs-fixer-custom-fixers
Register custom fixers on PHP-CS-Fixer configuration
<?php
use Jgut\PhpCsFixerCustomFixers\Fixers;
use Jgut\PhpCsFixerCustomFixers\Fixer\Comment\LeadingUppercaseCommentFixer;
use Jgut\PhpCsFixerCustomFixers\Fixer\Comment\PhpdocLeadingUppercaseSummaryFixer;
use Jgut\PhpCsFixerCustomFixers\Fixer\LanguageConstruct\FloatLeadingZeroFixer;
use PhpCsFixer\Config;
return (new Config())
+ ->registerCustomFixers(new Fixers())
->setRules([
'@PSR2' => true,
// ...,
+ LeadingUppercaseCommentFixer::name() => true,
+ PhpdocLeadingUppercaseSummaryFixer::name() => true,
+ FloatLeadingZeroFixer::name() => true,
]);
Float values should or should not have a leading zero
<?php
class Foo
{
- private float $value = .5;
+ private float $value = 0.5;
}
leading_zero (string), should add
or should remove
a leading zero
Comments should start with a leading uppercase letter
<?php
-// this is a comment
+// This is a comment
/*
- * this is a block comment
+ * This is a block comment
*/
Docblock summary should start with a leading uppercase letter
<?php
class Foo
{
/**
- * this is a docblock summary.
+ * This is a docblock summary.
*/
public function bar()
{
}
}
Found a bug or have a feature request? Please open a new issue. Have a look at existing issues before.
See file CONTRIBUTING.md
See file LICENSE included with the source code for a copy of the license terms.