PHP Mess Detector for Eclipse PHP Mess Detector for Eclipse php php

PHP Mess Detector for Eclipse


Old question but since there still seems to be interest in it... I just installed the PTI plugin and there was no mention of PHPMD so I wonder where you get the "Mess Detection" menu item from?

For me actually nothing of PTI works with Eclipse Kepler SR2. Whatever I try just nothing happens.

I'd recommend you MakeGood for running PHPUnit tests in Eclipse and setting up Jenkins (including PHPMD) for your project, it takes a bit time to set up but once it is running it is just great: Template for Jenkins Jobs for PHP Projects


When PHPMD runs, it first searches for a default PHP executable which must exist, and this is not set in "PHP Tools" but in "PHP":

Window > Preferences > PHP > PHP Executables > (choose one) > [SET DEFAULT]

But if you had not done this, you would have gotten an error.

At this point PHPMD runs, and places its output in the PHPMD view (not in the Console view), which is usually displayed at the bottom. If it does not appear at all, it might have been closed or ignored. So:

Window > Show View > PHP Tools (Others?) > PHPMD

Another thing that may happen is that PHPMD detects nothing (the view appears but it is empty). In that case you can check the Console view to see what happened. Otherwise, you could try and modify the phpmd.php script which is run by PTI so that it logs what it's doing (you might for example wrap the main routine in a try/catch), either to stdout or by opening a temporary file somewhere on your system.