Make RestLogSubscriber Properties Protected for Better Extensibility

Created on 28 November 2024, 24 days ago

Problem/Motivation

The RestLogSubscriber class in the rest_log module currently uses private properties, such as $stack. This design choice limits the ability of developers to extend and customize the class in their custom modules. As a result, developers are forced to use less ideal workarounds like PHP's Reflection API or closures to access these properties, which can lead to maintenance challenges and breaks encapsulation principles.

Steps to reproduce

  • Attempt to extend the RestLogSubscriber class in a custom module
  • Try to access or modify private properties such as $stack.
  • Notice that private properties cannot be accessed directly, requiring workarounds.

Proposed resolution

Change the visibility of private properties in the RestLogSubscriber class to protected. This change will allow subclasses to access and modify these properties directly, facilitating easier customization and extension of functionality.

Remaining tasks

  • Update the RestLogSubscriber class to change private properties to protected.
  • Review and test the changes to ensure no unintended side effects occur.
  • Update documentation if necessary to reflect these changes.

User interface changes

None. This change affects backend code only and does not impact the user interface.

API changes

The visibility change from private to protected will allow subclasses to access these properties, enhancing extensibility without altering existing public APIs.

Data model changes

None. This change does not affect the data model or database schema.

📌 Task
Status

Active

Version

2.3

Component

Code

Created by

🇳🇱Netherlands bonrita

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024