juliangut / php-cs-fixer-custom-fixers
Custom fixers for PHP CS Fixer
Fund package maintenance!
juliangut
Installs: 4 460
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.4|^8.0
- friendsofphp/php-cs-fixer: ^3.1
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ~0.7
- grifart/phpstan-oneline: ~0.4
- infection/infection: ~0.24
- overtrue/phplint: ^3.0|^4.0
- phpcompatibility/php-compatibility: ^9.3
- phpmd/phpmd: ^2.10
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.7
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-strict-rules: ^1.0
- phpunit/phpunit: ^9.5
- povils/phpmnd: ^2.5
- roave/security-advisories: dev-master
- sebastian/phpcpd: ^6.0
- slevomat/coding-standard: ^8.0
- squizlabs/php_codesniffer: ^3.6
- thecodingmachine/phpstan-strict-rules: ^1.0
This package is auto-updated.
Last update: 2024-04-05 14:42:16 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.