Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
use OCP\Settings\IManager;

class Application extends App implements IBootstrap {
public const APP_ID = 'external';
public const string APP_ID = 'external';

public function __construct() {
parent::__construct(self::APP_ID);
Expand Down Expand Up @@ -63,25 +63,25 @@
continue;
}

$navigationManager->add(function () use ($site, $url): array {

Check failure on line 66 in lib/AppInfo/Application.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

InvalidArgument

lib/AppInfo/Application.php:66:28: InvalidArgument: Argument 1 of OCP\INavigationManager::add expects array{app?: string, classes?: string, color?: string, href: string, icon?: string, id: string, name: string, order: int, type?: 'action'|'link'|'settings'}|callable():array{app?: string, classes?: string, color?: string, href: string, icon?: string, id: string, name: string, order: int, type?: 'action'|'link'|'settings'}, but impure-Closure():array{href: string, icon: string, id: string, name: string, order: int, target: mixed, type: 'guest'|'link'|'settings'} with additional array shape fields (target) was provided (see https://psalm.dev/004)
if ($site['icon'] !== '') {
$image = $url->linkToRoute('external.icon.showIcon', ['icon' => $site['icon']]);
} else {
$image = $url->linkToRoute('external.icon.showIcon', ['icon' => 'external.svg']);
}

$href = $site['url'];
$href = (string)$site['url'];
if (!$site['redirect']) {
$href = $url->linkToRoute('external.site.showPage', ['id' => $site['id'], 'path' => '']);
}

return [
'id' => 'external_index' . $site['id'],
'order' => 80 + $site['id'],
'order' => 80 + (int)$site['id'],
'href' => $href,
'icon' => $image,
'type' => $site['type'],
'name' => $site['name'],
'name' => (string)$site['name'],
'target' => $site['redirect'],
];
});
Expand Down
5 changes: 2 additions & 3 deletions lib/BeforeTemplateRenderedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,17 @@
continue;
}

$this->navigationManager->add(function () use ($site) {

Check failure on line 91 in lib/BeforeTemplateRenderedListener.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

InvalidArgument

lib/BeforeTemplateRenderedListener.php:91:34: InvalidArgument: Argument 1 of OCP\INavigationManager::add expects array{app?: string, classes?: string, color?: string, href: string, icon?: string, id: string, name: string, order: int, type?: 'action'|'link'|'settings'}|callable():array{app?: string, classes?: string, color?: string, href: string, icon?: string, id: string, name: string, order: int, type?: 'action'|'link'|'settings'}, but impure-Closure():array{href: string, icon: string, id: string, name: string, order: int, type: 'guest'|'link'|'settings'} provided (see https://psalm.dev/004)
$image = $this->generateImageLink($site, false);
$href = $this->getHref($site);

return [
'id' => 'external_index' . $site['id'],
'order' => 80 + $site['id'],
'order' => 80 + (int)$site['id'],
'href' => $href,
'icon' => $image,
'type' => $site['type'],
'name' => $site['name'],
'target' => $site['redirect'],
'name' => (string)$site['name'],
];
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/IconController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
*/
public function uploadIcon(): DataResponse {
$icon = $this->request->getUploadedFile('uploadicon');
if (empty($icon)) {
if ($icon === null || $icon === []) {
return new DataResponse([
'error' => $this->l10n->t('No file uploaded'),
], Http::STATUS_UNPROCESSABLE_ENTITY);
Expand Down
19 changes: 9 additions & 10 deletions lib/SitesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@
use OCP\L10N\IFactory;

class SitesManager {
public const TYPE_LINK = 'link';
public const TYPE_SETTING = 'settings';
public const TYPE_LOGIN = 'guest';
public const TYPE_QUOTA = 'quota';

public const DEVICE_ALL = '';
public const DEVICE_ANDROID = 'android';
public const DEVICE_IOS = 'ios';
public const DEVICE_DESKTOP = 'desktop';
public const DEVICE_BROWSER = 'browser';
public const string TYPE_LINK = 'link';
public const string TYPE_SETTING = 'settings';
public const string TYPE_LOGIN = 'guest';
public const string TYPE_QUOTA = 'quota';
public const string DEVICE_ALL = '';
public const string DEVICE_ANDROID = 'android';
public const string DEVICE_IOS = 'ios';
public const string DEVICE_DESKTOP = 'desktop';
public const string DEVICE_BROWSER = 'browser';

public function __construct(
private readonly IRequest $request,
Expand Down
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="tests/psalm-baseline.xml"
phpVersion="8.2"
phpVersion="8.3"
>
<stubs>
<file name="tests/stub.phpstub" preloadClasses="true"/>
Expand Down
Loading