Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ihor-sviziev opened this issue Oct 10, 2020 · 1 comment
Open

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

ihor-sviziev opened this issue Oct 10, 2020 · 1 comment
Labels

Comments

@ihor-sviziev
Copy link
Collaborator

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.

@ihor-sviziev ihor-sviziev added the proposal New rule proposal label Oct 10, 2020
@m2-assistant
Copy link

m2-assistant bot commented Oct 10, 2020

Hi @ihor-sviziev. Thank you for your report.
To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant