Skip to content

Commit 71f42e5

Browse files
Merge pull request #49276 from nextcloud/refactor/register-routes
2 parents 8cf41ee + c179e78 commit 71f42e5

File tree

3 files changed

+14
-26
lines changed

3 files changed

+14
-26
lines changed

apps/files_versions/appinfo/routes.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,20 @@
88

99
use OCP\Route\IRouter;
1010

11-
/** @var Application $application */
12-
$application = \OC::$server->query(Application::class);
13-
$application->registerRoutes($this, [
14-
'routes' => [
15-
[
16-
'name' => 'Preview#getPreview',
17-
'url' => '/preview',
18-
'verb' => 'GET',
19-
],
20-
],
21-
]);
22-
2311
/** @var IRouter $this */
2412
$this->create('files_versions_download', 'apps/files_versions/download.php')
2513
->actionInclude('files_versions/download.php');
2614
$this->create('files_versions_ajax_getVersions', 'apps/files_versions/ajax/getVersions.php')
2715
->actionInclude('files_versions/ajax/getVersions.php');
2816
$this->create('files_versions_ajax_rollbackVersion', 'apps/files_versions/ajax/rollbackVersion.php')
2917
->actionInclude('files_versions/ajax/rollbackVersion.php');
18+
19+
return [
20+
'routes' => [
21+
[
22+
'name' => 'Preview#getPreview',
23+
'url' => '/preview',
24+
'verb' => 'GET',
25+
],
26+
],
27+
];

apps/user_ldap/appinfo/routes.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
declare(strict_types=1);
44

5-
use OCA\User_LDAP\AppInfo\Application;
6-
use OCP\AppFramework\App;
7-
85
/**
96
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
107
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -25,23 +22,17 @@
2522
$this->create('user_ldap_ajax_wizard', 'apps/user_ldap/ajax/wizard.php')
2623
->actionInclude('user_ldap/ajax/wizard.php');
2724

28-
$application = new App('user_ldap');
29-
$application->registerRoutes($this, [
25+
return [
3026
'ocs' => [
3127
['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'],
3228
['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'],
3329
['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'],
3430
['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'],
35-
]
36-
]);
37-
38-
/** @var Application $application */
39-
$application = \OC::$server->query(Application::class);
40-
$application->registerRoutes($this, [
31+
],
4132
'routes' => [
4233
['name' => 'renewPassword#tryRenewPassword', 'url' => '/renewpassword', 'verb' => 'POST'],
4334
['name' => 'renewPassword#showRenewPasswordForm', 'url' => '/renewpassword/{user}', 'verb' => 'GET'],
4435
['name' => 'renewPassword#cancel', 'url' => '/renewpassword/cancel', 'verb' => 'GET'],
4536
['name' => 'renewPassword#showLoginFormInvalidPassword', 'url' => '/renewpassword/invalidlogin/{user}', 'verb' => 'GET'],
46-
]
47-
]);
37+
],
38+
];

build/psalm-baseline.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,6 @@
978978
</file>
979979
<file src="apps/files_versions/appinfo/routes.php">
980980
<InvalidScope>
981-
<code><![CDATA[$this]]></code>
982981
<code><![CDATA[$this->create('files_versions_download', 'apps/files_versions/download.php')]]></code>
983982
</InvalidScope>
984983
</file>

0 commit comments

Comments
 (0)