Question

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 is a fresh install of PHPMD, via pear. I have tried it with different and multiple rulesets (codesize, naming, unusedcode) for the same result. I had a suspicion the PDepend library might be bad, but reinstalling it didn't help. Any pointers?

Was it helpful?

Solution

Try as I may I was unable to reproduce the issue that you where experiencing but I did a little digging and this is what I found, hopefully it will lead to some sort of resolution:

The error you are describing is emitted as an exception of the PHP_Depend_Code_ASTFieldDeclaration:::setModifiers method call, it is thrown as a result of not having any modifiers for the method/class/property in question.

If I had to take a guess on what your issue was then I would say I might be because a version mismatch between PDepend and PHPMD. I would try uninstalling and reinstalling (I sourced mine from the pear repo if that makes any difference).

Good Luck.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top