Problem/Motivation

We added PHPStan\Rules\Classes\AccessPrivateConstantThroughStaticRule to rules in 11.x - we could add this to 10.6.x too.

Proposed resolution

See https://git.drupalcode.org/project/drupal/-/commit/403d53b26d5fc13f43e0b...

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3531606

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

alexpott created an issue.

nicxvan’s picture

I think this would prevent hitting the linked issue, but I think this is addressing the symptom not the cause.

I still think the root cause is using private in the first place.

alexpott’s picture

@nicxvan I disagree. The root cause is using stattic:: to get a private const - which this detects. Private constants in an of themselves are not the root cause. We have the same issue with a private static method... that should never be called using static:: either - it would cause the same problems.

alexpott’s picture

And for that matter any private static variable - they should be never be accessed with static:: unless the class is final...

santanu mondal made their first commit to this issue’s fork.