From af0bc3691b055c9ea890226987c6b1d6f5089fd9 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 21 Apr 2021 16:48:44 +0200 Subject: [PATCH] Change `$genericDboActionNames` into private constant in `AbstractEventListener` --- .../event/listener/AbstractEventListener.class.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/system/event/listener/AbstractEventListener.class.php b/wcfsetup/install/files/lib/system/event/listener/AbstractEventListener.class.php index e3aa1ccfd6..f4c0c97d0e 100644 --- a/wcfsetup/install/files/lib/system/event/listener/AbstractEventListener.class.php +++ b/wcfsetup/install/files/lib/system/event/listener/AbstractEventListener.class.php @@ -28,16 +28,24 @@ use wcf\data\AbstractDatabaseObjectAction; */ abstract class AbstractEventListener implements IParameterizedEventListener { + /** + * Names of events of `AbstractDatabaseObjectAction` for which the listener tries to call + * specific event handler methods for the executed action. + */ + private const DBOACTION_EVENT_NAMES = [ + 'finalizeAction', + 'initializeAction', + 'validateAction', + ]; + /** * @inheritDoc */ final public function execute($eventObj, $className, $eventName, array &$parameters) { - static $genericDboActionNames = ['finalizeAction', 'initializeAction', 'validateAction']; - $methodName = 'on' . \ucfirst($eventName); - if ($eventObj instanceof AbstractDatabaseObjectAction && \in_array($eventName, $genericDboActionNames)) { + if ($eventObj instanceof AbstractDatabaseObjectAction && \in_array($eventName, self::DBOACTION_EVENT_NAMES)) { $actionMethod = $methodName . \ucfirst($eventObj->getActionName()); if (\method_exists($this, $actionMethod)) { $this->{$actionMethod}($eventObj, $parameters); -- 2.20.1