PHP

PHP

By DeepSource

Class constants don't comply with PSR standards PHP-C1000

Style

As per PSR-1, class constants must be declared in all upper cases with underscore separators only.

It is recommended to follow PSR standards while developing PHP applications so the code is consistent and can be easily maintained.

Bad practice

class User
{
    // invalid: class constants can't be defined in lowercase
    public const active = '1';

    // invalid: class constants can't be in camel case
    public const inActive = '0';
}

Recommended

class User
{
    // make sure class constants must be declared in upper case
    public const ACTIVE = '1';

    // use underscore as a separators
    public const IN_ACTIVE = '0';
}