>
Download This Plugin | |
Download Elegant Themes | |
Name | PHP Validator |
Version | 1.30 |
Author | Manoj Thulasidas |
Rating | 0 |
Last updated | 2014-09-08 07:49:00 |
Downloads |
1712
|
Download Plugins Speed Test plugin for Wordpress |
Home page PageSpeed score has been degraded by 0%, while Post page PageSpeed score has been degraded by 0%
PHP Validator plugin added 11 bytes of resources to the Home page and 28 bytes of resources to the sample Post page.
PHP Validator plugin added 0 new host(s) to the Home page and 0 new host(s) to the sample Post page.
Great! PHP Validator plugin ads no tables to your Wordpress blog database.PHP Validator is a developer tool. It scans the file you specify and determines whether you have undefined functions or methods.
Why not just run the PHP code, you say? Well, PHP is not a compiled language. It looks for functions during runtime. So if you have a segment of code not covered by your normal testing, and you have an undefined function in there, you will never know of the undefined function until it hits production when the particular conditions activating that particular code segment are met.
In my case, in one of the projects I was working on (Easy PayPal, soon to become a WordPress plugin), I had a few include files defining functions in the global scope. I wanted to refactor them into three different classes and edit my ten or so source files the add $class->
wherever necessary. Careful and systematic though I am, I kept missing a few function calls. Finally I got everything working. But I always had this fear that there were code paths that I may have missed, and there will be nasty surprises down the line, since the package is fairly complex and my test coverage is far from 100%. I thought it was silly to rely on tests to detect what in all other languages would be obvious compilation errors. So I started looking for compilers. I found some, but could never get any one of them work. So I decided to write a tool myself, which I named PHP Validator. I am happy to say that I managed to find a few undefined functions and methods (that I would have otherwise missed) using this tool.
PHP Validator is released as a Lite version here. It is fully functional and will locate all the undefineds as the Pro version. In the Pro version, it will also list the line numbers at which the undefined function occurs, which may make it a bit easier to locate. Also available is a Stand-alone version that runs as an independent browser-based tool.