From: Matthias Schmidt Date: Wed, 21 Apr 2021 14:48:44 +0000 (+0200) Subject: Change `$genericDboActionNames` into private constant in `AbstractEventListener` X-Git-Tag: 5.4.0_Alpha_1~66 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=af0bc3691b055c9ea890226987c6b1d6f5089fd9;p=GitHub%2FWoltLab%2FWCF.git Change `$genericDboActionNames` into private constant in `AbstractEventListener` --- 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);