Frage

We're using PSR0, PSR1 and PSR2 standards in our project, but I want to exclude a specific file from just the PSR0 namespace checking rule. Is there a way I can add a comment to the file, so phpcs ignores this rule:

Each class must be in a namespace of at least one level...

War es hilfreich?

Lösung

Here: http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php

They show this example:

<!--
    You can also hard-code ignore patterns for specific sniffs,
    a feature not available on the command line.

    The code here will hide all messages from the Squiz DoubleQuoteUsage
    sniff for files that match either of the two exclude patterns.
 -->
 <rule ref="Squiz.Strings.DoubleQuoteUsage">
    <exclude-pattern>*/tests/*</exclude-pattern>
    <exclude-pattern>*/data/*</exclude-pattern>
 </rule>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top