Nifty

I was doing some work this morning that involved writing large amounts of very repetitive PHP code. I, personally, have a bad tendency to write large quantities of untested code when the structure is inherently repetitive (also using vim’s regex search and replace to do as much of the work as possible). Then what happens is that I run it and find all of the stupid syntax errors I made while typing faster than I should without testing as often as I should. Now, the CLI PHP interpreter has a nifty option: delint. Why delint? I have no idea, but it checks the files for parse errors. While this doesn’t exactly solve all programming bugs, it solves the ones most common on the project I am doing now. So I wrote a nifty little bash script that will take in a list of files, run php -l on all of them and, if there are errors, display them in a slightly more readable fashion than you would get straight from the command line. I am releasing it here under the BSD license (which is appended as comments to the end of the file). I know, I know. It’s a short script to attach a license. But, if you have any doubts as to the necessity of such a move, read this.

Download it here.