diff --git a/package.xml b/package.xml index c5fc6a9b5a..8e6ec1d628 100644 --- a/package.xml +++ b/package.xml @@ -30,6 +30,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> -- Thanks to Matthew Peveler for the patch - Fixed bug #2751 : Autoload relative paths first to avoid confusion with files from the global include path -- Thanks to Klaus Purer for the patch + - Fixed bug #2768 : Generic.Files.LineLength false positive for non-breakable strings at exactly the soft limit + -- Thanks to Alex Miles for the patch diff --git a/src/Standards/Generic/Sniffs/Files/LineLengthSniff.php b/src/Standards/Generic/Sniffs/Files/LineLengthSniff.php index 9e199e8960..525c5f2138 100644 --- a/src/Standards/Generic/Sniffs/Files/LineLengthSniff.php +++ b/src/Standards/Generic/Sniffs/Files/LineLengthSniff.php @@ -158,7 +158,7 @@ protected function checkLineLength($phpcsFile, $tokens, $stackPtr) // to ignore the line length in these cases if the URL would be longer than the max // line length once you indent it to the correct level. if ($lineLength > $this->lineLimit) { - $oldLength = $tokens[$stackPtr]['length']; + $oldLength = strlen($tokens[$stackPtr]['content']); $newLength = strlen(ltrim($tokens[$stackPtr]['content'], "/#\t ")); $indent = (($tokens[$stackPtr]['column'] - 1) + ($oldLength - $newLength)); diff --git a/src/Standards/Generic/Tests/Files/LineLengthUnitTest.3.inc b/src/Standards/Generic/Tests/Files/LineLengthUnitTest.3.inc index 8b250edd77..5c12a83b29 100644 --- a/src/Standards/Generic/Tests/Files/LineLengthUnitTest.3.inc +++ b/src/Standards/Generic/Tests/Files/LineLengthUnitTest.3.inc @@ -5,3 +5,12 @@ phpcs:set Generic.Files.LineLength absoluteLineLimit 150 /* This line is fine. This line is fine. This line is fine. This line is fine. This line is fine. */ /* This line is too long. This line is too long. This line is too long. This line is too long. This line is too long. This line is too long. */ /* This line is too long. This line is too long. This line is too long. This line is too long. This line is too long. This line is too long. This line is too long. */ + + /* + | ... + http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematoo + http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool + http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool1 + http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool12 + | ... + */