Static Analysis 1
Posted: December 6th, 2012, 2:23 pm
Right, it's my productive day today.
Can you make an analysis that checks all overriden implementations of a function (from top to bottom) and check if the argument list and type hints are all the same? And then check if they all return (or not) a value. I know that you cannot (or maybe you can!) check all code paths to see if the function should or should not return a value, but maybe look for a 'return' keyword?
We have plenty of bugs where the overriding function does not return what the base function does or has a different set of arguments.
I also recently had a bug with mispelled property name. Checking declared properties (including @property tags) is also a nice thing. Maybe a warning this time, but worth a check!
Can you make an analysis that checks all overriden implementations of a function (from top to bottom) and check if the argument list and type hints are all the same? And then check if they all return (or not) a value. I know that you cannot (or maybe you can!) check all code paths to see if the function should or should not return a value, but maybe look for a 'return' keyword?
We have plenty of bugs where the overriding function does not return what the base function does or has a different set of arguments.
I also recently had a bug with mispelled property name. Checking declared properties (including @property tags) is also a nice thing. Maybe a warning this time, but worth a check!