Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/private/EventDispatcher/EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function dispatchTyped(Event $event): void {

/**
* @return SymfonyDispatcher
* @deprecated 20.0.0
*/
public function getSymfonyDispatcher(): SymfonyDispatcher {
return $this->dispatcher;
Expand Down
16 changes: 16 additions & 0 deletions lib/private/EventDispatcher/SymfonyAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
* @deprecated 20.0.0 use \OCP\EventDispatcher\IEventDispatcher
*/
class SymfonyAdapter implements EventDispatcherInterface {

/** @var EventDispatcher */
private $eventDispatcher;
/** @var ILogger */
private $logger;

/**
* @deprecated 20.0.0
*/
public function __construct(EventDispatcher $eventDispatcher, ILogger $logger) {
$this->eventDispatcher = $eventDispatcher;
$this->logger = $logger;
Expand All @@ -57,6 +63,7 @@ public function __construct(EventDispatcher $eventDispatcher, ILogger $logger) {
* If not supplied, an empty Event instance is created
*
* @return void
* @deprecated 20.0.0
*/
public function dispatch($eventName, $event = null) {
// type hinting is not possible, due to usage of GenericEvent
Expand Down Expand Up @@ -85,6 +92,7 @@ public function dispatch($eventName, $event = null) {
* @param callable $listener The listener
* @param int $priority The higher this value, the earlier an event
* listener will be triggered in the chain (defaults to 0)
* @deprecated 20.0.0
*/
public function addListener($eventName, $listener, $priority = 0) {
if (is_callable($listener)) {
Expand All @@ -100,6 +108,7 @@ public function addListener($eventName, $listener, $priority = 0) {
*
* The subscriber is asked for all the events it is
* interested in and added as a listener for these events.
* @deprecated 20.0.0
*/
public function addSubscriber(EventSubscriberInterface $subscriber) {
$this->eventDispatcher->getSymfonyDispatcher()->addSubscriber($subscriber);
Expand All @@ -110,11 +119,15 @@ public function addSubscriber(EventSubscriberInterface $subscriber) {
*
* @param string $eventName The event to remove a listener from
* @param callable $listener The listener to remove
* @deprecated 20.0.0
*/
public function removeListener($eventName, $listener) {
$this->eventDispatcher->getSymfonyDispatcher()->removeListener($eventName, $listener);
}

/**
* @deprecated 20.0.0
*/
public function removeSubscriber(EventSubscriberInterface $subscriber) {
$this->eventDispatcher->getSymfonyDispatcher()->removeSubscriber($subscriber);
}
Expand All @@ -125,6 +138,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber) {
* @param string|null $eventName The name of the event
*
* @return array The event listeners for the specified event, or all event listeners by event name
* @deprecated 20.0.0
*/
public function getListeners($eventName = null) {
return $this->eventDispatcher->getSymfonyDispatcher()->getListeners($eventName);
Expand All @@ -139,6 +153,7 @@ public function getListeners($eventName = null) {
* @param callable $listener The listener
*
* @return int|null The event listener priority
* @deprecated 20.0.0
*/
public function getListenerPriority($eventName, $listener) {
return $this->eventDispatcher->getSymfonyDispatcher()->getListenerPriority($eventName, $listener);
Expand All @@ -150,6 +165,7 @@ public function getListenerPriority($eventName, $listener) {
* @param string|null $eventName The name of the event
*
* @return bool true if the specified event has any listeners, false otherwise
* @deprecated 20.0.0
*/
public function hasListeners($eventName = null) {
return $this->eventDispatcher->getSymfonyDispatcher()->hasListeners($eventName);
Expand Down