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

  ID: 19997
  Updated by: gsherwood@squiz.net
  Reported By: shane dot auckland@gmail.com
  Summary: Class names incorrectly detected as constants
-Status: Open
+Status: Closed
  Type: Bug
  Package: PHP_CodeSniffer
  Operating System: CentOS 6.4
  Package Version: 1.4.5
  PHP Version: Irrelevant
-Assigned To:
+Assigned To: squiz
  Roadmap Versions:
  New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: squiz
Fix committed to github repo:
https://github.com/squizlabs/PHP_CodeSniffer/commit/ed9e03367c1f1e17e0b83a0cc8
e0ce6fb56b992a


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

[2013-06-26 14:47:37] shanethehat

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"'

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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJun 26, '13 at 11:16p
activeJun 26, '13 at 11:16p
posts1
users1
websitepear.php.net

1 user in discussion

Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase