Add correct return types for getVariables methods

Created on 2 October 2023, over 1 year ago
Updated 4 October 2023, over 1 year ago

Problem/Motivation

Events like PagePreprocessEvent use an event-specific variables class instead of the generic AbstractPreprocessEvent. Their return types should indicate that.

Steps to reproduce

Look at the method name hints PhpStorm proposes for the return type of PagePreprocessEvent::getVariables(). Methods like isNodePage() are missing.

Proposed resolution

Add overloaded getVariables() methods with the more specific return type. An alternative would be to indicate the correct return type using a @method annotation in the class docblock.

📌 Task
Status

Fixed

Version

4.0

Component

Code

Created by

🇧🇪Belgium dieterholvoet Brussels

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

Comments & Activities

Production build 0.71.5 2024