Wallogit.com
2017 © Pedro Peláez
For details on PSR-2-R see fig-rectified-standards., (*2)
Full documentation @ /docs/., (*3)
This tool is not used/maintained anymore. Please use the sniffer which can both detect and fix cs issues as well as tokenize PHP files., (*4)
This uses FriendsOfPHP/PHP-CS-Fixer. It can detect and fix some issues automatically and is ideal for integration into the IDE., (*5)
You can use PSR-2-R by default.
Create your own .phpcs configuration in the root directory of your project.
You can copy-and-paste this one and adjust the path to the psr2r standard definition:, (*6)
$finder = Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__)
->exclude('bin')
->exclude('vendor') // add anything you want to omit
;
return require_once('vendor/fig-r/psr2r-fixer/.php_cs_psr2r');
In case you want to further modify it assign it to a variable and then you can continue to work on the returned object, before finally returning it., (*7)
You can now run it from your root directory as, (*8)
vendor/bin/php-cs-fixer fix
It will automatically pull your config (confirm that by looking for that info in the first line when starting the fixer)., (*9)
Of course you can also use any of the custom fixers in this repo in your config, or extend/modify them as you like., (*10)
... ->finder($finder) ->addCustomFixer(new \Psr2rFixer\Fixer\NoSpacesCastFixer()) ...
MIT, (*11)