Skip to content

Instantly share code, notes, and snippets.

@jeroendesloovere
Created December 16, 2016 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeroendesloovere/c0983c96c234b5a5609a72289307d882 to your computer and use it in GitHub Desktop.
Save jeroendesloovere/c0983c96c234b5a5609a72289307d882 to your computer and use it in GitHub Desktop.
php-cs-fixer

PHP-CS-FIXER

This tool checks for PSR code styling. More info

Usage

Installation

We download it to /usr/local/bin/

sudo curl http://get.sensiolabs.org/php-cs-fixer.phar -o /usr/local/bin/php-cs-fixer

We now make php-cs-fixer a global object.

sudo chmod a+x /usr/local/bin/php-cs-fixer

Then, just run php-cs-fixer.

Usage

Check a file or an entire folder

php-cs-fixer fix ~/Documents/my-repos/social-media-facebook/jeroendesloovere --level=psr2

More info

When you accidently didn't used the --level=psr-2, spaces are removed in concatenation. Spaces can be added againg by using:

php-cs-fixer fix backend/modules/whitepapers --fixers=concat_with_spaces

"Concatenation should be used with at least one whitespace around.", more info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment