This post originated from an RSS feed registered with PHP Buzz
by Alan Knowles.
Original Post: the new E_ANAL error_reporting setting
Feed Title: Smoking toooo much PHP
Feed URL: http://www.akbkhome.com/blog.php/RSS.xml
Feed Description: More than just a blog :)
After quite a few chats on various php-irc developer channels, it looks like PHP is going to be getting a new error_reporting level, E_ANAL.
while E_STRICT has been quite sucessfull in getting people to migrate from C# and Java, there is a sense that it is not quite complete. Apparently quite a number of them are missing their fatal exceptions on mundane issues). hence the new planned E_ANAL notices will start appearing when
you forget to declare a variable type before using it. (just giving it a default value doesnt count)
you try and do boolean tests on strings, integers, object (or anything that isnt a boolean)
string comparison on non-strings (although I'm tempted to suggest this for E_STRICT)
you declare a function (that's not part of a class)
you forget to put the return type of a method.
you forget to wrap a method call that can throw an exception in a try{ } catch block.
you make any property public (only available with the E_ANAL_JAVA extension).
any usage of PHP native array's or array functions.
any method call that does not involve at least 3 objects.
using any variable name that matches a object or method name anywhere in the imported methods or functions.
Of course while E_ANAL is regarded as esential for developing any enterprise applications, It is however highly recommended that it's turned off if you actually want to get anything done.