Skip to content

Commit 3750945

Browse files
committed
fix(psalm): Fix psalm issues related to moving files
Signed-off-by: Carl Schwan <carlschwan@kde.org>
1 parent 64d2224 commit 3750945

4 files changed

Lines changed: 18 additions & 34 deletions

File tree

build/psalm-baseline.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3268,11 +3268,6 @@
32683268
<code><![CDATA[provideInitialState]]></code>
32693269
</DeprecatedMethod>
32703270
</file>
3271-
<file src="lib/base.php">
3272-
<InvalidArgument>
3273-
<code><![CDATA[$restrictions]]></code>
3274-
</InvalidArgument>
3275-
</file>
32763271
<file src="lib/private/Accounts/AccountManager.php">
32773272
<FalsableReturnStatement>
32783273
<code><![CDATA[json_encode($preparedData)]]></code>

lib/private/App/AppManager.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -637,11 +637,6 @@ public function hasProtectedAppType($types) {
637637
}
638638

639639
/**
640-
* Enable an app only for specific groups
641-
*
642-
* @param string $appId
643-
* @param IGroup[] $groups
644-
* @param bool $forceEnable
645640
* @throws \InvalidArgumentException if app can't be enabled for groups
646641
* @throws AppPathNotFoundException
647642
*/
@@ -663,9 +658,8 @@ public function enableAppForGroups(string $appId, array $groups, bool $forceEnab
663658
$this->overwriteNextcloudRequirement($appId);
664659
}
665660

666-
/** @var string[] $groupIds */
667-
$groupIds = array_map(function ($group) {
668-
/** @var IGroup $group */
661+
/** @var list<string> $groupIds */
662+
$groupIds = array_map(function (IGroup|string $group): string {
669663
return ($group instanceof IGroup)
670664
? $group->getGID()
671665
: $group;

lib/public/App/IAppManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function hasProtectedAppType($types);
152152
* Enable an app only for specific groups
153153
*
154154
* @param string $appId
155-
* @param \OCP\IGroup[] $groups
155+
* @param list<\OCP\IGroup|string> $groups
156156
* @param bool $forceEnable
157157
* @throws \Exception
158158
* @since 8.0.0

lib/public/App/ManagerEvent.php

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* Class ManagerEvent
1515
*
1616
* @since 9.0.0
17+
* @deprecated 22.0.0 Use AppEnabledEvent, AppDisableEvent and AppUpdateEvent instead
1718
*/
1819
class ManagerEvent extends Event {
1920
/**
@@ -40,52 +41,46 @@ class ManagerEvent extends Event {
4041
*/
4142
public const EVENT_APP_UPDATE = 'OCP\App\IAppManager::updateApp';
4243

43-
/** @var string */
44-
protected $event;
45-
/** @var string */
46-
protected $appID;
47-
/** @var \OCP\IGroup[]|null */
48-
protected $groups;
49-
5044
/**
5145
* DispatcherEvent constructor.
5246
*
5347
* @param string $event
5448
* @param $appID
55-
* @param \OCP\IGroup[]|null $groups
49+
* @param list<\OCP\IGroup|string>|null $groups
5650
* @since 9.0.0
5751
*/
58-
public function __construct($event, $appID, ?array $groups = null) {
59-
$this->event = $event;
60-
$this->appID = $appID;
61-
$this->groups = $groups;
52+
public function __construct(
53+
private readonly string $event,
54+
private readonly string $appID,
55+
private readonly ?array $groups = null,
56+
) {
6257
}
6358

6459
/**
65-
* @return string
6660
* @since 9.0.0
6761
*/
68-
public function getEvent() {
62+
public function getEvent(): string {
6963
return $this->event;
7064
}
7165

7266
/**
7367
* @return string
7468
* @since 9.0.0
7569
*/
76-
public function getAppID() {
70+
public function getAppID(): string {
7771
return $this->appID;
7872
}
7973

8074
/**
8175
* returns the group Ids
82-
* @return string[]
76+
* @return list<string>
8377
* @since 9.0.0
8478
*/
85-
public function getGroups() {
86-
return array_map(function ($group) {
87-
/** @var \OCP\IGroup $group */
88-
return $group->getGID();
79+
public function getGroups(): array {
80+
return array_map(function (\OCP\IGroup|string $group): string {
81+
return ($group instanceof \OCP\IGroup)
82+
? $group->getGID()
83+
: $group;
8984
}, $this->groups);
9085
}
9186
}

0 commit comments

Comments
 (0)