Skip to content

Commit 0ebfdc2

Browse files
committed
#53 noteapicontroller: migrate to PHP8 annotations
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent 1b175b8 commit 0ebfdc2

2 files changed

Lines changed: 16 additions & 24 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# QOwnNotesAPI Change Log
22

3+
## Next
4+
5+
- Migrated to from PHP7 to PHP8 annotations (for [#53](https://github.com/pbek/qownnotesapi/issues/53))
6+
37
## 25.8.0
48

59
- Enabled and tested app for Nextcloud 32 (for [#52](https://github.com/pbek/qownnotesapi/issues/52))

lib/Controller/NoteApiController.php

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,14 @@ public function __construct($appName,
4545
/**
4646
* Gets all versions of a note.
4747
*
48-
* @NoAdminRequired
49-
*
50-
* @NoCSRFRequired
51-
*
52-
* @CORS
53-
*
5448
* @return array
5549
*
5650
* @throws \OCP\Lock\LockedException
5751
* @throws \OC\User\NoUserException
5852
*/
53+
#[NoAdminRequired]
54+
#[NoCSRFRequired]
55+
#[CORS]
5956
public function getAllVersions() {
6057
$source = $this->request->getParam('file_name', '');
6158
$errorMessages = [];
@@ -148,16 +145,13 @@ protected static function getUidAndFilename($filename) {
148145
/**
149146
* Returns information about the ownCloud server.
150147
*
151-
* @NoAdminRequired
152-
*
153-
* @NoCSRFRequired
154-
*
155-
* @CORS
156-
*
157148
* @return string|array
158149
*
159150
* @throws Exception
160151
*/
152+
#[NoAdminRequired]
153+
#[NoCSRFRequired]
154+
#[CORS]
161155
public function getAppInfo() {
162156
$appManager = \OC::$server->getAppManager();
163157
$versionsAppEnabled = $appManager->isEnabledForUser('files_versions');
@@ -186,16 +180,13 @@ public function getAppInfo() {
186180
/**
187181
* Gets information about trashed notes.
188182
*
189-
* @NoAdminRequired
190-
*
191-
* @NoCSRFRequired
192-
*
193-
* @CORS
194-
*
195183
* @return string|array
196184
*
197185
* @throws \OCP\Lock\LockedException
198186
*/
187+
#[NoAdminRequired]
188+
#[NoCSRFRequired]
189+
#[CORS]
199190
public function getTrashedNotes() {
200191
$dir = $this->request->getParam('dir', '');
201192
$customFileExtensions = $this->request->getParam('extensions', []);
@@ -284,13 +275,10 @@ public function getTrashedNotes() {
284275
* @throws \OCP\Files\NotPermittedException
285276
*
286277
* @see owncloud/core/apps/files_trashbin/ajax/undelete.php
287-
*
288-
* @NoAdminRequired
289-
*
290-
* @NoCSRFRequired
291-
*
292-
* @CORS
293278
*/
279+
#[NoAdminRequired]
280+
#[NoCSRFRequired]
281+
#[CORS]
294282
public function restoreTrashedNote() {
295283
$filename = $this->request->getParam('file_name');
296284
$timestamp = (int) $this->request->getParam('timestamp');

0 commit comments

Comments
 (0)