Edit report at http://pear.php.net/bugs/bug.php?id=18973&edit=1
ID: 18973
Comment by: brian.kendig@disney.com
Reported By: brian dot kendig at disney dot com
Summary: phpcs is looking for variables in a nowdoc
Status: Open
Type: Bug
Package: PHP_CodeSniffer
Operating System: Mac OS X 10.6.8
Package Version: SVN
PHP Version: 5.3.8
Roadmap Versions:
New Comment:
The same error also occurs in heredocs. php won't recognize $456 as a
valid variable name, so phpcs shouldn't be catching it either.
Previous Comments:
------------------------------------------------------------------------
[2011-11-08 17:33:51] bkendig
Description:
------------
A quoted value in a nowdoc, like "$456", gives an error: Variable
"456" is not in valid camel caps format
According to
"http://php.net/manual/en/language.types.string.php", text in
nowdocs is not parsed. phpcs should not be flagging an error
here.
Test script:
---------------
$ cat foo.php
<?php
$foo = <<<'BAR'
$123
"$456"
BAR;
Expected result:
----------------
Nothing.
Actual result:
--------------
$ php PHP_CodeSniffer/scripts/phpcs -- foo.php --
standard=Zend
FILE: /Users/brkendig/foo.php
------------------------------------------------------------------------
--------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
------------------------------------------------------------------------
--------
4 | ERROR | Variable "456" is not in valid camel caps format
------------------------------------------------------------------------
--------
------------------------------------------------------------------------