Check/Fix your PHP code - PSRs
- Use PHP-CodeSniffer to check if your code is in compliance with PSR-1 and PSR-2:
phpcs --standard=PSR1 /path/to/file/FileName.php
phpcs --standard=PSR2 /path/to/file/FileName.php
- Use PHP Coding Standards Fixer to "automatically" fix your code for PSR-1 and PSR-2:
php-cs-fixer fix /path/to/file/FileName.php
Written by Er Galvão Abbott
Related protips
2 Responses

A bit missleading title., phpcs doesn't fix code but reformatts it to PSR standards.
over 1 year ago
·

Thanks for the feedback.
That's why the title has "PSRs" in it. The idea was to make a concise title, but giving the idea that in this tip you find a tool that fix your mistakes related to the PSRs.
Any other code problems should be fixed by the programmer anyway, so...
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#