stickee / php-cs-fixer-config
stickee's PHP CS Fixer config
Installs: 11 775
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.3
- adamwojs/php-cs-fixer-phpdoc-force-fqcn: ^2.0
- friendsofphp/php-cs-fixer: ^3.68.5
- dev-main
- v3.x-dev
- v3.0.1
- v3.0.0
- v2.9.1
- v2.9.0
- v2.8.0
- v2.7.0
- v2.6.0
- v2.5.0
- v2.4.0
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.1
- v2.0.0
- 1.1.x-dev
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.0
- dev-fix/missing-dist-config
- dev-fix/missing-config
- dev-chore/deps
- dev-chore/remove-husky
- dev-feat/rename-config-file
- dev-docs/install-in-root
- dev-license
- dev-fix/lock-to-v3-45-0
- dev-fix/fqcn-rules
- dev-fix/ci-git-commit-path
- dev-ci/semantic-release-changelog
This package is auto-updated.
Last update: 2025-02-03 17:10:28 UTC
README
Provides a PHP CS Fixer config for stickee projects.
Installation
composer require --dev stickee/php-cs-fixer-config cp vendor/stickee/php-cs-fixer-config/dist/.php-cs-fixer.php .php-cs-fixer.php
You must commit the .php-cs-fixer.php
config file.
You must add .php-cs-fixer.cache
to your .gitignore
file.
Usage
vendor/bin/php-cs-fixer fix
Overrides
You can override any of the rules or add your own by adding them to the $overrideRules
array in the .php-cs-fixer.php
file.
See here for a detailed description of available rules and their options.
Example
This has already been done for you with the ordered_class_elements
rule which has been reset to the PSR12
value of use_traits
only.
This has been added to help PR reviewers see only what has been changed when linting your project and not elements that have been re-ordered.
Once you are happy that your project has been linted correctly you may remove this override to use the stickee settings for this rule which are stricter and order more elements.
CI
An example GitHub action file is included at vendor/stickee/php-cs-fixer-config/dist/.github/workflows/php-cs-fixer.yaml
.
This will run PHP CS Fixer on PRs and new commits to those PRs.
Rules
The available RuleSets can be found at vendor/stickee/php-cs-fixer-config/src/RuleSet/
.
You can probably [ctrl] + click the class in the .php-cs-fixer.php
file to get to it in your editor.
Web description (prettier)
You can use either https://mlocati.github.io/php-cs-fixer-configurator/#version:3.2 or https://cs.symfony.com/doc/rules/index.html to see what the rules are doing.
CLI description (faster)
Alternatively you can run vendor/bin/php-cs-fixer describe <rule-or-set-name>
.
Credits
https://github.com/Visual-Craft/php-cs-fixer-config
for inspiration on how to create a custom config for PHP CS Fixer since there's no built-in way to do it.
stickeerehan
for his earlier work on PHP Code Styles so I didn't have to start from scratch.
The "supermarket mobiles" developers
for reviewing the many PRs that finalised the rules that we use.
The members of the #codestyle Slack channel
for caring about code styles.