wayofdev / cs-fixer-config
Package adds custom rule-sets to php-cs-fixer
Fund package maintenance!
wayofdev
Installs: 24 992
Dependents: 14
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 0
Open Issues: 11
Requires
- php: ^8.1
- friendsofphp/php-cs-fixer: ^3.14.4
Requires (Dev)
- ergebnis/composer-normalize: ^2.30.2
- phpstan/extension-installer: ^1.2.0
- phpstan/phpstan: ^1.10.5
- phpstan/phpstan-deprecation-rules: ^1.1.2
- phpstan/phpstan-phpunit: ^1.3.10
- phpstan/phpstan-strict-rules: ^1.5.0
- phpunit/phpunit: ^10.0.14
- roave/security-advisories: dev-latest
- dev-master
- v1.2.60
- v1.2.59
- v1.2.58
- v1.2.57
- v1.2.56
- v1.2.55
- v1.2.54
- v1.2.53
- v1.2.52
- v1.2.51
- v1.2.50
- v1.2.49
- v1.2.48
- v1.2.47
- v1.2.46
- v1.2.45
- v1.2.44
- v1.2.43
- v1.2.42
- v1.2.41
- v1.2.40
- v1.2.39
- v1.2.38
- v1.2.37
- v1.2.36
- v1.2.35
- v1.2.34
- v1.2.33
- v1.2.32
- v1.2.31
- v1.2.30
- v1.2.29
- v1.2.28
- v1.2.27
- v1.2.26
- v1.2.25
- v1.2.24
- v1.2.23
- v1.2.22
- v1.2.21
- v1.2.20
- v1.2.19
- v1.2.18
- v1.2.17
- v1.2.16
- v1.2.15
- v1.2.14
- v1.2.13
- v1.2.12
- v1.2.11
- v1.2.10
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.19
- v1.1.18
- v1.1.17
- v1.1.16
- v1.1.15
- v1.1.14
- v1.1.13
- v1.1.12
- v1.1.11
- v1.1.10
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- dev-renovate/actions-checkout-digest
- dev-renovate/phpunit-phpunit-11.x
- dev-renovate/ergebnis-composer-normalize-2.x-lockfile
- dev-renovate/actions-cache-4.x
- dev-renovate/phpstan-packages
- dev-renovate/phpunit-phpunit-10.x-lockfile
- dev-renovate/friendsofphp-php-cs-fixer-3.x-lockfile
- dev-renovate/actions-labeler-5.x
- dev-renovate/google-github-actions-release-please-action-4.x
- dev-renovate/redhat-plumbers-in-action-differential-shellcheck-5.x
- dev-feat/auto-merge
- dev-codesee-arch-diagram-workflow-1678375134679
This package is auto-updated.
Last update: 2024-04-25 16:21:58 UTC
README
PHP CS Fixer Config
Wrapper with pre-defined rules around the PHP-CS-Fixer package — A tool to automatically fix PHP Coding Standards issues.
If you like/use this package, please consider starring it. Thanks!
💿 Installation
→ Using composer
Require as dependency:
$ composer req wayofdev/cs-fixer-config
🛠 Configuration
-
Create PHP file and name it
.php-cs-fixer.dist.php
and place it inside root directory of project. It will be recognized by PHP CS Fixer automatically. -
Example contents of
.php-cs-fixer.dist.php
file:<?php declare(strict_types=1); use WayOfDev\PhpCsFixer\Config\ConfigBuilder; use WayOfDev\PhpCsFixer\Config\RuleSets\DefaultSet; require_once 'vendor/autoload.php'; return ConfigBuilder::createFromRuleSet(new DefaultSet()) ->inDir(__DIR__ . '/src') ->inDir(__DIR__ . '/tests') ->addFiles([__FILE__]) ->getConfig();
-
Place
.php-cs-fixer.cache
file into.gitignore
💻 Usage
→ Running
Fix coding standards by simply running console command:
$ php vendor/bin/php-cs-fixer fix -v
→ Using Makefile
To use with our Makefile
:
-
Add
scripts
section tocomposer.json
:{ "scripts": { "cs-fix": "php vendor/bin/php-cs-fixer fix -v", "cs-diff": "php vendor/bin/php-cs-fixer fix --dry-run -v --diff" } }
-
Use
Makefile
code to run PHP-CS-Fixer tests:# Run inspections and fix code $ make cs-fix # Check coding standards without applying the fix $ make cs-diff
🧪 Running Tests
→ PHPUnit tests
To run tests, run the following command:
$ make test
→ Static Analysis
Code quality using PHPStan:
$ make stan
→ Coding Standards Fixing
Fix code using The PHP Coding Standards Fixer (PHP CS Fixer) to follow our standards:
$ make cs-fix
🤝 License
🙆🏼♂️ Author Information
Created in 2022 by lotyp / wayofdev
🧱 Resources
-
Full documentation about all fixers are available here - PHP-CS-Fixer configuration UI
-
The official PHP-CS-Fixer documentation