Currently, I am using NetBeans IDE and it has a very nice feature which shows if a variable is defined but is not used in its scope. This works very nicely if you have bunch of old code, and you are trying to remove the dead bits from it.
Is there a tool/service/anything, which would do the same thing however which would find variables which are set in the controller but then not used in a view. It does not have to be fully automatic.
For example if you have the following in your controller:
$this->set(array(
'variable1' => $variable1,
'variable2' => $variable2
));
And the view looks like this:
<p>Peter ate <?php echo $variable1; ?> apples.
It would highlight or in any other way identify variable2
(given that it is not used in layout as well).
Try running PHP Mess Detector on your codebase.
There is even a Netbeans plugin for that. Just don't run it on CakePHP source itself, or you will get a clear understanding how horribly broken it actually is.
Might be counterproductive. And cause you a cognitive dissonance of religious nature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With