phpmd icon indicating copy to clipboard operation
phpmd copied to clipboard

Support for Wildcard Exceptions for StaticAccess Rule

Open webysther opened this issue 9 years ago • 6 comments

For laravel (and others projects) sometimes the only way is using static access, doing this i fix without turn off the check for other classes:

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

  <rule ref="rulesets/cleancode.xml/StaticAccess">
      <properties>
          <property name="exceptions">
            <value>
              \Illuminate\Foundation\Inspiring,
              \Illuminate\Pagination\LengthAwarePaginator,
              \Illuminate\Support\Arr,
              \Illuminate\Support\Str
            </value>
          </property>
      </properties>
  </rule>

Is useful support pattern:

  <rule ref="rulesets/cleancode.xml/StaticAccess">
      <properties>
          <property name="exceptions">
            <value>
              \Illuminate\*,
              \Respect\Validation\*
            </value>
          </property>
      </properties>
  </rule>

webysther avatar May 18 '16 03:05 webysther

If I understand you correctly, you want to support for the * character as a wildcard.

I think that would be useful.

ravage84 avatar May 18 '16 09:05 ravage84

Yes. 😃

webysther avatar May 18 '16 14:05 webysther

Would you be willing to create a pull request?

ravage84 avatar May 18 '16 14:05 ravage84

Yes.

webysther avatar May 18 '16 14:05 webysther

@Webysther are you still interested in creating a PR for this? I would appreciate it. :smile_cat:

ravage84 avatar Jun 27 '16 11:06 ravage84

Yes, for the next week, please. Sorry.

webysther avatar Jun 28 '16 19:06 webysther