Bug #19694 [Opn->Fbk]: Squiz.PHP.LowercasePHPFunctions incorrectly matches on class methods.

From: Date: Wed, 07 Nov 2012 01:48:35 +0000
Subject: Bug #19694 [Opn->Fbk]: Squiz.PHP.LowercasePHPFunctions incorrectly matches on class methods.
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-9295@lists.php.net to get a copy of this message
Edit report at https://pear.php.net/bugs/bug.php?id=19694&edit=1 ID: 19694 Updated by: gsherwood@squiz.net Reported By: pear at kennel17 dot co dot uk Summary: Squiz.PHP.LowercasePHPFunctions incorrectly matches on class methods. -Status: Open +Status: Feedback Type: Bug Package: PHP_CodeSniffer Operating System: All Package Version: 1.4.1 PHP Version: Irrelevant -Assigned To: +Assigned To: squiz Roadmap Versions: New Comment: -Status: Open +Status: Feedback -Assigned To: +Assigned To: squiz There is already code in there to make sure the function name doesnt have a -> or :: in front of it and that code has been there for 2 years, so I don't think you'd have an old file. Are you able to give me some sample code that produces the error and show me what output you get from running PHPCS on your file with the built-in Squiz standard. Previous Comments: ------------------------------------------------------------------------ [2012-11-07 01:19:10] happydog Description: ------------ Squiz.PHP.LowercasePHPFunctions reports errors if any of the built-in PHP functions are used with the incorrect case. However, it gives false positives when you have class methods that happen to match an existing PHP function and your coding style is such that it is not in lower-case. An example that we use all over the place is providing a static Count() function for our data objects, which returns the number of objects of that type currently in the system. Any call to these functions is flagged as incorrect, even though it is not. Expected result: ---------------- That the sniff correctly identifies when a function call is actually a method call, i.e. to distinguish count() from ::count() or ->count() and to only check function calls for correct casing. Actual result: -------------- Class methods are also being checked, which can result in a lot of false positives if you use a coding style that is not lower-case. ------------------------------------------------------------------------ -- Edit this bug report at https://pear.php.net/bugs/bug.php?id=19694&edit=1

« previous php.pear.bugs (#9295) next »