Rule constant_case
¶
The PHP constants true
, false
, and null
MUST be written using the
correct casing.
Configuration¶
case
¶
Whether to use the upper
or lower
case syntax.
Allowed values: 'lower'
and 'upper'
Default value: 'lower'
Examples¶
Example #1¶
Default configuration.
--- Original
+++ New
<?php
-$a = FALSE;
-$b = True;
-$c = nuLL;
+$a = false;
+$b = true;
+$c = null;
Example #2¶
With configuration: ['case' => 'upper']
.
--- Original
+++ New
<?php
$a = FALSE;
-$b = True;
-$c = nuLL;
+$b = TRUE;
+$c = NULL;
Rule sets¶
The rule is part of the following rule sets:
References¶
Fixer class: PhpCsFixer\Fixer\Casing\ConstantCaseFixer
Test class: PhpCsFixer\Tests\Fixer\Casing\ConstantCaseFixerTest
The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.