Skip to content

Do not recommend using static:: for private constants #197

Open
@ihor-sviziev

Description

@ihor-sviziev

Rule

Using static:: for private constants and methods discouraged.

Reason

In case if someone will extend the class OR create plugin for it - he will get the Undefined class constant error.
In past we had few issues related to this - magento/magento2#28797 magento/magento2#29925.

We had it only with constants, but potentially the same issue could appear with static method calls.

Implementation

Detect all private constants in the class and all static:: calls to them and add warning if such case detected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions