Skip to content

feat: Throw an error when trying to listen to no longer used signals#59489

Draft
CarlSchwan wants to merge 6 commits intomasterfrom
carl/allow-list-hooks
Draft

feat: Throw an error when trying to listen to no longer used signals#59489
CarlSchwan wants to merge 6 commits intomasterfrom
carl/allow-list-hooks

Conversation

@CarlSchwan
Copy link
Copy Markdown
Member

  • Resolves: #

Summary

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Comment thread lib/private/legacy/OC_Hook.php Outdated
Comment thread lib/private/legacy/OC_Hook.php Outdated
Comment thread lib/private/legacy/OC_Hook.php Outdated
Comment thread lib/private/User/Manager.php
Comment thread lib/private/legacy/OC_Hook.php Outdated
Copy link
Copy Markdown
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit comment about ::class says "Only works if the class actually exists", I think that’s not true, PHP allows using ::class for any class even if it does not exists.

Only issue is that psalm usually complains.

@CarlSchwan CarlSchwan force-pushed the carl/allow-list-hooks branch from 2ab48d7 to 0e70391 Compare April 9, 2026 13:31
Comment thread lib/private/Authentication/LoginCredentials/Store.php Outdated
Comment thread lib/private/legacy/OC_User.php
Comment thread lib/private/Server.php
Comment thread lib/private/SubAdmin.php Outdated
@CarlSchwan CarlSchwan force-pushed the carl/allow-list-hooks branch 3 times, most recently from 64857ac to 6007b46 Compare April 22, 2026 09:51
@CarlSchwan CarlSchwan force-pushed the carl/allow-list-hooks branch 3 times, most recently from 0c266da to 60a5d58 Compare May 4, 2026 14:40
CarlSchwan added 6 commits May 5, 2026 14:39
Signed-off-by: Carl Schwan <carlschwan@kde.org>
Signed-off-by: Carl Schwan <carlschwan@kde.org>
Allow to use ::class as class names. Only works if the class actually
exists, which in many case, isn't the case anymore.

Signed-off-by: Carl Schwan <carlschwan@kde.org>
And replace the few remaining by converting the event to hooks instead
of the other way around.

Signed-off-by: Carl Schwan <carlschwan@kde.org>
Signed-off-by: Carl Schwan <carlschwan@kde.org>
Allow to get rid of more legacy code and make sure UserSessionTest is
also in psalm

Signed-off-by: Carl Schwan <carlschwan@kde.org>
@CarlSchwan CarlSchwan force-pushed the carl/allow-list-hooks branch from 60a5d58 to 62a3ef5 Compare May 5, 2026 12:40
private function callForRegistrations(): void {
static $eventSent = false;
if (!$eventSent) {
Server::get(IEventDispatcher::class)->dispatch(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/**
* @since 34.0.0
*/
interface IGetUserNameFromLoginNameBackend {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing attribute Implementable

}

Server::get(IEventDispatcher::class)->addListener(UserLoggedInEvent::class, function (UserLoggedInEvent $event) {
if ($event instanceof UserLoggedInEvent) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be elseif in case an event implements both interfaces

Comment on lines +82 to +83
private ContainerInterface $container,
private IRootFolder $rootFolder,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants