Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Fixing PHP Code Standard Issues

DZone's Guide to

Fixing PHP Code Standard Issues

· Web Dev Zone
Free Resource

Make the transition to Node.js if you are a Java, PHP, Rails or .NET developer with these resources to help jumpstart your Node.js knowledge plus pick up some development tips.  Brought to you in partnership with IBM.

It’s been one busy day, cranking out features like no tomorrow (even issuing pull requests on github to fix Zend Framework 2 issues) and still finding time to improve my PHP toolbelt.

Today while issuing pull requests I came across PHP-CS-Fixer which was referenced as a way to fix some minor code formatting issues in my pull request. Basically run it on a project directory and it fixes “most” issues to make your code better adhere to PHP coding standards as defined in the PSR-1 and PSR-2 documents.

Just run it against the root of your project and it fixes all the formatting issues caused by python/java/javascript developers like myself. :)

php-cs-fixer fix . -v --level=psr2

As an added check, I’m now using this script as a git pre-commit hook on my PHP projects to tell me of any issues.

 

Learn why developers are gravitating towards Node and its ability to retain and leverage the skills of JavaScript developers and the ability to deliver projects faster than other languages can.  Brought to you in partnership with IBM.

Topics:

Published at DZone with permission of James Carr, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}