-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dispatcher): Move remaining simple cases in apps/ folder to IEven… #39485
fix(dispatcher): Move remaining simple cases in apps/ folder to IEven… #39485
Conversation
@@ -148,12 +143,18 @@ | |||
}); | |||
|
|||
// 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) { |
Check notice
Code scanning / Psalm
RedundantConditionGivenDocblockType Note
/** @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) { |
Check notice
Code scanning / Psalm
RedundantConditionGivenDocblockType Note
@@ -136,7 +134,7 @@ | |||
$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); |
Check notice
Code scanning / Psalm
DeprecatedMethod Note
@@ -153,7 +151,7 @@ | |||
); | |||
} | |||
|
|||
private function registerBackendDependents(IAppContainer $appContainer, EventDispatcherInterface $dispatcher) { | |||
private function registerBackendDependents(IAppContainer $appContainer, IEventDispatcher $dispatcher) { |
Check notice
Code scanning / Psalm
MissingReturnType Note
@@ -153,7 +151,7 @@ | |||
); | |||
} | |||
|
|||
private function registerBackendDependents(IAppContainer $appContainer, EventDispatcherInterface $dispatcher) { | |||
private function registerBackendDependents(IAppContainer $appContainer, IEventDispatcher $dispatcher) { |
Check notice
Code scanning / Psalm
DeprecatedInterface Note
08ce53a
to
f733301
Compare
…tDispatcher Signed-off-by: Joas Schilling <[email protected]>
f733301
to
77bc6c3
Compare
$dispatcher->addListener('OCP\Share::postShare', function ($event) { | ||
if (!$event instanceof OldGenericEvent) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this guard needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It helps to trick psalm, so it doesn't yield on $listener->shareNotification($event)
Later on, which only eats GenericEvent.
But it only is an intermediate step anyway to move forward to 5.4.x of the dispatcher. When we have to update to 6.4.x at the end of the year, GenericEvent will no longer exist and we need to do more work I guess, so I took the soft/low effort approach and added this mini guard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹
Docs in nextcloud/documentation#10858 |
…tDispatcher
Checklist