juliangut / php-cs-fixer-custom-fixers
Custom fixers for PHP CS Fixer
Fund package maintenance!
juliangut
Installs: 5 837
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: ^8.0
- friendsofphp/php-cs-fixer: ^3.61.1
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- infection/infection: ~0.24|~0.27
- juliangut/phpstan-config: ^1.2
- overtrue/phplint: ^9.0
- phpcompatibility/php-compatibility: ^9.3
- phpmd/phpmd: ^2.14
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^9.6.13|^10.4
- povils/phpmnd: ^3.3
- roave/security-advisories: dev-master
- slevomat/coding-standard: ^8.0
- squizlabs/php_codesniffer: ^3.6
This package is auto-updated.
Last update: 2024-10-28 21:15:43 UTC
README
php-cs-fixer-custom-fixers
Custom fixers for PHP-CS-Fixer
Installation
Composer
composer require --dev juliangut/php-cs-fixer-custom-fixers
Usage
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, ]);
Fixers
LanguageConstruct
FloatLeadingZeroFixer
Float values should or should not have a leading zero
<?php class Foo { - private float $value = .5; + private float $value = 0.5; }
Configuration
leading_zero (string), should add
or should remove
a leading zero
Comment
LeadingUppercaseCommentFixer
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 */
PhpdocLeadingUppercaseSummaryFixer
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() { } }
Contributing
Found a bug or have a feature request? Please open a new issue. Have a look at existing issues before.
See file CONTRIBUTING.md
License
See file LICENSE included with the source code for a copy of the license terms.