Browse files

Fixed bug #19374 : HEREDOC/NOWDOC Indentation problems

  • Loading branch information...
1 parent 3d66c81 commit f19c5365800772d4ebcdb175c6c6ac5852e5d870 @gsherwood gsherwood committed Apr 11, 2012
View
8 CodeSniffer/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php
@@ -184,11 +184,15 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
// If this is a HEREDOC then we need to ignore it as the
// whitespace before the contents within the HEREDOC are
// considered part of the content.
- if ($tokens[$i]['code'] === T_START_HEREDOC) {
+ if ($tokens[$i]['code'] === T_START_HEREDOC
+ || $tokens[$i]['code'] === T_START_NOWDOC
+ ) {
$inHereDoc = true;
continue;
} else if ($inHereDoc === true) {
- if ($tokens[$i]['code'] === T_END_HEREDOC) {
+ if ($tokens[$i]['code'] === T_END_HEREDOC
+ || $tokens[$i]['code'] === T_END_NOWDOC
+ ) {
$inHereDoc = false;
}
View
13 CodeSniffer/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.inc
@@ -397,4 +397,17 @@ $myFunction = function() {
$a = 403;
}
}
+
+class Whatever
+{
+ protected $_protectedArray = array(
+ 'normalString' => 'That email address is already in use!',
+ 'offendingString' => <<<'STRING'
+Each line of this string is always said to be at column 0,
+ no matter how many spaces are placed
+ at the beginning of each line
+and the ending STRING on the next line is reported as having to be indented.
+STRING
+ );
+}
?>
View
1 package.xml
@@ -43,6 +43,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Fixed bug #19324 : Setting show_warnings configuration option does not work
- Fixed bug #19354 : Not recognizing references passed to method
- Fixed bug #19361 : CSS tokenzier generates errors when PHP embedded in CSS file
+ - Fixed bug #19374 : HEREDOC/NOWDOC Indentation problems
</notes>
<contents>
<dir name="/">

0 comments on commit f19c536

Please sign in to comment.