2

I was asked to implement PHPMD at work (as well as PHPCS... another upcoming posted question, I assume). I am not very Linux-savvy, either. Sorry.

I followed the download instructions on PHPMD. I used Composer and got all the dependencies properly (I assume). I placed them in the usr/bin directory with full permissions.

I tried using the terminal to enter the command line on the documentation page, except with the changes being relevant to my machine and I wanted the output to be a file I can save for documentation.

PHPMD Command

phpmd sampleFile.php xml codesize --reportfile report.xml

Output File

<?xml version="1.0" encoding="UTF-8" ?>
    <pmd version="@project.version@" timestamp="2016-01-28T14:10:47-05:00">
</pmd>

This doesn't look like the response that is shown in the PHPMD documentation. Any guesses as to what I did wrong? I am not sure if I should be looking into something that I did wrong with PHPMD or something that I did wrong with Linux. I am using a Linux Red Hat v6.7 (Santiago) VM, if you care.

Thank you!

Robert Broden
  • 118
  • 4
  • 11

1 Answers1

2

phpmd does not seem to show any output for scripts that have no functions or classes (pure spaghetti code). I wonder if there is a way to enable this?

Jay Sheth
  • 1,738
  • 16
  • 15
  • you were right. thank you! i was trying phpmd on any file just to see if I could get a result. didn't happen to think that the result would be based on functions or classes (not sure why). tried phpmd on some of our other files that contain functions and classes and seems to work fine. thank you! – Robert Broden Feb 17 '16 at 15:15