FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=18266&edit=1

ID: 18266
Updated by: gsherwood@squiz.net
Reported By: mrten+pear at ii dot nl
Summary: Extra check in populateTokenListeners()
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: PHP_CodeSniffer
Operating System: Unix
Package Version: 1.3.0RC2
PHP Version: 5.3.1
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Open
+Status: Wont fix
-Assigned To:
+Assigned To: squiz
I'm not going to add this in simply because I don't think I need all
those extra is_array calls while processing. This issue will be found
during sniff development and so would never occur during a normal code
check. I don't want to reduce performance (even slightly) for regular
users when they wouldn't encounter these warnings.


Previous Comments:
------------------------------------------------------------------------

[2011-02-11 17:06:07] mrten

Added #patch
bug:18266;patch:add-tokenlistener-arrayofarrays-check;revision:1297443966;.

------------------------------------------------------------------------

[2011-02-11 17:04:15] mrten

Description:
------------
I ran into a small problem when I inadvertently returned an array of
arrays in register() in a Sniff:

public function register() {
return array(PHP_CodeSniffer_Tokens::$scopeOpeners);
}//end register()

This in turn makes Codesniffer report some notices:

Warning: Illegal offset type in isset or empty in
/usr/share/php/PHP/CodeSniffer.php on line 951
Warning: Illegal offset type in /usr/share/php/PHP/CodeSniffer.php on
line 952
Warning: Illegal offset type in /usr/share/php/PHP/CodeSniffer.php on
line 955
Warning: in_array() expects parameter 2 to be array, null given in
/usr/share/php/PHP/CodeSniffer.php on line 955

Now, I understand that this is my problem, but since the code is already
checking that register() returns an array I thought it also would be
nice if it checked that it wasn't an array of arrays.

Attached is a patch.

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedApr 8, '11 at 6:19a
activeApr 8, '11 at 6:19a
posts1
users1
websitepear.php.net

1 user in discussion

Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase