When using a class constant which has the same name as a PHP constant, the check WebimpressCodingStandard.PHP.ImportInternalConstant throws an error, even if it shouldn't.
For example:
<?php
declare(strict_types=1);
namespace Foo;
class Test {
private const TRUE = 'true';
}
results in this error:
vendor/bin/phpcs --sniffs="WebimpressCodingStandard.PHP.ImportInternalConstant" Test.php
FILE: /mnt/e/PhpStormProjects/Test.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
8 | ERROR | [x] PHP internal constant "TRUE" must be imported
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
That happens with more such constants. In one of our projects I get 4 errors, with class constants TRUE, FALSE, SORT_ASC and SORT_DESC.
It doesn't matter if the constant is public or private.
When using a class constant which has the same name as a PHP constant, the check
WebimpressCodingStandard.PHP.ImportInternalConstant
throws an error, even if it shouldn't. For example:results in this error:
That happens with more such constants. In one of our projects I get 4 errors, with class constants
TRUE
,FALSE
,SORT_ASC
andSORT_DESC
. It doesn't matter if the constant ispublic
orprivate
.