Skip to content

Commit

Permalink
Fixed bug #19374 : HEREDOC/NOWDOC Indentation problems
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Apr 11, 2012
1 parent 3d66c81 commit f19c536
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
?>
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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="/">
Expand Down

0 comments on commit f19c536

Please sign in to comment.