diff --git a/apps/admin_audit/lib/AppInfo/Application.php b/apps/admin_audit/lib/AppInfo/Application.php index 77b76885a20e7..8efc82bb8bdd8 100644 --- a/apps/admin_audit/lib/AppInfo/Application.php +++ b/apps/admin_audit/lib/AppInfo/Application.php @@ -43,12 +43,12 @@ use OCP\AppFramework\App; use OCP\Authentication\TwoFactorAuth\IProvider; use OCP\Console\ConsoleEvent; +use OCP\EventDispatcher\GenericEvent; use OCP\IGroupManager; use OCP\ILogger; use OCP\IPreview; use OCP\IUserSession; use OCP\Util; -use Symfony\Component\EventDispatcher\GenericEvent; use OCP\Share; class Application extends App { diff --git a/apps/dav/appinfo/app.php b/apps/dav/appinfo/app.php index dd9e0e9c096b8..6cdd2d0018cfd 100644 --- a/apps/dav/appinfo/app.php +++ b/apps/dav/appinfo/app.php @@ -25,7 +25,7 @@ use OCA\DAV\AppInfo\Application; use OCA\DAV\CardDAV\CardDavBackend; -use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\EventDispatcher\GenericEvent; \OC_App::loadApps(['dav']); diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index 80e9dea882902..1b3d17a8e9b49 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -42,11 +42,11 @@ use OCA\DAV\CardDAV\PhotoCache; use OCA\DAV\CardDAV\SyncService; use OCA\DAV\HookManager; -use \OCP\AppFramework\App; +use OCP\AppFramework\App; use OCP\Contacts\IManager as IContactsManager; use OCP\Calendar\IManager as ICalendarManager; use OCP\IUser; -use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\EventDispatcher\GenericEvent; class Application extends App { diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 62d3909ce3911..61685fdbfec7b 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -38,6 +38,7 @@ use OCA\DAV\Connector\Sabre\Principal; use OCA\DAV\DAV\Sharing\Backend; use OCP\IDBConnection; +use OCP\EventDispatcher\GenericEvent; use OCP\IGroupManager; use OCP\ILogger; use OCP\IUser; @@ -64,7 +65,6 @@ use Sabre\VObject\Recur\EventIterator; use Sabre\Uri; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; /** * Class CalDavBackend diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 7dbd41a69c8cf..726e85817c10c 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -37,6 +37,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use OCA\DAV\DAV\Sharing\Backend; use OCA\DAV\DAV\Sharing\IShareable; +use OCP\EventDispatcher\GenericEvent; use OCP\IDBConnection; use OCP\IGroupManager; use OCP\IUser; @@ -49,7 +50,6 @@ use Sabre\VObject\Component\VCard; use Sabre\VObject\Reader; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class CardDavBackend implements BackendInterface, SyncSupport { diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php index aa18ef63a5cda..65c445873694d 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -38,8 +38,8 @@ use OCA\DAV\Connector\Sabre\Principal; use OCP\App\IAppManager; use OCP\DB\QueryBuilder\IQueryBuilder; -use OCP\IConfig; use OCP\IDBConnection; +use OCP\EventDispatcher\GenericEvent; use OCP\IGroupManager; use OCP\IL10N; use OCP\IUserManager; @@ -50,7 +50,6 @@ use Sabre\VObject\Component\VCard; use Sabre\VObject\Property\Text; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; use Test\TestCase; /** diff --git a/apps/federation/lib/TrustedServers.php b/apps/federation/lib/TrustedServers.php index 092279eb2b957..6dbff1a35d71e 100644 --- a/apps/federation/lib/TrustedServers.php +++ b/apps/federation/lib/TrustedServers.php @@ -32,12 +32,12 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; +use OCP\EventDispatcher\GenericEvent; use OCP\Http\Client\IClientService; use OCP\IConfig; use OCP\ILogger; use OCP\Security\ISecureRandom; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class TrustedServers { diff --git a/apps/federation/tests/TrustedServersTest.php b/apps/federation/tests/TrustedServersTest.php index c350796a01af7..99b834acfbc70 100644 --- a/apps/federation/tests/TrustedServersTest.php +++ b/apps/federation/tests/TrustedServersTest.php @@ -33,6 +33,7 @@ use OCA\Federation\TrustedServers; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; +use OCP\EventDispatcher\GenericEvent; use OCP\Http\Client\IClient; use OCP\Http\Client\IClientService; use OCP\Http\Client\IResponse; @@ -221,8 +222,8 @@ public function testRemoveServer() { ->willReturnCallback( function($eventId, $event) { $this->assertSame($eventId, 'OCP\Federation\TrustedServerEvent::remove'); - $this->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); - /** @var \Symfony\Component\EventDispatcher\GenericEvent $event */ + $this->assertInstanceOf(GenericEvent::class, $event); + /** @var GenericEvent $event */ $this->assertSame('url_hash', $event->getSubject()); } ); diff --git a/apps/files/lib/Listener/LegacyLoadAdditionalScriptsAdapter.php b/apps/files/lib/Listener/LegacyLoadAdditionalScriptsAdapter.php index ba89d59122770..470159b77963c 100644 --- a/apps/files/lib/Listener/LegacyLoadAdditionalScriptsAdapter.php +++ b/apps/files/lib/Listener/LegacyLoadAdditionalScriptsAdapter.php @@ -28,7 +28,7 @@ use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; -use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\EventDispatcher\GenericEvent; class LegacyLoadAdditionalScriptsAdapter implements IEventListener { diff --git a/apps/files/lib/Service/TagService.php b/apps/files/lib/Service/TagService.php index 7437f0c31ad70..52314e70300b2 100644 --- a/apps/files/lib/Service/TagService.php +++ b/apps/files/lib/Service/TagService.php @@ -27,12 +27,12 @@ use OC\Tags; use OCA\Files\Activity\FavoriteProvider; use OCP\Activity\IManager; +use OCP\EventDispatcher\GenericEvent; use OCP\Files\Folder; use OCP\ITags; use OCP\IUser; use OCP\IUserSession; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; /** * Service class to manage tags on files. diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index f5cbb63e08315..1584b8b0113a8 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -63,7 +63,7 @@ use OCP\Files\IRootFolder; use OCP\Share\Exceptions\ShareNotFound; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\EventDispatcher\GenericEvent; use OCP\Share\IManager as ShareManager; /** diff --git a/apps/lookup_server_connector/lib/AppInfo/Application.php b/apps/lookup_server_connector/lib/AppInfo/Application.php index 66bd2dd062c59..dff7930460a5f 100644 --- a/apps/lookup_server_connector/lib/AppInfo/Application.php +++ b/apps/lookup_server_connector/lib/AppInfo/Application.php @@ -24,7 +24,7 @@ use OCA\LookupServerConnector\UpdateLookupServer; use OCP\AppFramework\App; use OCP\IUser; -use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\EventDispatcher\GenericEvent; class Application extends App { public function __construct () { diff --git a/apps/settings/lib/AppInfo/Application.php b/apps/settings/lib/AppInfo/Application.php index 0a564cacc8e26..7662c028d0e6a 100644 --- a/apps/settings/lib/AppInfo/Application.php +++ b/apps/settings/lib/AppInfo/Application.php @@ -46,6 +46,7 @@ use OCP\Activity\IManager as IActivityManager; use OCP\AppFramework\App; use OCP\Defaults; +use OCP\EventDispatcher\GenericEvent; use OCP\IContainer; use OCP\IGroup; use OCP\ILogger; @@ -53,7 +54,6 @@ use OCP\Settings\IManager; use OCP\Util; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class Application extends App { diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index 620920f777b0b..9a235457c7e16 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -48,6 +48,7 @@ use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\RedirectResponse; +use OCP\EventDispatcher\GenericEvent; use OCP\Http\Client\IClientService; use OCP\IConfig; use OCP\IDateTimeFormatter; @@ -59,7 +60,6 @@ use OCP\Lock\ILockingProvider; use OCP\Security\ISecureRandom; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class CheckSetupController extends Controller { /** @var IConfig */ diff --git a/apps/workflowengine/lib/AppInfo/Application.php b/apps/workflowengine/lib/AppInfo/Application.php index cea6ac7a1e549..dd761910a822f 100644 --- a/apps/workflowengine/lib/AppInfo/Application.php +++ b/apps/workflowengine/lib/AppInfo/Application.php @@ -23,12 +23,12 @@ use OCA\WorkflowEngine\Manager; use OCP\AppFramework\QueryException; +use OCP\EventDispatcher\GenericEvent; use OCP\Template; use OCA\WorkflowEngine\Controller\RequestTime; use OCP\WorkflowEngine\IEntity; use OCP\WorkflowEngine\IOperation; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class Application extends \OCP\AppFramework\App { diff --git a/apps/workflowengine/lib/Entity/File.php b/apps/workflowengine/lib/Entity/File.php index 8fb035afacc54..65dae7b93ee24 100644 --- a/apps/workflowengine/lib/Entity/File.php +++ b/apps/workflowengine/lib/Entity/File.php @@ -24,6 +24,7 @@ namespace OCA\WorkflowEngine\Entity; +use OCP\EventDispatcher\GenericEvent; use OCP\Files\IRootFolder; use OCP\IL10N; use OCP\IURLGenerator; @@ -31,7 +32,6 @@ use OCP\WorkflowEngine\GenericEntityEvent; use OCP\WorkflowEngine\IEntity; use OCP\WorkflowEngine\IRuleMatcher; -use Symfony\Component\EventDispatcher\GenericEvent; class File implements IEntity { diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php index 07438b2f7cb13..5a831efbf14ec 100644 --- a/apps/workflowengine/lib/Manager.php +++ b/apps/workflowengine/lib/Manager.php @@ -39,6 +39,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\Storage\IStorage; use OCP\IDBConnection; +use OCP\EventDispatcher\GenericEvent; use OCP\IL10N; use OCP\ILogger; use OCP\IServerContainer; @@ -51,7 +52,6 @@ use OCP\WorkflowEngine\IOperation; use OCP\WorkflowEngine\IRuleMatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class Manager implements IManager { diff --git a/core/Application.php b/core/Application.php index cc4d9ba990b3f..0aa508caacd31 100644 --- a/core/Application.php +++ b/core/Application.php @@ -38,11 +38,10 @@ use OC\DB\MissingIndexInformation; use OC\DB\SchemaWrapper; use OCP\AppFramework\App; +use OCP\EventDispatcher\GenericEvent; use OCP\EventDispatcher\IEventDispatcher; use OCP\IDBConnection; -use OCP\IServerContainer; use OCP\Util; -use Symfony\Component\EventDispatcher\GenericEvent; /** * Class Application diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 527a2cd7b19c9..e14088f1acc2e 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -24,12 +24,12 @@ namespace OC\Core\Command\Db; use OC\DB\SchemaWrapper; +use OCP\EventDispatcher\GenericEvent; use OCP\IDBConnection; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; /** * Class AddMissingIndices diff --git a/core/Command/Maintenance/Repair.php b/core/Command/Maintenance/Repair.php index a013ade99c5dc..0ce0620cb2ad9 100644 --- a/core/Command/Maintenance/Repair.php +++ b/core/Command/Maintenance/Repair.php @@ -28,6 +28,7 @@ use Exception; use OCP\App\IAppManager; +use OCP\EventDispatcher\GenericEvent; use OCP\IConfig; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\ProgressBar; @@ -35,7 +36,6 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class Repair extends Command { /** @var \OC\Repair $repair */ diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php index 2d7ec4f688d11..1227e92b6fcc7 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -37,6 +37,7 @@ use OC\Console\TimestampFormatter; use OC\Installer; use OC\Updater; +use OCP\EventDispatcher\GenericEvent; use OCP\IConfig; use OCP\ILogger; use OCP\Util; @@ -44,7 +45,6 @@ use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class Upgrade extends Command { diff --git a/core/Controller/AppPasswordController.php b/core/Controller/AppPasswordController.php index a66acb3c5f36f..ff3dbe775fbae 100644 --- a/core/Controller/AppPasswordController.php +++ b/core/Controller/AppPasswordController.php @@ -32,11 +32,11 @@ use OCP\Authentication\Exceptions\CredentialsUnavailableException; use OCP\Authentication\Exceptions\PasswordUnavailableException; use OCP\Authentication\LoginCredentials\IStore; +use OCP\EventDispatcher\GenericEvent; use OCP\IRequest; use OCP\ISession; use OCP\Security\ISecureRandom; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class AppPasswordController extends \OCP\AppFramework\OCSController { @@ -121,6 +121,7 @@ public function getAppPassword(): DataResponse { * @NoAdminRequired * * @return DataResponse + * @throws OCSForbiddenException */ public function deleteAppPassword() { if (!$this->session->exists('app_password')) { @@ -141,6 +142,7 @@ public function deleteAppPassword() { /** * @NoAdminRequired + * @throws OCSForbiddenException */ public function rotateAppPassword(): DataResponse { if (!$this->session->exists('app_password')) { diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index bffedf1922473..85199575ed976 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -33,11 +33,13 @@ use OCA\OAuth2\Db\AccessToken; use OCA\OAuth2\Db\AccessTokenMapper; use OCA\OAuth2\Db\ClientMapper; +use OCA\OAuth2\Exceptions\ClientNotFoundException; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\StandaloneTemplateResponse; use OCP\Defaults; +use OCP\EventDispatcher\GenericEvent; use OCP\IL10N; use OCP\IRequest; use OCP\ISession; @@ -47,7 +49,6 @@ use OCP\Security\ISecureRandom; use OCP\Session\Exceptions\SessionNotAvailableException; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class ClientFlowLoginController extends Controller { /** @var IUserSession */ @@ -161,6 +162,7 @@ private function stateTokenForbiddenResponse() { * @param string $clientIdentifier * * @return StandaloneTemplateResponse + * @throws ClientNotFoundException */ public function showAuthPickerPage($clientIdentifier = '') { $clientName = $this->getClientName(); @@ -230,6 +232,7 @@ public function showAuthPickerPage($clientIdentifier = '') { * @param string $stateToken * @param string $clientIdentifier * @return StandaloneTemplateResponse + * @throws ClientNotFoundException */ public function grantPage($stateToken = '', $clientIdentifier = '') { @@ -277,6 +280,7 @@ public function grantPage($stateToken = '', * @param string $stateToken * @param string $clientIdentifier * @return Http\RedirectResponse|Response + * @throws ClientNotFoundException */ public function generateAppPassword($stateToken, $clientIdentifier = '') { diff --git a/core/ajax/update.php b/core/ajax/update.php index 2cf4377e3e4b3..f86c219de8f32 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -29,8 +29,11 @@ * */ +use OCP\EventDispatcher\GenericEvent; +use OCP\IEventSource; +use OCP\IL10N; use OCP\ILogger; -use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\Util; if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { @set_time_limit(0); @@ -53,12 +56,12 @@ class FeedBackHandler { private $progressStateStep = 0; /** @var string */ private $currentStep; - /** @var \OCP\IEventSource */ + /** @var IEventSource */ private $eventSource; - /** @var \OCP\IL10N */ + /** @var IL10N */ private $l10n; - public function __construct(\OCP\IEventSource $eventSource, \OCP\IL10N $l10n) { + public function __construct(IEventSource $eventSource, IL10N $l10n) { $this->eventSource = $eventSource; $this->l10n = $l10n; } @@ -102,7 +105,7 @@ public function handleRepairFeedback($event) { } } -if (\OCP\Util::needUpgrade()) { +if (Util::needUpgrade()) { $config = \OC::$server->getSystemConfig(); if ($config->getValue('upgrade.disable-web', false)) { diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 203b6cfecdac3..be76b5f9f0531 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -175,6 +175,7 @@ 'OCP\\Encryption\\IManager' => $baseDir . '/lib/public/Encryption/IManager.php', 'OCP\\Encryption\\Keys\\IStorage' => $baseDir . '/lib/public/Encryption/Keys/IStorage.php', 'OCP\\EventDispatcher\\Event' => $baseDir . '/lib/public/EventDispatcher/Event.php', + 'OCP\\EventDispatcher\\GenericEvent' => $baseDir . '/lib/public/EventDispatcher/GenericEvent.php', 'OCP\\EventDispatcher\\IEventDispatcher' => $baseDir . '/lib/public/EventDispatcher/IEventDispatcher.php', 'OCP\\EventDispatcher\\IEventListener' => $baseDir . '/lib/public/EventDispatcher/IEventListener.php', 'OCP\\Federation\\Exceptions\\ActionNotSupportedException' => $baseDir . '/lib/public/Federation/Exceptions/ActionNotSupportedException.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 7641293473c3c..4a3b4a7a336ea 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -204,6 +204,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\Encryption\\IManager' => __DIR__ . '/../../..' . '/lib/public/Encryption/IManager.php', 'OCP\\Encryption\\Keys\\IStorage' => __DIR__ . '/../../..' . '/lib/public/Encryption/Keys/IStorage.php', 'OCP\\EventDispatcher\\Event' => __DIR__ . '/../../..' . '/lib/public/EventDispatcher/Event.php', + 'OCP\\EventDispatcher\\GenericEvent' => __DIR__ . '/../../..' . '/lib/public/EventDispatcher/GenericEvent.php', 'OCP\\EventDispatcher\\IEventDispatcher' => __DIR__ . '/../../..' . '/lib/public/EventDispatcher/IEventDispatcher.php', 'OCP\\EventDispatcher\\IEventListener' => __DIR__ . '/../../..' . '/lib/public/EventDispatcher/IEventListener.php', 'OCP\\Federation\\Exceptions\\ActionNotSupportedException' => __DIR__ . '/../../..' . '/lib/public/Federation/Exceptions/ActionNotSupportedException.php', diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 7a73ec455eb33..402022477cadd 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -29,10 +29,10 @@ use OCP\Accounts\IAccount; use OCP\Accounts\IAccountManager; use OCP\BackgroundJob\IJobList; +use OCP\EventDispatcher\GenericEvent; use OCP\IDBConnection; use OCP\IUser; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; use OCA\Settings\BackgroundJobs\VerifyUserData; /** diff --git a/lib/private/Authentication/Events/ARemoteWipeEvent.php b/lib/private/Authentication/Events/ARemoteWipeEvent.php index f6c0888214314..866e711a7d403 100644 --- a/lib/private/Authentication/Events/ARemoteWipeEvent.php +++ b/lib/private/Authentication/Events/ARemoteWipeEvent.php @@ -27,7 +27,6 @@ use OC\Authentication\Token\IToken; use OCP\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\GenericEvent; abstract class ARemoteWipeEvent extends Event { diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index 17f8479f25762..40bcf148ac49a 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -27,17 +27,16 @@ namespace OC\Authentication\TwoFactorAuth; +use OCP\EventDispatcher\GenericEvent; use function array_diff; use function array_filter; use BadMethodCallException; use Exception; -use OC\Authentication\Exceptions\ExpiredTokenException; use OC\Authentication\Exceptions\InvalidTokenException; use OC\Authentication\Token\IProvider as TokenProvider; use OCP\Activity\IManager; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Authentication\TwoFactorAuth\IActivatableAtLogin; -use OCP\Authentication\TwoFactorAuth\ILoginSetupProvider; use OCP\Authentication\TwoFactorAuth\IProvider; use OCP\Authentication\TwoFactorAuth\IRegistry; use OCP\IConfig; @@ -45,7 +44,6 @@ use OCP\ISession; use OCP\IUser; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class Manager { diff --git a/lib/private/Collaboration/Resources/Listener.php b/lib/private/Collaboration/Resources/Listener.php index 7014f3bb9f021..b8c245ef219fb 100644 --- a/lib/private/Collaboration/Resources/Listener.php +++ b/lib/private/Collaboration/Resources/Listener.php @@ -23,11 +23,12 @@ namespace OC\Collaboration\Resources; +use OC; use OCP\Collaboration\Resources\IManager; +use OCP\EventDispatcher\GenericEvent; use OCP\IGroup; use OCP\IUser; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class Listener { @@ -36,7 +37,7 @@ public static function register(EventDispatcherInterface $dispatcher): void { /** @var IUser $user */ $user = $event->getArgument('user'); /** @var IManager $resourceManager */ - $resourceManager = \OC::$server->query(IManager::class); + $resourceManager = OC::$server->query(IManager::class); $resourceManager->invalidateAccessCacheForUser($user); }; @@ -47,7 +48,7 @@ public static function register(EventDispatcherInterface $dispatcher): void { /** @var IUser $user */ $user = $event->getSubject(); /** @var IManager $resourceManager */ - $resourceManager = \OC::$server->query(IManager::class); + $resourceManager = OC::$server->query(IManager::class); $resourceManager->invalidateAccessCacheForUser($user); }); @@ -56,7 +57,7 @@ public static function register(EventDispatcherInterface $dispatcher): void { /** @var IGroup $group */ $group = $event->getSubject(); /** @var IManager $resourceManager */ - $resourceManager = \OC::$server->query(IManager::class); + $resourceManager = OC::$server->query(IManager::class); foreach ($group->getUsers() as $user) { $resourceManager->invalidateAccessCacheForUser($user); diff --git a/lib/private/DB/Migrator.php b/lib/private/DB/Migrator.php index a853ab1ea1b10..15edda57d52ef 100644 --- a/lib/private/DB/Migrator.php +++ b/lib/private/DB/Migrator.php @@ -37,10 +37,10 @@ use \Doctrine\DBAL\Schema\Comparator; use Doctrine\DBAL\Types\StringType; use Doctrine\DBAL\Types\Type; +use OCP\EventDispatcher\GenericEvent; use OCP\IConfig; use OCP\Security\ISecureRandom; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class Migrator { diff --git a/lib/private/Files/Node/HookConnector.php b/lib/private/Files/Node/HookConnector.php index 4783a71b07b52..9640621f9bff0 100644 --- a/lib/private/Files/Node/HookConnector.php +++ b/lib/private/Files/Node/HookConnector.php @@ -22,12 +22,12 @@ namespace OC\Files\Node; +use OCP\EventDispatcher\GenericEvent; use OCP\Files\FileInfo; use OC\Files\Filesystem; use OC\Files\View; use OCP\Util; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class HookConnector { /** diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index c440dd4a8f128..c6f9ec846004d 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -29,11 +29,11 @@ use OC\Files\Filesystem; use OC\Files\Mount\MoveableMount; +use OCP\EventDispatcher\GenericEvent; use OCP\Files\FileInfo; use OCP\Files\InvalidPathException; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; -use Symfony\Component\EventDispatcher\GenericEvent; // FIXME: this class really should be abstract class Node implements \OCP\Files\Node { diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php index 8d86425c8e57f..dd106c444f780 100644 --- a/lib/private/Group/Group.php +++ b/lib/private/Group/Group.php @@ -30,6 +30,8 @@ namespace OC\Group; +use OC\User\User; +use OCP\EventDispatcher\GenericEvent; use OCP\Group\Backend\IGetDisplayNameBackend; use OCP\Group\Backend\IHideFromCollaborationBackend; use OC\Hooks\PublicEmitter; @@ -40,7 +42,6 @@ use OCP\Group\Backend\ICountDisabledInGroup; use OCP\IUserManager; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class Group implements IGroup { /** @var null|string */ @@ -49,7 +50,7 @@ class Group implements IGroup { /** @var string */ private $gid; - /** @var \OC\User\User[] */ + /** @var User[] */ private $users = array(); /** @var bool */ @@ -119,7 +120,7 @@ public function setDisplayName(string $displayName): bool { /** * get all users in the group * - * @return \OC\User\User[] + * @return User[] */ public function getUsers() { if ($this->usersLoaded) { @@ -179,7 +180,7 @@ public function addUser(IUser $user) { $this->emitter->emit('\OC\Group', 'preAddUser', array($this, $user)); } foreach ($this->backends as $backend) { - if ($backend->implementsActions(\OC\Group\Backend::ADD_TO_GROUP)) { + if ($backend->implementsActions(Backend::ADD_TO_GROUP)) { $backend->addToGroup($user->getUID(), $this->gid); if ($this->users) { $this->users[$user->getUID()] = $user; @@ -200,7 +201,7 @@ public function addUser(IUser $user) { /** * remove a user from the group * - * @param \OC\User\User $user + * @param User $user */ public function removeUser($user) { $result = false; @@ -211,7 +212,7 @@ public function removeUser($user) { $this->emitter->emit('\OC\Group', 'preRemoveUser', array($this, $user)); } foreach ($this->backends as $backend) { - if ($backend->implementsActions(\OC\Group\Backend::REMOVE_FROM_GOUP) and $backend->inGroup($user->getUID(), $this->gid)) { + if ($backend->implementsActions(Backend::REMOVE_FROM_GOUP) and $backend->inGroup($user->getUID(), $this->gid)) { $backend->removeFromGroup($user->getUID(), $this->gid); $result = true; } @@ -240,7 +241,7 @@ public function removeUser($user) { * @param string $search * @param int $limit * @param int $offset - * @return \OC\User\User[] + * @return User[] */ public function searchUsers($search, $limit = null, $offset = null) { $users = array(); @@ -263,7 +264,7 @@ public function searchUsers($search, $limit = null, $offset = null) { public function count($search = '') { $users = false; foreach ($this->backends as $backend) { - if($backend->implementsActions(\OC\Group\Backend::COUNT_USERS)) { + if($backend->implementsActions(Backend::COUNT_USERS)) { if($users === false) { //we could directly add to a bool variable, but this would //be ugly @@ -301,7 +302,7 @@ public function countDisabled() { * @param string $search * @param int $limit * @param int $offset - * @return \OC\User\User[] + * @return User[] */ public function searchDisplayName($search, $limit = null, $offset = null) { $users = array(); @@ -332,7 +333,7 @@ public function delete() { $this->emitter->emit('\OC\Group', 'preDelete', array($this)); } foreach ($this->backends as $backend) { - if ($backend->implementsActions(\OC\Group\Backend::DELETE_GROUP)) { + if ($backend->implementsActions(Backend::DELETE_GROUP)) { $result = true; $backend->deleteGroup($this->gid); } @@ -349,7 +350,7 @@ public function delete() { /** * returns all the Users from an array that really exists * @param string[] $userIds an array containing user IDs - * @return \OC\User\User[] an Array with the userId as Key and \OC\User\User as value + * @return User[] an Array with the userId as Key and \OC\User\User as value */ private function getVerifiedUsers($userIds) { if (!is_array($userIds)) { diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index 79c512c84aac2..6269b06a24b51 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -25,7 +25,7 @@ namespace OC\Preview; -use OC\Preview\GeneratorHelper; +use OCP\EventDispatcher\GenericEvent; use OCP\Files\File; use OCP\Files\IAppData; use OCP\Files\NotFoundException; @@ -35,11 +35,9 @@ use OCP\IConfig; use OCP\IImage; use OCP\IPreview; -use OCP\Preview\IProvider; use OCP\Preview\IVersionedPreviewFile; use OCP\Preview\IProviderV2; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class Generator { diff --git a/lib/private/Repair.php b/lib/private/Repair.php index 2b6080ca985a1..fe5820306cefc 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -57,10 +57,10 @@ use OCP\AppFramework\QueryException; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Collaboration\Resources\IManager; +use OCP\EventDispatcher\GenericEvent; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class Repair implements IOutput { @@ -134,6 +134,7 @@ public function addStep($repairStep) { * command line or after an upgrade. * * @return IRepairStep[] + * @throws QueryException */ public static function getRepairSteps() { return [ diff --git a/lib/private/Server.php b/lib/private/Server.php index b4af17ba28825..625f9e36cc464 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -108,7 +108,6 @@ use OC\Security\CertificateManager; use OC\Security\CredentialsManager; use OC\Security\Crypto; -use OC\Security\CSP\ContentSecurityPolicyManager; use OC\Security\CSP\ContentSecurityPolicyNonceManager; use OC\Security\CSRF\CsrfTokenGenerator; use OC\Security\CSRF\CsrfTokenManager; @@ -135,6 +134,7 @@ use OCP\Contacts\ContactsMenu\IContactsStore; use OCP\Dashboard\IDashboardManager; use OCP\Defaults; +use OCP\EventDispatcher\GenericEvent; use OCP\EventDispatcher\IEventDispatcher; use OCP\Federation\ICloudFederationFactory; use OCP\Federation\ICloudFederationProviderManager; @@ -159,7 +159,6 @@ use OCP\Security\IContentSecurityPolicyManager; use OCP\Share\IShareHelper; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; /** * Class Server diff --git a/lib/private/Share20/LegacyHooks.php b/lib/private/Share20/LegacyHooks.php index 4cc748aa41888..0782af6ce7392 100644 --- a/lib/private/Share20/LegacyHooks.php +++ b/lib/private/Share20/LegacyHooks.php @@ -25,10 +25,10 @@ namespace OC\Share20; +use OCP\EventDispatcher\GenericEvent; use OCP\Files\File; use OCP\Share\IShare; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; use OCP\Share; class LegacyHooks { diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 2e8e6f9a3af73..b159907af5572 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -41,6 +41,7 @@ use OC\Files\Mount\MoveableMount; use OC\HintException; use OC\Share20\Exception\ProviderException; +use OCP\EventDispatcher\GenericEvent; use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\IRootFolder; @@ -63,7 +64,6 @@ use OCP\Share\IProviderFactory; use OCP\Share\IShare; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; use OCP\Share\IShareProvider; use OCP\Share; diff --git a/lib/private/Updater.php b/lib/private/Updater.php index d5de1bf6b274e..0d47b581f6450 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -38,10 +38,10 @@ use OC\Hooks\BasicEmitter; use OC\IntegrityCheck\Checker; use OC_App; +use OCP\EventDispatcher\GenericEvent; use OCP\IConfig; use OCP\ILogger; use OCP\Util; -use Symfony\Component\EventDispatcher\GenericEvent; /** * Class that handles autoupdating of ownCloud diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index 3db96fa02e205..760b14a34be62 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -58,6 +58,7 @@ namespace OC\User; use OC\Cache\CappedMemoryCache; +use OCP\EventDispatcher\GenericEvent; use OCP\IDBConnection; use OCP\User\Backend\ABackend; use OCP\User\Backend\ICheckPasswordBackend; @@ -69,7 +70,6 @@ use OCP\User\Backend\ISetDisplayNameBackend; use OCP\User\Backend\ISetPasswordBackend; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; /** * Class for user management in a SQL Database (e.g. MySQL, SQLite) diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 842d19d8d5452..d5940de4f4cdb 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -50,6 +50,7 @@ use OC_Util; use OCA\DAV\Connector\Sabre\Auth; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\EventDispatcher\GenericEvent; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\NotPermittedException; use OCP\IConfig; @@ -62,7 +63,6 @@ use OCP\Security\ISecureRandom; use OCP\Session\Exceptions\SessionNotAvailableException; use OCP\Util; -use Symfony\Component\EventDispatcher\GenericEvent; /** * Class Session diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 12af787a5a6e6..b187550cb8099 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -35,6 +35,7 @@ use OC\Files\Cache\Storage; use OC\Hooks\Emitter; use OC_Helper; +use OCP\EventDispatcher\GenericEvent; use OCP\IAvatarManager; use OCP\IImage; use OCP\IURLGenerator; @@ -43,7 +44,6 @@ use OCP\UserInterface; use \OCP\IUserBackend; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class User implements IUser { /** @var string */ diff --git a/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php b/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php index 59dbafcb56f9b..9dc42803701fa 100644 --- a/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php +++ b/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php @@ -23,7 +23,7 @@ namespace OCP\Collaboration\AutoComplete; -use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\EventDispatcher\GenericEvent; /** * @since 16.0.0 diff --git a/lib/public/EventDispatcher/GenericEvent.php b/lib/public/EventDispatcher/GenericEvent.php new file mode 100644 index 0000000000000..7e47ed569943c --- /dev/null +++ b/lib/public/EventDispatcher/GenericEvent.php @@ -0,0 +1,171 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCP\EventDispatcher; + +use ArrayAccess; +use ArrayIterator; +use InvalidArgumentException; +use IteratorAggregate; +use Traversable; +use function array_key_exists; + +/** + * Class GenericEvent + * + * convenience reimplementation of \Symfony\Component\GenericEvent against + * \OCP\EventDispatcher\Event + * + * @package OCP\EventDispatcher + * @since 18.0.0 + */ +class GenericEvent extends Event implements ArrayAccess, IteratorAggregate { + protected $subject; + protected $arguments; + + /** + * Encapsulate an event with $subject and $args. + * + * @since 18.0.0 + */ + public function __construct($subject = null, array $arguments = []) { + $this->subject = $subject; + $this->arguments = $arguments; + } + + /** + * Getter for subject property. + * + * @since 18.0.0 + */ + public function getSubject() { + return $this->subject; + } + + /** + * Get argument by key. + * + * @throws InvalidArgumentException if key is not found + * @since 18.0.0 + */ + public function getArgument(string $key) { + if ($this->hasArgument($key)) { + return $this->arguments[$key]; + } + + throw new InvalidArgumentException(sprintf('Argument "%s" not found.', $key)); + } + + /** + * Add argument to event. + * + * @since 18.0.0 + */ + public function setArgument(string $key, $value): GenericEvent { + $this->arguments[$key] = $value; + return $this; + } + + /** + * Getter for all arguments. + * + * @since 18.0.0 + */ + public function getArguments(): array { + return $this->arguments; + } + + /** + * Set args property. + * + * @since 18.0.0 + */ + public function setArguments(array $args = []): GenericEvent { + $this->arguments = $args; + return $this; + } + + /** + * Has argument. + * + * @since 18.0.0 + */ + public function hasArgument(string $key): bool { + return array_key_exists($key, $this->arguments); + } + + /** + * Retrieve an external iterator + * + * @link https://php.net/manual/en/iteratoraggregate.getiterator.php + * @since 18.0.0 + */ + public function getIterator(): Traversable { + return new ArrayIterator($this->arguments); + } + + /** + * Whether a offset exists + * + * @link https://php.net/manual/en/arrayaccess.offsetexists.php + * @since 18.0.0 + */ + public function offsetExists($offset): bool { + return $this->hasArgument($offset); + } + + /** + * Offset to retrieve + * + * @link https://php.net/manual/en/arrayaccess.offsetget.php + * @since 18.0.0 + */ + public function offsetGet($offset) { + if ($this->hasArgument($offset)) { + unset($this->arguments[$offset]); + } + } + + /** + * Offset to set + * + * @link https://php.net/manual/en/arrayaccess.offsetset.php + * @since 18.0.0 + */ + public function offsetSet($offset, $value): void { + $this->setArgument($offset, $value); + } + + /** + * Offset to unset + * + * @link https://php.net/manual/en/arrayaccess.offsetunset.php + * @since 18.0.0 + */ + public function offsetUnset($offset): void { + if ($this->hasArgument($offset)) { + unset($this->arguments[$offset]); + } + } +} diff --git a/lib/public/Files_FullTextSearch/Model/AFilesDocument.php b/lib/public/Files_FullTextSearch/Model/AFilesDocument.php index 143788f33ade2..cc96ca340ae86 100644 --- a/lib/public/Files_FullTextSearch/Model/AFilesDocument.php +++ b/lib/public/Files_FullTextSearch/Model/AFilesDocument.php @@ -32,7 +32,6 @@ use OC\FullTextSearch\Model\IndexDocument; -use OCP\FullTextSearch\Model\IIndexDocument; /** diff --git a/lib/public/WorkflowEngine/IEntity.php b/lib/public/WorkflowEngine/IEntity.php index c08e9072a380d..3406d477e53f3 100644 --- a/lib/public/WorkflowEngine/IEntity.php +++ b/lib/public/WorkflowEngine/IEntity.php @@ -24,7 +24,7 @@ namespace OCP\WorkflowEngine; -use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\EventDispatcher\GenericEvent; /** * Interface IEntity diff --git a/lib/public/WorkflowEngine/IOperation.php b/lib/public/WorkflowEngine/IOperation.php index d16fd618a84bb..f9a1b69640632 100644 --- a/lib/public/WorkflowEngine/IOperation.php +++ b/lib/public/WorkflowEngine/IOperation.php @@ -23,7 +23,7 @@ namespace OCP\WorkflowEngine; -use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\EventDispatcher\GenericEvent; /** * Interface IOperation diff --git a/tests/lib/Accounts/AccountsManagerTest.php b/tests/lib/Accounts/AccountsManagerTest.php index bff3b353a1e0d..11b50238e01cc 100644 --- a/tests/lib/Accounts/AccountsManagerTest.php +++ b/tests/lib/Accounts/AccountsManagerTest.php @@ -27,9 +27,9 @@ use OC\Accounts\AccountManager; use OCP\Accounts\IAccountManager; use OCP\BackgroundJob\IJobList; +use OCP\EventDispatcher\GenericEvent; use OCP\IUser; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; use Test\TestCase; /** diff --git a/tests/lib/Files/Node/HookConnectorTest.php b/tests/lib/Files/Node/HookConnectorTest.php index 0d67fada3c0be..e66b805d8d7c2 100644 --- a/tests/lib/Files/Node/HookConnectorTest.php +++ b/tests/lib/Files/Node/HookConnectorTest.php @@ -13,11 +13,11 @@ use OC\Files\Node\Root; use OC\Files\Storage\Temporary; use OC\Files\View; +use OCP\EventDispatcher\GenericEvent; use OCP\Files\Node; use OCP\ILogger; use OCP\IUserManager; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; use Test\TestCase; use Test\Traits\MountProviderTrait; use Test\Traits\UserTrait; diff --git a/tests/lib/Migration/BackgroundRepairTest.php b/tests/lib/Migration/BackgroundRepairTest.php index df81fd45772d7..0eaa87cc146f8 100644 --- a/tests/lib/Migration/BackgroundRepairTest.php +++ b/tests/lib/Migration/BackgroundRepairTest.php @@ -23,11 +23,11 @@ use OC\Migration\BackgroundRepair; use OC\NeedsUpdateException; +use OCP\EventDispatcher\GenericEvent; use OCP\ILogger; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; use Test\TestCase; class TestRepairStep implements IRepairStep { diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php index 9bca43a1a7efb..c16503e43078d 100644 --- a/tests/lib/Preview/GeneratorTest.php +++ b/tests/lib/Preview/GeneratorTest.php @@ -24,6 +24,7 @@ use OC\Preview\Generator; use OC\Preview\GeneratorHelper; +use OCP\EventDispatcher\GenericEvent; use OCP\Files\File; use OCP\Files\IAppData; use OCP\Files\NotFoundException; @@ -32,10 +33,8 @@ use OCP\IConfig; use OCP\IImage; use OCP\IPreview; -use OCP\Preview\IProvider; use OCP\Preview\IProviderV2; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class GeneratorTest extends \Test\TestCase { diff --git a/tests/lib/RepairStepTest.php b/tests/lib/RepairStepTest.php index 1ec28de87687e..9a8642064e2e2 100644 --- a/tests/lib/RepairStepTest.php +++ b/tests/lib/RepairStepTest.php @@ -8,6 +8,7 @@ namespace Test; +use OCP\EventDispatcher\GenericEvent; use OCP\Migration\IRepairStep; use Symfony\Component\EventDispatcher\EventDispatcher; @@ -45,15 +46,15 @@ public function setUp() { $this->repair = new \OC\Repair([], $dispatcher); $dispatcher->addListener('\OC\Repair::warning', function ($event) { - /** @var \Symfony\Component\EventDispatcher\GenericEvent $event */ + /** @var GenericEvent $event */ $this->outputArray[] = 'warning: ' . $event->getArgument(0); }); $dispatcher->addListener('\OC\Repair::info', function ($event) { - /** @var \Symfony\Component\EventDispatcher\GenericEvent $event */ + /** @var GenericEvent $event */ $this->outputArray[] = 'info: ' . $event->getArgument(0); }); $dispatcher->addListener('\OC\Repair::step', function ($event) { - /** @var \Symfony\Component\EventDispatcher\GenericEvent $event */ + /** @var GenericEvent $event */ $this->outputArray[] = 'step: ' . $event->getArgument(0); }); } diff --git a/tests/lib/Share20/LegacyHooksTest.php b/tests/lib/Share20/LegacyHooksTest.php index 5fc6a447047c0..1f380e12a01eb 100644 --- a/tests/lib/Share20/LegacyHooksTest.php +++ b/tests/lib/Share20/LegacyHooksTest.php @@ -22,12 +22,14 @@ */ namespace Test\Share20; +use OC\EventDispatcher\SymfonyAdapter; use OC\Share20\LegacyHooks; use OC\Share20\Manager; use OCP\Constants; +use OCP\EventDispatcher\GenericEvent; use OCP\Files\File; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\GenericEvent; +use OC\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyEventDispatcher; use Test\TestCase; class LegacyHooksTest extends TestCase { @@ -44,7 +46,9 @@ class LegacyHooksTest extends TestCase { public function setUp() { parent::setUp(); - $this->eventDispatcher = new EventDispatcher(); + $logger = \OC::$server->getLogger(); + $symfonyDispatcher = new SymfonyEventDispatcher(); + $this->eventDispatcher = new SymfonyAdapter(new EventDispatcher($symfonyDispatcher, \OC::$server, $logger), $logger); $this->hooks = new LegacyHooks($this->eventDispatcher); $this->manager = \OC::$server->getShareManager(); } diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index 6f46d69d8df16..0635867d7431e 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -41,8 +41,8 @@ use OCP\Share\IShare; use OC\Share20\Manager; use OC\Share20\Exception; - use OC\Share20\Share; +use OCP\EventDispatcher\GenericEvent; use OCP\IL10N; use OCP\ILogger; use OCP\IConfig; @@ -52,7 +52,6 @@ use OCP\Files\Mount\IMountManager; use OCP\IGroupManager; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; /** * Class ManagerTest diff --git a/tests/lib/User/DatabaseTest.php b/tests/lib/User/DatabaseTest.php index 666833ec44c17..1590765517cdd 100644 --- a/tests/lib/User/DatabaseTest.php +++ b/tests/lib/User/DatabaseTest.php @@ -21,10 +21,11 @@ */ namespace Test\User; + use OC\HintException; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; use OC\User\User; +use OCP\EventDispatcher\GenericEvent; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** * Class DatabaseTest