\OC::$server->getSystemTagObjectMapper(),
\OC::$server->getUserSession(),
$groupManager,
- \OC::$server->getEventDispatcher()
+ $dispatcher
);
$systemTagInUseCollection = \OCP\Server::get(SystemTag\SystemTagsInUseCollection::class);
$commentsCollection = new Comments\RootCollection(
*/
namespace OCA\DAV\SystemTag;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\IGroupManager;
use OCP\IUserSession;
use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\SystemTagsEntityEvent;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\SimpleCollection;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class SystemTagsRelationsCollection extends SimpleCollection {
-
- /**
- * SystemTagsRelationsCollection constructor.
- *
- * @param ISystemTagManager $tagManager
- * @param ISystemTagObjectMapper $tagMapper
- * @param IUserSession $userSession
- * @param IGroupManager $groupManager
- * @param EventDispatcherInterface $dispatcher
- */
public function __construct(
ISystemTagManager $tagManager,
ISystemTagObjectMapper $tagMapper,
IUserSession $userSession,
IGroupManager $groupManager,
- EventDispatcherInterface $dispatcher
+ IEventDispatcher $dispatcher,
) {
$children = [
new SystemTagsObjectTypeCollection(
),
];
- $event = new SystemTagsEntityEvent(SystemTagsEntityEvent::EVENT_ENTITY);
+ $event = new SystemTagsEntityEvent();
$dispatcher->dispatch(SystemTagsEntityEvent::EVENT_ENTITY, $event);
+ $dispatcher->dispatchTyped($event);
foreach ($event->getEntityCollections() as $entity => $entityExistsFunction) {
$children[] = new SystemTagsObjectTypeCollection(
*/
namespace OCA\Files\Collaboration\Resources;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\Server;
use OCP\Collaboration\Resources\IManager;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class Listener {
- public static function register(EventDispatcherInterface $dispatcher): void {
+ public static function register(IEventDispatcher $dispatcher): void {
$dispatcher->addListener('OCP\Share::postShare', [self::class, 'shareModification']);
$dispatcher->addListener('OCP\Share::postUnshare', [self::class, 'shareModification']);
$dispatcher->addListener('OCP\Share::postUnshareFromSelf', [self::class, 'shareModification']);
use OCP\IUserSession;
use OCP\Share\IManager;
use OCP\Template;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
/**
private $l10n;
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var EventDispatcherInterface */
+ /** @var IEventDispatcher */
private $eventDispatcher;
/** @var ViewController|\PHPUnit\Framework\MockObject\MockObject */
private $viewController;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\NotFoundException;
use OCA\Files_External\Service\GlobalStoragesService;
+use OCA\Files_External\Service\UserStoragesService;
use OCP\AppFramework\Http;
+use PHPUnit\Framework\MockObject\MockObject;
abstract class StoragesControllerTest extends \Test\TestCase {
protected $controller;
/**
- * @var GlobalStoragesService
+ * @var GlobalStoragesService|UserStoragesService|MockObject
*/
protected $service;
}
/**
- * @return \OCA\Files_External\Lib\Backend\Backend
+ * @return \OCA\Files_External\Lib\Backend\Backend|MockObject
*/
protected function getBackendMock($class = '\OCA\Files_External\Lib\Backend\SMB', $storageClass = '\OCA\Files_External\Lib\Storage\SMB') {
$backend = $this->getMockBuilder(Backend::class)
}
/**
- * @return \OCA\Files_External\Lib\Auth\AuthMechanism
+ * @return \OCA\Files_External\Lib\Auth\AuthMechanism|MockObject
*/
protected function getAuthMechMock($scheme = 'null', $class = '\OCA\Files_External\Lib\Auth\NullMechanism') {
$authMech = $this->getMockBuilder(AuthMechanism::class)
use OCA\Files_Sharing\Notification\Notifier;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCA\Files\Event\LoadSidebar;
-use OCP\Files\Event\BeforeDirectGetEvent;
use OCA\Files_Sharing\ShareBackend\File;
use OCA\Files_Sharing\ShareBackend\Folder;
use OCA\Files_Sharing\ViewOnly;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent as ResourcesLoadAdditionalScriptsEvent;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\EventDispatcher\GenericEvent;
use OCP\Federation\ICloudIdManager;
use OCP\Files\Config\IMountProviderCollection;
use OCP\Files\Events\BeforeDirectFileDownloadEvent;
use OCP\IDBConnection;
use OCP\IGroup;
use OCP\IUserSession;
-use OCP\L10N\IFactory;
use OCP\Share\Events\ShareCreatedEvent;
-use OCP\Share\IManager;
use OCP\User\Events\UserChangedEvent;
use OCP\Util;
use Psr\Container\ContainerInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent as OldGenericEvent;
class Application extends App implements IBootstrap {
$mountProviderCollection->registerProvider($externalMountProvider);
}
- public function registerEventsScripts(IEventDispatcher $dispatcher, EventDispatcherInterface $oldDispatcher): void {
+ public function registerEventsScripts(IEventDispatcher $dispatcher): void {
// sidebar and files scripts
$dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class);
$dispatcher->addServiceListener(BeforeTemplateRenderedEvent::class, LegacyBeforeTemplateRenderedListener::class);
});
// notifications api to accept incoming user shares
- $oldDispatcher->addListener('OCP\Share::postShare', function (OldGenericEvent $event) {
+ $dispatcher->addListener('OCP\Share::postShare', function ($event) {
+ if (!$event instanceof OldGenericEvent) {
+ return;
+ }
/** @var Listener $listener */
$listener = $this->getContainer()->query(Listener::class);
$listener->shareNotification($event);
});
- $oldDispatcher->addListener(IGroup::class . '::postAddUser', function (OldGenericEvent $event) {
+ $dispatcher->addListener(IGroup::class . '::postAddUser', function ($event) {
+ if (!$event instanceof OldGenericEvent) {
+ return;
+ }
/** @var Listener $listener */
$listener = $this->getContainer()->query(Listener::class);
$listener->userAddedToGroup($event);
use OCP\Files\Events\BeforeDirectFileDownloadEvent;
use OCP\Files\Events\BeforeZipCreatedEvent;
use Psr\Log\LoggerInterface;
-use OC\Share20\LegacyHooks;
use OC\Share20\Manager;
use OC\EventDispatcher\EventDispatcher;
use OCA\Files_Sharing\AppInfo\Application;
use OCA\Files_Sharing\SharedStorage;
-use OCP\Constants;
-use OCP\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\Files\Cache\ICacheEntry;
-use OCP\Files\Event\BeforeDirectGetEvent;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
/** @var IRootFolder */
private $rootFolder;
- /** @var Manager */ private $manager;
+ /** @var Manager */
+ private $manager;
protected function setUp(): void {
parent::setUp();
use OCP\Share\IManager as IShareManager;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class Application extends App implements IBootstrap {
public function __construct() {
$context->injectFn(function (
INotificationManager $notificationManager,
IAppContainer $appContainer,
- EventDispatcherInterface $legacyDispatcher,
IEventDispatcher $dispatcher,
IGroupManager $groupManager,
User_Proxy $userBackend,
$groupManager->addBackend($groupBackend);
$userBackendRegisteredEvent = new UserBackendRegistered($userBackend, $userPluginManager);
- $legacyDispatcher->dispatch('OCA\\User_LDAP\\User\\User::postLDAPBackendAdded', $userBackendRegisteredEvent);
+ $dispatcher->dispatch('OCA\\User_LDAP\\User\\User::postLDAPBackendAdded', $userBackendRegisteredEvent);
$dispatcher->dispatchTyped($userBackendRegisteredEvent);
$groupBackendRegisteredEvent = new GroupBackendRegistered($groupBackend, $groupPluginManager);
$dispatcher->dispatchTyped($groupBackendRegisteredEvent);
);
}
- private function registerBackendDependents(IAppContainer $appContainer, EventDispatcherInterface $dispatcher) {
+ private function registerBackendDependents(IAppContainer $appContainer, IEventDispatcher $dispatcher) {
$dispatcher->addListener(
'OCA\\Files_External::loadAdditionalBackends',
function () use ($appContainer) {
use OCP\WorkflowEngine\IManager;
use OCP\WorkflowEngine\IOperation;
use PHPUnit\Framework\MockObject\MockObject;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
/**
* Class SystemTagsEntityEvent
*
* @since 9.1.0
+ * @since 28.0.0 Dispatched as a typed event
*/
class SystemTagsEntityEvent extends Event {
/**
- * @deprecated 22.0.0
+ * @deprecated 22.0.0 Listen to the typed event instead
*/
public const EVENT_ENTITY = 'OCP\SystemTag\ISystemTagManager::registerEntity';
- /** @var string */
- protected $event;
/** @var \Closure[] */
protected $collections;
/**
- * SystemTagsEntityEvent constructor.
- *
- * @param string $event
* @since 9.1.0
*/
- public function __construct(string $event) {
- $this->event = $event;
+ public function __construct() {
+ parent::__construct();
$this->collections = [];
}