Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.2

Bug #19997 Class names incorrectly detected as constants
Submitted: 2013-06-26 18:47 UTC
From: shanethehat Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.4.5)
PHP Version: Irrelevant OS: CentOS 6.4
Roadmaps: (Not assigned)    
Subscription  


 [2013-06-26 18:47 UTC] shanethehat (Shane Auckland)
Description: ------------ Class names such as 'True' and 'False' are incorrectly detected as mixed case constants by the LowerCaseConstantSniff. An example block of code from a real world application follows, running the PSR2 ruleset against it results in a false error being raised against the use of the Symfony True constraint object. PHP version is CentOS6.4 default package version of 5.3.3. Test script: --------------- use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints\True; class MyFormType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add( 'propertyName', 'checkbox', array( 'constraints' => new True( array( 'message' => 'Constraint message' )),));}} Expected result: ---------------- Running the PSR2 ruleset against the provided code should not consider the True constraint object to be a constant. Actual result: -------------- Running the PSR2 ruleset against the provided code presents the error: 'TRUE, FALSE and NULL must be lowercasecase; expected "true" but found "True"'

Comments

 [2013-06-27 05:19 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
Fix committed to github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/ed9e03367c1f1e17e0b83a0cc8 e0ce6fb56b992a