Skip to content

Commit

Permalink
Fix interface usage for backport
Browse files Browse the repository at this point in the history
  • Loading branch information
lennartdohmann committed Sep 9, 2024
1 parent 068acaf commit ae9649e
Showing 1 changed file with 47 additions and 34 deletions.
81 changes: 47 additions & 34 deletions lib/SystemTag/SystemTagObjectMapperWithoutActivityFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

use OC\SystemTag\SystemTagObjectMapper;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IDBConnection;
use OCP\SystemTag\ISystemTagManager;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class SystemTagObjectMapperWithoutActivityFactory
{
Expand All @@ -18,39 +19,51 @@ public static function createSilentSystemTagObjectMapper(IDBConnection $connecti
return new SystemTagObjectMapper($connection, $tagManager, self::createFakeEventDispatcher());
}

private static function createFakeEventDispatcher(): IEventDispatcher
private static function createFakeEventDispatcher(): EventDispatcherInterface
{
return new class implements IEventDispatcher {
public function addListener(string $eventName, callable $listener, int $priority = 0): void
{
// DUMMY
}

public function removeListener(string $eventName, callable $listener): void
{
// DUMMY
}

public function addServiceListener(string $eventName, string $className, int $priority = 0): void
{
// DUMMY
}

public function hasListeners(string $eventName): bool
{
// DUMMY
return false;
}

public function dispatch(string $eventName, Event $event): void
{
// DUMMY
}

public function dispatchTyped(Event $event): void
{
// DUMMY
}
};
return new class implements EventDispatcherInterface {

public function addListener(string $eventName, callable $listener, int $priority = 0)
{
// DUMMY
}

public function addSubscriber(EventSubscriberInterface $subscriber)
{
// DUMMY
}

public function removeListener(string $eventName, callable $listener)
{
// DUMMY
}

public function removeSubscriber(EventSubscriberInterface $subscriber)
{
// DUMMY
}

public function getListeners(?string $eventName = null)
{
// DUMMY
}

public function dispatch(object $event, ?string $eventName = null): object
{
// DUMMY
return new Event();
}

public function getListenerPriority(string $eventName, callable $listener)
{
// DUMMY
}

public function hasListeners(?string $eventName = null)
{
// DUMMY
return false;
}
};
}
}

0 comments on commit ae9649e

Please sign in to comment.