PHPMD - the PHP Mess Detector -- is a code quality analysis tool for PHP, similar to PMD for Java.
Questions tagged [phpmd]
80 questions
1
vote
0 answers
PHPMD - Check for duplicated code
I just found out about the tool PHPMD and I notice that it's really useful, the thing is that I read the documentation about creating custom rules and stuff, but it just talks about using software metrics from PHPDepend.
I would like to know if it's…

TiagoM
- 3,458
- 4
- 42
- 83
1
vote
1 answer
Understanding php static code analysis results
I need an advice. Cant found any information about static code analysis results. For example, i use phploc, and generate report. But it's a good results or a bad i dont know.
As I understand what utility I wouldn't have enjoyed report must be the…

Tapakan
- 328
- 1
- 3
- 15
1
vote
1 answer
Explanation needed for laravel avoid using static access
I would like to more in depth knowledge about using static methods . I'm using laravel 5.2 framework for my application.
In my application mostly i have used static functions For example i have model class name like post and method name is…

Alice
- 25
- 2
- 9
1
vote
1 answer
Is there a tool to analyze PHP code to check whether returned value is used properly?
Let's say I have the following code:
$result = $thirdPartyAPI->doSomething(); // returns false if error
if ($result == false) {
return $someErrorCode;
}
// process the valid $result
I have lots of calls to the $thirdPartyAPI spread throughout…

rchavarria
- 930
- 10
- 16
1
vote
1 answer
Integrate phpmd in windows IDE
I'm looking for an executable phpMD file for integration with PHPStorm on windows.
The phpmd website has instructions for installing / building via git, but is there an executable .exe / bat file?
Can someone give a hint where to find it?
Thanks

gruentee
- 323
- 2
- 12
1
vote
0 answers
Php Messdetector: report assignment on conditions
I would like to find the configuration of phpmd to prevent the assignment of an if.
This means that I would like to detect this case:
if ($key = $val)
Any suggestion ?

Germanaz0
- 914
- 8
- 18
1
vote
1 answer
build.xml copy+paste detector won't pick up duplicated codes
Duplicated code below present in two different controller files but the copy paste detector in build.xml won't pick it up when running the phing. The report file it generates has just empty block as shown below. Can someone tell me what I'm…

BentCoder
- 12,257
- 22
- 93
- 165
1
vote
1 answer
PHP 2.1 plugin with Sonar 3.7.4
I am currently using the SonarQube 3.7.4 version and php plugin 2.1 . When I analyse the php project . It won't analyse the Php Mess Detector, and Php codeSniffer, Result shows the Rules compliance 100% and issue is 0 always. But it is worked in the…

Saravanan_na
- 11
- 1
1
vote
1 answer
PHP mess detector optional parameters
I have interface X
interface X
{
public function foo($x, $y = 0);
}
then I have class
class xx implements X
{
public function foo($x, $y = 0)
{
// use $x, but not $y
}
}
This is perfectly normal, because I do not want to…

Mantas
- 4,259
- 2
- 27
- 32
1
vote
1 answer
Having directory reference trouble with Jenkins & Phing
I have set up my first CI environment with Jenkins and Phing and it is mostly running perfectly, though I have a few hiccups I can't resolve. I am constantly having trouble in determining how to reference directories within various parts of my build…

Jordan Windebank
- 147
- 10
1
vote
3 answers
PHPMD avoid static access to parent
Is there a way to avoid the parent:: static accessor in PHP classes, or is this one of those times to use @SuppressWarnings(StaticAccess)?
On the same lines, it seems like this StaticAccess warning is popping in suspicious places. Exception…

Ben
- 54,723
- 49
- 178
- 224
1
vote
1 answer
PHP MessDetector Invalid Field Modifiers given
I'm running this command:
sudo phpmd /repository/my/code/trunk/src/ text naming --reportfile code.staticanalysis
And getting this result:
Invalid field modifiers given, allowed modifiers are IS_PUBLIC, IS_PROTECTED, IS_PRIVATE and IS_STATIC.
This…

Nathaniel Ford
- 20,545
- 20
- 91
- 102
1
vote
1 answer
BooleanGetMethodName warning in phpmd
I generate my entities using doctrine mapping in symfony2, and get this code:
/**
* Get active
*
* @return boolean
*/
public function getActive() {
return $this->active;
}
Using jenkins and PMD plugin, they throw BooleanGetMethodName…

ihsan
- 2,279
- 20
- 36
1
vote
3 answers
jenkins setting up a php project - errors in log
So using jenkins-php.org I tried to setup a project. Unfortunately I get errors. First of all where do I put those xml configuration files it asks for (phpmd and phpcd)? And are there some standard configurations I can use as a starting point?
But…

steros
- 1,794
- 2
- 26
- 60
1
vote
1 answer
Cannot install phpmd through composer
I have this in my composer.json file:
"require": {
"phpmd/phpmd:": "1.4.0"
}
When I do:
php composer.phar update
I get:
Problem 1
- The requested package phpmd/phpmd: 1.4.0 could not be found.
In the documentation they say it can be…

Richard Knop
- 81,041
- 149
- 392
- 552