fix(psalm): Fix psalm issues related to moving files

Signed-off-by: Carl Schwan <carlschwan@kde.org>
This commit is contained in:
Carl Schwan 2026-06-05 10:47:14 +02:00
parent 64d222486f
commit 3750945cb8
No known key found for this signature in database
GPG key ID: 02325448204E452A
4 changed files with 18 additions and 34 deletions

View file

@ -3268,11 +3268,6 @@
<code><![CDATA[provideInitialState]]></code>
</DeprecatedMethod>
</file>
<file src="lib/base.php">
<InvalidArgument>
<code><![CDATA[$restrictions]]></code>
</InvalidArgument>
</file>
<file src="lib/private/Accounts/AccountManager.php">
<FalsableReturnStatement>
<code><![CDATA[json_encode($preparedData)]]></code>

View file

@ -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<string> $groupIds */
$groupIds = array_map(function (IGroup|string $group): string {
return ($group instanceof IGroup)
? $group->getGID()
: $group;

View file

@ -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

View file

@ -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<string>
* @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);
}
}