Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed bug #19699 : Generic.Files.LineLength giving false positives wh…

…en tab-width is used
  • Loading branch information...
commit dcf61b5f3feb677f190f5b0bbeac246533045c3b 1 parent 2e698c3
@gsherwood gsherwood authored
Showing with 4 additions and 31 deletions.
  1. +1 −9 CodeSniffer/File.php
  2. +3 −22 package.xml
View
10 CodeSniffer/File.php
@@ -1086,7 +1086,7 @@ private static function _convertTabs(&$tokens, $tokenizer, $eolChar)
if (strpos($tokenContent, "\t") === false) {
// There are no tabs in this content.
- $currColumn += (strlen($tokenContent) - 1);
+ $currColumn += strlen($tokenContent);
} else {
// We need to determine the length of each tab.
$tabs = preg_split(
@@ -1097,7 +1097,6 @@ private static function _convertTabs(&$tokens, $tokenizer, $eolChar)
);
$tabNum = 0;
- $adjustedTab = false;
$tabsToSpaces = array();
$newContent = '';
@@ -1119,7 +1118,6 @@ private static function _convertTabs(&$tokens, $tokenizer, $eolChar)
// This is the first tab, and we are already at a
// tab stop, so this tab counts as a single space.
$currColumn++;
- $adjustedTab = true;
} else {
$currColumn++;
while (($currColumn % PHP_CODESNIFFER_TAB_WIDTH) != 0) {
@@ -1134,10 +1132,6 @@ private static function _convertTabs(&$tokens, $tokenizer, $eolChar)
}//end if
}//end foreach
- if ($tabNum === 1 && $adjustedTab === true) {
- $currColumn--;
- }
-
$tokens[$i]['content'] = $newContent;
}//end if
@@ -1145,8 +1139,6 @@ private static function _convertTabs(&$tokens, $tokenizer, $eolChar)
&& $tokens[($i + 1)]['line'] !== $tokens[$i]['line']
) {
$currColumn = 1;
- } else {
- $currColumn++;
}
}//end for
View
25 package.xml
@@ -17,8 +17,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
<date>2012-11-09</date>
<time>13:32:00</time>
<version>
- <release>1.4.2</release>
- <api>1.4.2</api>
+ <release>1.4.3</release>
+ <api>1.4.3</api>
</version>
<stability>
<release>stable</release>
@@ -26,26 +26,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
</stability>
<license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD 3-Clause License</license>
<notes>
- - PHP_CodeSniffer can now be installed using Composer
- -- Require squizlabs/php_codesniffer in your composer.json file
- -- Thanks to Rob Bast, Stephen Rees-Carter, Stefano Kowalke and Ivan Habunek for help with this
- - Squiz BlockCommentSniff and InlineCommentSniff no longer report errors for trait block comments
- - Squiz SelfMemberReferenceSniff now supports namespaces
- -- Thanks to Andy Grunwald for the patch
- - Squiz FileCommentSniff now uses tag names inside the error codes for many messages
- -- This allows you to exclude specific missing, out of order etc., tags
- - Squiz SuperfluousWhitespaceSniff now has an option to ignore blank lines
- -- This will stop errors being reported for lines that contain only whitespace
- -- Set the ignoreBlankLines property to TRUE in your ruleset.xml file to enable this
- - PSR2 no longer reports errors for whitespace at the end of blank lines
- - Fixed gitblame report not working on Windows
- -- Thanks to Rogerio Prado de Jesus
- - Fixed an incorrect error in Squiz OperatorSpacingSniff for default values inside a closure definition
- - Fixed bug #19691 : SubversionPropertiesSniff fails to find missing properties
- -- Thanks to Kevin Winahradsky for the patch
- - Fixed bug #19692 : DisallowMultipleAssignments is triggered by a closure
- - Fixed bug #19693 : exclude-patterns no longer work on specific messages
- - Fixed bug #19694 : Squiz.PHP.LowercasePHPFunctions incorrectly matches return by ref functions
+ - Fixed bug #19699 : Generic.Files.LineLength giving false positives when tab-width is used
</notes>
<contents>
<dir name="/">
Please sign in to comment.
Something went wrong with that request. Please try again.