Components (ie, Report, Dimension, Menu, etc. subclasses) should immutable singletons #6229
Labels
answered
For when a question was asked and we referred to forum or answered it.
c: Platform
For Matomo platform changes that aren't impacting any of our APIs but improve the core itself.
Task
Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone
These classes mainly provide metadata regarding plugin extensibility so there's no reason for them to be instantiated outside of Piwik core, nor is there reason for them to be modified outside of the classes themselves. Thus, they should be immutable and object identity should provide object equality (eg, there should only be one instance of each subclass created). They could potentially be stored in a DI container, however, it should be noted that since they do not need to be configured, they should be instantiated automatically and not be referenced in DI config.
The text was updated successfully, but these errors were encountered: