Apparentemente un modo per farlo è questo: creare un nuovo "Standard", creare un nuovo ruleset.xml, quindi inserirlo nel file ruleset.xml, una stanza XML che imposta la proprietà.
Per esempio, (io sono su Windows così i miei backslash sono tutti i backslash e non barre FWD)
cd \ dev \ phpcs \ CodeSniffer
mkdir NewStandard
All'interno di tale directory , creare ruleset.xml, contenente questo:
<?xml version="1.0"?>
<ruleset name="Custom Standard">
<description>My custom coding standard</description>
<rule ref="PEAR">
<exclude name="PEAR.Commenting.ClassComment"/>
<exclude name="PEAR.Commenting.FileComment"/>
<exclude name="PEAR.Commenting.FunctionComment"/>
<exclude name="PEAR.Commenting.InlineComment"/>
<exclude name="PEAR.Classes.ClassDeclaration"/>
<exclude name="Generic.Files.LineEndings"/>
</rule>
<rule ref="PEAR.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="2"/>
</properties>
</rule>
</ruleset>
La stanza finale all'interno del file xml imposta l'app proprietà appropriata.
Per fare questo, è necessario sapere che
A) il rientro Sniff (regola) è PEAR.WhiteSpace.ScopeIndent
B) la proprietà su quel sniff è chiamato indent
.
Poi, phpcs eseguiti come di consueto in questo modo:
\php\php.exe phpcs\scripts\phpcs --standard=NewStandard --report=emacs MyCode.php
documentazione:
http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php
+2 - ben fatto domanda e risposta. E sì, i documenti non sono così buoni, quindi molto graditi. – hakre