diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 6be6d092..8782c2ca 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -24,6 +24,7 @@ use OCA\AppAPI\Notifications\ExAppNotifier; use OCA\AppAPI\PublicCapabilities; use OCA\AppAPI\SetupChecks\DaemonCheck; +use OCA\DAV\Events\SabrePluginAddEvent; use OCA\DAV\Events\SabrePluginAuthInitEvent; use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCP\AppFramework\App; @@ -32,7 +33,6 @@ use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\EventDispatcher\IEventDispatcher; use OCP\Navigation\Events\LoadAdditionalEntriesEvent; -use OCP\SabrePluginEvent; use OCP\Settings\Events\DeclarativeSettingsGetValueEvent; use OCP\Settings\Events\DeclarativeSettingsRegisterFormEvent; use OCP\Settings\Events\DeclarativeSettingsSetValueEvent; @@ -77,9 +77,9 @@ public function boot(IBootContext $context): void { public function registerDavAuth(): void { $container = $this->getContainer(); - $dispatcher = $container->query(IEventDispatcher::class); - $dispatcher->addListener('OCA\DAV\Connector\Sabre::addPlugin', function (SabrePluginEvent $event) use ($container) { - $event->getServer()->addPlugin($container->query(DavPlugin::class)); + $dispatcher = $container->get(IEventDispatcher::class); + $dispatcher->addListener(SabrePluginAddEvent::class, function (SabrePluginAddEvent $event) use ($container) { + $event->getServer()->addPlugin($container->get(DavPlugin::class)); }); } } diff --git a/psalm.xml b/psalm.xml index 4d087f3d..751a678c 100644 --- a/psalm.xml +++ b/psalm.xml @@ -54,4 +54,7 @@ + + + diff --git a/tests/stubs/oca_dav_events_sabrepluginaddevent.php b/tests/stubs/oca_dav_events_sabrepluginaddevent.php new file mode 100644 index 00000000..4192a72b --- /dev/null +++ b/tests/stubs/oca_dav_events_sabrepluginaddevent.php @@ -0,0 +1,35 @@ +