Edit report at https://pear.php.net/bugs/bug.php?id=19469&edit=1
ID: 19469
Updated by: [email protected]
Reported By: [email protected]
Summary: PHP_CodeSniffer_File::getMemberProperties() sets
wrong scope
Status: Open
Type: Bug
Package: PHP_CodeSniffer
Operating System: windows 7
Package Version: 1.3.4
PHP Version: 5.3.8
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:
-Assigned To:
+Assigned To: squiz
Firstly, this has nothing to do with Windows, so I'm not sure why you
have mentioned
the file comment sniff on windows. I'm ignoring that bit for now.
Secondly, only private members can have a leading underscore in you are
using the
PEAR or Squiz standards (you don't say which specific sniff you are
using) so you will
have to remove the underscore from those protected vars if you want the
sniff to
pass.
I will have a look into why the core is not getting the correct
visibility, but it was
certainly not written with the syntax you are using in mind. You'll need
to split those
member vars into separate lines if you want to conform with commenting
standards.
But PHPCS should parse it correctly regardless, so I will get it fixed.
Previous Comments:
------------------------------------------------------------------------
[2012-06-10 17:01:39] juanmf
Description:
------------
Hi, I'm using PHPCS 1.3.3 sicne 1.3.4 has lots of bugs with
Windows paths when sniff are specified with this notation
"PEAR.Commenting.FileComment".
The problem is that
PHP_CodeSniffer_File::getMemberProperties() says that $_key
is public in code like the following (see Test script). Therefore
the ValidVariableName sniff complains about the leading
underscore.
Thanks!
Test script:
---------------
class a
{
protected
$_sheet,
$_FieldParser,
$_key;
}
Expected result:
----------------
$_key should pass since its protected.
Actual result:
--------------
$_key fires this:
Public member variable "_key" must not contain a leading
underscore.
------------------------------------------------------------------------