magento-coding-standard
magento-coding-standard copied to clipboard
Do not recommend using static:: for private constants
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 - https://github.com/magento/magento2/pull/28797 https://github.com/magento/magento2/pull/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.
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
- Join Magento Community Engineering Slack and ask your questions in #github channel.