Skip to content

Pick 'self::' or 'static::' for the 'MOD_ID' constant #255

Description

@AlexSkrypnyk

Deferred from the codebase convergence work. Every fix here renames or reshapes a published symbol of this library, so it is a backward-compatibility break and was deliberately left out of the non-breaking follow-up.

Summary

BehatScreenshotExtension reads its own MOD_ID constant two different ways, and the two are not equivalent for subclasses.

Details

  • getConfigKey() uses self::MOD_ID.
  • load() uses static::MOD_ID.

MOD_ID is a public constant on a non-final extension class. A consumer rebranding the extension by subclassing it and overriding the constant gets the overridden value in load() but the original in getConfigKey() - so half the rebrand works and half does not, silently.

This is not a style question. Converging on self:: locks the constant against subclass override; converging on static:: makes overriding it work consistently. Either is defensible, but the current mix produces behaviour nobody chose, and picking either changes what an existing subclass does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions