Bug #19374 [Opn->Csd]: HEREDOC/NOWDOC Indentation problems
| From: | gsherwood at squiz dot net | Date: | Wed, 11 Apr 2012 05:01:15 +0000 |
| Subject: | Bug #19374 [Opn->Csd]: HEREDOC/NOWDOC Indentation problems | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8552@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19374&edit=1
ID: 19374
Updated by: gsherwood@squiz.net
Reported By: echosa at gmail dot com
Summary: HEREDOC/NOWDOC Indentation problems
-Status: Open
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: Mac OS X 10.7.3
Package Version: 1.3.3
PHP Version: 5.3.8
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: squiz
The sniff reporting this issue already skipped heredocs, but didn't get
nowdoc
support. I've added that now and it should fix this issue. Commit is
here:
https://github.com/squizlabs/PHP_CodeSniffer/commit/f19c5365800772d4ebcdb175c
6c6ac5852e5d870
Previous Comments:
------------------------------------------------------------------------
[2012-04-05 19:04:29] echosa
Description:
------------
HEREDOC/NOWDOC strings are incorrectly reported as having
no indentation and needing to be indented 4 spaces. This
includes the the opening tag (if on its own line) and the closing
tag (which should never be indented).
Specifically, this is happening to me when using a NOWDOC as a
protected class property array default value.
Test script:
---------------
<?php
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
);
}
Expected result:
----------------
I would expect the script to pass cleanly, with the exception of
the missing file and class doc comments.
Actual result:
--------------
test.php|2 col 1 error| Missing file doc comment
test.php|2 col 1 error| Missing class doc comment
test.php|7 col 1 error| Line indented incorrectly; expected at
least 4 spaces, found 0
test.php|8 col 1 error| Line indented incorrectly; expected at
least 4 spaces, found 0
test.php|9 col 1 error| Line indented incorrectly; expected at
least 4 spaces, found 0
test.php|10 col 1 error| Line indented incorrectly; expected at
least 4 spaces, found 0
test.php|11 col 1 error| Line indented incorrectly; expected at
least 4 spaces, found 0
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19374&edit=1