Skip to content

Commit 2c884a0

Browse files
committed
Merge branch 'master' into report-memory-improvements
Conflicts: package.xml
2 parents ad5046a + d8ed4e3 commit 2c884a0

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

CodeSniffer/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
260260
$column = $tokens[$firstToken]['column'];
261261

262262
// Ignore the token for indentation if it's in the ignore list.
263-
if (in_array($tokens[$firstToken]['code'], $this->ignoreIndentationTokens)) {
263+
if (in_array($tokens[$firstToken]['code'], $this->ignoreIndentationTokens)
264+
|| in_array($tokens[$firstToken]['type'], $this->ignoreIndentationTokens)
265+
) {
264266
continue;
265267
}
266268

CodeSniffer/Standards/PSR2/ruleset.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@
5656
<!-- 2.4 Indenting -->
5757

5858
<!-- Code MUST use an indent of 4 spaces, and MUST NOT use tabs for indenting. -->
59-
<rule ref="Generic.WhiteSpace.ScopeIndent"/>
59+
<rule ref="Generic.WhiteSpace.ScopeIndent">
60+
<properties>
61+
<property name="ignoreIndentationTokens" type="array" value="T_COMMENT,T_DOC_COMMENT"/>
62+
</properties>
63+
</rule>
6064
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
6165

6266
<!-- 2.5 Keywords and True/False/Null -->

README.markdown

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ The easiest way to install PHP\_CodeSniffer is to use the PEAR installer. This w
1919

2020
pear install PHP_CodeSniffer
2121

22-
If you use [Composer](http://getcomposer.org/), include a dependency for `squizlabs/php_codesniffer` in your `composer.json` file. For example:
22+
If you prefer using [Composer](http://getcomposer.org/) you can easily install PHP_CodeSniffer system-wide with the following command:
23+
24+
composer global require 'squizlabs/php_codesniffer=*'
25+
26+
Make sure you have `~/.composer/vendor/bin/` in your PATH.
27+
28+
Or alternatively, include a dependency for `squizlabs/php_codesniffer` in your `composer.json` file. For example:
2329

2430
{
2531
"require": {

package.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ http://pear.php.net/dtd/package-2.0.xsd">
2626
</stability>
2727
<license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD 3-Clause License</license>
2828
<notes>
29+
- Generic ScopeIndentSniff now allows for ignored tokens to be set via ruleset.xml files
30+
-- E.g., to ignore comments, override a property using:
31+
-- name="ignoreIndentationTokens" type="array" value="T_COMMENT,T_DOC_COMMENT"
32+
- PSR2 standard now ignores comments when checking indentation rules
2933
- Fixed bug #20093 : Bug with ternary operator token
3034
- Fixed bug #20097 : CLI.php throws error in php 5.2
3135
- Fixed bug #20100 : incorrect Function mysql() has been deprecated report

0 commit comments

Comments
 (0)