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

ID: 18762
Updated by: gsherwood@squiz.net
Reported By: bakert at gmail dot com
Summary: Incorrect handling of define and constant in
UpperCaseConstantNameSniff (patch)
-Status: Open
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: OS X Snow Leopard
Package Version: 1.3.0
PHP Version: 5.3.1
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: squiz
This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on pear.php.net
by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

Thanks for the patch.


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

[2011-09-03 15:51:53] bakert

Added #patch bug:18762;patch:bug18762.patch;revision:1315061513;.

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

[2011-08-28 03:49:59] bakert

Description:
------------
UpperCaseConstantNameSniff treats static methods named
"define" and "constant" as if they were the PHP "define" and
"constant" which gives false positives in
UpperCaseConstantNameSniff.

The following patch will fix:

162c162,163
< if ($tokens[$prev]['code'] ===
T_OBJECT_OPERATOR) {
---
if ($tokens[$prev]['code'] ===
T_OBJECT_OPERATOR
$tokens[$prev]['code'] ===
T_DOUBLE_COLON) {


Test script:
---------------
<?php

class A {
public static function constant($x) {}
}

A::constant('anything-not-in-uppercase');

// Now run phpcs on this file

Expected result:
----------------
No output.

Actual result:
--------------
Constants must be uppercase; expected 'ANYTHING-NOT-ALL-
CAPS' but found 'anything-not-all-caps'

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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedSep 12, '11 at 3:37a
activeSep 12, '11 at 3:37a
posts1
users1
websitepear.php.net

1 user in discussion

Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase