0

When I run phpmd I get this error (from cleancode ruleset): Avoid using static access to class '\Namespace\Domain\Exception\UserExceptions'

I make a phpmd.xml with this content:

<?xml version="1.0"?>
<ruleset>
   <rule ref="rulesets/cleancode.xml">
       <properties>
           <property name="exceptions" value="'\Namespace\Domain\Exception\UserExceptions'"/>
       </properties>
   </rule>
</ruleset> 

But this not working for me, Is my syntax wrong to specify the class name? I also try with: value="\Namespace\Domain\Exception\UserExceptions" value="UserExceptions" value="'UserExceptions'"

but none of the options works for me.

1 Answers1

1

I found the solution!

<rule ref="rulesets/cleancode.xml">
    <exclude name="StaticAccess"/>
</rule>

<rule ref="rulesets/cleancode.xml/StaticAccess">
    <properties>
        <property name="exceptions">
            <value>
                \Laminas\Stdlib\ArrayUtils,
                otherClass
            </value>
        </property>
    </properties>
</rule>