Download the PHP package sllh/php-cs-fixer-styleci-bridge without Composer
On this page you can find all versions of the php package sllh/php-cs-fixer-styleci-bridge. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sllh/php-cs-fixer-styleci-bridge
More information about sllh/php-cs-fixer-styleci-bridge
Files in sllh/php-cs-fixer-styleci-bridge
Package php-cs-fixer-styleci-bridge
Short Description Auto configure PHP-CS-Fixer from StyleCI config file
License MIT
Informations about the package php-cs-fixer-styleci-bridge
PHP-CS-Fixer StyleCI bridge
:warning: This package is not maintained anymore. :warning:
PHP-CS-Fixer v2 came with a brand new configuration structure but StyleCI decided to keep the old way.
Because of that, it's now very hard to maintain this bridge and it's still not compatible with PHP-CS-Fixer v2.
This is also why I decided to abandon this package and write FlintCI, my own Code Review service for multiple fixers and linters without any required configuration bridge.
You can try it here (flintci.io), or keep using StyleCI without this bridge.
Auto configure PHP-CS-Fixer from StyleCI config file.
This library permits to generate php-cs-fixer configuration directly from your .styleci.yml
config file.
With that, you will avoid the pain of both config files maintenance.
Who is using this?
You can see which projects are using this package on the dedicated Packagist page.
Installation
Include this library on your dev dependencies:
Usage
You can use this bridge with several manners.
Basic usage
Put the following config on your .php_cs
file:
With this configuration, the configuration bridge will just parse your .styleci.yml
file.
Sample working file:
Directories options
You can change default repository of your .styleci.yml
file and directories for the CS Finder directly on ConfigBridge::create
method or constructor.
Customize the configuration class
ConfigBridge::create
returns a Symfony\CS\Config\Config
that you can customize as you want.
Using the bridge
You can also using bridge method, part by part.
Manually enable or disable fixers
To enable or disable some fixers manually on the .php_cs
file,
you will have to use merge system to keep fixers defined by the bridge:
Header comment
Unfortunately, header comment option is not available on StyleCI config file.
You will have to copy it from StyleCI web interface and set it manually.
The config bridge will automatically detect the fixer and add it on CS configuration.
PHP-CS-Fixer 1.x
PHP-CS-Fixer 2.x
Both versions
You can handle both versions easily with some magic method_exists
tricks:
Troubleshooting
Conflict with code or vendor library
In some edge cases, the bridge code may conflict with your code or your included vendor.
This kind of issue was discovered in puli/cli#21 (comment)
and fixed since v1.3.3
in #47.
Before that, you had to require the vendor autoload like this:
This is not the secured way. Make sure to require our custom loader instead:
All versions of php-cs-fixer-styleci-bridge with dependencies
composer/semver Version ^1.0
doctrine/inflector Version ^1.0
sllh/styleci-fixers Version ^3.0 || ^4.0
symfony/config Version ^2.3 || ^3.0
symfony/console Version ^2.3 || ^3.0
symfony/yaml Version ^2.3 || ^3.0