What intrigues me…

Menu

How to check your php project (many files in a folder) for parse errors

Hey hadn’t wrote anything for a while here, but this is so brilliand and convenient, so I couldn’t resist to share it.

It’s about to check your project for obvious errors before releasing the changes on the production server. I found this answer in StackOverflow, but the solution is for SVN repository and while currently I am working with snv it suits me, but looking forward to migrate to Git, I was thinking “Wasn’t it nice to check the all php files within a folder?”

This should be executed in terminal (at least in Ubuntu it is straight forward) and it print all files which had Parse errors within the folder. I think it’s a must for any php developer who release their code in production server. I already put it as alias in my .bashrc, but I will add it in my “build” script too.

Doesn’t matter if it is CakePHP or not. PHP CodeSniffer is just a general tool, and the CakePHP guidelines are just a style rule for PHP CodeSniffer which can be used on any project. CodeSniffer also includes PSR-1 and PSR-2 as style rules.

CodeSniffer gives you some really nice reports on your project, even if you just want to use it for checking for parse errors.

Agree, I’ve tested it already, it’s quite extensive, good and automatically is integrated with Sublime Editor, but I need to fine tune it, since it add a lot of feedback for spacing and identation, since I don’t need them.