Skip to content

Commit

Permalink
Merge pull request #43194 from nextcloud/fix/fix-psalm-missing-templa…
Browse files Browse the repository at this point in the history
…te-parameter
  • Loading branch information
come-nc authored Jan 30, 2024
2 parents e224432 + 0dd0035 commit 52f3616
Show file tree
Hide file tree
Showing 62 changed files with 83 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Log\Audit\CriticalActionPerformedEvent;

/** @template-implements IEventListener<CriticalActionPerformedEvent> */
class CriticalActionPerformedEventListener extends Action implements IEventListener {
public function handle(Event $event): void {
if (!($event instanceof CriticalActionPerformedEvent)) {
Expand Down
1 change: 1 addition & 0 deletions apps/comments/lib/Listener/CommentsEntityEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Files\IRootFolder;

/** @template-implements IEventListener<CommentsEntityEvent> */
class CommentsEntityEventListener implements IEventListener {
public function __construct(
private IRootFolder $rootFolder,
Expand Down
1 change: 1 addition & 0 deletions apps/comments/lib/Listener/LoadAdditionalScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Util;

/** @template-implements IEventListener<LoadAdditionalScriptsEvent> */
class LoadAdditionalScripts implements IEventListener {
public function handle(Event $event): void {
if (!($event instanceof LoadAdditionalScriptsEvent)) {
Expand Down
1 change: 1 addition & 0 deletions apps/comments/lib/Listener/LoadSidebarScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Util;

/** @template-implements IEventListener<LoadSidebar> */
class LoadSidebarScripts implements IEventListener {
public function __construct(
private ICommentsManager $commentsManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
use Sabre\VObject\Component\VCard;
use Sabre\VObject\UUIDUtil;

/** @template-implements IEventListener<ContactInteractedWithEvent> */
class ContactInteractionListener implements IEventListener {

use TTransactional;
Expand Down Expand Up @@ -74,7 +75,7 @@ public function handle(Event $event): void {
$uid = $event->getUid();
$email = $event->getEmail();
$federatedCloudId = $event->getFederatedCloudId();

$existingContact = $this->cardSearchDao->findExisting(
$event->getActor(),
$uid,
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Listener/ActivityUpdaterListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use Throwable;
use function sprintf;

/** @template-implements IEventListener<CalendarCreatedEvent|CalendarUpdatedEvent|CalendarMovedToTrashEvent|CalendarRestoredEvent|CalendarDeletedEvent|CalendarObjectCreatedEvent|CalendarObjectUpdatedEvent|CalendarObjectMovedEvent|CalendarObjectMovedToTrashEvent|CalendarObjectRestoredEvent|CalendarObjectDeletedEvent> */
class ActivityUpdaterListener implements IEventListener {

/** @var ActivityBackend */
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Listener/AddressbookListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use Throwable;
use function sprintf;

/** @template-implements IEventListener<AddressBookCreatedEvent|AddressBookUpdatedEvent|AddressBookDeletedEvent|AddressBookShareUpdatedEvent> */
class AddressbookListener implements IEventListener {
/** @var ActivityBackend */
private $activityBackend;
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Listener/BirthdayListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;

/** @template-implements IEventListener<CardCreatedEvent|CardUpdatedEvent|CardDeletedEvent> */
class BirthdayListener implements IEventListener {
private BirthdayService $birthdayService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
use function strlen;
use function substr;

/** @template-implements IEventListener<CalendarObjectCreatedEvent|CalendarObjectUpdatedEvent|CalendarShareUpdatedEvent> */
class CalendarContactInteractionListener implements IEventListener {
private const URI_USERS = 'principals/users/';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
use Throwable;

/**
* @template-implements IEventListener<\OCA\DAV\Events\CalendarDeletedEvent>
* @template-implements IEventListener<CalendarDeletedEvent>
*/
class CalendarDeletionDefaultUpdaterListener implements IEventListener {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
use Throwable;
use function sprintf;

/** @template-implements IEventListener<CalendarMovedToTrashEvent|CalendarDeletedEvent|CalendarRestoredEvent|CalendarObjectCreatedEvent|CalendarObjectUpdatedEvent|CalendarObjectMovedToTrashEvent|CalendarObjectRestoredEvent|CalendarObjectDeletedEvent> */
class CalendarObjectReminderUpdaterListener implements IEventListener {

/** @var ReminderBackend */
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Listener/CalendarPublicationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCP\EventDispatcher\IEventListener;
use Psr\Log\LoggerInterface;

/** @template-implements IEventListener<CalendarPublishedEvent|CalendarUnpublishedEvent> */
class CalendarPublicationListener implements IEventListener {
private Backend $activityBackend;
private LoggerInterface $logger;
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Listener/CalendarShareUpdateListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use OCP\EventDispatcher\IEventListener;
use Psr\Log\LoggerInterface;

/** @template-implements IEventListener<CalendarShareUpdatedEvent> */
class CalendarShareUpdateListener implements IEventListener {
private Backend $activityBackend;
private LoggerInterface $logger;
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Listener/CardListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use Throwable;
use function sprintf;

/** @template-implements IEventListener<CardCreatedEvent|CardUpdatedEvent|CardDeletedEvent> */
class CardListener implements IEventListener {
/** @var ActivityBackend */
private $activityBackend;
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Listener/ClearPhotoCacheListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;

/** @template-implements IEventListener<CardUpdatedEvent|CardDeletedEvent> */
class ClearPhotoCacheListener implements IEventListener {
private PhotoCache $photoCache;

Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Listener/SubscriptionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use OCP\EventDispatcher\IEventListener;
use Psr\Log\LoggerInterface;

/** @template-implements IEventListener<SubscriptionCreatedEvent|SubscriptionDeletedEvent> */
class SubscriptionListener implements IEventListener {
private IJobList $jobList;
private RefreshWebcalService $refreshWebcalService;
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Listener/TrustedServerRemovedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Federation\Events\TrustedServerRemovedEvent;

/** @template-implements IEventListener<TrustedServerRemovedEvent> */
class TrustedServerRemovedListener implements IEventListener {
private CardDavBackend $cardDavBackend;

Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/Listener/UserPreferenceListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;

/** @template-implements IEventListener<BeforePreferenceSetEvent|BeforePreferenceDeletedEvent> */
class UserPreferenceListener implements IEventListener {

protected IJobList $jobList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;

/** @template-implements IEventListener<LoadAdditionalScriptsEvent> */
class LoadAdditionalScriptsListener implements IEventListener {
/** @var FederatedShareProvider */
protected $federatedShareProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

/**
* @since 20.0.0
* @template-implements IEventListener<SabrePluginAuthInitEvent>
*/
class SabrePluginAuthInitListener implements IEventListener {
private FedAuth $fedAuth;
Expand Down
1 change: 1 addition & 0 deletions apps/files/lib/Listener/LoadSidebarListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Util;

/** @template-implements IEventListener<LoadSidebar> */
class LoadSidebarListener implements IEventListener {
public function handle(Event $event): void {
if (!($event instanceof LoadSidebar)) {
Expand Down
1 change: 1 addition & 0 deletions apps/files/lib/Listener/RenderReferenceEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;

/** @template-implements IEventListener<RenderReferenceEvent> */
class RenderReferenceEventListener implements IEventListener {
public function handle(Event $event): void {
if (!$event instanceof RenderReferenceEvent) {
Expand Down
1 change: 1 addition & 0 deletions apps/files_external/lib/Listener/GroupDeletedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Group\Events\GroupDeletedEvent;

/** @template-implements IEventListener<GroupDeletedEvent> */
class GroupDeletedListener implements IEventListener {
/** @var DBConfigService */
private $config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
use OCP\Util;

/**
* @template-implements IEventListener<Event|LoadAdditionalScriptsEvent>
* @template-implements IEventListener<LoadAdditionalScriptsEvent>
*/
class LoadAdditionalListener implements IEventListener {

Expand Down
1 change: 1 addition & 0 deletions apps/files_external/lib/Listener/StorePasswordListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use OCP\User\Events\PasswordUpdatedEvent;
use OCP\User\Events\UserLoggedInEvent;

/** @template-implements IEventListener<PasswordUpdatedEvent|UserLoggedInEvent> */
class StorePasswordListener implements IEventListener {
/** @var ICredentialsManager */
private $credentialsManager;
Expand Down
1 change: 1 addition & 0 deletions apps/files_external/lib/Listener/UserDeletedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\User\Events\UserDeletedEvent;

/** @template-implements IEventListener<UserDeletedEvent> */
class UserDeletedListener implements IEventListener {
/** @var DBConfigService */
private $config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Util;

/** @template-implements IEventListener<LoadAdditionalScriptsEvent> */
class LoadAdditionalScriptsListener implements IEventListener {
public function __construct(
private IAppManager $appManager,
Expand Down
1 change: 1 addition & 0 deletions apps/files_reminders/lib/Listener/NodeDeletedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Files\Events\Node\NodeDeletedEvent;

/** @template-implements IEventListener<NodeDeletedEvent> */
class NodeDeletedListener implements IEventListener {
public function __construct(
private ReminderService $reminderService,
Expand Down
1 change: 1 addition & 0 deletions apps/files_reminders/lib/Listener/UserDeletedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\User\Events\UserDeletedEvent;

/** @template-implements IEventListener<UserDeletedEvent> */
class UserDeletedListener implements IEventListener {
public function __construct(
private ReminderService $reminderService,
Expand Down
1 change: 1 addition & 0 deletions apps/files_sharing/lib/Listener/LoadAdditionalListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCP\Share\IManager;
use OCP\Util;

/** @template-implements IEventListener<LoadAdditionalScriptsEvent> */
class LoadAdditionalListener implements IEventListener {
public function handle(Event $event): void {
if (!($event instanceof LoadAdditionalScriptsEvent)) {
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/Listener/LoadSidebarListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
use OCP\Util;

/**
* @template-implements IEventListener<Event>
* @template-implements IEventListener<LoadSidebar>
*/
class LoadSidebarListener implements IEventListener {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use Psr\Log\LoggerInterface;
use function in_array;

/** @template-implements IEventListener<ShareCreatedEvent> */
class ShareInteractionListener implements IEventListener {
private const SUPPORTED_SHARE_TYPES = [
IShare::TYPE_USER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use OCP\Share\IManager;
use OCP\Share\IShare;

/** @template-implements IEventListener<UserAddedEvent> */
class UserAddedToGroupListener implements IEventListener {

/** @var IManager */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use OCP\Share\IManager;
use OCP\Share\IShare;

/** @template-implements IEventListener<ShareCreatedEvent> */
class UserShareAcceptanceListener implements IEventListener {

/** @var IConfig */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Util;

/** @template-implements IEventListener<LoadAdditionalScriptsEvent> */
class LoadAdditionalScripts implements IEventListener {
public function handle(Event $event): void {
if (!($event instanceof LoadAdditionalScriptsEvent)) {
Expand Down
1 change: 1 addition & 0 deletions apps/files_versions/lib/Listener/FileEventsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
use OCP\IUserSession;
use Psr\Log\LoggerInterface;

/** @template-implements IEventListener<BeforeNodeCopiedEvent|BeforeNodeDeletedEvent|BeforeNodeRenamedEvent|BeforeNodeTouchedEvent|BeforeNodeWrittenEvent|NodeCopiedEvent|NodeCreatedEvent|NodeDeletedEvent|NodeRenamedEvent|NodeTouchedEvent|NodeWrittenEvent> */
class FileEventsListener implements IEventListener {
/**
* @var array<int, array>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Util;

/** @template-implements IEventListener<LoadAdditionalScriptsEvent> */
class LoadAdditionalListener implements IEventListener {
public function handle(Event $event): void {
if (!($event instanceof LoadAdditionalScriptsEvent)) {
Expand Down
1 change: 1 addition & 0 deletions apps/files_versions/lib/Listener/LoadSidebarListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Util;

/** @template-implements IEventListener<LoadSidebar> */
class LoadSidebarListener implements IEventListener {
public function handle(Event $event): void {
if (!($event instanceof LoadSidebar)) {
Expand Down
1 change: 1 addition & 0 deletions apps/provisioning_api/lib/Listener/UserDeletedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\User\Events\UserDeletedEvent;

/** @template-implements IEventListener<UserDeletedEvent> */
class UserDeletedListener implements IEventListener {

/** @var KnownUserService */
Expand Down
1 change: 1 addition & 0 deletions apps/settings/lib/Listener/GroupRemovedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use OCP\EventDispatcher\IEventListener;
use OCP\Group\Events\GroupDeletedEvent;

/** @template-implements IEventListener<GroupDeletedEvent> */
class GroupRemovedListener implements IEventListener {

/** @var AuthorizedGroupService $authorizedGroupService */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use OCP\IUser;
use OCP\IUserSession;

/** @template-implements IEventListener<UserAddedEvent> */
class UserAddedToGroupActivityListener implements IEventListener {

/** @var Manager */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use OCP\IUser;
use OCP\IUserSession;

/** @template-implements IEventListener<UserRemovedEvent> */
class UserRemovedFromGroupActivityListener implements IEventListener {

/** @var Manager */
Expand Down
1 change: 1 addition & 0 deletions apps/theming/lib/Listener/BeforePreferenceListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;

/** @template-implements IEventListener<BeforePreferenceDeletedEvent|BeforePreferenceSetEvent> */
class BeforePreferenceListener implements IEventListener {
public function __construct(
private IAppManager $appManager,
Expand Down
4 changes: 3 additions & 1 deletion apps/theming/lib/Listener/BeforeTemplateRenderedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use OCA\Theming\Service\BackgroundService;
use OCA\Theming\Service\JSDataService;
use OCA\Theming\Service\ThemeInjectionService;
use OCP\AppFramework\Http\Events\BeforeLoginTemplateRenderedEvent;
use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
Expand All @@ -38,6 +39,7 @@
use OCP\IUserSession;
use Psr\Container\ContainerInterface;

/** @template-implements IEventListener<BeforeTemplateRenderedEvent|BeforeLoginTemplateRenderedEvent> */
class BeforeTemplateRenderedListener implements IEventListener {

private IInitialState $initialState;
Expand Down Expand Up @@ -66,7 +68,7 @@ public function handle(Event $event): void {
fn () => $this->container->get(JSDataService::class),
);

/** @var BeforeTemplateRenderedEvent $event */
/** @var BeforeTemplateRenderedEvent|BeforeLoginTemplateRenderedEvent $event */
if ($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) {
$this->initialState->provideLazyInitialState('shortcutsDisabled', function () {
if ($this->userSession->getUser()) {
Expand Down
Loading

0 comments on commit 52f3616

Please sign in to comment.