Hi all! After few weeks of inactivity we are here again and we want to show you some new hints which will try to improve your code in NetBeans 7.4 (at least we hope so ;-). So here they are:
Too Many Lines
So what do you think that it does? Yes, exactly :-) It checks the number of lines of class, interface, trait and method (function) declarations. If the number is exceeded, than IDE warns you. So your elements will be more readable and pretty thin :-)
Do you think that the default value is too strict? Don't worry, you can simply adjust it ;-)
Everyone knows superglobals, but not everyone knows that superglobal arrays shouldn't be accessed directly. Never ever trust to user inputs. Every user input should be somehow filtered/validated. And that's why this hint was created :-)
As you certainly know, one can use conditional statements and control structures without curly braces (if block doesn't contain more than one statement). But it makes code less readable, so we suggest you to use braces everytime. This hint works for Do-While, While, For and Foreach loops and for If-Else-ElseIf statements.
Empty statement is just an empty statement so why to pollute your code by stuff which does nothing?
Error Control Operator Misused
Error control operator is pure evil (we talk about an "at" sign). It hides much more errors than you think. So don't use it. But we allow to use it in some special cases like
fopen() and such.
Nested Blocks in Functions
Just another hint which tries to make your code more readable. Too many nested blocks make your code ugly and it also tends to violate single responsibility principle. So it tries to check the depth of your blocks and warns you if it seems suspicious.
And you can set your custom depth number of course ;-)
Parent Constructor Call
Constructor of parent class should be called if exists. It ensures the right initialization of instantiated object. So if you override parent constructor we try to check whether you should call parent constructor or not.
Unnecessary Closing Delimiter
Using PHP closing delimiter at the end of file is unnecessary when there is no text after it. It is just a cause of Headers already sent error and such. So if it finds such an unnecessary delimiter, IDE will warn you.
What are unreachable statements? E.g. statements after
return statement. Just snippets which will never be executed. They just pollute your code. Hint tries to detect them and warn you.
Please, don't forget, that all hints are just our suggestions. If you don't want, you don't have to use them. You can simply disable every hint which you don't like in: Tools -> Options -> Editor -> Hints -> PHP. Just uncheck it in the list.