From 10a72972f970684e8cc8f9a78df6aa0edf6e9b92 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 24 Aug 2014 17:52:20 +0200 Subject: [PATCH] Rename \wcf\system\event\listener\IEventListener to IParameterizedEventListener This is for BC reasons, as PHP does not allow using a class of another namespace when a class with the same name already exists within the same namespace. IParameterizedEventListener will be aliased to IEventListener when \wcf\system\event\IEventListener is removed. see bd8f17f01975dacba19199ac4b7f4bba567f3e98 --- .../files/lib/system/event/EventHandler.class.php | 14 +++++++------- .../lib/system/event/IEventListener.class.php | 2 +- ...s.php => IParameterizedEventListener.class.php} | 5 ++++- .../listener/PreParserAtUserListener.class.php | 4 ++-- .../listener/SessionAccessLogListener.class.php | 4 ++-- 5 files changed, 16 insertions(+), 13 deletions(-) rename wcfsetup/install/files/lib/system/event/listener/{IEventListener.class.php => IParameterizedEventListener.class.php} (75%) diff --git a/wcfsetup/install/files/lib/system/event/EventHandler.class.php b/wcfsetup/install/files/lib/system/event/EventHandler.class.php index d22fed086e..6e5da6ee2d 100644 --- a/wcfsetup/install/files/lib/system/event/EventHandler.class.php +++ b/wcfsetup/install/files/lib/system/event/EventHandler.class.php @@ -1,7 +1,7 @@ inheritedActionsObjects[$name] as $actionObj) { - if ($actionObj instanceof IEventListener) { + if ($actionObj instanceof IParameterizedEventListener) { $actionObj->execute($eventObj, $className, $eventName, $parameters); if (!is_array($parameters)) { @@ -193,10 +193,10 @@ class EventHandler extends SingletonFactory { if (!class_exists($action['listenerClassName'])) { throw new SystemException("Unable to find class '".$action['listenerClassName']."'"); } - if (!ClassUtil::isInstanceOf($action['listenerClassName'], 'wcf\system\event\listener\IEventListener')) { + if (!ClassUtil::isInstanceOf($action['listenerClassName'], 'wcf\system\event\listener\IParameterizedEventListener')) { // legacy event listeners if (!ClassUtil::isInstanceOf($action['listenerClassName'], 'wcf\system\event\IEventListener')) { - throw new SystemException("'".$action['listenerClassName']."' does not implement 'wcf\system\event\listener\IEventListener'"); + throw new SystemException("'".$action['listenerClassName']."' does not implement 'wcf\system\event\listener\IParameterizedEventListener'"); } } @@ -210,7 +210,7 @@ class EventHandler extends SingletonFactory { // execute actions foreach ($this->actionsObjects[$name] as $actionObj) { - if ($actionObj instanceof IEventListener) { + if ($actionObj instanceof IParameterizedEventListener) { $actionObj->execute($eventObj, $className, $eventName, $parameters); if (!is_array($parameters)) { diff --git a/wcfsetup/install/files/lib/system/event/IEventListener.class.php b/wcfsetup/install/files/lib/system/event/IEventListener.class.php index 575abbea98..941d914d83 100644 --- a/wcfsetup/install/files/lib/system/event/IEventListener.class.php +++ b/wcfsetup/install/files/lib/system/event/IEventListener.class.php @@ -5,7 +5,7 @@ namespace wcf\system\event; * *DEPRECATED* * EventListeners can be registered for a specific event in many controller objects. * - * @deprecated since 2.1, use \wcf\system\event\listener\IEventListener + * @deprecated since 2.1, use \wcf\system\event\listener\IParameterizedEventListener * @author Marcel Werk * @copyright 2001-2014 WoltLab GmbH * @license GNU Lesser General Public License diff --git a/wcfsetup/install/files/lib/system/event/listener/IEventListener.class.php b/wcfsetup/install/files/lib/system/event/listener/IParameterizedEventListener.class.php similarity index 75% rename from wcfsetup/install/files/lib/system/event/listener/IEventListener.class.php rename to wcfsetup/install/files/lib/system/event/listener/IParameterizedEventListener.class.php index 208ba82309..1b2366b092 100644 --- a/wcfsetup/install/files/lib/system/event/listener/IEventListener.class.php +++ b/wcfsetup/install/files/lib/system/event/listener/IParameterizedEventListener.class.php @@ -3,6 +3,9 @@ namespace wcf\system\event\listener; /** * EventListeners can be registered for a specific event in many controller objects. + * NOTE: This class will be aliased to \wcf\system\event\listener\IEventListener in + * a future version. It is named IParameterizedEventListener for backwards + * compatibility reasons only. * * @author Tim Duesterhus, Marcel Werk * @copyright 2001-2014 WoltLab GmbH @@ -11,7 +14,7 @@ namespace wcf\system\event\listener; * @subpackage system.event.listener * @category Community Framework */ -interface IEventListener { +interface IParameterizedEventListener { /** * Executes this action. * diff --git a/wcfsetup/install/files/lib/system/event/listener/PreParserAtUserListener.class.php b/wcfsetup/install/files/lib/system/event/listener/PreParserAtUserListener.class.php index 3c92a13bb4..bb0f72bb36 100644 --- a/wcfsetup/install/files/lib/system/event/listener/PreParserAtUserListener.class.php +++ b/wcfsetup/install/files/lib/system/event/listener/PreParserAtUserListener.class.php @@ -17,9 +17,9 @@ use wcf\util\StringStack; * @subpackage system.event.listener * @category Community Framework */ -class PreParserAtUserListener implements IEventListener { +class PreParserAtUserListener implements IParameterizedEventListener { /** - * @see \wcf\system\event\listener\IEventListener::execute() + * @see \wcf\system\event\listener\IParameterizedEventListener::execute() */ public function execute($eventObj, $className, $eventName, array &$parameters) { if (!$eventObj->text) return; diff --git a/wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php b/wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php index 9f6d488de6..0a362b2780 100644 --- a/wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php +++ b/wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php @@ -16,9 +16,9 @@ use wcf\util\UserUtil; * @subpackage system.event.listener * @category Community Framework */ -class SessionAccessLogListener implements IEventListener { +class SessionAccessLogListener implements IParameterizedEventListener { /** - * @see \wcf\system\event\listener\IEventListener::execute() + * @see \wcf\system\event\listener\IParameterizedEventListener::execute() */ public function execute($eventObj, $className, $eventName, array &$parameters) { if (WCF::getUser()->userID && WCF::getSession()->getPermission('admin.general.canUseAcp') && !defined(get_class($eventObj).'::DO_NOT_LOG')) { -- 2.20.1