svn: /pear/peardoc/trunk/en/package/php/php-codesniffer/ advanced-usage.xml
| From: | Greg Sherwood | Date: | Wed, 02 Sep 2009 05:34:36 +0000 |
| Subject: | svn: /pear/peardoc/trunk/en/package/php/php-codesniffer/ advanced-usage.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-11768@lists.php.net to get a copy of this message | ||
squiz Wed, 02 Sep 2009 05:34:36 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=287960
Log:
Added docs for the @CodingStandardsIgnore* tags
Changed paths:
U pear/peardoc/trunk/en/package/php/php-codesniffer/advanced-usage.xml
Modified: pear/peardoc/trunk/en/package/php/php-codesniffer/advanced-usage.xml
===================================================================
--- pear/peardoc/trunk/en/package/php/php-codesniffer/advanced-usage.xml 2009-09-02 04:30:56 UTC
(rev 287959)
+++ pear/peardoc/trunk/en/package/php/php-codesniffer/advanced-usage.xml 2009-09-02 05:34:36 UTC
(rev 287960)
@@ -60,9 +60,44 @@
]]>
</screen>
</example>
+ <note>
+ <simpara>
+ You can also tell PHP_CodeSniffer to ignore a file using a special comment inserted at the top
of the file. This will stop the file being checked even if it does not match the ignore pattern.
+ </simpara>
+ <example><info><title>Ignoring parts of a file</title></info>
+ <screen>
+<![CDATA[
+<?php
+// @codingStandardsIgnoreFile
+$xmlPackage = new XMLPackage;
+$xmlPackage['error_code'] = get_default_error_code_value();
+$xmlPackage->send();
+?>
+]]>
+ </screen>
+ </example>
+ </note>
</refsection>
+ <refsection
xml:id="package.php.php-codesniffer.advanced-usage.ignore-file-parts"><info><title>Ignoring
Parts of a File</title></info>
+ <para>
+ Some parts of your code may be unable to conform to your coding standard. For example, you might
have to break your standard to integrate with an external library or web service. To stop
PHP_CodeSniffer generating errors for this code, you can wrap it in special comments.
PHP_CodeSniffer will then hide all errors and warnings that are generated for these lines of code.
+ </para>
+ <example><info><title>Ignoring parts of a file</title></info>
+ <screen>
+<![CDATA[
+$xmlPackage = new XMLPackage;
+// @codingStandardsIgnoreStart
+$xmlPackage['error_code'] = get_default_error_code_value();
+// @codingStandardsIgnoreEnd
+$xmlPackage->send();
+]]>
+ </screen>
+ </example>
+ </refsection>
+
+
<refsection
xml:id="package.php.php-codesniffer.advanced-usage.sniffs"><info><title>Limiting
Results to Specific Sniffs</title></info>
<para>
By default, PHP_CodeSniffer will ceck your code using all sniffs in the specified standard.
Sometimes you may want to find all occcurances of an error to eliminate it more quickly or
understand the scope of the problem. PHP_CodeSniffer allows you to specify a list of sniffs to limit
results to using the <literal>--sniffs</literal> command line argument. Sniffs are
separated by commas.
@@ -107,7 +142,6 @@
To set a configuration option, use the <literal>--config-set</literal> command line
argument.
</para>
<example><info><title>Setting a configuration option</title></info>
-
<screen>
<![CDATA[
$ phpcs --config-set <option> <value>