Skip to content

[CodingStyle] Inline private constant, that is used only once #3702

@TomasVotruba

Description

@TomasVotruba

Some class constants are decoupled just fore its own sake.

The constants should be reusable static parts of the code, so it's used just once and one place.


Apply only for Scalar values, skip arrays, as they would clutter the code

class SomeClass
{
-    private const TYPE = 'SomeClass';

    public function isThisType($variable)
    {
-        return $this->checkType($variable, self::TYPE);
+        return $this->checkType($variable, 'SomeClass');
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions