Active
Project:
Drupal core
Version:
10.6.x-dev
Component:
other
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
22 Jun 2025 at 10:26 UTC
Updated:
16 Oct 2025 at 07:04 UTC
Jump to comment: Most recent
We added PHPStan\Rules\Classes\AccessPrivateConstantThroughStaticRule to rules in 11.x - we could add this to 10.6.x too.
See https://git.drupalcode.org/project/drupal/-/commit/403d53b26d5fc13f43e0b...
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
Comment #2
nicxvan commentedI 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.
Comment #3
alexpott@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.
Comment #4
alexpottAnd for that matter any private static variable - they should be never be accessed with static:: unless the class is final...