Make WordPress Core


Ignore:
Timestamp:
08/28/2026 04:57:25 AM (24 hours ago)
Author:
westonruter
Message:

Code Quality: Call WP_Theme_JSON's private statics via self::.

In r52744 this class's internal calls were rewritten from self:: to static:: so that the subclasses it was opening the class up to could override them. For a private method that buys nothing, since a subclass cannot supply one, and PHPStan reports it as unsafe: late static binding resolves static:: to the runtime class, where the private method is not visible. Thirty such call sites were left, reaching fourteen private statics. All fourteen are declared private static on WP_Theme_JSON itself, so self:: is behavior-identical. A docblock example on compute_spacing_sizes() showed the same form and is updated along with the code it documents.

This now eliminates the tests/phpstan/baselines/staticClassAccess.privateMethod.neon baseline. In r63368 the identifier was cleared from the four other classes reporting it, and WP_Theme_JSON was the last.

Developed as subset of https://github.com/WordPress/wordpress-develop/pull/13064.
Follow-up to r52744, r63020, r63368.

See #65817.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpstan.neon.dist

    r63381 r63384  
    7979        - tests/phpstan/baselines/return.unusedType.neon
    8080        - tests/phpstan/baselines/smallerOrEqual.alwaysTrue.neon
    81         - tests/phpstan/baselines/staticClassAccess.privateMethod.neon
    8281        - tests/phpstan/baselines/ternary.alwaysTrue.neon
    8382        - tests/phpstan/baselines/varTag.noVariable.neon
Note: See TracChangeset for help on using the changeset viewer.