From 3750945cb854649b0dd506a2f728ddf341be9319 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 5 Jun 2026 10:47:14 +0200 Subject: [PATCH] fix(psalm): Fix psalm issues related to moving files Signed-off-by: Carl Schwan --- build/psalm-baseline.xml | 5 ----- lib/private/App/AppManager.php | 10 ++-------- lib/public/App/IAppManager.php | 2 +- lib/public/App/ManagerEvent.php | 35 ++++++++++++++------------------- 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index d34cdd388b2..fe478aab69d 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -3268,11 +3268,6 @@ - - - - - diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 2d690650244..3edeeec27e1 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -637,11 +637,6 @@ class AppManager implements IAppManager { } /** - * Enable an app only for specific groups - * - * @param string $appId - * @param IGroup[] $groups - * @param bool $forceEnable * @throws \InvalidArgumentException if app can't be enabled for groups * @throws AppPathNotFoundException */ @@ -663,9 +658,8 @@ class AppManager implements IAppManager { $this->overwriteNextcloudRequirement($appId); } - /** @var string[] $groupIds */ - $groupIds = array_map(function ($group) { - /** @var IGroup $group */ + /** @var list $groupIds */ + $groupIds = array_map(function (IGroup|string $group): string { return ($group instanceof IGroup) ? $group->getGID() : $group; diff --git a/lib/public/App/IAppManager.php b/lib/public/App/IAppManager.php index 94d6e15d803..04b07c1d2d1 100644 --- a/lib/public/App/IAppManager.php +++ b/lib/public/App/IAppManager.php @@ -152,7 +152,7 @@ interface IAppManager { * Enable an app only for specific groups * * @param string $appId - * @param \OCP\IGroup[] $groups + * @param list<\OCP\IGroup|string> $groups * @param bool $forceEnable * @throws \Exception * @since 8.0.0 diff --git a/lib/public/App/ManagerEvent.php b/lib/public/App/ManagerEvent.php index 71ed5616251..101817d1322 100644 --- a/lib/public/App/ManagerEvent.php +++ b/lib/public/App/ManagerEvent.php @@ -14,6 +14,7 @@ use OCP\EventDispatcher\Event; * Class ManagerEvent * * @since 9.0.0 + * @deprecated 22.0.0 Use AppEnabledEvent, AppDisableEvent and AppUpdateEvent instead */ class ManagerEvent extends Event { /** @@ -40,32 +41,25 @@ class ManagerEvent extends Event { */ public const EVENT_APP_UPDATE = 'OCP\App\IAppManager::updateApp'; - /** @var string */ - protected $event; - /** @var string */ - protected $appID; - /** @var \OCP\IGroup[]|null */ - protected $groups; - /** * DispatcherEvent constructor. * * @param string $event * @param $appID - * @param \OCP\IGroup[]|null $groups + * @param list<\OCP\IGroup|string>|null $groups * @since 9.0.0 */ - public function __construct($event, $appID, ?array $groups = null) { - $this->event = $event; - $this->appID = $appID; - $this->groups = $groups; + public function __construct( + private readonly string $event, + private readonly string $appID, + private readonly ?array $groups = null, + ) { } /** - * @return string * @since 9.0.0 */ - public function getEvent() { + public function getEvent(): string { return $this->event; } @@ -73,19 +67,20 @@ class ManagerEvent extends Event { * @return string * @since 9.0.0 */ - public function getAppID() { + public function getAppID(): string { return $this->appID; } /** * returns the group Ids - * @return string[] + * @return list * @since 9.0.0 */ - public function getGroups() { - return array_map(function ($group) { - /** @var \OCP\IGroup $group */ - return $group->getGID(); + public function getGroups(): array { + return array_map(function (\OCP\IGroup|string $group): string { + return ($group instanceof \OCP\IGroup) + ? $group->getGID() + : $group; }, $this->groups); } }