diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-04-27 14:38:18 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-04-30 19:04:59 +0200 |
commit | 832f79ac9388addeb2b22479c6da1ac46eea205c (patch) | |
tree | ae2c4c4a992564d0df168d1674c26354990ae4f1 | |
parent | 8e07f323a164a513e4dd2de8d07bbaa8731293d3 (diff) | |
download | nextcloud-server-832f79ac9388addeb2b22479c6da1ac46eea205c.tar.gz nextcloud-server-832f79ac9388addeb2b22479c6da1ac46eea205c.zip |
chore: apply code style
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1999 files changed, 10034 insertions, 8718 deletions
diff --git a/apps/admin_audit/lib/Actions/Files.php b/apps/admin_audit/lib/Actions/Files.php index bf9660b1939..57204e0b022 100644 --- a/apps/admin_audit/lib/Actions/Files.php +++ b/apps/admin_audit/lib/Actions/Files.php @@ -41,7 +41,7 @@ class Files extends Action { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file read: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + 'Exception thrown in file read: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -61,7 +61,7 @@ class Files extends Action { $this->renamedNodes[$source->getId()] = $source; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file rename: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + 'Exception thrown in file rename: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -81,7 +81,7 @@ class Files extends Action { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file rename: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + 'Exception thrown in file rename: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -105,7 +105,7 @@ class Files extends Action { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file create: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + 'Exception thrown in file create: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -132,7 +132,7 @@ class Files extends Action { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file copy: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + 'Exception thrown in file copy: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -155,7 +155,7 @@ class Files extends Action { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file write: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + 'Exception thrown in file write: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -181,7 +181,7 @@ class Files extends Action { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file delete: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + 'Exception thrown in file delete: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } @@ -210,7 +210,7 @@ class Files extends Action { ]; } catch (InvalidPathException|NotFoundException $e) { \OCP\Server::get(LoggerInterface::class)->error( - "Exception thrown in file preview: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + 'Exception thrown in file preview: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] ); return; } diff --git a/apps/cloud_federation_api/lib/Capabilities.php b/apps/cloud_federation_api/lib/Capabilities.php index 61cc45a24e6..d5cb30bdc3f 100644 --- a/apps/cloud_federation_api/lib/Capabilities.php +++ b/apps/cloud_federation_api/lib/Capabilities.php @@ -55,8 +55,8 @@ class Capabilities implements ICapability { $resource = $this->provider->createNewResourceType(); $resource->setName('file') - ->setShareTypes(['user', 'group']) - ->setProtocols(['webdav' => '/public.php/webdav/']); + ->setShareTypes(['user', 'group']) + ->setProtocols(['webdav' => '/public.php/webdav/']); $this->provider->addResourceType($resource); diff --git a/apps/cloud_federation_api/lib/Config.php b/apps/cloud_federation_api/lib/Config.php index 9aefca746a1..610769f2d8e 100644 --- a/apps/cloud_federation_api/lib/Config.php +++ b/apps/cloud_federation_api/lib/Config.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php index 21c557354ff..80695caa61d 100644 --- a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php +++ b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -71,9 +72,9 @@ class RequestHandlerController extends Controller { * @param string $resourceType 'file', 'calendar',... * * @return JSONResponse<Http::STATUS_CREATED, CloudFederationAPIAddShare, array{}>|JSONResponse<Http::STATUS_BAD_REQUEST, CloudFederationAPIValidationError, array{}>|JSONResponse<Http::STATUS_NOT_IMPLEMENTED, CloudFederationAPIError, array{}> - * 201: The notification was successfully received. The display name of the recipient might be returned in the body - * 400: Bad request due to invalid parameters, e.g. when `shareWith` is not found or required properties are missing - * 501: Share type or the resource type is not supported + * 201: The notification was successfully received. The display name of the recipient might be returned in the body + * 400: Bad request due to invalid parameters, e.g. when `shareWith` is not found or required properties are missing + * 501: Share type or the resource type is not supported */ #[PublicPage] #[NoCSRFRequired] @@ -196,10 +197,10 @@ class RequestHandlerController extends Controller { * @param array<string, mixed>|null $notification The actual payload of the notification * * @return JSONResponse<Http::STATUS_CREATED, array<string, mixed>, array{}>|JSONResponse<Http::STATUS_BAD_REQUEST, CloudFederationAPIValidationError, array{}>|JSONResponse<Http::STATUS_FORBIDDEN|Http::STATUS_NOT_IMPLEMENTED, CloudFederationAPIError, array{}> - * 201: The notification was successfully received - * 400: Bad request due to invalid parameters, e.g. when `type` is invalid or missing - * 403: Getting resource is not allowed - * 501: The resource type is not supported + * 201: The notification was successfully received + * 400: Bad request due to invalid parameters, e.g. when `type` is invalid or missing + * 403: Getting resource is not allowed + * 501: The resource type is not supported */ #[NoCSRFRequired] #[PublicPage] diff --git a/apps/comments/lib/Activity/Filter.php b/apps/comments/lib/Activity/Filter.php index 6f010d855cb..8dcafd872d7 100644 --- a/apps/comments/lib/Activity/Filter.php +++ b/apps/comments/lib/Activity/Filter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/comments/lib/Activity/Listener.php b/apps/comments/lib/Activity/Listener.php index f49f2077a61..f94be8eda96 100644 --- a/apps/comments/lib/Activity/Listener.php +++ b/apps/comments/lib/Activity/Listener.php @@ -38,7 +38,7 @@ class Listener { // Get all mount point owners $cache = $this->mountCollection->getMountCache(); - $mounts = $cache->getMountsForFileId((int)$event->getComment()->getObjectId()); + $mounts = $cache->getMountsForFileId((int) $event->getComment()->getObjectId()); if (empty($mounts)) { return; } @@ -47,7 +47,7 @@ class Listener { foreach ($mounts as $mount) { $owner = $mount->getUser()->getUID(); $ownerFolder = $this->rootFolder->getUserFolder($owner); - $nodes = $ownerFolder->getById((int)$event->getComment()->getObjectId()); + $nodes = $ownerFolder->getById((int) $event->getComment()->getObjectId()); if (!empty($nodes)) { /** @var Node $node */ $node = array_shift($nodes); @@ -75,7 +75,7 @@ class Listener { foreach ($users as $user => $path) { // numerical user ids end up as integers from array keys, but string // is required - $activity->setAffectedUser((string)$user); + $activity->setAffectedUser((string) $user); $activity->setSubject('add_comment_subject', [ 'actor' => $actor, diff --git a/apps/comments/lib/Activity/Provider.php b/apps/comments/lib/Activity/Provider.php index 704ef0e0a48..4806eeec693 100644 --- a/apps/comments/lib/Activity/Provider.php +++ b/apps/comments/lib/Activity/Provider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/comments/lib/Activity/Setting.php b/apps/comments/lib/Activity/Setting.php index 9315aedc104..7fbf4001b20 100644 --- a/apps/comments/lib/Activity/Setting.php +++ b/apps/comments/lib/Activity/Setting.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/comments/lib/AppInfo/Application.php b/apps/comments/lib/AppInfo/Application.php index f0a7b063c9a..db4a2ce614c 100644 --- a/apps/comments/lib/AppInfo/Application.php +++ b/apps/comments/lib/AppInfo/Application.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/comments/lib/Collaboration/CommentersSorter.php b/apps/comments/lib/Collaboration/CommentersSorter.php index 46fec87c777..baa27155573 100644 --- a/apps/comments/lib/Collaboration/CommentersSorter.php +++ b/apps/comments/lib/Collaboration/CommentersSorter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/comments/lib/Controller/NotificationsController.php b/apps/comments/lib/Controller/NotificationsController.php index a3228247884..708ae7978da 100644 --- a/apps/comments/lib/Controller/NotificationsController.php +++ b/apps/comments/lib/Controller/NotificationsController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -69,7 +70,7 @@ class NotificationsController extends Controller { return new NotFoundResponse(); } $userFolder = $this->rootFolder->getUserFolder($currentUser->getUID()); - $files = $userFolder->getById((int)$comment->getObjectId()); + $files = $userFolder->getById((int) $comment->getObjectId()); $this->markProcessed($comment, $currentUser); diff --git a/apps/comments/lib/Listener/CommentsEntityEventListener.php b/apps/comments/lib/Listener/CommentsEntityEventListener.php index 5aeeb3c63ea..2a805d80083 100644 --- a/apps/comments/lib/Listener/CommentsEntityEventListener.php +++ b/apps/comments/lib/Listener/CommentsEntityEventListener.php @@ -28,7 +28,7 @@ class CommentsEntityEventListener implements IEventListener { } $event->addEntityCollection('files', function ($name): bool { - $nodes = $this->rootFolder->getUserFolder($this->userId)->getById((int)$name); + $nodes = $this->rootFolder->getUserFolder($this->userId)->getById((int) $name); return !empty($nodes); }); } diff --git a/apps/comments/lib/MaxAutoCompleteResultsInitialState.php b/apps/comments/lib/MaxAutoCompleteResultsInitialState.php index b4c8f8719db..96bc2e6ea16 100644 --- a/apps/comments/lib/MaxAutoCompleteResultsInitialState.php +++ b/apps/comments/lib/MaxAutoCompleteResultsInitialState.php @@ -22,6 +22,6 @@ class MaxAutoCompleteResultsInitialState extends InitialStateProvider { } public function getData(): int { - return (int)$this->config->getAppValue('comments', 'maxAutoCompleteResults', '10'); + return (int) $this->config->getAppValue('comments', 'maxAutoCompleteResults', '10'); } } diff --git a/apps/comments/lib/Notification/Notifier.php b/apps/comments/lib/Notification/Notifier.php index d5563ef7d85..9ed63029fc9 100644 --- a/apps/comments/lib/Notification/Notifier.php +++ b/apps/comments/lib/Notification/Notifier.php @@ -84,7 +84,7 @@ class Notifier implements INotifier { throw new UnknownNotificationException('Unsupported comment object'); } $userFolder = $this->rootFolder->getUserFolder($notification->getUser()); - $nodes = $userFolder->getById((int)$parameters[1]); + $nodes = $userFolder->getById((int) $parameters[1]); if (empty($nodes)) { throw new AlreadyProcessedException(); } diff --git a/apps/comments/lib/Search/Result.php b/apps/comments/lib/Search/Result.php index f9bdc71f0a3..a37b80686d2 100644 --- a/apps/comments/lib/Search/Result.php +++ b/apps/comments/lib/Search/Result.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/comments/tests/Unit/Activity/ListenerTest.php b/apps/comments/tests/Unit/Activity/ListenerTest.php index c1606aee745..cd9a1c29150 100644 --- a/apps/comments/tests/Unit/Activity/ListenerTest.php +++ b/apps/comments/tests/Unit/Activity/ListenerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php b/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php index 0a67a699f86..e251bfec1c1 100644 --- a/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php +++ b/apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -11,9 +12,9 @@ use OCP\Comments\ICommentsManager; use Test\TestCase; class CommentersSorterTest extends TestCase { - /** @var ICommentsManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ICommentsManager|\PHPUnit\Framework\MockObject\MockObject */ protected $commentsManager; - /** @var CommentersSorter */ + /** @var CommentersSorter */ protected $sorter; protected function setUp(): void { diff --git a/apps/comments/tests/Unit/EventHandlerTest.php b/apps/comments/tests/Unit/EventHandlerTest.php index fc7890440f3..b024f7326f6 100644 --- a/apps/comments/tests/Unit/EventHandlerTest.php +++ b/apps/comments/tests/Unit/EventHandlerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -13,7 +14,7 @@ use OCP\Comments\IComment; use Test\TestCase; class EventHandlerTest extends TestCase { - /** @var CommentsEventListener */ + /** @var CommentsEventListener */ protected $eventHandler; /** @var ActivityListener|\PHPUnit\Framework\MockObject\MockObject */ diff --git a/apps/comments/tests/Unit/Notification/ListenerTest.php b/apps/comments/tests/Unit/Notification/ListenerTest.php index a81753b3e34..3082333e8a3 100644 --- a/apps/comments/tests/Unit/Notification/ListenerTest.php +++ b/apps/comments/tests/Unit/Notification/ListenerTest.php @@ -26,7 +26,7 @@ class ListenerTest extends TestCase { /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */ protected $urlGenerator; - /** @var Listener */ + /** @var Listener */ protected $listener; protected function setUp(): void { diff --git a/apps/comments/tests/Unit/Notification/NotifierTest.php b/apps/comments/tests/Unit/Notification/NotifierTest.php index a01c08a6760..0ca78fa8ebb 100644 --- a/apps/comments/tests/Unit/Notification/NotifierTest.php +++ b/apps/comments/tests/Unit/Notification/NotifierTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/contactsinteraction/lib/AddressBook.php b/apps/contactsinteraction/lib/AddressBook.php index dfa66ff6737..0462bfadba1 100644 --- a/apps/contactsinteraction/lib/AddressBook.php +++ b/apps/contactsinteraction/lib/AddressBook.php @@ -39,7 +39,7 @@ class AddressBook extends ExternalAddressBook implements IACL { * @throws Exception */ public function delete(): void { - throw new Exception("This addressbook is immutable"); + throw new Exception('This addressbook is immutable'); } /** @@ -47,7 +47,7 @@ class AddressBook extends ExternalAddressBook implements IACL { * @throws Exception */ public function createFile($name, $data = null) { - throw new Exception("This addressbook is immutable"); + throw new Exception('This addressbook is immutable'); } /** @@ -59,13 +59,13 @@ class AddressBook extends ExternalAddressBook implements IACL { return new Card( $this->mapper->find( $this->getUid(), - (int)$name + (int) $name ), $this->principalUri, $this->getACL() ); } catch (DoesNotExistException $ex) { - throw new NotFound("Contact does not exist: " . $ex->getMessage(), 0, $ex); + throw new NotFound('Contact does not exist: ' . $ex->getMessage(), 0, $ex); } } @@ -92,7 +92,7 @@ class AddressBook extends ExternalAddressBook implements IACL { try { $this->mapper->find( $this->getUid(), - (int)$name + (int) $name ); return true; } catch (DoesNotExistException $e) { @@ -112,7 +112,7 @@ class AddressBook extends ExternalAddressBook implements IACL { * @throws Exception */ public function propPatch(PropPatch $propPatch) { - throw new Exception("This addressbook is immutable"); + throw new Exception('This addressbook is immutable'); } /** diff --git a/apps/contactsinteraction/lib/Db/CardSearchDao.php b/apps/contactsinteraction/lib/Db/CardSearchDao.php index 0929cb7efa0..09fa4711adb 100644 --- a/apps/contactsinteraction/lib/Db/CardSearchDao.php +++ b/apps/contactsinteraction/lib/Db/CardSearchDao.php @@ -50,7 +50,7 @@ class CardSearchDao { } $addressbooksQuery->selectDistinct('id') ->from('addressbooks') - ->where($addressbooksQuery->expr()->eq('principaluri', $cardQuery->createNamedParameter("principals/users/" . $user->getUID()))); + ->where($addressbooksQuery->expr()->eq('principaluri', $cardQuery->createNamedParameter('principals/users/' . $user->getUID()))); $propQuery->selectDistinct('cardid') ->from('cards_properties') ->where($propQuery->expr()->in('addressbookid', $propQuery->createFunction($addressbooksQuery->getSQL()), IQueryBuilder::PARAM_INT_ARRAY)) diff --git a/apps/contactsinteraction/lib/Db/RecentContactMapper.php b/apps/contactsinteraction/lib/Db/RecentContactMapper.php index c835b5287c8..02d2c1e8ea1 100644 --- a/apps/contactsinteraction/lib/Db/RecentContactMapper.php +++ b/apps/contactsinteraction/lib/Db/RecentContactMapper.php @@ -100,7 +100,7 @@ class RecentContactMapper extends QBMapper { return null; } - return (int)$row['last_contact']; + return (int) $row['last_contact']; } public function cleanUp(int $olderThan): void { diff --git a/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php b/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php index ac0cd927512..78b366f015e 100644 --- a/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php +++ b/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php @@ -45,12 +45,12 @@ class ContactInteractionListener implements IEventListener { } if ($event->getUid() === null && $event->getEmail() === null && $event->getFederatedCloudId() === null) { - $this->logger->warning("Contact interaction event has no user identifier set"); + $this->logger->warning('Contact interaction event has no user identifier set'); return; } if ($event->getUid() !== null && $event->getUid() === $event->getActor()->getUID()) { - $this->logger->info("Ignoring contact interaction with self"); + $this->logger->info('Ignoring contact interaction with self'); return; } diff --git a/apps/dav/appinfo/routes.php b/apps/dav/appinfo/routes.php index 91c1ba58ea2..dba7bcbbdf0 100644 --- a/apps/dav/appinfo/routes.php +++ b/apps/dav/appinfo/routes.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Avatars/AvatarHome.php b/apps/dav/lib/Avatars/AvatarHome.php index 1f86941e592..f3ed3e5f8c1 100644 --- a/apps/dav/lib/Avatars/AvatarHome.php +++ b/apps/dav/lib/Avatars/AvatarHome.php @@ -43,7 +43,7 @@ class AvatarHome implements ICollection { public function getChild($name) { $elements = pathinfo($name); $ext = $elements['extension'] ?? ''; - $size = (int)($elements['filename'] ?? '64'); + $size = (int) ($elements['filename'] ?? '64'); if (!in_array($ext, ['jpeg', 'png'], true)) { throw new MethodNotAllowed('File format not allowed'); } diff --git a/apps/dav/lib/Avatars/AvatarNode.php b/apps/dav/lib/Avatars/AvatarNode.php index 3931ce3ff71..949c443d3fd 100644 --- a/apps/dav/lib/Avatars/AvatarNode.php +++ b/apps/dav/lib/Avatars/AvatarNode.php @@ -74,7 +74,7 @@ class AvatarNode extends File { public function getLastModified() { $timestamp = $this->avatar->getFile($this->size)->getMTime(); if (!empty($timestamp)) { - return (int)$timestamp; + return (int) $timestamp; } return $timestamp; } diff --git a/apps/dav/lib/Avatars/RootCollection.php b/apps/dav/lib/Avatars/RootCollection.php index d7cdb92c6be..2de5272bb68 100644 --- a/apps/dav/lib/Avatars/RootCollection.php +++ b/apps/dav/lib/Avatars/RootCollection.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2017 ownCloud GmbH diff --git a/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php b/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php index 1479cd363b3..6fe10c576bb 100644 --- a/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php +++ b/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php @@ -14,7 +14,7 @@ use OCP\IDBConnection; class CleanupInvitationTokenJob extends TimedJob { - /** @var IDBConnection */ + /** @var IDBConnection */ private $db; public function __construct(IDBConnection $db, ITimeFactory $time) { diff --git a/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php b/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php index fa53a8be4f0..bc306d58fe1 100644 --- a/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php +++ b/apps/dav/lib/BackgroundJob/DeleteOutdatedSchedulingObjects.php @@ -30,6 +30,6 @@ class DeleteOutdatedSchedulingObjects extends TimedJob { protected function run($argument): void { $time = $this->time->getTime() - (60 * 60); $this->calDavBackend->deleteOutdatedSchedulingObjects($time, 50000); - $this->logger->info("Removed outdated scheduling objects"); + $this->logger->info('Removed outdated scheduling objects'); } } diff --git a/apps/dav/lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php b/apps/dav/lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php index 8293b370996..cc4fd5dce9d 100644 --- a/apps/dav/lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php +++ b/apps/dav/lib/BackgroundJob/OutOfOfficeEventDispatcherJob.php @@ -41,7 +41,7 @@ class OutOfOfficeEventDispatcherJob extends QueuedJob { try { $absence = $this->absenceMapper->findById($id); - } catch (DoesNotExistException | \OCP\DB\Exception $e) { + } catch (DoesNotExistException|\OCP\DB\Exception $e) { $this->logger->error('Failed to dispatch out-of-office event: ' . $e->getMessage(), [ 'exception' => $e, 'argument' => $argument, diff --git a/apps/dav/lib/BackgroundJob/UploadCleanup.php b/apps/dav/lib/BackgroundJob/UploadCleanup.php index d90e6cbd171..aa19dbb22ec 100644 --- a/apps/dav/lib/BackgroundJob/UploadCleanup.php +++ b/apps/dav/lib/BackgroundJob/UploadCleanup.php @@ -44,7 +44,7 @@ class UploadCleanup extends TimedJob { /** @var Folder $uploads */ $uploads = $userRoot->get('uploads'); $uploadFolder = $uploads->get($folder); - } catch (NotFoundException | NoUserException $e) { + } catch (NotFoundException|NoUserException $e) { $this->jobList->remove(self::class, $argument); return; } @@ -53,7 +53,7 @@ class UploadCleanup extends TimedJob { $time = $this->time->getTime() - 60 * 60 * 24; if (!($uploadFolder instanceof Folder)) { - $this->logger->error("Found a file inside the uploads folder. Uid: " . $uid . ' folder: ' . $folder); + $this->logger->error('Found a file inside the uploads folder. Uid: ' . $uid . ' folder: ' . $folder); if ($uploadFolder->getMTime() < $time) { $uploadFolder->delete(); } diff --git a/apps/dav/lib/BackgroundJob/UserStatusAutomation.php b/apps/dav/lib/BackgroundJob/UserStatusAutomation.php index 1593be49a5d..8d5c229241d 100644 --- a/apps/dav/lib/BackgroundJob/UserStatusAutomation.php +++ b/apps/dav/lib/BackgroundJob/UserStatusAutomation.php @@ -55,14 +55,14 @@ class UserStatusAutomation extends TimedJob { $userId = $argument['userId']; $user = $this->userManager->get($userId); - if($user === null) { + if ($user === null) { return; } $ooo = $this->coordinator->getCurrentOutOfOfficeData($user); $continue = $this->processOutOfOfficeData($user, $ooo); - if($continue === false) { + if ($continue === false) { return; } @@ -150,7 +150,7 @@ class UserStatusAutomation extends TimedJob { $effectiveEnd = \DateTime::createFromImmutable($originalEnd)->sub(new \DateInterval('P7D')); try { - $it = new RRuleIterator((string)$available->RRULE, $effectiveStart); + $it = new RRuleIterator((string) $available->RRULE, $effectiveStart); $it->fastForward($lastMidnight); $startToday = $it->current(); @@ -196,7 +196,7 @@ class UserStatusAutomation extends TimedJob { return; } - if(!$hasDndForOfficeHours) { + if (!$hasDndForOfficeHours) { // Office hours are not set to DND, so there is nothing to do. return; } @@ -207,7 +207,7 @@ class UserStatusAutomation extends TimedJob { } private function processOutOfOfficeData(IUser $user, ?IOutOfOfficeData $ooo): bool { - if(empty($ooo)) { + if (empty($ooo)) { // Reset the user status if the absence doesn't exist $this->logger->debug('User has no OOO period in effect, reverting DND status if applicable'); $this->manager->revertUserStatus($user->getUID(), IUserStatus::MESSAGE_OUT_OF_OFFICE, IUserStatus::DND); @@ -215,12 +215,12 @@ class UserStatusAutomation extends TimedJob { return true; } - if(!$this->coordinator->isInEffect($ooo)) { + if (!$this->coordinator->isInEffect($ooo)) { // Reset the user status if the absence is (no longer) in effect $this->logger->debug('User has no OOO period in effect, reverting DND status if applicable'); $this->manager->revertUserStatus($user->getUID(), IUserStatus::MESSAGE_OUT_OF_OFFICE, IUserStatus::DND); - if($ooo->getStartDate() > $this->time->getTime()) { + if ($ooo->getStartDate() > $this->time->getTime()) { // Set the next run to take place at the start of the ooo period if it is in the future // This might be overwritten if there is an availability setting, but we can't determine // if this is the case here diff --git a/apps/dav/lib/BulkUpload/BulkUploadPlugin.php b/apps/dav/lib/BulkUpload/BulkUploadPlugin.php index ae7f55d7107..80e7da98da1 100644 --- a/apps/dav/lib/BulkUpload/BulkUploadPlugin.php +++ b/apps/dav/lib/BulkUpload/BulkUploadPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only @@ -44,7 +45,7 @@ class BulkUploadPlugin extends ServerPlugin { */ public function httpPost(RequestInterface $request, ResponseInterface $response): bool { // Limit bulk upload to the /dav/bulk endpoint - if ($request->getPath() !== "bulk") { + if ($request->getPath() !== 'bulk') { return true; } @@ -77,16 +78,16 @@ class BulkUploadPlugin extends ServerPlugin { $node = $this->userFolder->getFirstNodeById($node->getId()); $writtenFiles[$headers['x-file-path']] = [ - "error" => false, - "etag" => $node->getETag(), - "fileid" => DavUtil::getDavFileId($node->getId()), - "permissions" => DavUtil::getDavPermissions($node), + 'error' => false, + 'etag' => $node->getETag(), + 'fileid' => DavUtil::getDavFileId($node->getId()), + 'permissions' => DavUtil::getDavPermissions($node), ]; } catch (\Exception $e) { $this->logger->error($e->getMessage(), ['path' => $headers['x-file-path']]); $writtenFiles[$headers['x-file-path']] = [ - "error" => true, - "message" => $e->getMessage(), + 'error' => true, + 'message' => $e->getMessage(), ]; } } diff --git a/apps/dav/lib/BulkUpload/MultipartRequestParser.php b/apps/dav/lib/BulkUpload/MultipartRequestParser.php index 2d3cf7d421c..654246c98c8 100644 --- a/apps/dav/lib/BulkUpload/MultipartRequestParser.php +++ b/apps/dav/lib/BulkUpload/MultipartRequestParser.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only @@ -19,10 +20,10 @@ class MultipartRequestParser { private $stream; /** @var string */ - private $boundary = ""; + private $boundary = ''; /** @var string */ - private $lastBoundary = ""; + private $lastBoundary = ''; /** * @throws BadRequest @@ -39,7 +40,7 @@ class MultipartRequestParser { } if ($contentType === null) { - throw new BadRequest("Content-Type can not be null"); + throw new BadRequest('Content-Type can not be null'); } $this->stream = $stream; @@ -60,7 +61,7 @@ class MultipartRequestParser { [$mimeType, $boundary] = explode(';', $contentType); [$boundaryKey, $boundaryValue] = explode('=', $boundary); } catch (\Exception $e) { - throw new BadRequest("Error while parsing boundary in Content-Type header.", Http::STATUS_BAD_REQUEST, $e); + throw new BadRequest('Error while parsing boundary in Content-Type header.', Http::STATUS_BAD_REQUEST, $e); } $boundaryValue = trim($boundaryValue); @@ -96,7 +97,7 @@ class MultipartRequestParser { $seekBackResult = fseek($this->stream, -$expectedContentLength, SEEK_CUR); if ($seekBackResult === -1) { - throw new Exception("Unknown error while seeking content", Http::STATUS_INTERNAL_SERVER_ERROR); + throw new Exception('Unknown error while seeking content', Http::STATUS_INTERNAL_SERVER_ERROR); } return $expectedContent === $content; @@ -134,7 +135,7 @@ class MultipartRequestParser { $headers = $this->readPartHeaders(); - $content = $this->readPartContent($headers["content-length"], $headers["x-file-md5"]); + $content = $this->readPartContent($headers['content-length'], $headers['x-file-md5']); return [$headers, $content]; } @@ -146,7 +147,7 @@ class MultipartRequestParser { */ private function readBoundary(): string { if (!$this->isAtBoundary()) { - throw new BadRequest("Boundary not found where it should be."); + throw new BadRequest('Boundary not found where it should be.'); } return fread($this->stream, strlen($this->boundary)); @@ -180,12 +181,12 @@ class MultipartRequestParser { } } - if (!isset($headers["content-length"])) { - throw new LengthRequired("The Content-Length header must not be null."); + if (!isset($headers['content-length'])) { + throw new LengthRequired('The Content-Length header must not be null.'); } - if (!isset($headers["x-file-md5"])) { - throw new BadRequest("The X-File-MD5 header must not be null."); + if (!isset($headers['x-file-md5'])) { + throw new BadRequest('The X-File-MD5 header must not be null.'); } return $headers; @@ -201,7 +202,7 @@ class MultipartRequestParser { $computedMd5 = $this->computeMd5Hash($length); if ($md5 !== $computedMd5) { - throw new BadRequest("Computed md5 hash is incorrect."); + throw new BadRequest('Computed md5 hash is incorrect.'); } if ($length === 0) { @@ -215,7 +216,7 @@ class MultipartRequestParser { } if ($length !== 0 && feof($this->stream)) { - throw new Exception("Unexpected EOF while reading stream."); + throw new Exception('Unexpected EOF while reading stream.'); } // Read '\r\n'. diff --git a/apps/dav/lib/CalDAV/Activity/Backend.php b/apps/dav/lib/CalDAV/Activity/Backend.php index c2018baab92..41b24314388 100644 --- a/apps/dav/lib/CalDAV/Activity/Backend.php +++ b/apps/dav/lib/CalDAV/Activity/Backend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php b/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php index 6ac161a0a2c..b76ad053670 100644 --- a/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -40,8 +41,8 @@ class Calendar implements IFilter { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/dav/lib/CalDAV/Activity/Filter/Todo.php b/apps/dav/lib/CalDAV/Activity/Filter/Todo.php index dfa05ae9099..2dadb0a88c6 100644 --- a/apps/dav/lib/CalDAV/Activity/Filter/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Filter/Todo.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -40,8 +41,8 @@ class Todo implements IFilter { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Base.php b/apps/dav/lib/CalDAV/Activity/Provider/Base.php index 14e68cc6a3d..c4efb03cdeb 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Base.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Base.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -52,14 +53,14 @@ abstract class Base implements IProvider { $data['name'] === CalDavBackend::PERSONAL_CALENDAR_NAME) { return [ 'type' => 'calendar', - 'id' => (string)$data['id'], + 'id' => (string) $data['id'], 'name' => $l->t('Personal'), ]; } return [ 'type' => 'calendar', - 'id' => (string)$data['id'], + 'id' => (string) $data['id'], 'name' => $data['name'], ]; } @@ -72,7 +73,7 @@ abstract class Base implements IProvider { protected function generateLegacyCalendarParameter($id, $name) { return [ 'type' => 'calendar', - 'id' => (string)$id, + 'id' => (string) $id, 'name' => $name, ]; } diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php index a7509831f29..04569cb8d65 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Event.php b/apps/dav/lib/CalDAV/Activity/Provider/Event.php index 959c0a815dd..203c62a6639 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php index 68a95341ff2..bfea5447799 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php b/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php index 4e1fdc0fe97..0ad86a919bc 100644 --- a/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,8 +25,8 @@ class Calendar extends CalDAVSetting { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/dav/lib/CalDAV/Activity/Setting/Event.php b/apps/dav/lib/CalDAV/Activity/Setting/Event.php index a177d27d2e3..ea9476d6f08 100644 --- a/apps/dav/lib/CalDAV/Activity/Setting/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Setting/Event.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,8 +25,8 @@ class Event extends CalDAVSetting { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/dav/lib/CalDAV/Activity/Setting/Todo.php b/apps/dav/lib/CalDAV/Activity/Setting/Todo.php index ecd3634ee12..ed8377b0ffa 100644 --- a/apps/dav/lib/CalDAV/Activity/Setting/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Setting/Todo.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -25,8 +26,8 @@ class Todo extends CalDAVSetting { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php b/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php index 2d9beff9ced..7f4c1d13dcd 100644 --- a/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php +++ b/apps/dav/lib/CalDAV/AppCalendar/AppCalendar.php @@ -174,7 +174,7 @@ class AppCalendar extends ExternalCalendar { // We need to group by UID (actually by filename but we do not have that information) $result = []; foreach ($objects as $object) { - $uid = (string)$object['UID'] ?: uniqid(); + $uid = (string) $object['UID'] ?: uniqid(); if (!isset($result[$uid])) { $result[$uid] = []; } diff --git a/apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php b/apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php index ba3f7074faf..34db064dddb 100644 --- a/apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php +++ b/apps/dav/lib/CalDAV/AppCalendar/CalendarObject.php @@ -97,7 +97,7 @@ class CalendarObject implements ICalendarObject, IACL { $components = $this->vobject->getBaseComponents(); foreach ($components as $key => $component) { $components[$key]->STATUS = 'CANCELLED'; - $components[$key]->SEQUENCE = isset($component->SEQUENCE) ? ((int)$component->SEQUENCE->getValue()) + 1 : 1; + $components[$key]->SEQUENCE = isset($component->SEQUENCE) ? ((int) $component->SEQUENCE->getValue()) + 1 : 1; if ($component->name === 'VEVENT') { $components[$key]->METHOD = 'CANCEL'; } @@ -116,9 +116,9 @@ class CalendarObject implements ICalendarObject, IACL { throw new NotFound('Invalid node'); } if (isset($base->{'X-FILENAME'})) { - return (string)$base->{'X-FILENAME'}; + return (string) $base->{'X-FILENAME'}; } - return (string)$base->UID . '.ics'; + return (string) $base->UID . '.ics'; } public function setName($name): void { diff --git a/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php b/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php index 733e8079111..049d76e7c10 100644 --- a/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php +++ b/apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -115,7 +116,7 @@ class EnablePlugin extends ServerPlugin { } $owner = substr($node->getOwner(), 17); - if($owner !== $this->user->getUID()) { + if ($owner !== $this->user->getUID()) { $this->server->httpResponse->setStatus(403); return false; } diff --git a/apps/dav/lib/CalDAV/BirthdayService.php b/apps/dav/lib/CalDAV/BirthdayService.php index 0990cd674dd..faf76f6697a 100644 --- a/apps/dav/lib/CalDAV/BirthdayService.php +++ b/apps/dav/lib/CalDAV/BirthdayService.php @@ -169,7 +169,7 @@ class BirthdayService { return null; } $birthday = $doc->{$dateField}; - if (!(string)$birthday) { + if (!(string) $birthday) { return null; } // Skip if the BDAY property is not of the right type. @@ -188,18 +188,18 @@ class BirthdayService { $omitYear = (isset($parameters['X-APPLE-OMIT-YEAR']) && $parameters['X-APPLE-OMIT-YEAR'] === $dateParts['year']); // 'X-APPLE-OMIT-YEAR' is not always present, at least iOS 12.4 uses the hard coded date of 1604 (the start of the gregorian calendar) when the year is unknown - if ($omitYear || (int)$dateParts['year'] === 1604) { + if ($omitYear || (int) $dateParts['year'] === 1604) { $dateParts['year'] = null; } } $originalYear = null; if ($dateParts['year'] !== null) { - $originalYear = (int)$dateParts['year']; + $originalYear = (int) $dateParts['year']; } - $leapDay = ((int)$dateParts['month'] === 2 - && (int)$dateParts['date'] === 29); + $leapDay = ((int) $dateParts['month'] === 2 + && (int) $dateParts['date'] === 29); if ($dateParts['year'] === null || $originalYear < 1970) { $birthday = ($leapDay ? '1972-' : '1970-') . $dateParts['month'] . '-' . $dateParts['date']; diff --git a/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php b/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php index 3f6eff4e1f4..06fb7236000 100644 --- a/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php +++ b/apps/dav/lib/CalDAV/CachedSubscriptionImpl.php @@ -62,7 +62,7 @@ class CachedSubscriptionImpl implements ICalendar { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options - optional parameters: - * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] + * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] * @param int|null $limit - limit number of search results * @param int|null $offset - offset for paging of search results * @return array an array of events/journals/todos which are arrays of key-value-pairs diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 0aec5525cdb..81ad1f4a0f1 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -222,7 +223,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } $result = $query->executeQuery(); - $column = (int)$result->fetchOne(); + $column = (int) $result->fetchOne(); $result->closeCursor(); return $column; } @@ -243,7 +244,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } $result = $query->executeQuery(); - $column = (int)$result->fetchOne(); + $column = (int) $result->fetchOne(); $result->closeCursor(); return $column; } @@ -521,8 +522,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int) $row['access'] === Backend::ACCESS_READ, + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int) $row['access'] === self::ACCESS_PUBLIC, ]; $calendar = $this->rowToCalendar($row, $calendar); @@ -586,8 +587,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int) $row['access'] === Backend::ACCESS_READ, + '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int) $row['access'] === self::ACCESS_PUBLIC, ]; $calendar = $this->rowToCalendar($row, $calendar); @@ -799,7 +800,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription return [$calendarId, $calendarData]; }, $this->db); - $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData)); + $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData)); return $calendarId; } @@ -847,7 +848,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); $query->executeStatement(); - $this->addChanges($calendarId, [""], 2); + $this->addChanges($calendarId, [''], 2); $calendarData = $this->getCalendarById($calendarId); $shares = $this->getShares($calendarId); @@ -1046,9 +1047,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'lastmodified' => $row['lastmodified'], 'etag' => '"' . $row['etag'] . '"', 'calendarid' => $row['calendarid'], - 'size' => (int)$row['size'], + 'size' => (int) $row['size'], 'component' => strtolower($row['componenttype']), - 'classification' => (int)$row['classification'] + 'classification' => (int) $row['classification'] ]; } $stmt->closeCursor(); @@ -1113,9 +1114,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'etag' => '"' . $row['etag'] . '"', 'calendarid' => $row['calendarid'], 'calendaruri' => $row['calendaruri'], - 'size' => (int)$row['size'], + 'size' => (int) $row['size'], 'component' => strtolower($row['componenttype']), - 'classification' => (int)$row['classification'], + 'classification' => (int) $row['classification'], '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], ]; } @@ -1173,10 +1174,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'lastmodified' => $row['lastmodified'], 'etag' => '"' . $row['etag'] . '"', 'calendarid' => $row['calendarid'], - 'size' => (int)$row['size'], + 'size' => (int) $row['size'], 'calendardata' => $this->readBlob($row['calendardata']), 'component' => strtolower($row['componenttype']), - 'classification' => (int)$row['classification'], + 'classification' => (int) $row['classification'], '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], ]; } @@ -1221,10 +1222,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'lastmodified' => $row['lastmodified'], 'etag' => '"' . $row['etag'] . '"', 'calendarid' => $row['calendarid'], - 'size' => (int)$row['size'], + 'size' => (int) $row['size'], 'calendardata' => $this->readBlob($row['calendardata']), 'component' => strtolower($row['componenttype']), - 'classification' => (int)$row['classification'] + 'classification' => (int) $row['classification'] ]; } $result->closeCursor(); @@ -1354,15 +1355,15 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { $query = $this->db->getQueryBuilder(); $query->update('calendarobjects') - ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) - ->set('lastmodified', $query->createNamedParameter(time())) - ->set('etag', $query->createNamedParameter($extraData['etag'])) - ->set('size', $query->createNamedParameter($extraData['size'])) - ->set('componenttype', $query->createNamedParameter($extraData['componentType'])) - ->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence'])) - ->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence'])) - ->set('classification', $query->createNamedParameter($extraData['classification'])) - ->set('uid', $query->createNamedParameter($extraData['uid'])) + ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) + ->set('lastmodified', $query->createNamedParameter(time())) + ->set('etag', $query->createNamedParameter($extraData['etag'])) + ->set('size', $query->createNamedParameter($extraData['size'])) + ->set('componenttype', $query->createNamedParameter($extraData['componentType'])) + ->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence'])) + ->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence'])) + ->set('classification', $query->createNamedParameter($extraData['classification'])) + ->set('uid', $query->createNamedParameter($extraData['uid'])) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))) @@ -1510,13 +1511,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription if (!empty($pathInfo['extension'])) { // Append a suffix to "free" the old URI for recreation $newUri = sprintf( - "%s-deleted.%s", + '%s-deleted.%s', $pathInfo['filename'], $pathInfo['extension'] ); } else { $newUri = sprintf( - "%s-deleted", + '%s-deleted', $pathInfo['filename'] ); } @@ -1565,7 +1566,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $this->cachedObjects = []; $this->atomic(function () use ($objectData) { $id = (int) $objectData['id']; - $restoreUri = str_replace("-deleted.ics", ".ics", $objectData['uri']); + $restoreUri = str_replace('-deleted.ics', '.ics', $objectData['uri']); $targetObject = $this->getCalendarObject( $objectData['calendarid'], $restoreUri @@ -1992,7 +1993,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription // For the pagination with hasLimit and hasTimeRange, a stable ordering is helpful. $outerQuery->addOrderBy('id'); - $offset = (int)$offset; + $offset = (int) $offset; $outerQuery->setFirstResult($offset); $calendarObjects = []; @@ -2013,7 +2014,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * * 25 rows and 3 retries is entirely arbitrary. */ - $maxResults = (int)max($limit, 25); + $maxResults = (int) max($limit, 25); $outerQuery->setMaxResults($maxResults); for ($attempt = $objectsCount = 0; $attempt < 3 && $objectsCount < $limit; $attempt++) { @@ -2220,7 +2221,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $subscriptions = $this->getSubscriptionsForUser($principalUri); foreach ($calendars as $calendar) { $calendarAnd = $calendarObjectIdQuery->expr()->andX( - $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])), + $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id'])), $calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)), ); @@ -2234,7 +2235,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } foreach ($subscriptions as $subscription) { $subscriptionAnd = $calendarObjectIdQuery->expr()->andX( - $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])), + $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id'])), $calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)), ); @@ -2323,8 +2324,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $result = $query->executeQuery(); $calendarObjects = []; while (($array = $result->fetch()) !== false) { - $array['calendarid'] = (int)$array['calendarid']; - $array['calendartype'] = (int)$array['calendartype']; + $array['calendarid'] = (int) $array['calendarid']; + $array['calendartype'] = (int) $array['calendartype']; $array['calendardata'] = $this->readBlob($array['calendardata']); $calendarObjects[] = $array; @@ -2394,10 +2395,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'etag' => '"' . $row['etag'] . '"', 'calendarid' => $row['calendarid'], 'calendaruri' => $row['calendaruri'], - 'size' => (int)$row['size'], + 'size' => (int) $row['size'], 'calendardata' => $this->readBlob($row['calendardata']), 'component' => strtolower($row['componenttype']), - 'classification' => (int)$row['classification'], + 'classification' => (int) $row['classification'], 'deleted_at' => isset($row['deleted_at']) ? ((int) $row['deleted_at']) : null, ]; } @@ -2513,7 +2514,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription while ($entry = $stmt->fetch(\PDO::FETCH_NUM)) { // assign uri (column 0) to appropriate mutation based on operation (column 1) // forced (int) is needed as doctrine with OCI returns the operation field as string not integer - match ((int)$entry[1]) { + match ((int) $entry[1]) { 1 => $result['added'][] = $entry[0], 2 => $result['modified'][] = $entry[0], 3 => $result['deleted'][] = $entry[0], @@ -2694,7 +2695,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription return $this->getSubscriptionById($subscriptionId); }, $this->db); - $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); + $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations)); return true; }); @@ -2732,7 +2733,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->executeStatement(); if ($subscriptionRow) { - $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); + $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, [])); } }, $this->db); } @@ -2772,7 +2773,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'calendardata' => $row['calendardata'], 'lastmodified' => $row['lastmodified'], 'etag' => '"' . $row['etag'] . '"', - 'size' => (int)$row['size'], + 'size' => (int) $row['size'], ]; } @@ -2790,9 +2791,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription public function getSchedulingObjects($principalUri) { $query = $this->db->getQueryBuilder(); $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) - ->from('schedulingobjects') - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) - ->executeQuery(); + ->from('schedulingobjects') + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) + ->executeQuery(); $results = []; while (($row = $stmt->fetch()) !== false) { @@ -2801,7 +2802,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'uri' => $row['uri'], 'lastmodified' => $row['lastmodified'], 'etag' => '"' . $row['etag'] . '"', - 'size' => (int)$row['size'], + 'size' => (int) $row['size'], ]; } $stmt->closeCursor(); @@ -2820,9 +2821,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $this->cachedObjects = []; $query = $this->db->getQueryBuilder(); $query->delete('schedulingobjects') - ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) - ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) - ->executeStatement(); + ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) + ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) + ->executeStatement(); } /** @@ -2840,11 +2841,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->setMaxResults($limit); $result = $query->executeQuery(); $count = $result->rowCount(); - if($count === 0) { + if ($count === 0) { return; } $ids = array_map(static function (array $id) { - return (int)$id[0]; + return (int) $id[0]; }, $result->fetchAll(\PDO::FETCH_NUM)); $result->closeCursor(); @@ -2852,12 +2853,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $deleteQuery = $this->db->getQueryBuilder(); $deleteQuery->delete('schedulingobjects') ->where($deleteQuery->expr()->in('id', $deleteQuery->createParameter('ids'), IQueryBuilder::PARAM_INT_ARRAY)); - foreach(array_chunk($ids, 1000) as $chunk) { + foreach (array_chunk($ids, 1000) as $chunk) { $deleteQuery->setParameter('ids', $chunk, IQueryBuilder::PARAM_INT_ARRAY); $numDeleted += $deleteQuery->executeStatement(); } - if($numDeleted === $limit) { + if ($numDeleted === $limit) { $this->logger->info("Deleted $limit scheduling objects, continuing with next batch"); $this->deleteOutdatedSchedulingObjects($modifiedBefore, $limit); } @@ -2905,7 +2906,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->from($table) ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); $result = $query->executeQuery(); - $syncToken = (int)$result->fetchOne(); + $syncToken = (int) $result->fetchOne(); $result->closeCursor(); $query = $this->db->getQueryBuilder(); @@ -2965,7 +2966,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ); $resultDeleted = $qbDeleted->executeQuery(); $deletedUris = array_map(function (string $uri) { - return str_replace("-deleted.ics", ".ics", $uri); + return str_replace('-deleted.ics', '.ics', $uri); }, $resultDeleted->fetchAll(\PDO::FETCH_COLUMN)); $resultDeleted->closeCursor(); $this->addChanges($calendarId, $deletedUris, 3, $calendarType); @@ -3009,7 +3010,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription // Track first component type and uid if ($uid === null) { $componentType = $component->name; - $uid = (string)$component->UID; + $uid = (string) $component->UID; } } } @@ -3332,7 +3333,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param array<string> $calendarObjectUris */ public function purgeCachedEventsForSubscription(int $subscriptionId, array $calendarObjectIds, array $calendarObjectUris): void { - if(empty($calendarObjectUris)) { + if (empty($calendarObjectUris)) { return; } @@ -3432,7 +3433,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); } - return (int)$objectIds['id']; + return (int) $objectIds['id']; } /** diff --git a/apps/dav/lib/CalDAV/CalendarHome.php b/apps/dav/lib/CalDAV/CalendarHome.php index d01c2affbc8..59a976ca6bc 100644 --- a/apps/dav/lib/CalDAV/CalendarHome.php +++ b/apps/dav/lib/CalDAV/CalendarHome.php @@ -149,9 +149,9 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome { // Calendar - this covers all "regular" calendars, but not shared // only check if the method is available - if($this->caldavBackend instanceof CalDavBackend) { + if ($this->caldavBackend instanceof CalDavBackend) { $calendar = $this->caldavBackend->getCalendarByUri($this->principalInfo['uri'], $name); - if(!empty($calendar)) { + if (!empty($calendar)) { return new Calendar($this->caldavBackend, $calendar, $this->l10n, $this->config, $this->logger); } } diff --git a/apps/dav/lib/CalDAV/CalendarImpl.php b/apps/dav/lib/CalDAV/CalendarImpl.php index cac9bad0d89..e568b8f72a2 100644 --- a/apps/dav/lib/CalDAV/CalendarImpl.php +++ b/apps/dav/lib/CalDAV/CalendarImpl.php @@ -84,7 +84,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage { /** @var VCalendar $vobj */ $vobj = Reader::read($timezoneProp); $components = $vobj->getComponents(); - if(empty($components)) { + if (empty($components)) { return null; } /** @var VTimeZone $vtimezone */ @@ -96,7 +96,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options - optional parameters: - * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] + * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] * @param int|null $limit - limit number of search results * @param int|null $offset - offset for paging of search results * @return array an array of events/journals/todos which are arrays of key-value-pairs @@ -233,7 +233,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage { } $iTipMessage->uid = isset($vEvent->{'UID'}) ? $vEvent->{'UID'}->getValue() : ''; $iTipMessage->component = 'VEVENT'; - $iTipMessage->sequence = isset($vEvent->{'SEQUENCE'}) ? (int)$vEvent->{'SEQUENCE'}->getValue() : 0; + $iTipMessage->sequence = isset($vEvent->{'SEQUENCE'}) ? (int) $vEvent->{'SEQUENCE'}->getValue() : 0; $iTipMessage->message = $vObject; $server->server->emit('schedule', [$iTipMessage]); } diff --git a/apps/dav/lib/CalDAV/CalendarManager.php b/apps/dav/lib/CalDAV/CalendarManager.php index a415a830d2e..538ee2e5289 100644 --- a/apps/dav/lib/CalDAV/CalendarManager.php +++ b/apps/dav/lib/CalDAV/CalendarManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/CalendarObject.php b/apps/dav/lib/CalDAV/CalendarObject.php index f7af3ce8b4b..0a8a0c7af14 100644 --- a/apps/dav/lib/CalDAV/CalendarObject.php +++ b/apps/dav/lib/CalDAV/CalendarObject.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -137,7 +138,7 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject { } public function getCalendarId(): int { - return (int)$this->objectData['calendarid']; + return (int) $this->objectData['calendarid']; } public function getPrincipalUri(): string { diff --git a/apps/dav/lib/CalDAV/EventComparisonService.php b/apps/dav/lib/CalDAV/EventComparisonService.php index e3c7749a772..63395e7ce1c 100644 --- a/apps/dav/lib/CalDAV/EventComparisonService.php +++ b/apps/dav/lib/CalDAV/EventComparisonService.php @@ -37,14 +37,14 @@ class EventComparisonService { */ private function removeIfUnchanged(VEvent $filterEvent, array &$eventsToFilter): bool { $filterEventData = []; - foreach(self::EVENT_DIFF as $eventDiff) { + foreach (self::EVENT_DIFF as $eventDiff) { $filterEventData[] = IMipService::readPropertyWithDefault($filterEvent, $eventDiff, ''); } /** @var VEvent $component */ foreach ($eventsToFilter as $k => $eventToFilter) { $eventToFilterData = []; - foreach(self::EVENT_DIFF as $eventDiff) { + foreach (self::EVENT_DIFF as $eventDiff) { $eventToFilterData[] = IMipService::readPropertyWithDefault($eventToFilter, $eventDiff, ''); } // events are identical and can be removed @@ -73,23 +73,23 @@ class EventComparisonService { $newEventComponents = $new->getComponents(); foreach ($newEventComponents as $k => $event) { - if(!$event instanceof VEvent) { + if (!$event instanceof VEvent) { unset($newEventComponents[$k]); } } - if(empty($old)) { + if (empty($old)) { return ['old' => null, 'new' => $newEventComponents]; } $oldEventComponents = $old->getComponents(); - if(is_array($oldEventComponents) && !empty($oldEventComponents)) { + if (is_array($oldEventComponents) && !empty($oldEventComponents)) { foreach ($oldEventComponents as $k => $event) { - if(!$event instanceof VEvent) { + if (!$event instanceof VEvent) { unset($oldEventComponents[$k]); continue; } - if($this->removeIfUnchanged($event, $newEventComponents)) { + if ($this->removeIfUnchanged($event, $newEventComponents)) { unset($oldEventComponents[$k]); } } diff --git a/apps/dav/lib/CalDAV/EventReader.php b/apps/dav/lib/CalDAV/EventReader.php index b1a4aac26d7..008e43fe52f 100644 --- a/apps/dav/lib/CalDAV/EventReader.php +++ b/apps/dav/lib/CalDAV/EventReader.php @@ -67,8 +67,8 @@ class EventReader { * @since 30.0.0 * * @param VCalendar|VEvent|Array|String $input - * @param string|null $uid - * @param DateTimeZone|null $timeZone reference timezone for floating dates and times + * @param string|null $uid + * @param DateTimeZone|null $timeZone reference timezone for floating dates and times */ public function __construct(VCalendar|VEvent|array|string $input, ?string $uid = null, ?DateTimeZone $timeZone = null) { @@ -308,9 +308,9 @@ class EventReader { * * @since 30.0.0 * - * @return string|null R - Relative or A - Absolute + * @return string|null R - Relative or A - Absolute */ - public function recurringPattern(): string | null { + public function recurringPattern(): string|null { if ($this->rruleIterator === null && $this->rdateIterator === null) { return null; } @@ -325,9 +325,9 @@ class EventReader { * * @since 30.0.0 * - * @return string|null daily, weekly, monthly, yearly, fixed + * @return string|null daily, weekly, monthly, yearly, fixed */ - public function recurringPrecision(): string | null { + public function recurringPrecision(): string|null { if ($this->rruleIterator !== null) { return $this->rruleIterator->precision(); } @@ -344,7 +344,7 @@ class EventReader { * * @return int|null */ - public function recurringInterval(): int | null { + public function recurringInterval(): int|null { return $this->rruleIterator?->interval(); } @@ -387,7 +387,7 @@ class EventReader { * * @return int|null */ - public function recurringConcludesAfter(): int | null { + public function recurringConcludesAfter(): int|null { // construct count place holder $count = 0; @@ -412,7 +412,7 @@ class EventReader { * * @return DateTime|null */ - public function recurringConcludesOn(): DateTime | null { + public function recurringConcludesOn(): DateTime|null { if ($this->rruleIterator !== null) { // retrieve rrule conclusion date @@ -639,7 +639,7 @@ class EventReader { * * @return DateTime */ - public function recurrenceDate(): DateTime | null { + public function recurrenceDate(): DateTime|null { if ($this->recurrenceCurrentDate !== null) { return DateTime::createFromInterface($this->recurrenceCurrentDate); } else { @@ -758,7 +758,7 @@ class EventReader { * * @since 30.0.0 * - * @param DateTimeInterface $dt date and time to advance + * @param DateTimeInterface $dt date and time to advance * * @return void */ diff --git a/apps/dav/lib/CalDAV/EventReaderRDate.php b/apps/dav/lib/CalDAV/EventReaderRDate.php index 65362be4b07..9d9669dc0f3 100644 --- a/apps/dav/lib/CalDAV/EventReaderRDate.php +++ b/apps/dav/lib/CalDAV/EventReaderRDate.php @@ -13,15 +13,15 @@ use DateTime; class EventReaderRDate extends \Sabre\VObject\Recur\RDateIterator { - public function concludes(): DateTime | null { + public function concludes(): DateTime|null { return $this->concludesOn(); } - public function concludesAfter(): int | null { + public function concludesAfter(): int|null { return !empty($this->dates) ? count($this->dates) : null; } - public function concludesOn(): DateTime | null { + public function concludesOn(): DateTime|null { if (count($this->dates) > 0) { return new DateTime( $this->dates[array_key_last($this->dates)], diff --git a/apps/dav/lib/CalDAV/EventReaderRRule.php b/apps/dav/lib/CalDAV/EventReaderRRule.php index fa47930caa8..fc229ddcd44 100644 --- a/apps/dav/lib/CalDAV/EventReaderRRule.php +++ b/apps/dav/lib/CalDAV/EventReaderRRule.php @@ -22,7 +22,7 @@ class EventReaderRRule extends \Sabre\VObject\Recur\RRuleIterator { return $this->interval; } - public function concludes(): DateTime | null { + public function concludes(): DateTime|null { // evaluate if until value is a date if ($this->until instanceof DateTimeInterface) { return DateTime::createFromInterface($this->until); @@ -48,11 +48,11 @@ class EventReaderRRule extends \Sabre\VObject\Recur\RRuleIterator { return null; } - public function concludesAfter(): int | null { + public function concludesAfter(): int|null { return !empty($this->count) ? $this->count : null; } - public function concludesOn(): DateTime | null { + public function concludesOn(): DateTime|null { return isset($this->until) ? DateTime::createFromInterface($this->until) : null; } diff --git a/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php b/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php index 2b4f8ed0223..20138b4edf8 100644 --- a/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php +++ b/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php b/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php index 882a11c34b2..64f548ef3ce 100644 --- a/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php +++ b/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Integration/ICalendarProvider.php b/apps/dav/lib/CalDAV/Integration/ICalendarProvider.php index bbee4cbda7c..40a8860dcb4 100644 --- a/apps/dav/lib/CalDAV/Integration/ICalendarProvider.php +++ b/apps/dav/lib/CalDAV/Integration/ICalendarProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php b/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php index e076b2cd1e2..f65c125d978 100644 --- a/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php +++ b/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Outbox.php b/apps/dav/lib/CalDAV/Outbox.php index ffda73147a6..9084004f08e 100644 --- a/apps/dav/lib/CalDAV/Outbox.php +++ b/apps/dav/lib/CalDAV/Outbox.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Principal/Collection.php b/apps/dav/lib/CalDAV/Principal/Collection.php index f2cea0b5136..b76fde66464 100644 --- a/apps/dav/lib/CalDAV/Principal/Collection.php +++ b/apps/dav/lib/CalDAV/Principal/Collection.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Principal/User.php b/apps/dav/lib/CalDAV/Principal/User.php index 60b7953ea62..047d83827ed 100644 --- a/apps/dav/lib/CalDAV/Principal/User.php +++ b/apps/dav/lib/CalDAV/Principal/User.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/PublicCalendar.php b/apps/dav/lib/CalDAV/PublicCalendar.php index 4ee811efeae..9af6e544165 100644 --- a/apps/dav/lib/CalDAV/PublicCalendar.php +++ b/apps/dav/lib/CalDAV/PublicCalendar.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/PublicCalendarObject.php b/apps/dav/lib/CalDAV/PublicCalendarObject.php index c3dc5ab1843..2ab40b94347 100644 --- a/apps/dav/lib/CalDAV/PublicCalendarObject.php +++ b/apps/dav/lib/CalDAV/PublicCalendarObject.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php index 94c5b7d1f52..35f3ec91a38 100644 --- a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php +++ b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Publishing/Xml/Publisher.php b/apps/dav/lib/CalDAV/Publishing/Xml/Publisher.php index d3543ce5bae..0af855d9e3c 100644 --- a/apps/dav/lib/CalDAV/Publishing/Xml/Publisher.php +++ b/apps/dav/lib/CalDAV/Publishing/Xml/Publisher.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php index 947d286643c..21432dca386 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php @@ -417,24 +417,24 @@ class EmailProvider extends AbstractProvider { } private function getWeekDayName(IL10N $l10n, DateTime $dt):string { - return (string)$l10n->l('weekdayName', $dt, ['width' => 'abbreviated']); + return (string) $l10n->l('weekdayName', $dt, ['width' => 'abbreviated']); } private function getDateString(IL10N $l10n, DateTime $dt):string { - return (string)$l10n->l('date', $dt, ['width' => 'medium']); + return (string) $l10n->l('date', $dt, ['width' => 'medium']); } private function getDateTimeString(IL10N $l10n, DateTime $dt):string { - return (string)$l10n->l('datetime', $dt, ['width' => 'medium|short']); + return (string) $l10n->l('datetime', $dt, ['width' => 'medium|short']); } private function getTimeString(IL10N $l10n, DateTime $dt):string { - return (string)$l10n->l('time', $dt, ['width' => 'short']); + return (string) $l10n->l('time', $dt, ['width' => 'short']); } private function getTitleFromVEvent(VEvent $vevent, IL10N $l10n):string { if (isset($vevent->SUMMARY)) { - return (string)$vevent->SUMMARY; + return (string) $vevent->SUMMARY; } return $l10n->t('Untitled event'); diff --git a/apps/dav/lib/CalDAV/Reminder/Notifier.php b/apps/dav/lib/CalDAV/Reminder/Notifier.php index f3c784ea21f..216729f8302 100644 --- a/apps/dav/lib/CalDAV/Reminder/Notifier.php +++ b/apps/dav/lib/CalDAV/Reminder/Notifier.php @@ -292,7 +292,7 @@ class Notifier implements INotifier { * @return string */ private function getWeekDayName(DateTime $dt):string { - return (string)$this->l10n->l('weekdayName', $dt, ['width' => 'abbreviated']); + return (string) $this->l10n->l('weekdayName', $dt, ['width' => 'abbreviated']); } /** @@ -300,7 +300,7 @@ class Notifier implements INotifier { * @return string */ private function getDateString(DateTime $dt):string { - return (string)$this->l10n->l('date', $dt, ['width' => 'medium']); + return (string) $this->l10n->l('date', $dt, ['width' => 'medium']); } /** @@ -308,7 +308,7 @@ class Notifier implements INotifier { * @return string */ private function getDateTimeString(DateTime $dt):string { - return (string)$this->l10n->l('datetime', $dt, ['width' => 'medium|short']); + return (string) $this->l10n->l('datetime', $dt, ['width' => 'medium|short']); } /** @@ -316,6 +316,6 @@ class Notifier implements INotifier { * @return string */ private function getTimeString(DateTime $dt):string { - return (string)$this->l10n->l('time', $dt, ['width' => 'short']); + return (string) $this->l10n->l('time', $dt, ['width' => 'short']); } } diff --git a/apps/dav/lib/CalDAV/Reminder/ReminderService.php b/apps/dav/lib/CalDAV/Reminder/ReminderService.php index be81e534dd3..35a179deabc 100644 --- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php +++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php @@ -447,7 +447,7 @@ class ReminderService { $uniqueReminders = []; foreach ($reminders as $reminder) { $key = $reminder['notification_date']. $reminder['event_hash'].$reminder['type']; - if(!isset($uniqueReminders[$key])) { + if (!isset($uniqueReminders[$key])) { $uniqueReminders[$key] = $reminder; } } diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php index 2eb8ebfc84e..0824c2340dd 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -386,7 +387,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { try { $stmt = $query->executeQuery(); } catch (Exception $e) { - $this->logger->error("Could not search resources: " . $e->getMessage(), ['exception' => $e]); + $this->logger->error('Could not search resources: ' . $e->getMessage(), ['exception' => $e]); } $rows = []; diff --git a/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php index 40396f67ce9..c70d93daf52 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php index 91cf78c296f..5704b23ae14 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index a3c3f4cb241..2e36bda95f1 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -95,7 +95,7 @@ class IMipPlugin extends SabreIMipPlugin { * @param bool $modified modified */ public function beforeWriteContent($uri, INode $node, $data, $modified): void { - if(!$node instanceof CalendarObject) { + if (!$node instanceof CalendarObject) { return; } /** @var VCalendar $vCalendar */ @@ -138,7 +138,7 @@ class IMipPlugin extends SabreIMipPlugin { $iTipMessage->scheduleStatus = '5.0; EMail delivery failed'; return; } - $recipientName = $iTipMessage->recipientName ? (string)$iTipMessage->recipientName : null; + $recipientName = $iTipMessage->recipientName ? (string) $iTipMessage->recipientName : null; $newEvents = $iTipMessage->message; $oldEvents = $this->getVCalendar(); @@ -152,7 +152,7 @@ class IMipPlugin extends SabreIMipPlugin { // No changed events after all - this shouldn't happen if there is significant change yet here we are // The scheduling status is debatable - if(empty($vEvent)) { + if (empty($vEvent)) { $this->logger->warning('iTip message said the change was significant but comparison did not detect any updated VEvents'); $iTipMessage->scheduleStatus = '1.0;We got the message, but it\'s not significant enough to warrant an email'; return; @@ -164,14 +164,14 @@ class IMipPlugin extends SabreIMipPlugin { // we also might not have an old event as this could be a new // invitation, or a new recurrence exception $attendee = $this->imipService->getCurrentAttendee($iTipMessage); - if($attendee === null) { + if ($attendee === null) { $uid = $vEvent->UID ?? 'no UID found'; $this->logger->debug('Could not find recipient ' . $recipient . ' as attendee for event with UID ' . $uid); $iTipMessage->scheduleStatus = '5.0; EMail delivery failed'; return; } // Don't send emails to things - if($this->imipService->isRoomOrResource($attendee)) { + if ($this->imipService->isRoomOrResource($attendee)) { $this->logger->debug('No invitation sent as recipient is room or resource', [ 'attendee' => $recipient, ]); diff --git a/apps/dav/lib/CalDAV/Schedule/IMipService.php b/apps/dav/lib/CalDAV/Schedule/IMipService.php index 81367d76ebe..137fb3585a3 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipService.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipService.php @@ -89,7 +89,7 @@ class IMipService { return $default; } $newstring = $vevent->$property->getValue(); - if(isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring) { + if (isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring) { $oldstring = $oldVEvent->$property->getValue(); return sprintf($strikethrough, $oldstring, $newstring); } @@ -144,7 +144,7 @@ class IMipService { $data = []; $data['meeting_when'] = $this->generateWhenString($eventReaderCurrent); - foreach(self::STRING_DIFF as $key => $property) { + foreach (self::STRING_DIFF as $key => $property) { $data[$key] = self::readPropertyWithDefault($vEvent, $property, $defaultVal); } @@ -154,7 +154,7 @@ class IMipService { $data['meeting_location_html'] = $locationHtml; } - if(!empty($oldVEvent)) { + if (!empty($oldVEvent)) { $oldMeetingWhen = $this->generateWhenString($eventReaderPrevious); $data['meeting_title_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'SUMMARY', $data['meeting_title']); $data['meeting_description_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'DESCRIPTION', $data['meeting_description']); @@ -336,7 +336,7 @@ class IMipService { public function generateWhenStringRecurringDaily(EventReader $er): string { // initialize - $interval = (int)$er->recurringInterval(); + $interval = (int) $er->recurringInterval(); $startTime = null; $conclusion = null; // time of the day @@ -387,7 +387,7 @@ class IMipService { public function generateWhenStringRecurringWeekly(EventReader $er): string { // initialize - $interval = (int)$er->recurringInterval(); + $interval = (int) $er->recurringInterval(); $startTime = null; $conclusion = null; // days of the week @@ -440,7 +440,7 @@ class IMipService { public function generateWhenStringRecurringMonthly(EventReader $er): string { // initialize - $interval = (int)$er->recurringInterval(); + $interval = (int) $er->recurringInterval(); $startTime = null; $conclusion = null; // days of month @@ -505,7 +505,7 @@ class IMipService { public function generateWhenStringRecurringYearly(EventReader $er): string { // initialize - $interval = (int)$er->recurringInterval(); + $interval = (int) $er->recurringInterval(); $startTime = null; $conclusion = null; // months of year @@ -777,10 +777,10 @@ class IMipService { $strikethrough = "<span style='text-decoration: line-through'>%s</span>"; $newMeetingWhen = $this->generateWhenString($eventReaderCurrent); - $newSummary = isset($vEvent->SUMMARY) && (string)$vEvent->SUMMARY !== '' ? (string)$vEvent->SUMMARY : $this->l10n->t('Untitled event'); - $newDescription = isset($vEvent->DESCRIPTION) && (string)$vEvent->DESCRIPTION !== '' ? (string)$vEvent->DESCRIPTION : $defaultVal; - $newUrl = isset($vEvent->URL) && (string)$vEvent->URL !== '' ? sprintf('<a href="%1$s">%1$s</a>', $vEvent->URL) : $defaultVal; - $newLocation = isset($vEvent->LOCATION) && (string)$vEvent->LOCATION !== '' ? (string)$vEvent->LOCATION : $defaultVal; + $newSummary = isset($vEvent->SUMMARY) && (string) $vEvent->SUMMARY !== '' ? (string) $vEvent->SUMMARY : $this->l10n->t('Untitled event'); + $newDescription = isset($vEvent->DESCRIPTION) && (string) $vEvent->DESCRIPTION !== '' ? (string) $vEvent->DESCRIPTION : $defaultVal; + $newUrl = isset($vEvent->URL) && (string) $vEvent->URL !== '' ? sprintf('<a href="%1$s">%1$s</a>', $vEvent->URL) : $defaultVal; + $newLocation = isset($vEvent->LOCATION) && (string) $vEvent->LOCATION !== '' ? (string) $vEvent->LOCATION : $defaultVal; $newLocationHtml = $this->linkify($newLocation) ?? $newLocation; $data = []; @@ -791,7 +791,7 @@ class IMipService { $data['meeting_description_html'] = $newDescription !== '' ? sprintf($strikethrough, $newDescription) : ''; $data['meeting_description'] = $newDescription; $data['meeting_url_html'] = $newUrl !== '' ? sprintf($strikethrough, $newUrl) : ''; - $data['meeting_url'] = isset($vEvent->URL) ? (string)$vEvent->URL : ''; + $data['meeting_url'] = isset($vEvent->URL) ? (string) $vEvent->URL : ''; $data['meeting_location_html'] = $newLocationHtml !== '' ? sprintf($strikethrough, $newLocationHtml) : ''; $data['meeting_location'] = $newLocation; return $data; @@ -808,7 +808,7 @@ class IMipService { $component = $vObject->VEVENT; if (isset($component->RRULE)) { - $it = new EventIterator($vObject, (string)$component->UID); + $it = new EventIterator($vObject, (string) $component->UID); $maxDate = new \DateTime(IMipPlugin::MAX_DATE); if ($it->isInfinite()) { return $maxDate->getTimestamp(); @@ -831,7 +831,7 @@ class IMipService { return $dtEnd->getDateTime()->getTimeStamp(); } - if(isset($component->DURATION)) { + if (isset($component->DURATION)) { /** @var \DateTime $endDate */ $endDate = clone $dtStart->getDateTime(); // $component->DTEND->getDateTime() returns DateTimeImmutable @@ -839,7 +839,7 @@ class IMipService { return $endDate->getTimestamp(); } - if(!$dtStart->hasTime()) { + if (!$dtStart->hasTime()) { /** @var \DateTime $endDate */ // $component->DTSTART->getDateTime() returns DateTimeImmutable $endDate = clone $dtStart->getDateTime(); @@ -855,7 +855,7 @@ class IMipService { * @param Property|null $attendee */ public function setL10n(?Property $attendee = null) { - if($attendee === null) { + if ($attendee === null) { return; } @@ -871,7 +871,7 @@ class IMipService { * @return bool */ public function getAttendeeRsvpOrReqForParticipant(?Property $attendee = null) { - if($attendee === null) { + if ($attendee === null) { return false; } @@ -979,10 +979,10 @@ class IMipService { htmlspecialchars($organizer->getNormalizedValue()), htmlspecialchars($organizerName ?: $organizerEmail)); $organizerText = sprintf('%s <%s>', $organizerName, $organizerEmail); - if(isset($organizer['PARTSTAT'])) { + if (isset($organizer['PARTSTAT'])) { /** @var Parameter $partstat */ $partstat = $organizer['PARTSTAT']; - if(strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) { + if (strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) { $organizerHTML .= ' ✔︎'; $organizerText .= ' ✔︎'; } @@ -1154,7 +1154,7 @@ class IMipService { public function isRoomOrResource(Property $attendee): bool { $cuType = $attendee->offsetGet('CUTYPE'); - if(!$cuType instanceof Parameter) { + if (!$cuType instanceof Parameter) { return false; } $type = $cuType->getValue() ?? 'INDIVIDUAL'; @@ -1178,7 +1178,7 @@ class IMipService { $interval = $dateInterval->m; $scale = 'month'; } elseif ($dateInterval->d >= 7) { - $interval = (int)($dateInterval->d / 7); + $interval = (int) ($dateInterval->d / 7); $scale = 'week'; } elseif ($dateInterval->d > 0) { $interval = $dateInterval->d; diff --git a/apps/dav/lib/CalDAV/Search/SearchPlugin.php b/apps/dav/lib/CalDAV/Search/SearchPlugin.php index fb55dec593c..a0810458145 100644 --- a/apps/dav/lib/CalDAV/Search/SearchPlugin.php +++ b/apps/dav/lib/CalDAV/Search/SearchPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php index 8a130865842..21a4fff1caf 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php index 943e657903e..6546a28174f 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -23,6 +24,6 @@ class LimitFilter implements XmlDeserializable { throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value'); } - return (int)$value; + return (int) $value; } } diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php index 439a795dde9..8b12c580eb7 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -23,6 +24,6 @@ class OffsetFilter implements XmlDeserializable { throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value'); } - return (int)$value; + return (int) $value; } } diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php index 3b03b63e909..0c31f32348a 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/PropFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/PropFilter.php index 42ecf630f44..251120e35cc 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/PropFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/PropFilter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php index b10cf3140cf..6d6bf958496 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php b/apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php index 639d0b32655..6ece88fa87b 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/CalDAV/Status/StatusService.php b/apps/dav/lib/CalDAV/Status/StatusService.php index 382621f1ba0..56eec5007b8 100644 --- a/apps/dav/lib/CalDAV/Status/StatusService.php +++ b/apps/dav/lib/CalDAV/Status/StatusService.php @@ -39,23 +39,23 @@ class StatusService { public function processCalendarStatus(string $userId): void { $user = $this->userManager->get($userId); - if($user === null) { + if ($user === null) { return; } $availability = $this->availabilityCoordinator->getCurrentOutOfOfficeData($user); - if($availability !== null && $this->availabilityCoordinator->isInEffect($availability)) { + if ($availability !== null && $this->availabilityCoordinator->isInEffect($availability)) { $this->logger->debug('An Absence is in effect, skipping calendar status check', ['user' => $userId]); return; } $calendarEvents = $this->cache->get($userId); - if($calendarEvents === null) { + if ($calendarEvents === null) { $calendarEvents = $this->getCalendarEvents($user); $this->cache->set($userId, $calendarEvents, 300); } - if(empty($calendarEvents)) { + if (empty($calendarEvents)) { try { $this->userStatusService->revertUserStatus($userId, IUserStatus::MESSAGE_CALENDAR_BUSY); } catch (Exception $e) { @@ -81,7 +81,7 @@ class StatusService { $currentStatus = null; } - if(($currentStatus !== null && $currentStatus->getMessageId() === IUserStatus::MESSAGE_CALL) + if (($currentStatus !== null && $currentStatus->getMessageId() === IUserStatus::MESSAGE_CALL) || ($currentStatus !== null && $currentStatus->getStatus() === IUserStatus::DND) || ($currentStatus !== null && $currentStatus->getStatus() === IUserStatus::INVISIBLE)) { // We don't overwrite the call status, DND status or Invisible status @@ -101,7 +101,7 @@ class StatusService { if (isset($component['DTSTART']) && $userStatusTimestamp !== null) { /** @var DateTimeImmutable $dateTime */ $dateTime = $component['DTSTART'][0]; - if($dateTime instanceof DateTimeImmutable && $userStatusTimestamp > $dateTime->getTimestamp()) { + if ($dateTime instanceof DateTimeImmutable && $userStatusTimestamp > $dateTime->getTimestamp()) { return false; } } @@ -112,7 +112,7 @@ class StatusService { return true; }); - if(empty($applicableEvents)) { + if (empty($applicableEvents)) { try { $this->userStatusService->revertUserStatus($userId, IUserStatus::MESSAGE_CALENDAR_BUSY); } catch (Exception $e) { @@ -130,7 +130,7 @@ class StatusService { } // Only update the status if it's neccesary otherwise we mess up the timestamp - if($currentStatus === null || $currentStatus->getMessageId() !== IUserStatus::MESSAGE_CALENDAR_BUSY) { + if ($currentStatus === null || $currentStatus->getMessageId() !== IUserStatus::MESSAGE_CALENDAR_BUSY) { // One event that fulfills all status conditions is enough // 1. Not an OOO event // 2. Current user status (that is not a calendar status) was not set after the start of this event @@ -148,7 +148,7 @@ class StatusService { private function getCalendarEvents(User $user): array { $calendars = $this->calendarManager->getCalendarsForPrincipal('principals/users/' . $user->getUID()); - if(empty($calendars)) { + if (empty($calendars)) { return []; } @@ -172,7 +172,7 @@ class StatusService { $dtEnd = DateTimeImmutable::createFromMutable($this->timeFactory->getDateTime('+5 minutes')); // Only query the calendars when there's any to search - if($query instanceof CalendarQuery && !empty($query->getCalendarUris())) { + if ($query instanceof CalendarQuery && !empty($query->getCalendarUris())) { // Query the next hour $query->setTimerangeStart($dtStart); $query->setTimerangeEnd($dtEnd); diff --git a/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php b/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php index ea1bf7d4f0f..e07be39c7b4 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php @@ -28,9 +28,9 @@ class Plugin extends ServerPlugin { * @var string[] */ public const ENABLE_FOR_CLIENTS = [ - "/^MSFT-WIN-3/", - "/Evolution/", - "/KIO/" + '/^MSFT-WIN-3/', + '/Evolution/', + '/KIO/' ]; /** diff --git a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php index 14c72285f67..07cb4a28a8e 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php @@ -45,12 +45,12 @@ class RefreshWebcalService { } // Check the refresh rate if there is any - if(!empty($subscription['{http://apple.com/ns/ical/}refreshrate'])) { + if (!empty($subscription['{http://apple.com/ns/ical/}refreshrate'])) { // add the refresh interval to the lastmodified timestamp $refreshInterval = new \DateInterval($subscription['{http://apple.com/ns/ical/}refreshrate']); $updateTime = $this->time->getDateTime(); $updateTime->setTimestamp($subscription['lastmodified'])->add($refreshInterval); - if($updateTime->getTimestamp() > $this->time->getTime()) { + if ($updateTime->getTimestamp() > $this->time->getTime()) { return; } } @@ -131,7 +131,7 @@ class RefreshWebcalService { try { $objectUri = $this->getRandomCalendarObjectUri(); $this->calDavBackend->createCalendarObject($subscription['id'], $objectUri, $vObject->serialize(), CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); - } catch (NoInstancesException | BadRequest $ex) { + } catch (NoInstancesException|BadRequest $ex) { $this->logger->warning('Unable to create calendar object from subscription {subscriptionId}', ['exception' => $ex, 'subscriptionId' => $subscription['id'], 'source' => $subscription['source']]); } } @@ -143,7 +143,7 @@ class RefreshWebcalService { return $dataSet['uri']; }, $localData); - if(!empty($ids) && !empty($uris)) { + if (!empty($ids) && !empty($uris)) { // Clean up on aisle 5 // The only events left over in the $localData array should be those that don't exist upstream // All deleted VObjects from upstream are removed @@ -157,7 +157,7 @@ class RefreshWebcalService { $this->updateSubscription($subscription, $mutations); } catch (ParseException $ex) { - $this->logger->error("Subscription {subscriptionId} could not be refreshed due to a parsing error", ['exception' => $ex, 'subscriptionId' => $subscription['id']]); + $this->logger->error('Subscription {subscriptionId} could not be refreshed due to a parsing error', ['exception' => $ex, 'subscriptionId' => $subscription['id']]); } } diff --git a/apps/dav/lib/Capabilities.php b/apps/dav/lib/Capabilities.php index c951c261115..3a1a9879e2d 100644 --- a/apps/dav/lib/Capabilities.php +++ b/apps/dav/lib/Capabilities.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud GmbH * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/dav/lib/CardDAV/Activity/Filter.php b/apps/dav/lib/CardDAV/Activity/Filter.php index 84e933fec7c..96a9fb630c5 100644 --- a/apps/dav/lib/CardDAV/Activity/Filter.php +++ b/apps/dav/lib/CardDAV/Activity/Filter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -38,8 +39,8 @@ class Filter implements IFilter { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. */ public function getPriority(): int { return 40; diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Base.php b/apps/dav/lib/CardDAV/Activity/Provider/Base.php index efc7827c220..10af430a0b1 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Base.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Base.php @@ -21,7 +21,7 @@ abstract class Base implements IProvider { /** @var IUserManager */ protected $userManager; - /** @var string[] */ + /** @var string[] */ protected $userDisplayNames = []; /** @var IGroupManager */ @@ -55,14 +55,14 @@ abstract class Base implements IProvider { $data['name'] === CardDavBackend::PERSONAL_ADDRESSBOOK_NAME) { return [ 'type' => 'addressbook', - 'id' => (string)$data['id'], + 'id' => (string) $data['id'], 'name' => $l->t('Personal'), ]; } return [ 'type' => 'addressbook', - 'id' => (string)$data['id'], + 'id' => (string) $data['id'], 'name' => $data['name'], ]; } diff --git a/apps/dav/lib/CardDAV/Activity/Setting.php b/apps/dav/lib/CardDAV/Activity/Setting.php index aa25898065f..cc68cf87c83 100644 --- a/apps/dav/lib/CardDAV/Activity/Setting.php +++ b/apps/dav/lib/CardDAV/Activity/Setting.php @@ -27,8 +27,8 @@ class Setting extends CalDAVSetting { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. */ public function getPriority(): int { return 50; diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php index 2ec645f04d2..c48f036f2bf 100644 --- a/apps/dav/lib/CardDAV/AddressBook.php +++ b/apps/dav/lib/CardDAV/AddressBook.php @@ -250,7 +250,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov } try { - return $this->carddavBackend->moveCard($sourceNode->getAddressbookId(), (int)$this->addressBookInfo['id'], $sourceNode->getUri(), $sourceNode->getOwner()); + return $this->carddavBackend->moveCard($sourceNode->getAddressbookId(), (int) $this->addressBookInfo['id'], $sourceNode->getUri(), $sourceNode->getOwner()); } catch (Exception $e) { // Avoid injecting LoggerInterface everywhere Server::get(LoggerInterface::class)->error('Could not move calendar object: ' . $e->getMessage(), ['exception' => $e]); diff --git a/apps/dav/lib/CardDAV/AddressBookImpl.php b/apps/dav/lib/CardDAV/AddressBookImpl.php index 44ff7b40752..36bc30e02f9 100644 --- a/apps/dav/lib/CardDAV/AddressBookImpl.php +++ b/apps/dav/lib/CardDAV/AddressBookImpl.php @@ -91,19 +91,19 @@ class AddressBookImpl implements IAddressBookEnabled { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options Options to define the output format and search behavior - * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array - * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']] - * - 'escape_like_param' - If set to false wildcards _ and % are not escaped - * - 'limit' - Set a numeric limit for the search results - * - 'offset' - Set the offset for the limited search results - * - 'wildcard' - Whether the search should use wildcards + * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array + * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']] + * - 'escape_like_param' - If set to false wildcards _ and % are not escaped + * - 'limit' - Set a numeric limit for the search results + * - 'offset' - Set the offset for the limited search results + * - 'wildcard' - Whether the search should use wildcards * @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, wildcard?: bool} $options * @return array an array of contacts which are arrays of key-value-pairs - * example result: - * [ - * ['id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => 'a@b.c', 'GEO' => '37.386013;-122.082932'], - * ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['d@e.f', 'g@h.i']] - * ] + * example result: + * [ + * ['id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => 'a@b.c', 'GEO' => '37.386013;-122.082932'], + * ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['d@e.f', 'g@h.i']] + * ] * @since 5.0.0 */ public function search($pattern, $searchProperties, $options) { @@ -144,13 +144,13 @@ class AddressBookImpl implements IAddressBookEnabled { if (is_string($entry)) { $property = $vCard->createProperty($key, $entry); } else { - if (($key === "ADR" || $key === "PHOTO") && is_string($entry["value"])) { - $entry["value"] = stripslashes($entry["value"]); - $entry["value"] = explode(';', $entry["value"]); + if (($key === 'ADR' || $key === 'PHOTO') && is_string($entry['value'])) { + $entry['value'] = stripslashes($entry['value']); + $entry['value'] = explode(';', $entry['value']); } - $property = $vCard->createProperty($key, $entry["value"]); - if (isset($entry["type"])) { - $property->add('TYPE', $entry["type"]); + $property = $vCard->createProperty($key, $entry['value']); + if (isset($entry['type'])) { + $property->add('TYPE', $entry['type']); } } $vCard->add($property); @@ -353,7 +353,7 @@ class AddressBookImpl implements IAddressBookEnabled { $path = 'addressbooks/users/' . $user . '/' . $uri; $properties = $this->propertyMapper->findPropertyByPathAndName($user, $path, '{http://owncloud.org/ns}enabled'); if (count($properties) > 0) { - return (bool)$properties[0]->getPropertyvalue(); + return (bool) $properties[0]->getPropertyvalue(); } return true; } diff --git a/apps/dav/lib/CardDAV/Card.php b/apps/dav/lib/CardDAV/Card.php index 67f605d2fb4..218684ed832 100644 --- a/apps/dav/lib/CardDAV/Card.php +++ b/apps/dav/lib/CardDAV/Card.php @@ -26,7 +26,7 @@ class Card extends \Sabre\CardDAV\Card { } public function getAddressbookId(): int { - return (int)$this->cardData['addressbookid']; + return (int) $this->cardData['addressbookid']; } public function getPrincipalUri(): string { diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 9d787c917d3..90d54329b99 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -154,7 +154,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { continue; } - $readOnly = (int)$row['access'] === Backend::ACCESS_READ; + $readOnly = (int) $row['access'] === Backend::ACCESS_READ; if (isset($addressBooks[$row['id']])) { if ($readOnly) { // New share can not have more permissions then the old one. @@ -330,14 +330,14 @@ class CardDavBackend implements BackendInterface, SyncSupport { $query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId))) ->executeStatement(); - $this->addChange($addressBookId, "", 2); + $this->addChange($addressBookId, '', 2); - $addressBookRow = $this->getAddressBookById((int)$addressBookId); - $shares = $this->getShares((int)$addressBookId); + $addressBookRow = $this->getAddressBookById((int) $addressBookId); + $shares = $this->getShares((int) $addressBookId); return [$addressBookRow, $shares]; }, $this->db); - $this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int)$addressBookId, $addressBookRow, $shares, $mutations)); + $this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int) $addressBookId, $addressBookRow, $shares, $mutations)); return true; }); @@ -417,7 +417,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { */ public function deleteAddressBook($addressBookId) { $this->atomic(function () use ($addressBookId) { - $addressBookId = (int)$addressBookId; + $addressBookId = (int) $addressBookId; $addressBookData = $this->getAddressBookById($addressBookId); $shares = $this->getShares($addressBookId); @@ -616,7 +616,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->andWhere($q->expr()->eq('uid', $q->createNamedParameter($uid))) ->setMaxResults(1); $result = $q->executeQuery(); - $count = (bool)$result->fetchOne(); + $count = (bool) $result->fetchOne(); $result->closeCursor(); if ($count) { throw new \Sabre\DAV\Exception\BadRequest('VCard object with uid already exists in this addressbook collection.'); @@ -729,7 +729,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($sourceAddressBookId, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT)) ->executeStatement(); - $this->purgeProperties($sourceAddressBookId, (int)$card['id']); + $this->purgeProperties($sourceAddressBookId, (int) $card['id']); $this->updateProperties($sourceAddressBookId, $card['uri'], $card['carddata']); $this->addChange($sourceAddressBookId, $card['uri'], 3); @@ -945,7 +945,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->from('addressbooks') ->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId))); $result = $query->executeQuery(); - $syncToken = (int)$result->fetchOne(); + $syncToken = (int) $result->fetchOne(); $result->closeCursor(); $query = $this->db->getQueryBuilder(); @@ -1032,11 +1032,11 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options = array() to define the search behavior - * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array - * - 'escape_like_param' - If set to false wildcards _ and % are not escaped, otherwise they are - * - 'limit' - Set a numeric limit for the search results - * - 'offset' - Set the offset for the limited search results - * - 'wildcard' - Whether the search should use wildcards + * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array + * - 'escape_like_param' - If set to false wildcards _ and % are not escaped, otherwise they are + * - 'limit' - Set a numeric limit for the search results + * - 'offset' - Set the offset for the limited search results + * - 'wildcard' - Whether the search should use wildcards * @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, wildcard?: bool} $options * @return array an array of contacts which are arrays of key-value-pairs */ @@ -1169,7 +1169,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $matches = $result->fetchAll(); $result->closeCursor(); $matches = array_map(function ($match) { - return (int)$match['cardid']; + return (int) $match['cardid']; }, $matches); $cards = []; @@ -1370,7 +1370,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { throw new \InvalidArgumentException('Card does not exists: ' . $uri); } - return (int)$cardIds['id']; + return (int) $cardIds['id']; } /** diff --git a/apps/dav/lib/CardDAV/ContactsManager.php b/apps/dav/lib/CardDAV/ContactsManager.php index 14bf8db7be5..c4751497a67 100644 --- a/apps/dav/lib/CardDAV/ContactsManager.php +++ b/apps/dav/lib/CardDAV/ContactsManager.php @@ -13,13 +13,13 @@ use OCP\IL10N; use OCP\IURLGenerator; class ContactsManager { - /** @var CardDavBackend */ + /** @var CardDavBackend */ private $backend; - /** @var IL10N */ + /** @var IL10N */ private $l10n; - /** @var PropertyMapper */ + /** @var PropertyMapper */ private $propertyMapper; /** @@ -51,7 +51,7 @@ class ContactsManager { * @param IURLGenerator $urlGenerator */ public function setupSystemContactsProvider(IManager $cm, ?string $userId, IURLGenerator $urlGenerator) { - $addressBooks = $this->backend->getAddressBooksForUser("principals/system/system"); + $addressBooks = $this->backend->getAddressBooksForUser('principals/system/system'); $this->register($cm, $addressBooks, $urlGenerator, $userId); } diff --git a/apps/dav/lib/CardDAV/ImageExportPlugin.php b/apps/dav/lib/CardDAV/ImageExportPlugin.php index e2173db519b..cbf78dcc707 100644 --- a/apps/dav/lib/CardDAV/ImageExportPlugin.php +++ b/apps/dav/lib/CardDAV/ImageExportPlugin.php @@ -55,7 +55,7 @@ class ImageExportPlugin extends ServerPlugin { return true; } - $size = isset($queryParams['size']) ? (int)$queryParams['size'] : -1; + $size = isset($queryParams['size']) ? (int) $queryParams['size'] : -1; $path = $request->getPath(); $node = $this->server->tree->getNodeForPath($path); diff --git a/apps/dav/lib/CardDAV/PhotoCache.php b/apps/dav/lib/CardDAV/PhotoCache.php index 3ea99c29a51..83b5f417896 100644 --- a/apps/dav/lib/CardDAV/PhotoCache.php +++ b/apps/dav/lib/CardDAV/PhotoCache.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -19,7 +20,7 @@ use Sabre\VObject\Reader; class PhotoCache { - /** @var array */ + /** @var array */ public const ALLOWED_CONTENT_TYPES = [ 'image/png' => 'png', 'image/jpeg' => 'jpg', diff --git a/apps/dav/lib/CardDAV/SyncService.php b/apps/dav/lib/CardDAV/SyncService.php index 264d34a150b..259ffdf8fda 100644 --- a/apps/dav/lib/CardDAV/SyncService.php +++ b/apps/dav/lib/CardDAV/SyncService.php @@ -143,7 +143,7 @@ class SyncService { \GuzzleHttp\Psr7\Utils::uriFor($path) ); - return (string)$uri; + return (string) $uri; } /** @@ -184,7 +184,7 @@ class SyncService { $options ); - return (string)$response->getBody(); + return (string) $response->getBody(); } private function buildSyncCollectionRequestBody(?string $syncToken): string { diff --git a/apps/dav/lib/CardDAV/SystemAddressbook.php b/apps/dav/lib/CardDAV/SystemAddressbook.php index 4ba06d0fc9c..aff51ac5b9b 100644 --- a/apps/dav/lib/CardDAV/SystemAddressbook.php +++ b/apps/dav/lib/CardDAV/SystemAddressbook.php @@ -254,7 +254,7 @@ class SystemAddressbook extends AddressBook { try { $this->getChild($uri); $added[] = $uri; - } catch (NotFound | Forbidden $e) { + } catch (NotFound|Forbidden $e) { $deleted[] = $uri; } } @@ -262,7 +262,7 @@ class SystemAddressbook extends AddressBook { try { $this->getChild($uri); $modified[] = $uri; - } catch (NotFound | Forbidden $e) { + } catch (NotFound|Forbidden $e) { $deleted[] = $uri; } } diff --git a/apps/dav/lib/CardDAV/UserAddressBooks.php b/apps/dav/lib/CardDAV/UserAddressBooks.php index d0719e02492..e2d3fe4d8c8 100644 --- a/apps/dav/lib/CardDAV/UserAddressBooks.php +++ b/apps/dav/lib/CardDAV/UserAddressBooks.php @@ -89,7 +89,7 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome { try { $trustedServers = \OC::$server->get(TrustedServers::class); $request = \OC::$server->get(IRequest::class); - } catch (QueryException | NotFoundExceptionInterface | ContainerExceptionInterface $e) { + } catch (QueryException|NotFoundExceptionInterface|ContainerExceptionInterface $e) { // nothing to do, the request / trusted servers don't exist } if ($addressBook['principaluri'] === 'principals/system/system') { diff --git a/apps/dav/lib/Command/CreateAddressBook.php b/apps/dav/lib/Command/CreateAddressBook.php index e7d7824d1b6..9626edeba26 100644 --- a/apps/dav/lib/Command/CreateAddressBook.php +++ b/apps/dav/lib/Command/CreateAddressBook.php @@ -24,14 +24,14 @@ class CreateAddressBook extends Command { protected function configure(): void { $this - ->setName('dav:create-addressbook') - ->setDescription('Create a dav addressbook') - ->addArgument('user', - InputArgument::REQUIRED, - 'User for whom the addressbook will be created') - ->addArgument('name', - InputArgument::REQUIRED, - 'Name of the addressbook'); + ->setName('dav:create-addressbook') + ->setDescription('Create a dav addressbook') + ->addArgument('user', + InputArgument::REQUIRED, + 'User for whom the addressbook will be created') + ->addArgument('name', + InputArgument::REQUIRED, + 'Name of the addressbook'); } protected function execute(InputInterface $input, OutputInterface $output): int { diff --git a/apps/dav/lib/Command/DeleteCalendar.php b/apps/dav/lib/Command/DeleteCalendar.php index 423a9b03434..93c901b2ba6 100644 --- a/apps/dav/lib/Command/DeleteCalendar.php +++ b/apps/dav/lib/Command/DeleteCalendar.php @@ -56,7 +56,7 @@ class DeleteCalendar extends Command { InputInterface $input, OutputInterface $output ): int { - /** @var string $user **/ + /** @var string $user * */ $user = $input->getArgument('uid'); if (!$this->userManager->userExists($user)) { throw new \InvalidArgumentException( @@ -67,7 +67,7 @@ class DeleteCalendar extends Command { if ($birthday !== false) { $name = BirthdayService::BIRTHDAY_CALENDAR_URI; } else { - /** @var string $name **/ + /** @var string $name * */ $name = $input->getArgument('name'); if (!$name) { throw new \InvalidArgumentException( diff --git a/apps/dav/lib/Command/FixCalendarSyncCommand.php b/apps/dav/lib/Command/FixCalendarSyncCommand.php index 5e92b3270d2..e94e1dc9c4a 100644 --- a/apps/dav/lib/Command/FixCalendarSyncCommand.php +++ b/apps/dav/lib/Command/FixCalendarSyncCommand.php @@ -56,7 +56,7 @@ class FixCalendarSyncCommand extends Command { } private function fixUserCalendars(IUser $user, ?ProgressBar $progress = null): void { - $calendars = $this->calDavBackend->getCalendarsForUser("principals/users/" . $user->getUID()); + $calendars = $this->calDavBackend->getCalendarsForUser('principals/users/' . $user->getUID()); foreach ($calendars as $calendar) { $this->calDavBackend->restoreChanges($calendar['id']); diff --git a/apps/dav/lib/Command/ListCalendars.php b/apps/dav/lib/Command/ListCalendars.php index 5344530e8a5..af3459686e5 100644 --- a/apps/dav/lib/Command/ListCalendars.php +++ b/apps/dav/lib/Command/ListCalendars.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Command/MoveCalendar.php b/apps/dav/lib/Command/MoveCalendar.php index b8adc75338a..b8acc191cc3 100644 --- a/apps/dav/lib/Command/MoveCalendar.php +++ b/apps/dav/lib/Command/MoveCalendar.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -50,7 +51,7 @@ class MoveCalendar extends Command { ->addArgument('destinationuid', InputArgument::REQUIRED, 'User who will receive the calendar') - ->addOption('force', 'f', InputOption::VALUE_NONE, "Force the migration by removing existing shares and renaming calendars in case of conflicts"); + ->addOption('force', 'f', InputOption::VALUE_NONE, 'Force the migration by removing existing shares and renaming calendars in case of conflicts'); } protected function execute(InputInterface $input, OutputInterface $output): int { @@ -97,8 +98,8 @@ class MoveCalendar extends Command { * Warn that share links have changed if there are shares */ $this->io->note([ - "Please note that moving calendar " . $calendar['uri'] . " from user <$userOrigin> to <$userDestination> has caused share links to change.", - "Sharees will need to change \"example.com/remote.php/dav/calendars/uid/" . $calendar['uri'] . "_shared_by_$userOrigin\" to \"example.com/remote.php/dav/calendars/uid/" . $newName ?: $calendar['uri'] . "_shared_by_$userDestination\"" + 'Please note that moving calendar ' . $calendar['uri'] . " from user <$userOrigin> to <$userDestination> has caused share links to change.", + 'Sharees will need to change "example.com/remote.php/dav/calendars/uid/' . $calendar['uri'] . "_shared_by_$userOrigin\" to \"example.com/remote.php/dav/calendars/uid/" . $newName ?: $calendar['uri'] . "_shared_by_$userDestination\"" ]); } @@ -155,7 +156,7 @@ class MoveCalendar extends Command { if ($force) { $this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config, $this->logger), [], ['principal:principals/groups/' . $userOrGroup]); } else { - throw new \InvalidArgumentException("User <$userDestination> is not part of the group <$userOrGroup> with whom the calendar <" . $calendar['uri'] . "> was shared. You may use -f to move the calendar while deleting this share."); + throw new \InvalidArgumentException("User <$userDestination> is not part of the group <$userOrGroup> with whom the calendar <" . $calendar['uri'] . '> was shared. You may use -f to move the calendar while deleting this share.'); } } @@ -166,7 +167,7 @@ class MoveCalendar extends Command { if ($force) { $this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config, $this->logger), [], ['principal:principals/users/' . $userOrGroup]); } else { - throw new \InvalidArgumentException("The calendar <" . $calendar['uri'] . "> is already shared to user <$userDestination>.You may use -f to move the calendar while deleting this share."); + throw new \InvalidArgumentException('The calendar <' . $calendar['uri'] . "> is already shared to user <$userDestination>.You may use -f to move the calendar while deleting this share."); } } } diff --git a/apps/dav/lib/Command/SendEventReminders.php b/apps/dav/lib/Command/SendEventReminders.php index f5afb30ed70..89bb5ce8c20 100644 --- a/apps/dav/lib/Command/SendEventReminders.php +++ b/apps/dav/lib/Command/SendEventReminders.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Command/SyncBirthdayCalendar.php b/apps/dav/lib/Command/SyncBirthdayCalendar.php index 5c8ac913af4..de63a8572bb 100644 --- a/apps/dav/lib/Command/SyncBirthdayCalendar.php +++ b/apps/dav/lib/Command/SyncBirthdayCalendar.php @@ -55,7 +55,7 @@ class SyncBirthdayCalendar extends Command { $this->birthdayService->syncUser($user); return self::SUCCESS; } - $output->writeln("Start birthday calendar sync for all users ..."); + $output->writeln('Start birthday calendar sync for all users ...'); $p = new ProgressBar($output); $p->start(); $this->userManager->callForSeenUsers(function ($user) use ($p) { diff --git a/apps/dav/lib/Comments/CommentNode.php b/apps/dav/lib/Comments/CommentNode.php index 3a9e5362528..a257611dd15 100644 --- a/apps/dav/lib/Comments/CommentNode.php +++ b/apps/dav/lib/Comments/CommentNode.php @@ -30,7 +30,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { public const PROPERTY_NAME_MENTION_ID = '{http://owncloud.org/ns}mentionId'; public const PROPERTY_NAME_MENTION_DISPLAYNAME = '{http://owncloud.org/ns}mentionDisplayName'; - /** @var IComment */ + /** @var IComment */ public $comment; /** @var ICommentsManager */ diff --git a/apps/dav/lib/Comments/CommentsPlugin.php b/apps/dav/lib/Comments/CommentsPlugin.php index 7db64313121..ed6614312e1 100644 --- a/apps/dav/lib/Comments/CommentsPlugin.php +++ b/apps/dav/lib/Comments/CommentsPlugin.php @@ -34,13 +34,13 @@ class CommentsPlugin extends ServerPlugin { public const REPORT_PARAM_OFFSET = '{http://owncloud.org/ns}offset'; public const REPORT_PARAM_TIMESTAMP = '{http://owncloud.org/ns}datetime'; - /** @var ICommentsManager */ + /** @var ICommentsManager */ protected $commentsManager; /** @var \Sabre\DAV\Server $server */ private $server; - /** @var \OCP\IUserSession */ + /** @var \OCP\IUserSession */ protected $userSession; /** @@ -158,7 +158,7 @@ class CommentsPlugin extends ServerPlugin { } if (!is_null($args['datetime'])) { - $args['datetime'] = new \DateTime((string)$args['datetime']); + $args['datetime'] = new \DateTime((string) $args['datetime']); } $results = $node->findChildren($args['limit'], $args['offset'], $args['datetime']); diff --git a/apps/dav/lib/Comments/EntityCollection.php b/apps/dav/lib/Comments/EntityCollection.php index 367dab54c5e..19af2d9c234 100644 --- a/apps/dav/lib/Comments/EntityCollection.php +++ b/apps/dav/lib/Comments/EntityCollection.php @@ -27,7 +27,7 @@ use Sabre\DAV\PropPatch; class EntityCollection extends RootCollection implements IProperties { public const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker'; - /** @var string */ + /** @var string */ protected $id; protected LoggerInterface $logger; diff --git a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php index b39dc7197b0..0e2b1c58748 100644 --- a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php b/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php index 8f5195e926b..9cff113140a 100644 --- a/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AppleQuirksPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -58,8 +59,8 @@ class AppleQuirksPlugin extends ServerPlugin { * This method handles HTTP REPORT requests. * * @param string $reportName - * @param mixed $report - * @param mixed $path + * @param mixed $report + * @param mixed $path * * @return bool */ diff --git a/apps/dav/lib/Connector/Sabre/BearerAuth.php b/apps/dav/lib/Connector/Sabre/BearerAuth.php index ac25160901e..4ef34900789 100644 --- a/apps/dav/lib/Connector/Sabre/BearerAuth.php +++ b/apps/dav/lib/Connector/Sabre/BearerAuth.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Connector/Sabre/CachingTree.php b/apps/dav/lib/Connector/Sabre/CachingTree.php index a715991fcf6..63c684f65d4 100644 --- a/apps/dav/lib/Connector/Sabre/CachingTree.php +++ b/apps/dav/lib/Connector/Sabre/CachingTree.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php b/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php index 1bf45b22537..e2fc3868f68 100644 --- a/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php +++ b/apps/dav/lib/Connector/Sabre/ChecksumUpdatePlugin.php @@ -50,7 +50,7 @@ class ChecksumUpdatePlugin extends ServerPlugin { $node = $this->server->tree->getNodeForPath($path); if ($node instanceof File) { $type = strtolower( - (string)$request->getHeader('X-Recalculate-Hash') + (string) $request->getHeader('X-Recalculate-Hash') ); $hash = $node->hash($type); diff --git a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php index 71514016bda..84e914bee35 100644 --- a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php @@ -59,14 +59,14 @@ class CommentPropertiesPlugin extends ServerPlugin { continue; } - $ids[] = (string)$id; + $ids[] = (string) $id; } $ids[] = (string) $directory->getId(); $unread = $this->commentsManager->getNumberOfUnreadCommentsForObjects('files', $ids, $this->userSession->getUser()); foreach ($unread as $id => $count) { - $this->cachedUnreadCount[(int)$id] = $count; + $this->cachedUnreadCount[(int) $id] = $count; } } @@ -95,7 +95,7 @@ class CommentPropertiesPlugin extends ServerPlugin { } $propFind->handle(self::PROPERTY_NAME_COUNT, function () use ($node): int { - return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId()); + return $this->commentsManager->getNumberOfCommentsForObject('files', (string) $node->getId()); }); $propFind->handle(self::PROPERTY_NAME_HREF, function () use ($node): ?string { @@ -117,7 +117,7 @@ class CommentPropertiesPlugin extends ServerPlugin { // in case we end up somewhere else, unexpectedly. return null; } - $commentsPart = 'dav/comments/files/' . rawurldecode((string)$node->getId()); + $commentsPart = 'dav/comments/files/' . rawurldecode((string) $node->getId()); return substr_replace($href, $commentsPart, $entryPoint + strlen('/remote.php/')); } @@ -131,8 +131,8 @@ class CommentPropertiesPlugin extends ServerPlugin { return null; } - $lastRead = $this->commentsManager->getReadMark('files', (string)$node->getId(), $user); + $lastRead = $this->commentsManager->getReadMark('files', (string) $node->getId(), $user); - return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId(), $lastRead); + return $this->commentsManager->getNumberOfCommentsForObject('files', (string) $node->getId(), $lastRead); } } diff --git a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php index 336930cf17d..7846896182f 100644 --- a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php +++ b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php @@ -52,7 +52,7 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin { } if ($this->getCurrentUserPrincipal() === $node->getOwner()) { - throw new Forbidden("Access denied"); + throw new Forbidden('Access denied'); } else { throw new NotFound( sprintf( diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index b429f453679..71a48c0cb14 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -294,7 +294,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol } $relativePath = $this->fileView->getRelativePath($this->info->getPath()); if ($relativePath === null) { - $this->getLogger()->warning("error while getting quota as the relative path cannot be found"); + $this->getLogger()->warning('error while getting quota as the relative path cannot be found'); return [0, 0]; } @@ -311,13 +311,13 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol ]; return $this->quotaInfo; } catch (\OCP\Files\NotFoundException $e) { - $this->getLogger()->warning("error while getting quota into", ['exception' => $e]); + $this->getLogger()->warning('error while getting quota into', ['exception' => $e]); return [0, 0]; } catch (\OCP\Files\StorageNotAvailableException $e) { - $this->getLogger()->warning("error while getting quota into", ['exception' => $e]); + $this->getLogger()->warning('error while getting quota into', ['exception' => $e]); return [0, 0]; } catch (NotPermittedException $e) { - $this->getLogger()->warning("error while getting quota into", ['exception' => $e]); + $this->getLogger()->warning('error while getting quota into', ['exception' => $e]); return [0, 0]; } } diff --git a/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php b/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php index 41ace002660..1e1e4aaed04 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php +++ b/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php index 5c39e6a437a..bad4bfa12ab 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php +++ b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php @@ -14,7 +14,7 @@ class FileLocked extends \Sabre\DAV\Exception { * @param string $message * @param int $code */ - public function __construct($message = "", $code = 0, ?Exception $previous = null) { + public function __construct($message = '', $code = 0, ?Exception $previous = null) { if ($previous instanceof \OCP\Files\LockNotAcquiredException) { $message = sprintf('Target file %s is locked by another process.', $previous->path); } diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 7d2933c5014..1bab3ba713c 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -228,7 +228,7 @@ class File extends Node implements IFile { } $lengthHeader = $this->request->getHeader('content-length'); - $expected = $lengthHeader !== '' ? (int)$lengthHeader : -1; + $expected = $lengthHeader !== '' ? (int) $lengthHeader : -1; if ($result === false && $expected >= 0) { throw new Exception( $this->l10n->t( diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index 4c2537a3541..2739da47284 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -607,7 +607,7 @@ class FilesPlugin extends ServerPlugin { $mutation, function (mixed $value) use ($accessRight, $knownMetadata, $node, $mutation, $filesMetadataManager): bool { /** @var FilesMetadata $metadata */ - $metadata = $filesMetadataManager->getMetadata((int)$node->getFileId(), true); + $metadata = $filesMetadataManager->getMetadata((int) $node->getFileId(), true); $metadata->setStorageId($node->getNode()->getStorage()->getCache()->getNumericStorageId()); $metadataKey = substr($mutation, strlen(self::FILE_METADATA_PREFIX)); diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php index 9b29950e4b4..bb4a94dfc60 100644 --- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php @@ -184,9 +184,9 @@ class FilesReportPlugin extends ServerPlugin { } elseif ($name === '{DAV:}limit') { foreach ($reportProps['value'] as $propVal) { if ($propVal['name'] === '{DAV:}nresults') { - $limit = (int)$propVal['value']; + $limit = (int) $propVal['value']; } elseif ($propVal['name'] === $ncns . 'firstresult') { - $offset = (int)$propVal['value']; + $offset = (int) $propVal['value']; } } } @@ -363,7 +363,7 @@ class FilesReportPlugin extends ServerPlugin { * Prepare propfind response for the given nodes * * @param string $filesUri $filesUri URI leading to root of the files URI, - * with a leading slash but no trailing slash + * with a leading slash but no trailing slash * @param string[] $requestedProps requested properties * @param Node[] nodes nodes for which to fetch and prepare responses * @return Response[] @@ -410,7 +410,7 @@ class FilesReportPlugin extends ServerPlugin { $results = []; foreach ($fileIds as $fileId) { - $entry = $folder->getFirstNodeById((int)$fileId); + $entry = $folder->getFirstNodeById((int) $fileId); if ($entry) { $results[] = $this->wrapNode($entry); } diff --git a/apps/dav/lib/Connector/Sabre/MtimeSanitizer.php b/apps/dav/lib/Connector/Sabre/MtimeSanitizer.php index efed6ce09f8..91ecb62ac4d 100644 --- a/apps/dav/lib/Connector/Sabre/MtimeSanitizer.php +++ b/apps/dav/lib/Connector/Sabre/MtimeSanitizer.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only @@ -17,10 +18,10 @@ class MtimeSanitizer { } // Prevent writing invalid mtime (timezone-proof) - if ((int)$mtimeFromRequest <= 24 * 60 * 60) { + if ((int) $mtimeFromRequest <= 24 * 60 * 60) { throw new \InvalidArgumentException('X-OC-MTime header must be a valid positive integer'); } - return (int)$mtimeFromRequest; + return (int) $mtimeFromRequest; } } diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index 3ca542fee73..d3caf8561a7 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -151,7 +151,7 @@ abstract class Node implements \Sabre\DAV\INode { public function getLastModified() { $timestamp = $this->info->getMtime(); if (!empty($timestamp)) { - return (int)$timestamp; + return (int) $timestamp; } return $timestamp; } @@ -265,7 +265,7 @@ abstract class Node implements \Sabre\DAV\INode { if ($storage && $storage->instanceOfStorage(ISharedStorage::class)) { /** @var ISharedStorage $storage */ - $permissions = (int)$storage->getShare()->getPermissions(); + $permissions = (int) $storage->getShare()->getPermissions(); } else { $permissions = $this->info->getPermissions(); } diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php index 7ac5b476154..94098b4aca3 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -25,7 +25,7 @@ class ObjectTree extends CachingTree { protected $fileView; /** - * @var \OCP\Files\Mount\IMountManager + * @var \OCP\Files\Mount\IMountManager */ protected $mountManager; @@ -38,7 +38,7 @@ class ObjectTree extends CachingTree { /** * @param \Sabre\DAV\INode $rootNode * @param \OC\Files\View $view - * @param \OCP\Files\Mount\IMountManager $mountManager + * @param \OCP\Files\Mount\IMountManager $mountManager */ public function init(\Sabre\DAV\INode $rootNode, \OC\Files\View $view, \OCP\Files\Mount\IMountManager $mountManager) { $this->rootNode = $rootNode; diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index f09ff4def64..671029f1475 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -180,7 +181,7 @@ class Principal implements BackendInterface { } elseif ($prefix === 'principals/system') { return [ 'uri' => 'principals/system/' . $name, - '{DAV:}displayname' => $this->languageFactory->get('dav')->t("Accounts"), + '{DAV:}displayname' => $this->languageFactory->get('dav')->t('Accounts'), ]; } return null; diff --git a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php index 5bb0f9cac31..4cc309ce43a 100644 --- a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php +++ b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php @@ -81,7 +81,7 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin { $destinationPath = $this->server->calculateUri($request->getHeader('Destination')); $quotaPath = $this->getPathForDestination($destinationPath); if ($quotaPath && is_numeric($length)) { - return $this->checkQuota($quotaPath, (int)$length); + return $this->checkQuota($quotaPath, (int) $length); } } diff --git a/apps/dav/lib/Connector/Sabre/Server.php b/apps/dav/lib/Connector/Sabre/Server.php index f3bfac1d6e0..11146373274 100644 --- a/apps/dav/lib/Connector/Sabre/Server.php +++ b/apps/dav/lib/Connector/Sabre/Server.php @@ -69,7 +69,7 @@ class Server extends \Sabre\DAV\Server { $DOM->appendChild($error); $h = function ($v) { - return htmlspecialchars((string)$v, ENT_NOQUOTES, 'UTF-8'); + return htmlspecialchars((string) $v, ENT_NOQUOTES, 'UTF-8'); }; if (self::$exposeVersion) { diff --git a/apps/dav/lib/Connector/Sabre/ShareTypeList.php b/apps/dav/lib/Connector/Sabre/ShareTypeList.php index abe56cd0301..5c881c8e3c3 100644 --- a/apps/dav/lib/Connector/Sabre/ShareTypeList.php +++ b/apps/dav/lib/Connector/Sabre/ShareTypeList.php @@ -57,7 +57,7 @@ class ShareTypeList implements Element { } foreach ($tree as $elem) { if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}share-type') { - $shareTypes[] = (int)$elem['value']; + $shareTypes[] = (int) $elem['value']; } } return new self($shareTypes); diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php index d7572c46ed3..ee219aff18f 100644 --- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php @@ -117,7 +117,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin { * * @param integer $fileId file id * @return array list($tags, $favorite) with $tags as tag array - * and $favorite is a boolean whether the file was favorited + * and $favorite is a boolean whether the file was favorited */ private function getTagsAndFav($fileId) { $isFav = false; @@ -203,9 +203,9 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin { )) { // note: pre-fetching only supported for depth <= 1 $folderContent = $node->getChildren(); - $fileIds[] = (int)$node->getId(); + $fileIds[] = (int) $node->getId(); foreach ($folderContent as $info) { - $fileIds[] = (int)$info->getId(); + $fileIds[] = (int) $info->getId(); } $tags = $this->getTagger()->getTagsForObjects($fileIds); if ($tags === false) { @@ -260,7 +260,7 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin { }); $propPatch->handle(self::FAVORITE_PROPERTYNAME, function ($favState) use ($node) { - if ((int)$favState === 1 || $favState === 'true') { + if ((int) $favState === 1 || $favState === 'true') { $this->getTagger()->tagAs($node->getId(), self::TAG_FAVORITE); } else { $this->getTagger()->unTag($node->getId(), self::TAG_FAVORITE); diff --git a/apps/dav/lib/Controller/BirthdayCalendarController.php b/apps/dav/lib/Controller/BirthdayCalendarController.php index e82c4ad534c..11aa6e308a1 100644 --- a/apps/dav/lib/Controller/BirthdayCalendarController.php +++ b/apps/dav/lib/Controller/BirthdayCalendarController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/DAV/CustomPropertiesBackend.php b/apps/dav/lib/DAV/CustomPropertiesBackend.php index 7b268083976..263d2d0b41a 100644 --- a/apps/dav/lib/DAV/CustomPropertiesBackend.php +++ b/apps/dav/lib/DAV/CustomPropertiesBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php index 7ccc3f02594..b3b2ea39177 100644 --- a/apps/dav/lib/DAV/GroupPrincipalBackend.php +++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/dav/lib/DAV/PublicAuth.php b/apps/dav/lib/DAV/PublicAuth.php index 2142bd04753..c2b4ada173a 100644 --- a/apps/dav/lib/DAV/PublicAuth.php +++ b/apps/dav/lib/DAV/PublicAuth.php @@ -53,9 +53,9 @@ class PublicAuth implements BackendInterface { */ public function check(RequestInterface $request, ResponseInterface $response) { if ($this->isRequestPublic($request)) { - return [true, "principals/system/public"]; + return [true, 'principals/system/public']; } - return [false, "No public access to this resource."]; + return [false, 'No public access to this resource.']; } /** diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index f63e4dce454..cdcf0ca7d44 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -58,7 +58,7 @@ abstract class Backend { } // Don't add share for owner - if($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) { + if ($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) { continue; } @@ -83,7 +83,7 @@ abstract class Backend { } // Don't add unshare for owner - if($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) { + if ($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) { continue; } @@ -92,7 +92,7 @@ abstract class Backend { // Check if a user has a groupshare that they're trying to free themselves from // If so we need to add a self::ACCESS_UNSHARED row - if(!str_contains($principal, 'group') + if (!str_contains($principal, 'group') && $this->service->hasGroupShare($oldShares) ) { $this->service->unshare($shareable->getResourceId(), $principal); @@ -123,31 +123,31 @@ abstract class Backend { * @return list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}> */ public function getShares(int $resourceId): array { - $cached = $this->shareCache->get((string)$resourceId); + $cached = $this->shareCache->get((string) $resourceId); if ($cached) { return $cached; } $rows = $this->service->getShares($resourceId); $shares = []; - foreach($rows as $row) { + foreach ($rows as $row) { $p = $this->principalBackend->getPrincipalByPath($row['principaluri']); $shares[] = [ 'href' => "principal:{$row['principaluri']}", - 'commonName' => isset($p['{DAV:}displayname']) ? (string)$p['{DAV:}displayname'] : '', + 'commonName' => isset($p['{DAV:}displayname']) ? (string) $p['{DAV:}displayname'] : '', 'status' => 1, 'readOnly' => (int) $row['access'] === Backend::ACCESS_READ, - '{http://owncloud.org/ns}principal' => (string)$row['principaluri'], + '{http://owncloud.org/ns}principal' => (string) $row['principaluri'], '{http://owncloud.org/ns}group-share' => isset($p['uri']) && (str_starts_with($p['uri'], 'principals/groups') || str_starts_with($p['uri'], 'principals/circles')) ]; } - $this->shareCache->set((string)$resourceId, $shares); + $this->shareCache->set((string) $resourceId, $shares); return $shares; } public function preloadShares(array $resourceIds): void { $resourceIds = array_filter($resourceIds, function (int $resourceId) { - return empty($this->shareCache->get((string)$resourceId)); + return empty($this->shareCache->get((string) $resourceId)); }); if (empty($resourceIds)) { return; @@ -155,18 +155,18 @@ abstract class Backend { $rows = $this->service->getSharesForIds($resourceIds); $sharesByResource = array_fill_keys($resourceIds, []); - foreach($rows as $row) { - $resourceId = (int)$row['resourceid']; + foreach ($rows as $row) { + $resourceId = (int) $row['resourceid']; $p = $this->principalBackend->getPrincipalByPath($row['principaluri']); $sharesByResource[$resourceId][] = [ 'href' => "principal:{$row['principaluri']}", - 'commonName' => isset($p['{DAV:}displayname']) ? (string)$p['{DAV:}displayname'] : '', + 'commonName' => isset($p['{DAV:}displayname']) ? (string) $p['{DAV:}displayname'] : '', 'status' => 1, 'readOnly' => (int) $row['access'] === self::ACCESS_READ, - '{http://owncloud.org/ns}principal' => (string)$row['principaluri'], + '{http://owncloud.org/ns}principal' => (string) $row['principaluri'], '{http://owncloud.org/ns}group-share' => isset($p['uri']) && str_starts_with($p['uri'], 'principals/groups') ]; - $this->shareCache->set((string)$resourceId, $sharesByResource[$resourceId]); + $this->shareCache->set((string) $resourceId, $sharesByResource[$resourceId]); } } diff --git a/apps/dav/lib/DAV/ViewOnlyPlugin.php b/apps/dav/lib/DAV/ViewOnlyPlugin.php index df3301e2e6b..b9e409a4781 100644 --- a/apps/dav/lib/DAV/ViewOnlyPlugin.php +++ b/apps/dav/lib/DAV/ViewOnlyPlugin.php @@ -74,7 +74,7 @@ class ViewOnlyPlugin extends ServerPlugin { $nodes = $this->userFolder->getById($node->getId()); $node = array_pop($nodes); if (!$node) { - throw new NotFoundException("Version file not accessible by current user"); + throw new NotFoundException('Version file not accessible by current user'); } } } else { diff --git a/apps/dav/lib/Db/Absence.php b/apps/dav/lib/Db/Absence.php index 550958aaabd..ffe0287f654 100644 --- a/apps/dav/lib/Db/Absence.php +++ b/apps/dav/lib/Db/Absence.php @@ -63,7 +63,7 @@ class Absence extends Entity implements JsonSerializable { public function toOutOufOfficeData(IUser $user, string $timezone): IOutOfOfficeData { if ($user->getUID() !== $this->getUserId()) { - throw new InvalidArgumentException("The user doesn't match the user id of this absence! Expected " . $this->getUserId() . ", got " . $user->getUID()); + throw new InvalidArgumentException("The user doesn't match the user id of this absence! Expected " . $this->getUserId() . ', got ' . $user->getUID()); } if ($this->getId() === null) { throw new Exception('Creating out-of-office data without ID'); @@ -74,7 +74,7 @@ class Absence extends Entity implements JsonSerializable { $endDate = new DateTime($this->getLastDay(), $tz); $endDate->setTime(23, 59); return new OutOfOfficeData( - (string)$this->getId(), + (string) $this->getId(), $user, $startDate->getTimestamp(), $endDate->getTimestamp(), diff --git a/apps/dav/lib/Direct/DirectFile.php b/apps/dav/lib/Direct/DirectFile.php index 45d86fcaeae..3c684b83ef2 100644 --- a/apps/dav/lib/Direct/DirectFile.php +++ b/apps/dav/lib/Direct/DirectFile.php @@ -96,7 +96,7 @@ class DirectFile implements IFile { throw new NotFound(); } if (!$file instanceof File) { - throw new Forbidden("direct download not allowed on directories"); + throw new Forbidden('direct download not allowed on directories'); } $this->file = $file; diff --git a/apps/dav/lib/Events/CalendarDeletedEvent.php b/apps/dav/lib/Events/CalendarDeletedEvent.php index 20c4b187246..326af0702ad 100644 --- a/apps/dav/lib/Events/CalendarDeletedEvent.php +++ b/apps/dav/lib/Events/CalendarDeletedEvent.php @@ -24,7 +24,7 @@ class CalendarDeletedEvent extends Event { /** @var array */ private $calendarData; - /** @var array */ + /** @var array */ private $shares; /** diff --git a/apps/dav/lib/Events/CalendarMovedToTrashEvent.php b/apps/dav/lib/Events/CalendarMovedToTrashEvent.php index 02ea0182e0a..b2eb8e1f018 100644 --- a/apps/dav/lib/Events/CalendarMovedToTrashEvent.php +++ b/apps/dav/lib/Events/CalendarMovedToTrashEvent.php @@ -21,7 +21,7 @@ class CalendarMovedToTrashEvent extends Event { /** @var array */ private $calendarData; - /** @var array */ + /** @var array */ private $shares; /** diff --git a/apps/dav/lib/Events/CalendarRestoredEvent.php b/apps/dav/lib/Events/CalendarRestoredEvent.php index a4ba75755e3..5ea754ef200 100644 --- a/apps/dav/lib/Events/CalendarRestoredEvent.php +++ b/apps/dav/lib/Events/CalendarRestoredEvent.php @@ -21,7 +21,7 @@ class CalendarRestoredEvent extends Event { /** @var array */ private $calendarData; - /** @var array */ + /** @var array */ private $shares; /** diff --git a/apps/dav/lib/Exception/UnsupportedLimitOnInitialSyncException.php b/apps/dav/lib/Exception/UnsupportedLimitOnInitialSyncException.php index 1022625c23b..c6b7f8564c5 100644 --- a/apps/dav/lib/Exception/UnsupportedLimitOnInitialSyncException.php +++ b/apps/dav/lib/Exception/UnsupportedLimitOnInitialSyncException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Files/BrowserErrorPagePlugin.php b/apps/dav/lib/Files/BrowserErrorPagePlugin.php index 46598db2040..7c06f637c5e 100644 --- a/apps/dav/lib/Files/BrowserErrorPagePlugin.php +++ b/apps/dav/lib/Files/BrowserErrorPagePlugin.php @@ -81,7 +81,7 @@ class BrowserErrorPagePlugin extends ServerPlugin { $templateName = 'exception'; if ($httpCode === 403 || $httpCode === 404) { - $templateName = (string)$httpCode; + $templateName = (string) $httpCode; } $content = new OC_Template('core', $templateName, 'guest'); diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php index 3bc729d6407..049b8facf8e 100644 --- a/apps/dav/lib/Files/FileSearchBackend.php +++ b/apps/dav/lib/Files/FileSearchBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -354,7 +355,7 @@ class FileSearchBackend implements ISearchBackend { return new SearchQuery( $operators, - (int)$limit->maxResults, + (int) $limit->maxResults, $offset, $orders, $this->user, @@ -476,7 +477,7 @@ class FileSearchBackend implements ISearchBackend { if (is_numeric($value)) { return max(0, 0 + $value); } - $date = \DateTime::createFromFormat(\DateTimeInterface::ATOM, (string)$value); + $date = \DateTime::createFromFormat(\DateTimeInterface::ATOM, (string) $value); return ($date instanceof \DateTime && $date->getTimestamp() !== false) ? $date->getTimestamp() : 0; default: return $value; diff --git a/apps/dav/lib/Files/LazySearchBackend.php b/apps/dav/lib/Files/LazySearchBackend.php index a0ad730ff2b..6ba539ddd87 100644 --- a/apps/dav/lib/Files/LazySearchBackend.php +++ b/apps/dav/lib/Files/LazySearchBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php index 9d883be81fc..25b5ceefdf1 100644 --- a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php +++ b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Listener/CalendarShareUpdateListener.php b/apps/dav/lib/Listener/CalendarShareUpdateListener.php index c2ce058825e..51a8968cac1 100644 --- a/apps/dav/lib/Listener/CalendarShareUpdateListener.php +++ b/apps/dav/lib/Listener/CalendarShareUpdateListener.php @@ -34,7 +34,7 @@ class CalendarShareUpdateListener implements IEventListener { return; } - $this->logger->debug("Creating activity for Calendar having its shares updated"); + $this->logger->debug('Creating activity for Calendar having its shares updated'); $this->activityBackend->onCalendarUpdateShares( $event->getCalendarData(), diff --git a/apps/dav/lib/Listener/SubscriptionListener.php b/apps/dav/lib/Listener/SubscriptionListener.php index 9c9904d1aa2..971ec23fd64 100644 --- a/apps/dav/lib/Listener/SubscriptionListener.php +++ b/apps/dav/lib/Listener/SubscriptionListener.php @@ -43,8 +43,8 @@ class SubscriptionListener implements IEventListener { $this->logger->debug('Refreshing webcal data for subscription ' . $subscriptionId); $this->refreshWebcalService->refreshSubscription( - (string)$subscriptionData['principaluri'], - (string)$subscriptionData['uri'] + (string) $subscriptionData['principaluri'], + (string) $subscriptionData['uri'] ); $this->logger->debug('Scheduling webcal data refreshment for subscription ' . $subscriptionId); diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndex.php b/apps/dav/lib/Migration/BuildCalendarSearchIndex.php index 222554a3732..050ab17c763 100644 --- a/apps/dav/lib/Migration/BuildCalendarSearchIndex.php +++ b/apps/dav/lib/Migration/BuildCalendarSearchIndex.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndex.php b/apps/dav/lib/Migration/BuildSocialSearchIndex.php index 16100196e1b..7f91126d4ba 100644 --- a/apps/dav/lib/Migration/BuildSocialSearchIndex.php +++ b/apps/dav/lib/Migration/BuildSocialSearchIndex.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -56,7 +57,7 @@ class BuildSocialSearchIndex implements IRepairStep { $query->select($query->func()->max('cardid')) ->from('cards_properties') ->where($query->expr()->eq('name', $query->createNamedParameter('X-SOCIALPROFILE'))); - $maxId = (int)$query->execute()->fetchOne(); + $maxId = (int) $query->execute()->fetchOne(); if ($maxId === 0) { return; diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php index f727f4ea09a..67b12b15070 100644 --- a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php @@ -60,7 +60,7 @@ class BuildSocialSearchIndexBackgroundJob extends QueuedJob { ->from('cards', 'c') ->orderBy('id', 'ASC') ->where($query->expr()->like('carddata', $query->createNamedParameter('%SOCIALPROFILE%'))) - ->andWhere($query->expr()->gt('id', $query->createNamedParameter((int)$offset, IQueryBuilder::PARAM_INT))) + ->andWhere($query->expr()->gt('id', $query->createNamedParameter((int) $offset, IQueryBuilder::PARAM_INT))) ->setMaxResults(100); $social_cards = $query->executeQuery()->fetchAll(); diff --git a/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php b/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php index c7f57dcb117..17260cfaa6c 100644 --- a/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php +++ b/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -41,7 +42,7 @@ class CalDAVRemoveEmptyValue implements IRepairStep { $output->startProgress(count($objects)); foreach ($objects as $row) { - $calObject = $this->calDavBackend->getCalendarObject((int)$row['calendarid'], $row['uri']); + $calObject = $this->calDavBackend->getCalendarObject((int) $row['calendarid'], $row['uri']); $data = preg_replace('/' . $pattern . '/', ':', $calObject['calendardata']); if ($data !== $calObject['calendardata']) { @@ -52,14 +53,14 @@ class CalDAVRemoveEmptyValue implements IRepairStep { } catch (InvalidDataException $e) { $this->logger->info('Calendar object for calendar {cal} with uri {uri} still invalid', [ 'app' => 'dav', - 'cal' => (int)$row['calendarid'], + 'cal' => (int) $row['calendarid'], 'uri' => $row['uri'], ]); $warnings++; continue; } - $this->calDavBackend->updateCalendarObject((int)$row['calendarid'], $row['uri'], $data); + $this->calDavBackend->updateCalendarObject((int) $row['calendarid'], $row['uri'], $data); $count++; } } diff --git a/apps/dav/lib/Migration/FixBirthdayCalendarComponent.php b/apps/dav/lib/Migration/FixBirthdayCalendarComponent.php index d22e4b82c9f..df49dedc941 100644 --- a/apps/dav/lib/Migration/FixBirthdayCalendarComponent.php +++ b/apps/dav/lib/Migration/FixBirthdayCalendarComponent.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud GmbH. * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php index 94ef7e8a13b..94c4e92ece9 100644 --- a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php +++ b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php index 53e6deba1ca..920de3757a0 100644 --- a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php +++ b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php @@ -74,7 +74,7 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep { $result->closeCursor(); if ($count !== false) { - $count = (int)$count; + $count = (int) $count; } else { $count = 0; } diff --git a/apps/dav/lib/Migration/RemoveObjectProperties.php b/apps/dav/lib/Migration/RemoveObjectProperties.php index b87eb82af19..32e59eec7b5 100644 --- a/apps/dav/lib/Migration/RemoveObjectProperties.php +++ b/apps/dav/lib/Migration/RemoveObjectProperties.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/dav/lib/Migration/Version1004Date20170825134824.php b/apps/dav/lib/Migration/Version1004Date20170825134824.php index 54c4c194778..4bf9637b697 100644 --- a/apps/dav/lib/Migration/Version1004Date20170825134824.php +++ b/apps/dav/lib/Migration/Version1004Date20170825134824.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Migration/Version1004Date20170919104507.php b/apps/dav/lib/Migration/Version1004Date20170919104507.php index ca20e2fb4e7..678d92d2b83 100644 --- a/apps/dav/lib/Migration/Version1004Date20170919104507.php +++ b/apps/dav/lib/Migration/Version1004Date20170919104507.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Migration/Version1004Date20170924124212.php b/apps/dav/lib/Migration/Version1004Date20170924124212.php index fbfec7e8e2d..4d221e91132 100644 --- a/apps/dav/lib/Migration/Version1004Date20170924124212.php +++ b/apps/dav/lib/Migration/Version1004Date20170924124212.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Migration/Version1004Date20170926103422.php b/apps/dav/lib/Migration/Version1004Date20170926103422.php index 3bd5ba144c0..ec56e035006 100644 --- a/apps/dav/lib/Migration/Version1004Date20170926103422.php +++ b/apps/dav/lib/Migration/Version1004Date20170926103422.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -14,7 +15,7 @@ class Version1004Date20170926103422 extends BigIntMigration { /** * @return array Returns an array with the following structure - * ['table1' => ['column1', 'column2'], ...] + * ['table1' => ['column1', 'column2'], ...] * @since 13.0.0 */ protected function getColumnsByTable() { diff --git a/apps/dav/lib/Migration/Version1005Date20180530124431.php b/apps/dav/lib/Migration/Version1005Date20180530124431.php index ac1994893fd..b5f9ff26962 100644 --- a/apps/dav/lib/Migration/Version1005Date20180530124431.php +++ b/apps/dav/lib/Migration/Version1005Date20180530124431.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Migration/Version1006Date20180619154313.php b/apps/dav/lib/Migration/Version1006Date20180619154313.php index 195209ed046..231861a68c4 100644 --- a/apps/dav/lib/Migration/Version1006Date20180619154313.php +++ b/apps/dav/lib/Migration/Version1006Date20180619154313.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Migration/Version1027Date20230504122946.php b/apps/dav/lib/Migration/Version1027Date20230504122946.php index 7b49c64453e..9e1d1701934 100644 --- a/apps/dav/lib/Migration/Version1027Date20230504122946.php +++ b/apps/dav/lib/Migration/Version1027Date20230504122946.php @@ -31,7 +31,7 @@ class Version1027Date20230504122946 extends SimpleMigrationStep { * @param array $options */ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { - if($this->userManager->countSeenUsers() > 100 || array_sum($this->userManager->countUsers()) > 100) { + if ($this->userManager->countSeenUsers() > 100 || array_sum($this->userManager->countUsers()) > 100) { $this->config->setAppValue('dav', 'needs_system_address_book_sync', 'yes'); $output->info('Could not sync system address books during update - too many user records have been found. Please call occ dav:sync-system-addressbook manually.'); return; diff --git a/apps/dav/lib/Migration/Version1029Date20221114151721.php b/apps/dav/lib/Migration/Version1029Date20221114151721.php index 05b04486c88..dba5e0b1a48 100644 --- a/apps/dav/lib/Migration/Version1029Date20221114151721.php +++ b/apps/dav/lib/Migration/Version1029Date20221114151721.php @@ -28,7 +28,7 @@ class Version1029Date20221114151721 extends SimpleMigrationStep { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); $calendarObjectsTable = $schema->getTable('calendarobjects'); - if(!$calendarObjectsTable->hasIndex('calobj_clssfction_index')) { + if (!$calendarObjectsTable->hasIndex('calobj_clssfction_index')) { $calendarObjectsTable->addIndex(['classification'], 'calobj_clssfction_index'); return $schema; } diff --git a/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php b/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php index f1313b89582..c8ef7a5cc19 100644 --- a/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php +++ b/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php index 54818a890f3..d189bd503d0 100644 --- a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php +++ b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Search/ContactsSearchProvider.php b/apps/dav/lib/Search/ContactsSearchProvider.php index b0f6f1a044c..d6f7df1adf7 100644 --- a/apps/dav/lib/Search/ContactsSearchProvider.php +++ b/apps/dav/lib/Search/ContactsSearchProvider.php @@ -107,14 +107,14 @@ class ContactsSearchProvider implements IFilteringProvider { $thumbnailUrl = $this->getDavUrlForContact($addressBook['principaluri'], $addressBook['uri'], $contactRow['uri']) . '?photo'; } - $title = (string)$vCard->FN; + $title = (string) $vCard->FN; $subline = $this->generateSubline($vCard); $resourceUrl = $this->getDeepLinkToContactsApp($addressBook['uri'], (string) $vCard->UID); $result = new SearchResultEntry($thumbnailUrl, $title, $subline, $resourceUrl, 'icon-contacts-dark', true); - $result->addAttribute("displayName", $title); - $result->addAttribute("email", $subline); - $result->addAttribute("phoneNumber", (string)$vCard->TEL); + $result->addAttribute('displayName', $title); + $result->addAttribute('email', $subline); + $result->addAttribute('phoneNumber', (string) $vCard->TEL); return $result; }, $searchResults); @@ -166,7 +166,7 @@ class ContactsSearchProvider implements IFilteringProvider { return ''; } - return (string)$emailAddresses[0]; + return (string) $emailAddresses[0]; } public function getSupportedFilters(): array { diff --git a/apps/dav/lib/Search/EventsSearchProvider.php b/apps/dav/lib/Search/EventsSearchProvider.php index 6c9fe5167c5..071fceee1fe 100644 --- a/apps/dav/lib/Search/EventsSearchProvider.php +++ b/apps/dav/lib/Search/EventsSearchProvider.php @@ -149,7 +149,7 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering } $formattedResults = \array_map(function (array $eventRow) use ($calendarsById, $subscriptionsById): SearchResultEntry { $component = $this->getPrimaryComponent($eventRow['calendardata'], self::$componentType); - $title = (string)($component->SUMMARY ?? $this->l10n->t('Untitled event')); + $title = (string) ($component->SUMMARY ?? $this->l10n->t('Untitled event')); $subline = $this->generateSubline($component); if ($eventRow['calendartype'] === CalDavBackend::CALENDAR_TYPE_CALENDAR) { @@ -164,7 +164,7 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering if ($dtStart instanceof DateTime) { $startDateTime = $dtStart->getDateTime()->format('U'); - $result->addAttribute("createdAt", $startDateTime); + $result->addAttribute('createdAt', $startDateTime); } return $result; diff --git a/apps/dav/lib/Search/TasksSearchProvider.php b/apps/dav/lib/Search/TasksSearchProvider.php index 15baf070e81..d37ed3ecac5 100644 --- a/apps/dav/lib/Search/TasksSearchProvider.php +++ b/apps/dav/lib/Search/TasksSearchProvider.php @@ -95,7 +95,7 @@ class TasksSearchProvider extends ACalendarSearchProvider { ); $formattedResults = \array_map(function (array $taskRow) use ($calendarsById, $subscriptionsById):SearchResultEntry { $component = $this->getPrimaryComponent($taskRow['calendardata'], self::$componentType); - $title = (string)($component->SUMMARY ?? $this->l10n->t('Untitled task')); + $title = (string) ($component->SUMMARY ?? $this->l10n->t('Untitled task')); $subline = $this->generateSubline($component); if ($taskRow['calendartype'] === CalDavBackend::CALENDAR_TYPE_CALENDAR) { diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index d57a4554fe3..8f4a6bc726f 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/dav/lib/Settings/CalDAVSettings.php b/apps/dav/lib/Settings/CalDAVSettings.php index 7c738a83148..73e22432475 100644 --- a/apps/dav/lib/Settings/CalDAVSettings.php +++ b/apps/dav/lib/Settings/CalDAVSettings.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/SystemTag/SystemTagList.php b/apps/dav/lib/SystemTag/SystemTagList.php index cbdf98b752f..255ee26d48f 100644 --- a/apps/dav/lib/SystemTag/SystemTagList.php +++ b/apps/dav/lib/SystemTag/SystemTagList.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php index ec2014163b3..90f377af844 100644 --- a/apps/dav/lib/SystemTag/SystemTagPlugin.php +++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php @@ -173,11 +173,11 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { $userAssignable = true; if (isset($data['userVisible'])) { - $userVisible = (bool)$data['userVisible']; + $userVisible = (bool) $data['userVisible']; } if (isset($data['userAssignable'])) { - $userAssignable = (bool)$data['userAssignable']; + $userAssignable = (bool) $data['userAssignable']; } $groups = []; diff --git a/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php b/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php index 12a0ff00d3b..1290314e4bc 100644 --- a/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php @@ -79,7 +79,7 @@ class SystemTagsInUseCollection extends SimpleCollection { $result = $this->systemTagsInFilesDetector->detectAssignedSystemTagsIn($userFolder, $this->mediaType); $children = []; foreach ($result as $tagData) { - $tag = new SystemTag((string)$tagData['id'], $tagData['name'], (bool)$tagData['visibility'], (bool)$tagData['editable']); + $tag = new SystemTag((string) $tagData['id'], $tagData['name'], (bool) $tagData['visibility'], (bool) $tagData['editable']); // read only, so we can submit the isAdmin parameter as false generally $node = new SystemTagNode($tag, $user, false, $this->systemTagManager); $node->setNumberOfFiles((int) $tagData['number_files']); diff --git a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php index dc0f1bc5d36..6871f03d6db 100644 --- a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php @@ -37,7 +37,7 @@ class SystemTagsRelationsCollection extends SimpleCollection { function (string $name) use ($rootFolder, $userSession): bool { $user = $userSession->getUser(); if ($user) { - $node = $rootFolder->getUserFolder($user->getUID())->getFirstNodeById((int)$name); + $node = $rootFolder->getUserFolder($user->getUID())->getFirstNodeById((int) $name); return $node !== null; } else { return false; @@ -46,7 +46,7 @@ class SystemTagsRelationsCollection extends SimpleCollection { function (string $name) use ($rootFolder, $userSession): bool { $user = $userSession->getUser(); if ($user) { - $nodes = $rootFolder->getUserFolder($user->getUID())->getById((int)$name); + $nodes = $rootFolder->getUserFolder($user->getUID())->getById((int) $name); foreach ($nodes as $node) { if (($node->getPermissions() & Constants::PERMISSION_UPDATE) === Constants::PERMISSION_UPDATE) { return true; diff --git a/apps/dav/lib/Traits/PrincipalProxyTrait.php b/apps/dav/lib/Traits/PrincipalProxyTrait.php index 279f796b720..feec485fe5c 100644 --- a/apps/dav/lib/Traits/PrincipalProxyTrait.php +++ b/apps/dav/lib/Traits/PrincipalProxyTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/lib/Upload/ChunkingPlugin.php b/apps/dav/lib/Upload/ChunkingPlugin.php index cf4d65168cc..1acac959f2e 100644 --- a/apps/dav/lib/Upload/ChunkingPlugin.php +++ b/apps/dav/lib/Upload/ChunkingPlugin.php @@ -106,7 +106,7 @@ class ChunkingPlugin extends ServerPlugin { // casted to string because cast to float cause equality for non equal numbers // and integer has the problem of limited size on 32 bit systems - if ((string)$expectedSize !== (string)$actualSize) { + if ((string) $expectedSize !== (string) $actualSize) { throw new BadRequest("Chunks on server do not sum up to $expectedSize but to $actualSize bytes"); } } diff --git a/apps/dav/lib/Upload/ChunkingV2Plugin.php b/apps/dav/lib/Upload/ChunkingV2Plugin.php index 846b4ea42ba..a2f9f3c5b6d 100644 --- a/apps/dav/lib/Upload/ChunkingV2Plugin.php +++ b/apps/dav/lib/Upload/ChunkingV2Plugin.php @@ -139,7 +139,7 @@ class ChunkingV2Plugin extends ServerPlugin { [$storage, $storagePath] = $this->getUploadStorage($this->uploadPath); $chunkName = basename($request->getPath()); - $partId = is_numeric($chunkName) ? (int)$chunkName : -1; + $partId = is_numeric($chunkName) ? (int) $chunkName : -1; if (!($partId >= 1 && $partId <= 10000)) { throw new BadRequest('Invalid chunk name, must be numeric between 1 and 10000'); } @@ -147,7 +147,7 @@ class ChunkingV2Plugin extends ServerPlugin { $uploadFile = $this->getUploadFile($this->uploadPath); $tempTargetFile = null; - $additionalSize = (int)$request->getHeader('Content-Length'); + $additionalSize = (int) $request->getHeader('Content-Length'); if ($this->uploadFolder->childExists(self::TEMP_TARGET) && $this->uploadPath) { /** @var UploadFile $tempTargetFile */ $tempTargetFile = $this->uploadFolder->getChild(self::TEMP_TARGET); @@ -162,7 +162,7 @@ class ChunkingV2Plugin extends ServerPlugin { } $stream = $request->getBodyAsStream(); - $storage->putChunkedWritePart($storagePath, $this->uploadId, (string)$partId, $stream, $additionalSize); + $storage->putChunkedWritePart($storagePath, $this->uploadId, (string) $partId, $stream, $additionalSize); $storage->getCache()->update($uploadFile->getId(), ['size' => $uploadFile->getSize() + $additionalSize]); if ($tempTargetFile) { @@ -294,7 +294,7 @@ class ChunkingV2Plugin extends ServerPlugin { throw new InvalidArgumentException('X-OC-MTime header must be an integer (unix timestamp).'); } - return (int)$mtimeFromRequest; + return (int) $mtimeFromRequest; } /** diff --git a/apps/dav/lib/Upload/UploadFile.php b/apps/dav/lib/Upload/UploadFile.php index ae64760e0ce..742eda78d08 100644 --- a/apps/dav/lib/Upload/UploadFile.php +++ b/apps/dav/lib/Upload/UploadFile.php @@ -12,7 +12,7 @@ use OCA\DAV\Connector\Sabre\File; use Sabre\DAV\IFile; class UploadFile implements IFile { - /** @var File */ + /** @var File */ private $file; public function __construct(File $file) { diff --git a/apps/dav/lib/UserMigration/ContactsMigrator.php b/apps/dav/lib/UserMigration/ContactsMigrator.php index 70f92379fe2..a14d3bc5e1c 100644 --- a/apps/dav/lib/UserMigration/ContactsMigrator.php +++ b/apps/dav/lib/UserMigration/ContactsMigrator.php @@ -251,7 +251,7 @@ class ContactsMigrator implements IMigrator, ISizeEstimationMigrator { $vCard->serialize(), ); } catch (Throwable $e) { - $output->writeln("Error creating contact \"" . ($vCard->FN ?? 'null') . "\" from \"$filename\", skipping…"); + $output->writeln('Error creating contact "' . ($vCard->FN ?? 'null') . "\" from \"$filename\", skipping…"); } } diff --git a/apps/dav/tests/unit/AppInfo/PluginManagerTest.php b/apps/dav/tests/unit/AppInfo/PluginManagerTest.php index 8211cdfc02c..377654268db 100644 --- a/apps/dav/tests/unit/AppInfo/PluginManagerTest.php +++ b/apps/dav/tests/unit/AppInfo/PluginManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud GmbH. * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php b/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php index 9cd75445232..d08d0fd4496 100644 --- a/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php @@ -32,7 +32,7 @@ class PruneOutdatedSyncTokensJobTest extends TestCase { /** @var IConfig|MockObject */ private $config; - /** @var LoggerInterface|MockObject*/ + /** @var LoggerInterface|MockObject */ private $logger; private PruneOutdatedSyncTokensJob $backgroundJob; diff --git a/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php b/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php index 6ace633b072..634e9bca381 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/BackendTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php index a7c84260f21..59a63fa6db8 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php index fcfd1f81517..6d4a8ce0d95 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php index 6aa47f33750..e9b5c90d35e 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php b/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php index ba97c888b0c..9b25ebf0e95 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php b/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php index ec237825731..7908e900f75 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php b/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php index 678b815999c..2755cedc136 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php b/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php index 92288f5dfb0..67e0481e02a 100644 --- a/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php +++ b/apps/dav/tests/unit/CalDAV/AppCalendar/CalendarObjectTest.php @@ -99,7 +99,7 @@ class CalendarObjectTest extends TestCase { $this->vobject->expects($this->once()) ->method('getBaseComponent') - ->willReturn((object)['UID' => 'someid']); + ->willReturn((object) ['UID' => 'someid']); $this->calendar->expects($this->once()) ->method('getPermissions') ->willReturn(Constants::PERMISSION_ALL); @@ -156,7 +156,7 @@ class CalendarObjectTest extends TestCase { public function testGetName() { $this->vobject->expects($this->exactly(2)) ->method('getBaseComponent') - ->willReturnOnConsecutiveCalls((object)['UID' => 'someid'], (object)['UID' => 'someid', 'X-FILENAME' => 'real-filename.ics']); + ->willReturnOnConsecutiveCalls((object) ['UID' => 'someid'], (object) ['UID' => 'someid', 'X-FILENAME' => 'real-filename.ics']); $this->assertEquals($this->calendarObject->getName(), 'someid.ics'); $this->assertEquals($this->calendarObject->getName(), 'real-filename.ics'); diff --git a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php index e7de7d0a55e..2cee9707bbf 100644 --- a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php +++ b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,7 +25,7 @@ class EnablePluginTest extends TestCase { /** @var BirthdayService |\PHPUnit\Framework\MockObject\MockObject */ protected $birthdayService; - /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */ protected $user; /** @var \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin $plugin */ diff --git a/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php b/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php index 56e4930d3b3..d63df0f4727 100644 --- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php +++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php b/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php index e1d22bc3e7b..d9e1a4d5f26 100644 --- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php +++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index 1656996408e..9ffe9413abb 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -733,7 +734,7 @@ EOS; 'last occurrence before unix epoch starts' => [0, 'lastOccurence', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.3.0//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:19110324\r\nDTEND;VALUE=DATE:19110325\r\nDTSTAMP:20200927T180638Z\r\nUID:asdfasdfasdf@google.com\r\nCREATED:20200626T181848Z\r\nDESCRIPTION:Very old event\r\nLAST-MODIFIED:20200922T192707Z\r\nSUMMARY:Some old event\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"], - 'first occurrence is found when not first VEVENT in group' => [(new DateTime('2020-09-01T110000', new DateTimeZone("America/Los_Angeles")))->getTimestamp(), 'firstOccurence', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.3.0//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nDTSTART;TZID=America/Los_Angeles:20201013T110000\r\nDTEND;TZID=America/Los_Angeles:20201013T120000\r\nDTSTAMP:20200927T180638Z\r\nUID:asdf0000@google.com\r\nRECURRENCE-ID;TZID=America/Los_Angeles:20201013T110000\r\nCREATED:20160330T034726Z\r\nLAST-MODIFIED:20200925T042014Z\r\nSTATUS:CONFIRMED\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nDTSTART;TZID=America/Los_Angeles:20200901T110000\r\nDTEND;TZID=America/Los_Angeles:20200901T120000\r\nRRULE:FREQ=WEEKLY;BYDAY=TU\r\nEXDATE;TZID=America/Los_Angeles:20200922T110000\r\nEXDATE;TZID=America/Los_Angeles:20200915T110000\r\nEXDATE;TZID=America/Los_Angeles:20200908T110000\r\nDTSTAMP:20200927T180638Z\r\nUID:asdf0000@google.com\r\nCREATED:20160330T034726Z\r\nLAST-MODIFIED:20200915T162810Z\r\nSTATUS:CONFIRMED\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"], + 'first occurrence is found when not first VEVENT in group' => [(new DateTime('2020-09-01T110000', new DateTimeZone('America/Los_Angeles')))->getTimestamp(), 'firstOccurence', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.3.0//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nDTSTART;TZID=America/Los_Angeles:20201013T110000\r\nDTEND;TZID=America/Los_Angeles:20201013T120000\r\nDTSTAMP:20200927T180638Z\r\nUID:asdf0000@google.com\r\nRECURRENCE-ID;TZID=America/Los_Angeles:20201013T110000\r\nCREATED:20160330T034726Z\r\nLAST-MODIFIED:20200925T042014Z\r\nSTATUS:CONFIRMED\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nDTSTART;TZID=America/Los_Angeles:20200901T110000\r\nDTEND;TZID=America/Los_Angeles:20200901T120000\r\nRRULE:FREQ=WEEKLY;BYDAY=TU\r\nEXDATE;TZID=America/Los_Angeles:20200922T110000\r\nEXDATE;TZID=America/Los_Angeles:20200915T110000\r\nEXDATE;TZID=America/Los_Angeles:20200908T110000\r\nDTSTAMP:20200927T180638Z\r\nUID:asdf0000@google.com\r\nCREATED:20160330T034726Z\r\nLAST-MODIFIED:20200915T162810Z\r\nSTATUS:CONFIRMED\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"], 'CLASS:PRIVATE' => [CalDavBackend::CLASSIFICATION_PRIVATE, 'classification', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//dmfs.org//mimedir.icalendar//EN\r\nBEGIN:VTIMEZONE\r\nTZID:Europe/Berlin\r\nX-LIC-LOCATION:Europe/Berlin\r\nBEGIN:DAYLIGHT\r\nTZOFFSETFROM:+0100\r\nTZOFFSETTO:+0200\r\nTZNAME:CEST\r\nDTSTART:19700329T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\r\nEND:DAYLIGHT\r\nBEGIN:STANDARD\r\nTZOFFSETFROM:+0200\r\nTZOFFSETTO:+0100\r\nTZNAME:CET\r\nDTSTART:19701025T030000\r\nRRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\r\nEND:STANDARD\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nDTSTART;TZID=Europe/Berlin:20160419T130000\r\nSUMMARY:Test\r\nCLASS:PRIVATE\r\nTRANSP:OPAQUE\r\nSTATUS:CONFIRMED\r\nDTEND;TZID=Europe/Berlin:20160419T140000\r\nLAST-MODIFIED:20160419T074202Z\r\nDTSTAMP:20160419T074202Z\r\nCREATED:20160419T074202Z\r\nUID:2e468c48-7860-492e-bc52-92fa0daeeccf.1461051722310\r\nEND:VEVENT\r\nEND:VCALENDAR"], diff --git a/apps/dav/tests/unit/CalDAV/CalendarHomeTest.php b/apps/dav/tests/unit/CalDAV/CalendarHomeTest.php index 9956c17fff3..bba9698bd08 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarHomeTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarHomeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/dav/tests/unit/CalDAV/CalendarImplTest.php b/apps/dav/tests/unit/CalDAV/CalendarImplTest.php index 85545854918..87b515ca5f3 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarImplTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarImplTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -138,13 +139,13 @@ EOF; ->method('setCurrentPrincipal') ->with($this->calendar->getPrincipalURI()); - /** @var \Sabre\DAVACL\Plugin|MockObject $aclPlugin*/ + /** @var \Sabre\DAVACL\Plugin|MockObject $aclPlugin */ $aclPlugin = $this->createMock(\Sabre\DAVACL\Plugin::class); /** @var Plugin|MockObject $schedulingPlugin */ $schedulingPlugin = $this->createMock(Plugin::class); $iTipMessage = $this->getITipMessage($message); - $iTipMessage->recipient = "mailto:lewis@stardew-tent-living.com"; + $iTipMessage->recipient = 'mailto:lewis@stardew-tent-living.com'; $server = $this->createMock(Server::class); $server->expects($this->any()) @@ -250,7 +251,7 @@ EOF; $iTipMessage->sender = $attendee; $iTipMessage->uid = isset($vEvent->{'UID'}) ? $vEvent->{'UID'}->getValue() : ''; $iTipMessage->component = 'VEVENT'; - $iTipMessage->sequence = isset($vEvent->{'SEQUENCE'}) ? (int)$vEvent->{'SEQUENCE'}->getValue() : 0; + $iTipMessage->sequence = isset($vEvent->{'SEQUENCE'}) ? (int) $vEvent->{'SEQUENCE'}->getValue() : 0; $iTipMessage->message = $vObject; return $iTipMessage; } diff --git a/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php b/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php index 63d92dff40d..845474562c9 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index ace2f808615..25a90d5f148 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -25,7 +26,7 @@ class CalendarTest extends TestCase { /** @var IConfig */ protected $config; - /** @var MockObject|LoggerInterface */ + /** @var MockObject|LoggerInterface */ protected $logger; protected function setUp(): void { @@ -418,7 +419,7 @@ EOD; $l10n->expects($this->once()) ->method('t') ->with('Busy') - ->willReturn("Translated busy"); + ->willReturn('Translated busy'); } else { $l10n->expects($this->never()) ->method('t'); diff --git a/apps/dav/tests/unit/CalDAV/EventReaderTest.php b/apps/dav/tests/unit/CalDAV/EventReaderTest.php index fa07b99fbaf..039763628fb 100644 --- a/apps/dav/tests/unit/CalDAV/EventReaderTest.php +++ b/apps/dav/tests/unit/CalDAV/EventReaderTest.php @@ -16,19 +16,19 @@ use Test\TestCase; class EventReaderTest extends TestCase { - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1a; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1b; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1c; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1d; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1e; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar2; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar3; protected function setUp(): void { diff --git a/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php b/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php index 778df5697f0..824b3e1448f 100644 --- a/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Listener/CalendarPublicationListenerTest.php b/apps/dav/tests/unit/CalDAV/Listener/CalendarPublicationListenerTest.php index b55359cd208..d03001731b2 100644 --- a/apps/dav/tests/unit/CalDAV/Listener/CalendarPublicationListenerTest.php +++ b/apps/dav/tests/unit/CalDAV/Listener/CalendarPublicationListenerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Listener/CalendarShareUpdateListenerTest.php b/apps/dav/tests/unit/CalDAV/Listener/CalendarShareUpdateListenerTest.php index b8414ecd695..fb4eafe34f4 100644 --- a/apps/dav/tests/unit/CalDAV/Listener/CalendarShareUpdateListenerTest.php +++ b/apps/dav/tests/unit/CalDAV/Listener/CalendarShareUpdateListenerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Listener/SubscriptionListenerTest.php b/apps/dav/tests/unit/CalDAV/Listener/SubscriptionListenerTest.php index 589e659b9ea..06ebeefc0b4 100644 --- a/apps/dav/tests/unit/CalDAV/Listener/SubscriptionListenerTest.php +++ b/apps/dav/tests/unit/CalDAV/Listener/SubscriptionListenerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/OutboxTest.php b/apps/dav/tests/unit/CalDAV/OutboxTest.php index def2bd80157..7e59f696eee 100644 --- a/apps/dav/tests/unit/CalDAV/OutboxTest.php +++ b/apps/dav/tests/unit/CalDAV/OutboxTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/PluginTest.php b/apps/dav/tests/unit/CalDAV/PluginTest.php index 0915fdf2646..b9986ac4356 100644 --- a/apps/dav/tests/unit/CalDAV/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/PluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php index 4333754222b..c2b6b6f8715 100644 --- a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php +++ b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php index 04b99b70124..f9523aa77a4 100644 --- a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -46,7 +47,7 @@ class PublicCalendarTest extends CalendarTest { ]; /** @var MockObject | IConfig $config */ $config = $this->createMock(IConfig::class); - /** @var MockObject | LoggerInterface $logger */ + /** @var MockObject | LoggerInterface $logger */ $logger = $this->createMock(LoggerInterface::class); $c = new PublicCalendar($backend, $calendarInfo, $this->l10n, $config, $logger); $children = $c->getChildren(); @@ -134,7 +135,7 @@ EOD; ]; /** @var MockObject | IConfig $config */ $config = $this->createMock(IConfig::class); - /** @var MockObject | LoggerInterface $logger */ + /** @var MockObject | LoggerInterface $logger */ $logger = $this->createMock(LoggerInterface::class); $c = new PublicCalendar($backend, $calendarInfo, $this->l10n, $config, $logger); diff --git a/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php b/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php index 769e1537646..a410b0f210d 100644 --- a/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php +++ b/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php b/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php index 8aecdf7f0dd..2e3dcd58f7b 100644 --- a/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php +++ b/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php b/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php index 1bf94713966..20b3dadfdf1 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php @@ -242,7 +242,7 @@ class BackendTest extends TestCase { $this->assertEquals($rows[3]['notification_date'], 123600); - $reminderId = (int) $rows[3]['id']; + $reminderId = (int) $rows[3]['id']; $newNotificationDate = 123700; $this->reminderBackend->updateReminder($reminderId, $newNotificationDate); diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php index dcf11a1a6b8..396cf480b40 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php @@ -59,7 +59,7 @@ class NotifierTest extends TestCase { ->method('n') ->willReturnCallback(function ($textSingular, $textPlural, $count, $args) { $text = $count === 1 ? $textSingular : $textPlural; - $text = str_replace('%n', (string)$count, $text); + $text = str_replace('%n', (string) $count, $text); return vsprintf($text, $args); }); $this->factory = $this->createMock(IFactory::class); diff --git a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php index d4594291d88..198c8d97b12 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php @@ -35,13 +35,13 @@ class ReminderServiceTest extends TestCase { /** @var IUserManager|MockObject */ private $userManager; - /** @var IGroupManager|MockObject*/ + /** @var IGroupManager|MockObject */ private $groupManager; /** @var CalDavBackend|MockObject */ private $caldavBackend; - /** @var ITimeFactory|MockObject */ + /** @var ITimeFactory|MockObject */ private $timeFactory; /** @var IConfig|MockObject */ diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php index ed39129fa56..1546836a29b 100644 --- a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/ResourcePrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/ResourcePrincipalBackendTest.php index d430afb0b01..25206fb9b7e 100644 --- a/apps/dav/tests/unit/CalDAV/ResourceBooking/ResourcePrincipalBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/ResourcePrincipalBackendTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/RoomPrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/RoomPrincipalBackendTest.php index cd63a3512ae..7168e2560f6 100644 --- a/apps/dav/tests/unit/CalDAV/ResourceBooking/RoomPrincipalBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/RoomPrincipalBackendTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php index 9ac6177fc8b..3acbf670d17 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php index 911d08ee862..abf8cfe3177 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipServiceTest.php @@ -48,13 +48,13 @@ class IMipServiceTest extends TestCase { /** @var IMipService */ private $service; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1a; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar1b; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar2; - /** @var VCalendar*/ + /** @var VCalendar */ private $vCalendar3; /** @var DateTime DateTime object that will be returned by DateTime() or DateTime('now') */ public static $datetimeNow; @@ -157,9 +157,9 @@ class IMipServiceTest extends TestCase { } public function testGetFrom(): void { - $senderName = "Detective McQueen"; - $default = "Twin Lakes Police Department - Darkside Division"; - $expected = "Detective McQueen via Twin Lakes Police Department - Darkside Division"; + $senderName = 'Detective McQueen'; + $default = 'Twin Lakes Police Department - Darkside Division'; + $expected = 'Detective McQueen via Twin Lakes Police Department - Darkside Division'; $this->l10n->expects(self::once()) ->method('t') diff --git a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php index 7a1d61a083b..cba61ef0b61 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php @@ -42,7 +42,7 @@ class PluginTest extends TestCase { /** @var Server|MockObject */ private $server; - /** @var IConfig|MockObject */ + /** @var IConfig|MockObject */ private $config; /** @var LoggerInterface&MockObject */ @@ -348,10 +348,10 @@ class PluginTest extends TestCase { if (!$exists || $deleted) { if (!$hasExistingCalendars) { $calendarBackend->expects($this->once()) - ->method('createCalendar') - ->with($principalUri, $calendarUri, [ - '{DAV:}displayname' => $displayName, - ]); + ->method('createCalendar') + ->with($principalUri, $calendarUri, [ + '{DAV:}displayname' => $displayName, + ]); $calendarHomeObject->expects($this->exactly($deleted ? 2 : 1)) ->method('getCalDAVBackend') diff --git a/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php b/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php index cbfd4639ed7..f9a72ccfba8 100644 --- a/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php +++ b/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php index ae4519e2542..a259990160d 100644 --- a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/Status/StatusServiceTest.php b/apps/dav/tests/unit/CalDAV/Status/StatusServiceTest.php index 78e76cf507d..5b3249103b9 100644 --- a/apps/dav/tests/unit/CalDAV/Status/StatusServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Status/StatusServiceTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/TimezoneServiceTest.php b/apps/dav/tests/unit/CalDAV/TimezoneServiceTest.php index b01139e4093..46c5bc8bb1c 100644 --- a/apps/dav/tests/unit/CalDAV/TimezoneServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/TimezoneServiceTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/TipBrokerTest.php b/apps/dav/tests/unit/CalDAV/TipBrokerTest.php index 3a8e240c1d8..ee8edea560c 100644 --- a/apps/dav/tests/unit/CalDAV/TipBrokerTest.php +++ b/apps/dav/tests/unit/CalDAV/TipBrokerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php index 7ec4722e905..f8a5dfc3cfc 100644 --- a/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php +++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/ConnectionTest.php @@ -65,7 +65,7 @@ class ConnectionTest extends TestCase { ->willThrowException($localServerException); $this->logger->expects(self::once()) ->method('warning') - ->with("Subscription 42 was not refreshed because it violates local access rules", ['exception' => $localServerException]); + ->with('Subscription 42 was not refreshed because it violates local access rules', ['exception' => $localServerException]); $this->connection->queryWebcalFeed($subscription); } diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php index 82c03c5cf68..a7ac444e22f 100644 --- a/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php index 0ca57333b35..d65a99a15e0 100644 --- a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php @@ -20,9 +20,9 @@ use Sabre\VObject\Recur\NoInstancesException; use Test\TestCase; class RefreshWebcalServiceTest extends TestCase { - private CalDavBackend | MockObject $caldavBackend; - private Connection | MockObject $connection; - private LoggerInterface | MockObject $logger; + private CalDavBackend|MockObject $caldavBackend; + private Connection|MockObject $connection; + private LoggerInterface|MockObject $logger; private ITimeFactory|MockObject $time; protected function setUp(): void { @@ -248,7 +248,7 @@ class RefreshWebcalServiceTest extends TestCase { $noInstanceException = new NoInstancesException("can't add calendar object"); $this->caldavBackend->expects(self::once()) - ->method("createCalendarObject") + ->method('createCalendarObject') ->willThrowException($noInstanceException); $this->logger->expects(self::once()) @@ -298,7 +298,7 @@ class RefreshWebcalServiceTest extends TestCase { $badRequestException = new BadRequest("can't add reach calendar url"); $this->caldavBackend->expects(self::once()) - ->method("createCalendarObject") + ->method('createCalendarObject') ->willThrowException($badRequestException); $this->logger->expects(self::once()) diff --git a/apps/dav/tests/unit/CapabilitiesTest.php b/apps/dav/tests/unit/CapabilitiesTest.php index e99f7b8da5f..76a5e85fdad 100644 --- a/apps/dav/tests/unit/CapabilitiesTest.php +++ b/apps/dav/tests/unit/CapabilitiesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php b/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php index 134a6ca5ca0..ac103e62bb7 100644 --- a/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php +++ b/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php index 404db50b729..ce2b3802e6f 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php @@ -18,25 +18,25 @@ use Sabre\VObject\Property\Text; use Test\TestCase; class AddressBookImplTest extends TestCase { - /** @var AddressBookImpl */ + /** @var AddressBookImpl */ private $addressBookImpl; - /** @var array */ + /** @var array */ private $addressBookInfo; - /** @var AddressBook | \PHPUnit\Framework\MockObject\MockObject */ + /** @var AddressBook | \PHPUnit\Framework\MockObject\MockObject */ private $addressBook; /** @var IURLGenerator | \PHPUnit\Framework\MockObject\MockObject */ private $urlGenerator; - /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject */ + /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject */ private $backend; - /** @var VCard | \PHPUnit\Framework\MockObject\MockObject */ + /** @var VCard | \PHPUnit\Framework\MockObject\MockObject */ private $vCard; - /** @var PropertyMapper | \PHPUnit\Framework\MockObject\MockObject */ + /** @var PropertyMapper | \PHPUnit\Framework\MockObject\MockObject */ private $propertyMapper; protected function setUp(): void { diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php index 0e9aed1caaf..463ce5b2f5e 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -59,7 +59,7 @@ class CardDavBackendTest extends TestCase { /** @var IEventDispatcher|MockObject */ private $dispatcher; private Backend $sharingBackend; - /** @var IDBConnection */ + /** @var IDBConnection */ private $db; /** @var string */ @@ -237,8 +237,8 @@ class CardDavBackendTest extends TestCase { public function testCardOperations(): void { /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $backend */ $backend = $this->getMockBuilder(CardDavBackend::class) - ->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->dispatcher, $this->sharingBackend]) - ->onlyMethods(['updateProperties', 'purgeProperties'])->getMock(); + ->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->dispatcher, $this->sharingBackend]) + ->onlyMethods(['updateProperties', 'purgeProperties'])->getMock(); // create a new address book $backend->createAddressBook(self::UNIT_TEST_USER, 'Example', []); @@ -536,13 +536,13 @@ class CardDavBackendTest extends TestCase { $this->assertSame('UID', $result[0]['name']); $this->assertSame($cardUri, $result[0]['value']); - $this->assertSame($bookId, (int)$result[0]['addressbookid']); - $this->assertSame($cardId, (int)$result[0]['cardid']); + $this->assertSame($bookId, (int) $result[0]['addressbookid']); + $this->assertSame($cardId, (int) $result[0]['cardid']); $this->assertSame('FN', $result[1]['name']); $this->assertSame('John Doe', $result[1]['value']); - $this->assertSame($bookId, (int)$result[1]['addressbookid']); - $this->assertSame($cardId, (int)$result[1]['cardid']); + $this->assertSame($bookId, (int) $result[1]['addressbookid']); + $this->assertSame($cardId, (int) $result[1]['cardid']); // update properties for existing vCard $vCard = new VCard(); @@ -561,8 +561,8 @@ class CardDavBackendTest extends TestCase { $this->assertSame('UID', $result[0]['name']); $this->assertSame($cardUri, $result[0]['value']); - $this->assertSame($bookId, (int)$result[0]['addressbookid']); - $this->assertSame($cardId, (int)$result[0]['cardid']); + $this->assertSame($bookId, (int) $result[0]['addressbookid']); + $this->assertSame($cardId, (int) $result[0]['cardid']); } public function testPurgeProperties(): void { @@ -603,8 +603,8 @@ class CardDavBackendTest extends TestCase { $qResult->closeCursor(); $this->assertSame(1, count($result)); - $this->assertSame(1, (int)$result[0]['addressbookid']); - $this->assertSame(2, (int)$result[0]['cardid']); + $this->assertSame(1, (int) $result[0]['addressbookid']); + $this->assertSame(2, (int) $result[0]['cardid']); } public function testGetCardId(): void { @@ -662,16 +662,16 @@ class CardDavBackendTest extends TestCase { $query = $this->db->getQueryBuilder(); for ($i = 0; $i < 3; $i++) { $query->insert($this->dbCardsTable) - ->values( - [ - 'addressbookid' => $query->createNamedParameter(0), - 'carddata' => $query->createNamedParameter($vCards[$i]->serialize(), IQueryBuilder::PARAM_LOB), - 'uri' => $query->createNamedParameter('uri' . $i), - 'lastmodified' => $query->createNamedParameter(time()), - 'etag' => $query->createNamedParameter('etag' . $i), - 'size' => $query->createNamedParameter(120), - ] - ); + ->values( + [ + 'addressbookid' => $query->createNamedParameter(0), + 'carddata' => $query->createNamedParameter($vCards[$i]->serialize(), IQueryBuilder::PARAM_LOB), + 'uri' => $query->createNamedParameter('uri' . $i), + 'lastmodified' => $query->createNamedParameter(time()), + 'etag' => $query->createNamedParameter('etag' . $i), + 'size' => $query->createNamedParameter(120), + ] + ); $query->execute(); $vCardIds[] = $query->getLastInsertId(); } @@ -771,16 +771,16 @@ class CardDavBackendTest extends TestCase { public function testGetCardUri(): void { $query = $this->db->getQueryBuilder(); $query->insert($this->dbCardsTable) - ->values( - [ - 'addressbookid' => $query->createNamedParameter(1), - 'carddata' => $query->createNamedParameter('carddata', IQueryBuilder::PARAM_LOB), - 'uri' => $query->createNamedParameter('uri'), - 'lastmodified' => $query->createNamedParameter(5489543), - 'etag' => $query->createNamedParameter('etag'), - 'size' => $query->createNamedParameter(120), - ] - ); + ->values( + [ + 'addressbookid' => $query->createNamedParameter(1), + 'carddata' => $query->createNamedParameter('carddata', IQueryBuilder::PARAM_LOB), + 'uri' => $query->createNamedParameter('uri'), + 'lastmodified' => $query->createNamedParameter(5489543), + 'etag' => $query->createNamedParameter('etag'), + 'size' => $query->createNamedParameter(120), + ] + ); $query->execute(); $id = $query->getLastInsertId(); @@ -799,26 +799,26 @@ class CardDavBackendTest extends TestCase { $query = $this->db->getQueryBuilder(); for ($i = 0; $i < 2; $i++) { $query->insert($this->dbCardsTable) - ->values( - [ - 'addressbookid' => $query->createNamedParameter($i), - 'carddata' => $query->createNamedParameter('carddata' . $i, IQueryBuilder::PARAM_LOB), - 'uri' => $query->createNamedParameter('uri' . $i), - 'lastmodified' => $query->createNamedParameter(5489543), - 'etag' => $query->createNamedParameter('etag' . $i), - 'size' => $query->createNamedParameter(120), - ] - ); + ->values( + [ + 'addressbookid' => $query->createNamedParameter($i), + 'carddata' => $query->createNamedParameter('carddata' . $i, IQueryBuilder::PARAM_LOB), + 'uri' => $query->createNamedParameter('uri' . $i), + 'lastmodified' => $query->createNamedParameter(5489543), + 'etag' => $query->createNamedParameter('etag' . $i), + 'size' => $query->createNamedParameter(120), + ] + ); $query->execute(); } $result = $this->backend->getContact(0, 'uri0'); $this->assertSame(8, count($result)); - $this->assertSame(0, (int)$result['addressbookid']); + $this->assertSame(0, (int) $result['addressbookid']); $this->assertSame('uri0', $result['uri']); - $this->assertSame(5489543, (int)$result['lastmodified']); + $this->assertSame(5489543, (int) $result['lastmodified']); $this->assertSame('"etag0"', $result['etag']); - $this->assertSame(120, (int)$result['size']); + $this->assertSame(120, (int) $result['size']); // this shouldn't return any result because 'uri1' is in address book 1 // see https://github.com/nextcloud/server/issues/229 @@ -842,7 +842,7 @@ class CardDavBackendTest extends TestCase { 'preferred' => $query->createNamedParameter(0) ] ) - ->execute(); + ->execute(); $result = $this->backend->collectCardProperties(666, 'FN'); $this->assertEquals(['John Doe'], $result); diff --git a/apps/dav/tests/unit/CardDAV/ConverterTest.php b/apps/dav/tests/unit/CardDAV/ConverterTest.php index df6489d5053..a582e31f9f7 100644 --- a/apps/dav/tests/unit/CardDAV/ConverterTest.php +++ b/apps/dav/tests/unit/CardDAV/ConverterTest.php @@ -53,7 +53,7 @@ class ConverterTest extends TestCase { ->willReturn($name); $property->expects($this->any()) ->method('getValue') - ->willReturn((string)$value); + ->willReturn((string) $value); $property->expects($this->any()) ->method('getScope') ->willReturn($scope); @@ -89,7 +89,7 @@ class ConverterTest extends TestCase { * @dataProvider providesNewUsers */ public function testCreation($expectedVCard, $displayName = null, $eMailAddress = null, $cloudId = null): void { - $user = $this->getUserMock((string)$displayName, $eMailAddress, $cloudId); + $user = $this->getUserMock((string) $displayName, $eMailAddress, $cloudId); $accountManager = $this->getAccountManager($user); $converter = new Converter($accountManager, $this->userManager, $this->urlGenerator, $this->logger); @@ -104,7 +104,7 @@ class ConverterTest extends TestCase { } public function testManagerProp(): void { - $user = $this->getUserMock("user", "user@domain.tld", "user@cloud.domain.tld"); + $user = $this->getUserMock('user', 'user@domain.tld', 'user@cloud.domain.tld'); $user->method('getManagerUids') ->willReturn(['mgr']); $this->userManager->expects(self::once()) @@ -168,8 +168,8 @@ class ConverterTest extends TestCase { 'fn' => 'Dr. Foo Bar', 'photo' => 'MTIzNDU2Nzg5', ], - "Dr. Foo Bar", - "foo@bar.net", + 'Dr. Foo Bar', + 'foo@bar.net', 'foo@cloud.net' ], [ @@ -178,9 +178,9 @@ class ConverterTest extends TestCase { 'fn' => 'Dr. Foo Bar', 'photo' => 'MTIzNDU2Nzg5', ], - "Dr. Foo Bar", + 'Dr. Foo Bar', null, - "foo@cloud.net" + 'foo@cloud.net' ], [ [ diff --git a/apps/dav/tests/unit/CardDAV/SystemAddressBookTest.php b/apps/dav/tests/unit/CardDAV/SystemAddressBookTest.php index a1c614cb69d..806c71759f8 100644 --- a/apps/dav/tests/unit/CardDAV/SystemAddressBookTest.php +++ b/apps/dav/tests/unit/CardDAV/SystemAddressBookTest.php @@ -150,7 +150,7 @@ VCF; ->with(123, 'user.vcf') ->willReturn($originalCard); - $card = $this->addressBook->getChild("user.vcf"); + $card = $this->addressBook->getChild('user.vcf'); /** @var VCard $vCard */ $vCard = Reader::read($card->get()); @@ -180,7 +180,7 @@ VCF; ]); $this->expectException(NotFound::class); - $this->addressBook->getChild("LDAP:user.vcf"); + $this->addressBook->getChild('LDAP:user.vcf'); } public function testGetChildWithoutEnumeration(): void { @@ -193,7 +193,7 @@ VCF; ]); $this->expectException(Forbidden::class); - $this->addressBook->getChild("LDAP:user.vcf"); + $this->addressBook->getChild('LDAP:user.vcf'); } public function testGetChildAsGuest(): void { @@ -211,7 +211,7 @@ VCF; ->willReturn($user); $this->expectException(Forbidden::class); - $this->addressBook->getChild("LDAP:user.vcf"); + $this->addressBook->getChild('LDAP:user.vcf'); } public function testGetChildWithGroupEnumerationRestriction(): void { @@ -272,7 +272,7 @@ VCF; ->willReturn($user); $this->expectException(Forbidden::class); - $this->addressBook->getChild("LDAP:user.vcf"); + $this->addressBook->getChild('LDAP:user.vcf'); } public function testGetOwnChildWithPhoneNumberEnumerationRestriction(): void { @@ -305,7 +305,7 @@ VCF; 'carddata' => $cardData, ]); - $this->addressBook->getChild("LDAP:user.vcf"); + $this->addressBook->getChild('LDAP:user.vcf'); } public function testGetMultipleChildrenWithGroupEnumerationRestriction(): void { diff --git a/apps/dav/tests/unit/Command/ListCalendarsTest.php b/apps/dav/tests/unit/Command/ListCalendarsTest.php index 30df9ee79dc..fcb3658a6fc 100644 --- a/apps/dav/tests/unit/Command/ListCalendarsTest.php +++ b/apps/dav/tests/unit/Command/ListCalendarsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -54,7 +55,7 @@ class ListCalendarsTest extends TestCase { $commandTester->execute([ 'uid' => self::USERNAME, ]); - $this->assertStringContainsString("User <" . self::USERNAME . "> in unknown", $commandTester->getDisplay()); + $this->assertStringContainsString('User <' . self::USERNAME . '> in unknown', $commandTester->getDisplay()); } public function testWithCorrectUserWithNoCalendars(): void { @@ -72,7 +73,7 @@ class ListCalendarsTest extends TestCase { $commandTester->execute([ 'uid' => self::USERNAME, ]); - $this->assertStringContainsString("User <" . self::USERNAME . "> has no calendars\n", $commandTester->getDisplay()); + $this->assertStringContainsString('User <' . self::USERNAME . "> has no calendars\n", $commandTester->getDisplay()); } public function dataExecute() { diff --git a/apps/dav/tests/unit/Command/MoveCalendarTest.php b/apps/dav/tests/unit/Command/MoveCalendarTest.php index 09831fdb1b2..aac947cbf4c 100644 --- a/apps/dav/tests/unit/Command/MoveCalendarTest.php +++ b/apps/dav/tests/unit/Command/MoveCalendarTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -194,7 +195,7 @@ class MoveCalendarTest extends TestCase { 'destinationuid' => 'user2', ]); - $this->assertStringContainsString("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); + $this->assertStringContainsString('[OK] Calendar <personal> was moved from user <user> to <user2>', $commandTester->getDisplay()); } public function dataTestMoveWithDestinationNotPartOfGroup(): array { @@ -240,7 +241,7 @@ class MoveCalendarTest extends TestCase { ]); if ($shareWithGroupMembersOnly === true) { $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage("User <user2> is not part of the group <nextclouders> with whom the calendar <personal> was shared. You may use -f to move the calendar while deleting this share."); + $this->expectExceptionMessage('User <user2> is not part of the group <nextclouders> with whom the calendar <personal> was shared. You may use -f to move the calendar while deleting this share.'); } $commandTester = new CommandTester($this->command); @@ -294,7 +295,7 @@ class MoveCalendarTest extends TestCase { 'destinationuid' => 'user2', ]); - $this->assertStringContainsString("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); + $this->assertStringContainsString('[OK] Calendar <personal> was moved from user <user> to <user2>', $commandTester->getDisplay()); } public function testMoveWithDestinationNotPartOfGroupAndForce(): void { @@ -342,7 +343,7 @@ class MoveCalendarTest extends TestCase { '--force' => true ]); - $this->assertStringContainsString("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); + $this->assertStringContainsString('[OK] Calendar <personal> was moved from user <user> to <user2>', $commandTester->getDisplay()); } public function dataTestMoveWithCalendarAlreadySharedToDestination(): array { @@ -380,17 +381,17 @@ class MoveCalendarTest extends TestCase { ); $this->calDav->expects($this->once())->method('getShares') - ->with(1234) - ->willReturn([ - [ - 'href' => 'principal:principals/users/user2', - '{DAV:}displayname' => 'Personal' - ] - ]); + ->with(1234) + ->willReturn([ + [ + 'href' => 'principal:principals/users/user2', + '{DAV:}displayname' => 'Personal' + ] + ]); if ($force === false) { $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage("The calendar <personal> is already shared to user <user2>.You may use -f to move the calendar while deleting this share."); + $this->expectExceptionMessage('The calendar <personal> is already shared to user <user2>.You may use -f to move the calendar while deleting this share.'); } else { $this->calDav->expects($this->once())->method('updateShares'); } diff --git a/apps/dav/tests/unit/Comments/CommentsNodeTest.php b/apps/dav/tests/unit/Comments/CommentsNodeTest.php index d2bb60af4b2..c253c59df0f 100644 --- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php +++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php @@ -19,7 +19,7 @@ use Sabre\DAV\PropPatch; class CommentsNodeTest extends \Test\TestCase { - /** @var ICommentsManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ICommentsManager|\PHPUnit\Framework\MockObject\MockObject */ protected $commentsManager; protected $comment; diff --git a/apps/dav/tests/unit/Comments/CommentsPluginTest.php b/apps/dav/tests/unit/Comments/CommentsPluginTest.php index 60c3e52ef54..5ca0cedf04b 100644 --- a/apps/dav/tests/unit/Comments/CommentsPluginTest.php +++ b/apps/dav/tests/unit/Comments/CommentsPluginTest.php @@ -29,7 +29,7 @@ class CommentsPluginTest extends \Test\TestCase { /** @var ICommentsManager */ private $commentsManager; - /** @var IUserSession */ + /** @var IUserSession */ private $userSession; /** @var CommentsPluginImplementation */ diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php index dccb1edd0ae..de258c9aaec 100644 --- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php @@ -221,11 +221,11 @@ class AuthTest extends TestCase { public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGet(): void { $request = $this->getMockBuilder(RequestInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $this->userSession ->expects($this->any()) ->method('isLoggedIn') diff --git a/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php b/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php index 92d5c95f4c7..d4f3287450c 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php index c2167214451..1cda0e4dbdb 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php @@ -16,7 +16,7 @@ use Sabre\DAV\PropFind; class CommentsPropertiesPluginTest extends \Test\TestCase { - /** @var CommentPropertiesPluginImplementation */ + /** @var CommentPropertiesPluginImplementation */ protected $plugin; protected $commentsManager; protected $userSession; diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index 3e297320d15..f20ded4baf2 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -72,9 +72,9 @@ class DirectoryTest extends \Test\TestCase { $this->info->method('getType') ->willReturn(Node::TYPE_FOLDER); $this->info->method('getName') - ->willReturn("folder"); + ->willReturn('folder'); $this->info->method('getPath') - ->willReturn("/admin/files/folder"); + ->willReturn('/admin/files/folder'); $this->info->method('getPermissions') ->willReturn(Constants::PERMISSION_READ); } diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php index 74f90507bb3..c7fb6066ed4 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php @@ -20,7 +20,7 @@ class ForbiddenTest extends \Test\TestCase { $DOM->appendChild($error); // serialize the exception - $message = "1234567890"; + $message = '1234567890'; $retry = false; $expectedXml = <<<EOD <?xml version="1.0" encoding="utf-8"?> diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php index 3da0c41b7b3..98921d735fa 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php @@ -20,7 +20,7 @@ class InvalidPathTest extends \Test\TestCase { $DOM->appendChild($error); // serialize the exception - $message = "1234567890"; + $message = '1234567890'; $retry = false; $expectedXml = <<<EOD <?xml version="1.0" encoding="utf-8"?> diff --git a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php index 40ebc69e42d..18165b79cb2 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php @@ -160,11 +160,11 @@ class FakeLockerPluginTest extends TestCase { ->getMock(); $response->expects($this->once()) - ->method('setStatus') - ->with('204'); + ->method('setStatus') + ->with('204'); $response->expects($this->once()) - ->method('setHeader') - ->with('Content-Length', '0'); + ->method('setHeader') + ->with('Content-Length', '0'); $this->assertSame(false, $this->fakeLockerPlugin->fakeUnlockProvider($request, $response)); } diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index d099a431184..fb15e5904e7 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -264,51 +264,51 @@ class FileTest extends TestCase { public function legalMtimeProvider() { return [ - "string" => [ - 'HTTP_X_OC_MTIME' => "string", + 'string' => [ + 'HTTP_X_OC_MTIME' => 'string', 'expected result' => null ], - "castable string (int)" => [ - 'HTTP_X_OC_MTIME' => "987654321", + 'castable string (int)' => [ + 'HTTP_X_OC_MTIME' => '987654321', 'expected result' => 987654321 ], - "castable string (float)" => [ - 'HTTP_X_OC_MTIME' => "123456789.56", + 'castable string (float)' => [ + 'HTTP_X_OC_MTIME' => '123456789.56', 'expected result' => 123456789 ], - "float" => [ + 'float' => [ 'HTTP_X_OC_MTIME' => 123456789.56, 'expected result' => 123456789 ], - "zero" => [ + 'zero' => [ 'HTTP_X_OC_MTIME' => 0, 'expected result' => null ], - "zero string" => [ - 'HTTP_X_OC_MTIME' => "0", + 'zero string' => [ + 'HTTP_X_OC_MTIME' => '0', 'expected result' => null ], - "negative zero string" => [ - 'HTTP_X_OC_MTIME' => "-0", + 'negative zero string' => [ + 'HTTP_X_OC_MTIME' => '-0', 'expected result' => null ], - "string starting with number following by char" => [ - 'HTTP_X_OC_MTIME' => "2345asdf", + 'string starting with number following by char' => [ + 'HTTP_X_OC_MTIME' => '2345asdf', 'expected result' => null ], - "string castable hex int" => [ - 'HTTP_X_OC_MTIME' => "0x45adf", + 'string castable hex int' => [ + 'HTTP_X_OC_MTIME' => '0x45adf', 'expected result' => null ], - "string that looks like invalid hex int" => [ - 'HTTP_X_OC_MTIME' => "0x123g", + 'string that looks like invalid hex int' => [ + 'HTTP_X_OC_MTIME' => '0x123g', 'expected result' => null ], - "negative int" => [ + 'negative int' => [ 'HTTP_X_OC_MTIME' => -34, 'expected result' => null ], - "negative float" => [ + 'negative float' => [ 'HTTP_X_OC_MTIME' => -34.43, 'expected result' => null ], @@ -322,7 +322,7 @@ class FileTest extends TestCase { public function testPutSingleFileLegalMtime($requestMtime, $resultMtime): void { $request = new Request([ 'server' => [ - 'HTTP_X_OC_MTIME' => (string)$requestMtime, + 'HTTP_X_OC_MTIME' => (string) $requestMtime, ] ], $this->requestId, $this->config, null); $file = 'foo.txt'; @@ -905,10 +905,10 @@ class FileTest extends TestCase { $userView = Filesystem::getView(); } return [ - "filesize" => $userView->filesize($path), - "mtime" => $userView->filemtime($path), - "filetype" => $userView->filetype($path), - "mimetype" => $userView->getMimeType($path) + 'filesize' => $userView->filesize($path), + 'mtime' => $userView->filemtime($path), + 'filetype' => $userView->filetype($path), + 'mimetype' => $userView->getMimeType($path) ]; } diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php index de38f196420..fa5cf268471 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -74,8 +74,8 @@ class FilesPluginTest extends TestCase { ); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $this->server->httpResponse = $response; $this->server->xml = new Service(); @@ -696,8 +696,8 @@ class FilesPluginTest extends TestCase { ->disableOriginalConstructor() ->getMock(); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $request ->expects($this->once()) diff --git a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php index 28c22202c1e..9ecc49222e9 100644 --- a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php @@ -20,7 +20,7 @@ use Test\TestCase; class MaintenancePluginTest extends TestCase { /** @var IConfig */ private $config; - /** @var \PHPUnit\Framework\MockObject\Builder\InvocationMocker|\PHPUnit_Framework_MockObject_Builder_InvocationMocker|IL10N */ + /** @var \PHPUnit\Framework\MockObject\Builder\InvocationMocker|\PHPUnit_Framework_MockObject_Builder_InvocationMocker|IL10N */ private $l10n; /** @var MaintenancePlugin */ private $maintenancePlugin; diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index f0996a17a33..5010f7698b5 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -73,7 +73,7 @@ class ObjectTreeTest extends \Test\TestCase { ->with($this->identicalTo($sourcePath)) ->willReturn(false); - /** @var $objectTree \OCA\DAV\Connector\Sabre\ObjectTree */ + /** @var \OCA\DAV\Connector\Sabre\ObjectTree $objectTree */ $mountManager = Filesystem::getMountManager(); $objectTree->init($rootDir, $view, $mountManager); $objectTree->copy($sourcePath, $targetPath); @@ -114,7 +114,7 @@ class ObjectTreeTest extends \Test\TestCase { $objectTree->expects($this->never()) ->method('getNodeForPath'); - /** @var $objectTree \OCA\DAV\Connector\Sabre\ObjectTree */ + /** @var \OCA\DAV\Connector\Sabre\ObjectTree $objectTree */ $mountManager = Filesystem::getMountManager(); $objectTree->init($rootDir, $view, $mountManager); $objectTree->copy($sourcePath, $targetPath); diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php index 03910f32095..3595c85eb41 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -96,26 +97,26 @@ class PrincipalTest extends TestCase { public function testGetPrincipalsByPrefixWithUsers(): void { $fooUser = $this->createMock(User::class); $fooUser - ->expects($this->once()) - ->method('getUID') - ->willReturn('foo'); + ->expects($this->once()) + ->method('getUID') + ->willReturn('foo'); $fooUser - ->expects($this->once()) - ->method('getDisplayName') - ->willReturn('Dr. Foo-Bar'); + ->expects($this->once()) + ->method('getDisplayName') + ->willReturn('Dr. Foo-Bar'); $fooUser - ->expects($this->once()) - ->method('getSystemEMailAddress') - ->willReturn(''); + ->expects($this->once()) + ->method('getSystemEMailAddress') + ->willReturn(''); $barUser = $this->createMock(User::class); $barUser ->expects($this->once()) ->method('getUID') ->willReturn('bar'); $barUser - ->expects($this->once()) - ->method('getSystemEMailAddress') - ->willReturn('bar@nextcloud.com'); + ->expects($this->once()) + ->method('getSystemEMailAddress') + ->willReturn('bar@nextcloud.com'); $this->userManager ->expects($this->once()) ->method('search') @@ -229,13 +230,13 @@ class PrincipalTest extends TestCase { public function testGetPrincipalsByPathWithMail(): void { $fooUser = $this->createMock(User::class); $fooUser - ->expects($this->once()) - ->method('getSystemEMailAddress') - ->willReturn('foo@nextcloud.com'); + ->expects($this->once()) + ->method('getSystemEMailAddress') + ->willReturn('foo@nextcloud.com'); $fooUser - ->expects($this->once()) - ->method('getUID') - ->willReturn('foo'); + ->expects($this->once()) + ->method('getUID') + ->willReturn('foo'); $this->userManager ->expects($this->once()) ->method('get') @@ -851,13 +852,13 @@ class PrincipalTest extends TestCase { ->willReturn(true); $this->shareManager->expects($this->once()) - ->method('shareWithGroupMembersOnly') - ->willReturn(true); + ->method('shareWithGroupMembersOnly') + ->willReturn(true); $user = $this->createMock(IUser::class); $this->userSession->expects($this->once()) - ->method('getUser') - ->willReturn($user); + ->method('getUser') + ->willReturn($user); $user2 = $this->createMock(IUser::class); $user2->method('getUID')->willReturn('user2'); @@ -865,9 +866,9 @@ class PrincipalTest extends TestCase { $user3->method('getUID')->willReturn('user3'); $this->userManager->expects($this->once()) - ->method('getByEmail') - ->with($email) - ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]); + ->method('getByEmail') + ->with($email) + ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]); if ($email === 'user2@foo.bar') { $this->groupManager->expects($this->exactly(2)) @@ -912,8 +913,8 @@ class PrincipalTest extends TestCase { ->willReturn(true); $this->shareManager->expects($this->once()) - ->method('shareWithGroupMembersOnly') - ->willReturn(false); + ->method('shareWithGroupMembersOnly') + ->willReturn(false); $user2 = $this->createMock(IUser::class); $user2->method('getUID')->willReturn('user2'); @@ -921,9 +922,9 @@ class PrincipalTest extends TestCase { $user3->method('getUID')->willReturn('user3'); $this->userManager->expects($this->once()) - ->method('getByEmail') - ->with($email) - ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]); + ->method('getByEmail') + ->with($email) + ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]); $this->assertEquals($expects, $this->connector->findByUri($uri, 'principals/users')); } diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php index bed5eb192d9..cf1ea4c6bae 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php @@ -72,7 +72,7 @@ class Auth implements BackendInterface { \OC::$server->getUserFolder($user); return [true, "principals/$user"]; } - return [false, "login failed"]; + return [false, 'login failed']; } /** diff --git a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php index c7c2bf0e431..282a88d250c 100644 --- a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php +++ b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php index 640c66b75e5..fbffa96cd58 100644 --- a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php +++ b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php @@ -451,7 +451,7 @@ EOF; $expr->expects($this->once()) ->method('eq') ->with('token', 'namedParameterToken') - ->willReturn((string)$function); + ->willReturn((string) $function); $this->dbConnection->expects($this->once()) ->method('getQueryBuilder') diff --git a/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php b/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php index ea5450391e8..2ea5e9c8b9f 100644 --- a/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php +++ b/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php index 606632fa45d..329ba2e9af6 100644 --- a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php @@ -34,7 +34,7 @@ class CustomPropertiesBackendTest extends TestCase { /** @var Tree | \PHPUnit\Framework\MockObject\MockObject */ private $tree; - /** @var IDBConnection */ + /** @var IDBConnection */ private $dbConnection; /** @var IUser | \PHPUnit\Framework\MockObject\MockObject */ @@ -121,7 +121,7 @@ class CustomPropertiesBackendTest extends TestCase { $data = []; while ($row = $result->fetch()) { $value = $row['propertyvalue']; - if ((int)$row['valuetype'] === CustomPropertiesBackend::PROPERTY_TYPE_HREF) { + if ((int) $row['valuetype'] === CustomPropertiesBackend::PROPERTY_TYPE_HREF) { $value = new Href($value); } $data[$row['propertyname']] = $value; @@ -396,7 +396,7 @@ class CustomPropertiesBackendTest extends TestCase { $this->defaultCalendarValidator->expects(self::once()) ->method('validateScheduleDefaultCalendar') ->with($node) - ->willThrowException(new \Sabre\DAV\Exception("Invalid calendar")); + ->willThrowException(new \Sabre\DAV\Exception('Invalid calendar')); $this->server->method('calculateUri') ->willReturnCallback(function ($uri) { diff --git a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php index 92c89fc62f8..284d11fa9f1 100644 --- a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php +++ b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/dav/tests/unit/DAV/Sharing/BackendTest.php b/apps/dav/tests/unit/DAV/Sharing/BackendTest.php index 344d57d1808..3caaefe030a 100644 --- a/apps/dav/tests/unit/DAV/Sharing/BackendTest.php +++ b/apps/dav/tests/unit/DAV/Sharing/BackendTest.php @@ -303,7 +303,7 @@ class BackendTest extends TestCase { $this->shareCache->expects(self::once()) ->method('get') - ->with((string)$resourceId) + ->with((string) $resourceId) ->willReturn(null); $this->calendarService->expects(self::once()) ->method('getShares') @@ -315,7 +315,7 @@ class BackendTest extends TestCase { ->willReturn(['uri' => $principal, '{DAV:}displayname' => 'bob']); $this->shareCache->expects(self::once()) ->method('set') - ->with((string)$resourceId, $expected); + ->with((string) $resourceId, $expected); $result = $this->backend->getShares($resourceId); $this->assertEquals($expected, $result); @@ -351,7 +351,7 @@ class BackendTest extends TestCase { $this->shareCache->expects(self::once()) ->method('get') - ->with((string)$resourceId) + ->with((string) $resourceId) ->willReturn(null); $service->expects(self::once()) ->method('getShares') @@ -363,7 +363,7 @@ class BackendTest extends TestCase { ->willReturn(['uri' => $principal, '{DAV:}displayname' => 'bob']); $this->shareCache->expects(self::once()) ->method('set') - ->with((string)$resourceId, $expected); + ->with((string) $resourceId, $expected); $result = $backend->getShares($resourceId); $this->assertEquals($expected, $result); diff --git a/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php b/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php index eb15bfe0b5a..7a4828dd2de 100644 --- a/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php +++ b/apps/dav/tests/unit/DAV/ViewOnlyPluginTest.php @@ -132,9 +132,9 @@ class ViewOnlyPluginTest extends TestCase { $this->request->expects($this->once())->method('getPath')->willReturn($davPath); $this->tree->expects($this->once()) - ->method('getNodeForPath') - ->with($davPath) - ->willReturn($davNode); + ->method('getNodeForPath') + ->with($davPath) + ->willReturn($davNode); $storage = $this->createMock(SharedStorage::class); $share = $this->createMock(IShare::class); @@ -147,9 +147,9 @@ class ViewOnlyPluginTest extends TestCase { $extAttr = $this->createMock(IAttributes::class); $share->method('getAttributes')->willReturn($extAttr); $extAttr->expects($this->once()) - ->method('getAttribute') - ->with('permissions', 'download') - ->willReturn($attrEnabled); + ->method('getAttribute') + ->with('permissions', 'download') + ->willReturn($attrEnabled); if (!$expectCanDownloadFile) { $this->expectException(Forbidden::class); diff --git a/apps/dav/tests/unit/Files/FileSearchBackendTest.php b/apps/dav/tests/unit/Files/FileSearchBackendTest.php index f6fe8b1c116..1ac605eeaef 100644 --- a/apps/dav/tests/unit/Files/FileSearchBackendTest.php +++ b/apps/dav/tests/unit/Files/FileSearchBackendTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/Files/MultipartRequestParserTest.php b/apps/dav/tests/unit/Files/MultipartRequestParserTest.php index 3458708b23b..24515a8e10b 100644 --- a/apps/dav/tests/unit/Files/MultipartRequestParserTest.php +++ b/apps/dav/tests/unit/Files/MultipartRequestParserTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only @@ -21,17 +22,17 @@ class MultipartRequestParserTest extends TestCase { private function getValidBodyObject() { return [ [ - "headers" => [ - "Content-Length" => 7, - "X-File-MD5" => "4f2377b4d911f7ec46325fe603c3af03", - "X-File-Path" => "/coucou.txt" + 'headers' => [ + 'Content-Length' => 7, + 'X-File-MD5' => '4f2377b4d911f7ec46325fe603c3af03', + 'X-File-Path' => '/coucou.txt' ], - "content" => "Coucou\n" + 'content' => "Coucou\n" ] ]; } - private function getMultipartParser(array $parts, array $headers = [], string $boundary = "boundary_azertyuiop"): MultipartRequestParser { + private function getMultipartParser(array $parts, array $headers = [], string $boundary = 'boundary_azertyuiop'): MultipartRequestParser { $request = $this->getMockBuilder('Sabre\HTTP\RequestInterface') ->disableOriginalConstructor() ->getMock(); @@ -43,19 +44,19 @@ class MultipartRequestParserTest extends TestCase { return $headers[$key]; }); - $body = ""; + $body = ''; foreach ($parts as $part) { $body .= '--'.$boundary."\r\n"; foreach ($part['headers'] as $headerKey => $headerPart) { - $body .= $headerKey.": ".$headerPart."\r\n"; + $body .= $headerKey.': '.$headerPart."\r\n"; } $body .= "\r\n"; $body .= $part['content']."\r\n"; } - $body .= '--'.$boundary."--"; + $body .= '--'.$boundary.'--'; $stream = fopen('php://temp', 'r+'); fwrite($stream, $body); @@ -73,7 +74,7 @@ class MultipartRequestParserTest extends TestCase { * Test validation of the request's body type */ public function testBodyTypeValidation(): void { - $bodyStream = "I am not a stream, but pretend to be"; + $bodyStream = 'I am not a stream, but pretend to be'; $request = $this->getMockBuilder('Sabre\HTTP\RequestInterface') ->disableOriginalConstructor() ->getMock(); @@ -100,11 +101,11 @@ class MultipartRequestParserTest extends TestCase { [$headers, $content] = $multipartParser->parseNextPart(); - $this->assertSame((int)$headers["content-length"], 7, "Content-Length header should be the same as provided."); - $this->assertSame($headers["x-file-md5"], "4f2377b4d911f7ec46325fe603c3af03", "X-File-MD5 header should be the same as provided."); - $this->assertSame($headers["x-file-path"], "/coucou.txt", "X-File-Path header should be the same as provided."); + $this->assertSame((int) $headers['content-length'], 7, 'Content-Length header should be the same as provided.'); + $this->assertSame($headers['x-file-md5'], '4f2377b4d911f7ec46325fe603c3af03', 'X-File-MD5 header should be the same as provided.'); + $this->assertSame($headers['x-file-path'], '/coucou.txt', 'X-File-Path header should be the same as provided.'); - $this->assertSame($content, "Coucou\n", "Content should be the same"); + $this->assertSame($content, "Coucou\n", 'Content should be the same'); } /** @@ -112,7 +113,7 @@ class MultipartRequestParserTest extends TestCase { */ public function testInvalidMd5Hash(): void { $bodyObject = $this->getValidBodyObject(); - $bodyObject["0"]["headers"]["X-File-MD5"] = "f2377b4d911f7ec46325fe603c3af03"; + $bodyObject['0']['headers']['X-File-MD5'] = 'f2377b4d911f7ec46325fe603c3af03'; $multipartParser = $this->getMultipartParser( $bodyObject ); @@ -126,7 +127,7 @@ class MultipartRequestParserTest extends TestCase { */ public function testNullMd5Hash(): void { $bodyObject = $this->getValidBodyObject(); - unset($bodyObject["0"]["headers"]["X-File-MD5"]); + unset($bodyObject['0']['headers']['X-File-MD5']); $multipartParser = $this->getMultipartParser( $bodyObject ); @@ -140,7 +141,7 @@ class MultipartRequestParserTest extends TestCase { */ public function testNullContentLength(): void { $bodyObject = $this->getValidBodyObject(); - unset($bodyObject["0"]["headers"]["Content-Length"]); + unset($bodyObject['0']['headers']['Content-Length']); $multipartParser = $this->getMultipartParser( $bodyObject ); @@ -154,7 +155,7 @@ class MultipartRequestParserTest extends TestCase { */ public function testLowerContentLength(): void { $bodyObject = $this->getValidBodyObject(); - $bodyObject["0"]["headers"]["Content-Length"] = 6; + $bodyObject['0']['headers']['Content-Length'] = 6; $multipartParser = $this->getMultipartParser( $bodyObject ); @@ -168,7 +169,7 @@ class MultipartRequestParserTest extends TestCase { */ public function testHigherContentLength(): void { $bodyObject = $this->getValidBodyObject(); - $bodyObject["0"]["headers"]["Content-Length"] = 8; + $bodyObject['0']['headers']['Content-Length'] = 8; $multipartParser = $this->getMultipartParser( $bodyObject ); diff --git a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php index 7264119f8c6..b5994f985ab 100644 --- a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php +++ b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php b/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php index 1cebf199d29..ae1eefd22e4 100644 --- a/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php +++ b/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php index bf4c60b3cf1..6eaa58524ef 100644 --- a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php +++ b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php b/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php index e2ac45526d2..82d483bee43 100644 --- a/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php +++ b/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningNodeTest.php b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningNodeTest.php index 0979aff8a81..be09f14cd51 100644 --- a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningNodeTest.php +++ b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningNodeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php index dbb399ea7a6..a9c7dcac0c9 100644 --- a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php +++ b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php b/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php index ed497d006e1..1024d8808b3 100644 --- a/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php +++ b/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -42,14 +43,14 @@ class CalDAVSettingsTest extends TestCase { public function testGetForm(): void { $this->config->method('getAppValue') - ->withConsecutive( - ['dav', 'sendInvitations', 'yes'], - ['dav', 'generateBirthdayCalendar', 'yes'], - ['dav', 'sendEventReminders', 'yes'], - ['dav', 'sendEventRemindersToSharedUsers', 'yes'], - ['dav', 'sendEventRemindersPush', 'yes'], - ) - ->will($this->onConsecutiveCalls('yes', 'no', 'yes', 'yes', 'yes')); + ->withConsecutive( + ['dav', 'sendInvitations', 'yes'], + ['dav', 'generateBirthdayCalendar', 'yes'], + ['dav', 'sendEventReminders', 'yes'], + ['dav', 'sendEventRemindersToSharedUsers', 'yes'], + ['dav', 'sendEventRemindersPush', 'yes'], + ) + ->will($this->onConsecutiveCalls('yes', 'no', 'yes', 'yes', 'yes')); $this->urlGenerator ->expects($this->once()) ->method('linkToDocs') diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php index 51711fc1666..67e7afa9c54 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php @@ -543,11 +543,11 @@ class SystemTagPluginTest extends \Test\TestCase { ->willReturn($node); $request = $this->getMockBuilder(RequestInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $request->expects($this->once()) ->method('getPath') @@ -617,11 +617,11 @@ class SystemTagPluginTest extends \Test\TestCase { ->with(1); $request = $this->getMockBuilder(RequestInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $request->expects($this->once()) ->method('getPath') @@ -666,11 +666,11 @@ class SystemTagPluginTest extends \Test\TestCase { ->method('createFile'); $request = $this->getMockBuilder(RequestInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $request->expects($this->once()) ->method('getPath') @@ -714,11 +714,11 @@ class SystemTagPluginTest extends \Test\TestCase { ->willReturn($node); $request = $this->getMockBuilder(RequestInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $response = $this->getMockBuilder(ResponseInterface::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $request->expects($this->once()) ->method('getPath') diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php index b202f340e32..a2a877073f7 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php @@ -70,7 +70,7 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase { return $node !== null; }; $writeAccessClosure = function ($name) use ($userFolder) { - $nodes = $userFolder->getById((int)$name); + $nodes = $userFolder->getById((int) $name); foreach ($nodes as $node) { if (($node->getPermissions() & Constants::PERMISSION_UPDATE) === Constants::PERMISSION_UPDATE) { return true; diff --git a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php index 6d821976f4e..217713eca33 100644 --- a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php +++ b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php @@ -55,11 +55,11 @@ class AssemblyStreamTest extends \Test\TestCase { $dataLess8k = $this->makeData(8191); $tonofnodes = []; - $tonofdata = ""; + $tonofdata = ''; for ($i = 0; $i < 101; $i++) { $thisdata = random_int(0, 100); // variable length and content $tonofdata .= $thisdata; - $tonofnodes[] = $this->buildNode((string)$i, (string)$thisdata); + $tonofnodes[] = $this->buildNode((string) $i, (string) $thisdata); } return[ diff --git a/apps/encryption/lib/Command/DisableMasterKey.php b/apps/encryption/lib/Command/DisableMasterKey.php index 7993ba38078..4af4301db01 100644 --- a/apps/encryption/lib/Command/DisableMasterKey.php +++ b/apps/encryption/lib/Command/DisableMasterKey.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -21,7 +22,7 @@ class DisableMasterKey extends Command { /** @var IConfig */ protected $config; - /** @var QuestionHelper */ + /** @var QuestionHelper */ protected $questionHelper; /** diff --git a/apps/encryption/lib/Command/EnableMasterKey.php b/apps/encryption/lib/Command/EnableMasterKey.php index 98ad58e1bf8..a3ff14d2eed 100644 --- a/apps/encryption/lib/Command/EnableMasterKey.php +++ b/apps/encryption/lib/Command/EnableMasterKey.php @@ -23,7 +23,7 @@ class EnableMasterKey extends Command { /** @var IConfig */ protected $config; - /** @var QuestionHelper */ + /** @var QuestionHelper */ protected $questionHelper; /** diff --git a/apps/encryption/lib/Command/FixEncryptedVersion.php b/apps/encryption/lib/Command/FixEncryptedVersion.php index 36f4ee3620e..81f6a27b73d 100644 --- a/apps/encryption/lib/Command/FixEncryptedVersion.php +++ b/apps/encryption/lib/Command/FixEncryptedVersion.php @@ -83,7 +83,7 @@ class FixEncryptedVersion extends Command { if ($user) { if ($all) { - $output->writeln("Specifying a user id and --all are mutually exclusive"); + $output->writeln('Specifying a user id and --all are mutually exclusive'); return 1; } @@ -96,20 +96,20 @@ class FixEncryptedVersion extends Command { } elseif ($all) { $result = 0; $this->userManager->callForSeenUsers(function (IUser $user) use ($pathOption, $output, &$result) { - $output->writeln("Processing files for " . $user->getUID()); + $output->writeln('Processing files for ' . $user->getUID()); $result = $this->runForUser($user->getUID(), $pathOption, $output); return $result === 0; }); return $result; } else { - $output->writeln("Either a user id or --all needs to be provided"); + $output->writeln('Either a user id or --all needs to be provided'); return 1; } } private function runForUser(string $user, string $pathOption, OutputInterface $output): int { $pathToWalk = "/$user/files"; - if ($pathOption !== "") { + if ($pathOption !== '') { $pathToWalk = "$pathToWalk/$pathOption"; } return $this->walkPathOfUser($user, $pathToWalk, $output); @@ -205,7 +205,7 @@ class FixEncryptedVersion extends Command { } return false; } catch (HintException $e) { - $this->logger->warning("Issue: " . $e->getMessage()); + $this->logger->warning('Issue: ' . $e->getMessage()); // If allowOnce is set to false, this becomes recursive. if ($ignoreCorrectEncVersionCall === true) { // Lets rectify the file by correcting encrypted version @@ -254,7 +254,7 @@ class FixEncryptedVersion extends Command { // try with zero first $cacheInfo = ['encryptedVersion' => 0, 'encrypted' => 0]; $cache->put($fileCache->getPath(), $cacheInfo); - $output->writeln("<info>Set the encrypted version to 0 (unencrypted)</info>"); + $output->writeln('<info>Set the encrypted version to 0 (unencrypted)</info>'); if ($this->verifyFileContent($path, $output, false) === true) { $output->writeln("<info>Fixed the file: \"$path\" with version 0 (unencrypted)</info>"); return true; @@ -268,7 +268,7 @@ class FixEncryptedVersion extends Command { $cache->put($fileCache->getPath(), $cacheInfo); $output->writeln("<info>Decrement the encrypted version to $encryptedVersion</info>"); if ($this->verifyFileContent($path, $output, false) === true) { - $output->writeln("<info>Fixed the file: \"$path\" with version " . $encryptedVersion . "</info>"); + $output->writeln("<info>Fixed the file: \"$path\" with version " . $encryptedVersion . '</info>'); return true; } $encryptedVersion--; @@ -291,7 +291,7 @@ class FixEncryptedVersion extends Command { $cache->put($fileCache->getPath(), $cacheInfo); $output->writeln("<info>Increment the encrypted version to $newEncryptedVersion</info>"); if ($this->verifyFileContent($path, $output, false) === true) { - $output->writeln("<info>Fixed the file: \"$path\" with version " . $newEncryptedVersion . "</info>"); + $output->writeln("<info>Fixed the file: \"$path\" with version " . $newEncryptedVersion . '</info>'); return true; } $increment++; diff --git a/apps/encryption/lib/Command/FixKeyLocation.php b/apps/encryption/lib/Command/FixKeyLocation.php index cb3408f77f1..4e6742b91a9 100644 --- a/apps/encryption/lib/Command/FixKeyLocation.php +++ b/apps/encryption/lib/Command/FixKeyLocation.php @@ -50,7 +50,7 @@ class FixKeyLocation extends Command { $this->keyRootDirectory = rtrim($this->encryptionUtil->getKeyStorageRoot(), '/'); $this->rootView = new View(); if (!$encryptionManager instanceof Manager) { - throw new \Exception("Wrong encryption manager"); + throw new \Exception('Wrong encryption manager'); } $this->encryptionManager = $encryptionManager; @@ -65,7 +65,7 @@ class FixKeyLocation extends Command { ->setName('encryption:fix-key-location') ->setDescription('Fix the location of encryption keys for external storage') ->addOption('dry-run', null, InputOption::VALUE_NONE, "Only list files that require key migration, don't try to perform any migration") - ->addArgument('user', InputArgument::REQUIRED, "User id to fix the key locations for"); + ->addArgument('user', InputArgument::REQUIRED, 'User id to fix the key locations for'); } protected function execute(InputInterface $input, OutputInterface $output): int { @@ -83,7 +83,7 @@ class FixKeyLocation extends Command { foreach ($mounts as $mount) { $mountRootFolder = $this->rootFolder->get($mount->getMountPoint()); if (!$mountRootFolder instanceof Folder) { - $output->writeln("<error>System wide mount point is not a directory, skipping: " . $mount->getMountPoint() . "</error>"); + $output->writeln('<error>System wide mount point is not a directory, skipping: ' . $mount->getMountPoint() . '</error>'); continue; } @@ -97,14 +97,14 @@ class FixKeyLocation extends Command { // key was stored incorrectly as user key, migrate if ($dryRun) { - $output->writeln("<info>" . $file->getPath() . "</info> needs migration"); + $output->writeln('<info>' . $file->getPath() . '</info> needs migration'); } else { - $output->write("Migrating key for <info>" . $file->getPath() . "</info> "); + $output->write('Migrating key for <info>' . $file->getPath() . '</info> '); if ($this->copyUserKeyToSystemAndValidate($user, $file)) { - $output->writeln("<info>✓</info>"); + $output->writeln('<info>✓</info>'); } else { - $output->writeln("<fg=red>❌</>"); - $output->writeln(" Failed to validate key for <error>" . $file->getPath() . "</error>, key will not be migrated"); + $output->writeln('<fg=red>❌</>'); + $output->writeln(' Failed to validate key for <error>' . $file->getPath() . '</error>, key will not be migrated'); } } } else { @@ -115,42 +115,42 @@ class FixKeyLocation extends Command { if ($isActuallyEncrypted) { if ($dryRun) { if ($shouldBeEncrypted) { - $output->write("<info>" . $file->getPath() . "</info> needs migration"); + $output->write('<info>' . $file->getPath() . '</info> needs migration'); } else { - $output->write("<info>" . $file->getPath() . "</info> needs decryption"); + $output->write('<info>' . $file->getPath() . '</info> needs decryption'); } $foundKey = $this->findUserKeyForSystemFile($user, $file); if ($foundKey) { - $output->writeln(", valid key found at <info>" . $foundKey . "</info>"); + $output->writeln(', valid key found at <info>' . $foundKey . '</info>'); } else { - $output->writeln(" <error>❌ No key found</error>"); + $output->writeln(' <error>❌ No key found</error>'); } } else { if ($shouldBeEncrypted) { - $output->write("<info>Migrating key for " . $file->getPath() . "</info>"); + $output->write('<info>Migrating key for ' . $file->getPath() . '</info>'); } else { - $output->write("<info>Decrypting " . $file->getPath() . "</info>"); + $output->write('<info>Decrypting ' . $file->getPath() . '</info>'); } $foundKey = $this->findUserKeyForSystemFile($user, $file); if ($foundKey) { if ($shouldBeEncrypted) { $systemKeyPath = $this->getSystemKeyPath($file); $this->rootView->copy($foundKey, $systemKeyPath); - $output->writeln(" Migrated key from <info>" . $foundKey . "</info>"); + $output->writeln(' Migrated key from <info>' . $foundKey . '</info>'); } else { $this->decryptWithSystemKey($file, $foundKey); - $output->writeln(" Decrypted with key from <info>" . $foundKey . "</info>"); + $output->writeln(' Decrypted with key from <info>' . $foundKey . '</info>'); } } else { - $output->writeln(" <error>❌ No key found</error>"); + $output->writeln(' <error>❌ No key found</error>'); } } } else { if ($dryRun) { - $output->writeln("<info>" . $file->getPath() . " needs to be marked as not encrypted</info>"); + $output->writeln('<info>' . $file->getPath() . ' needs to be marked as not encrypted</info>'); } else { $this->markAsUnEncrypted($file); - $output->writeln("<info>" . $file->getPath() . " marked as not encrypted</info>"); + $output->writeln('<info>' . $file->getPath() . ' marked as not encrypted</info>'); } } } @@ -288,7 +288,7 @@ class FixKeyLocation extends Command { } /** @var resource|false $handle */ if ($handle === false) { - throw new \Exception("Failed to open " . $node->getPath()); + throw new \Exception('Failed to open ' . $node->getPath()); } return $handle; } @@ -339,7 +339,7 @@ class FixKeyLocation extends Command { /** @var false|resource $dh */ $dh = $this->rootView->opendir($basePath); if (!$dh) { - throw new \Exception("Invalid base path " . $basePath); + throw new \Exception('Invalid base path ' . $basePath); } while ($child = readdir($dh)) { if ($child != '..' && $child != '.') { @@ -398,7 +398,7 @@ class FixKeyLocation extends Command { /** @var false|resource $source */ $source = $storage->fopen($node->getInternalPath(), 'r'); if (!$source) { - throw new \Exception("Failed to open " . $node->getPath() . " with " . $key); + throw new \Exception('Failed to open ' . $node->getPath() . ' with ' . $key); } $decryptedNode = $node->getParent()->newFile($name); @@ -418,7 +418,7 @@ class FixKeyLocation extends Command { } if ($this->isDataEncrypted($decryptedNode)) { - throw new \Exception($node->getPath() . " still encrypted after attempting to decrypt with " . $key); + throw new \Exception($node->getPath() . ' still encrypted after attempting to decrypt with ' . $key); } $this->markAsUnEncrypted($decryptedNode); diff --git a/apps/encryption/lib/Command/RecoverUser.php b/apps/encryption/lib/Command/RecoverUser.php index fcdc3f15fb5..cb331b8d7dc 100644 --- a/apps/encryption/lib/Command/RecoverUser.php +++ b/apps/encryption/lib/Command/RecoverUser.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -23,7 +24,7 @@ class RecoverUser extends Command { /** @var IUserManager */ protected $userManager; - /** @var QuestionHelper */ + /** @var QuestionHelper */ protected $questionHelper; /** diff --git a/apps/encryption/lib/Command/ScanLegacyFormat.php b/apps/encryption/lib/Command/ScanLegacyFormat.php index 07cfcfdade5..2ad23ff7a93 100644 --- a/apps/encryption/lib/Command/ScanLegacyFormat.php +++ b/apps/encryption/lib/Command/ScanLegacyFormat.php @@ -24,7 +24,7 @@ class ScanLegacyFormat extends Command { /** @var IConfig */ protected $config; - /** @var QuestionHelper */ + /** @var QuestionHelper */ protected $questionHelper; /** @var IUserManager */ diff --git a/apps/encryption/lib/Controller/SettingsController.php b/apps/encryption/lib/Controller/SettingsController.php index b21cdb0aacd..251f385127a 100644 --- a/apps/encryption/lib/Controller/SettingsController.php +++ b/apps/encryption/lib/Controller/SettingsController.php @@ -42,10 +42,10 @@ class SettingsController extends Controller { /** @var Session */ private $session; - /** @var ISession */ + /** @var ISession */ private $ocSession; - /** @var Util */ + /** @var Util */ private $util; /** diff --git a/apps/encryption/lib/Crypto/Crypt.php b/apps/encryption/lib/Crypto/Crypt.php index 00611f294bf..92d6ed6a443 100644 --- a/apps/encryption/lib/Crypto/Crypt.php +++ b/apps/encryption/lib/Crypto/Crypt.php @@ -457,7 +457,7 @@ class Crypt { if ($enforceSignature) { throw new GenericEncryptionException('Bad Signature', $this->l->t('Bad Signature')); } else { - $this->logger->info("Signature check skipped", ['app' => 'encryption']); + $this->logger->info('Signature check skipped', ['app' => 'encryption']); } } } @@ -751,7 +751,7 @@ class Crypt { $result = false; // check if RC4 is used - if (strcasecmp($cipher_algo, "rc4") === 0) { + if (strcasecmp($cipher_algo, 'rc4') === 0) { // decrypt the intermediate key with RSA if (openssl_private_decrypt($encrypted_key, $intermediate, $private_key, OPENSSL_PKCS1_PADDING)) { // decrypt the file key with the intermediate key @@ -776,7 +776,7 @@ class Crypt { $result = false; // check if RC4 is used - if (strcasecmp($cipher_algo, "rc4") === 0) { + if (strcasecmp($cipher_algo, 'rc4') === 0) { // make sure that there is at least one public key to use if (count($public_key) >= 1) { // generate the intermediate key diff --git a/apps/encryption/lib/Crypto/DecryptAll.php b/apps/encryption/lib/Crypto/DecryptAll.php index e1eb1ba6a2a..80c187571b7 100644 --- a/apps/encryption/lib/Crypto/DecryptAll.php +++ b/apps/encryption/lib/Crypto/DecryptAll.php @@ -18,19 +18,19 @@ use Symfony\Component\Console\Question\Question; class DecryptAll { - /** @var Util */ + /** @var Util */ protected $util; - /** @var QuestionHelper */ + /** @var QuestionHelper */ protected $questionHelper; - /** @var Crypt */ + /** @var Crypt */ protected $crypt; - /** @var KeyManager */ + /** @var KeyManager */ protected $keyManager; - /** @var Session */ + /** @var Session */ protected $session; /** diff --git a/apps/encryption/lib/Crypto/EncryptAll.php b/apps/encryption/lib/Crypto/EncryptAll.php index 09b418836d9..310f37aba83 100644 --- a/apps/encryption/lib/Crypto/EncryptAll.php +++ b/apps/encryption/lib/Crypto/EncryptAll.php @@ -44,28 +44,28 @@ class EncryptAll { /** @var Util */ protected $util; - /** @var array */ + /** @var array */ protected $userPasswords; - /** @var IConfig */ + /** @var IConfig */ protected $config; /** @var IMailer */ protected $mailer; - /** @var IL10N */ + /** @var IL10N */ protected $l; - /** @var IFactory */ + /** @var IFactory */ protected $l10nFactory; - /** @var QuestionHelper */ + /** @var QuestionHelper */ protected $questionHelper; - /** @var OutputInterface */ + /** @var OutputInterface */ protected $output; - /** @var InputInterface */ + /** @var InputInterface */ protected $input; /** @var ISecureRandom */ @@ -203,7 +203,7 @@ class EncryptAll { $userNo++; } } - $progress->setMessage("all files encrypted"); + $progress->setMessage('all files encrypted'); $progress->finish(); } diff --git a/apps/encryption/lib/Crypto/Encryption.php b/apps/encryption/lib/Crypto/Encryption.php index dda93e13306..04fee2fd92a 100644 --- a/apps/encryption/lib/Crypto/Encryption.php +++ b/apps/encryption/lib/Crypto/Encryption.php @@ -99,8 +99,8 @@ class Encryption implements IEncryptionModule { * @param array $accessList who has access to the file contains the key 'users' and 'public' * * @return array $header contain data as key-value pairs which should be - * written to the header, in case of a write operation - * or if no additional data is needed return a empty array + * written to the header, in case of a write operation + * or if no additional data is needed return a empty array */ public function begin($path, $user, $mode, array $header, array $accessList) { $this->path = $this->getPathToRealFile($path); @@ -131,7 +131,7 @@ class Encryption implements IEncryptionModule { // always use the version from the original file, also part files // need to have a correct version number if they get moved over to the // final location - $this->version = (int)$this->keyManager->getVersion($this->stripPartFileExtension($path), new View()); + $this->version = (int) $this->keyManager->getVersion($this->stripPartFileExtension($path), new View()); if ( $mode === 'w' @@ -285,7 +285,7 @@ class Encryption implements IEncryptionModule { // Read the chunk from the start of $data $chunk = substr($data, 0, $this->getUnencryptedBlockSize(true)); - $encrypted .= $this->crypt->symmetricEncryptFileContent($chunk, $this->fileKey, $this->version + 1, (string)$position); + $encrypted .= $this->crypt->symmetricEncryptFileContent($chunk, $this->fileKey, $this->version + 1, (string) $position); // Remove the chunk we just processed from // $data, leaving only unprocessed data in $data diff --git a/apps/encryption/lib/Exceptions/PrivateKeyMissingException.php b/apps/encryption/lib/Exceptions/PrivateKeyMissingException.php index 9e3dea67f3e..15fe8f4e72f 100644 --- a/apps/encryption/lib/Exceptions/PrivateKeyMissingException.php +++ b/apps/encryption/lib/Exceptions/PrivateKeyMissingException.php @@ -16,7 +16,7 @@ class PrivateKeyMissingException extends GenericEncryptionException { */ public function __construct($userId) { if (empty($userId)) { - $userId = "<no-user-id-given>"; + $userId = '<no-user-id-given>'; } parent::__construct("Private Key missing for user: $userId"); } diff --git a/apps/encryption/lib/Exceptions/PublicKeyMissingException.php b/apps/encryption/lib/Exceptions/PublicKeyMissingException.php index 3173f0fb44a..78eeeccf47d 100644 --- a/apps/encryption/lib/Exceptions/PublicKeyMissingException.php +++ b/apps/encryption/lib/Exceptions/PublicKeyMissingException.php @@ -16,7 +16,7 @@ class PublicKeyMissingException extends GenericEncryptionException { */ public function __construct($userId) { if (empty($userId)) { - $userId = "<no-user-id-given>"; + $userId = '<no-user-id-given>'; } parent::__construct("Public Key missing for user: $userId"); } diff --git a/apps/encryption/lib/HookManager.php b/apps/encryption/lib/HookManager.php index 71fa4f0a08e..6ad56ebad78 100644 --- a/apps/encryption/lib/HookManager.php +++ b/apps/encryption/lib/HookManager.php @@ -15,7 +15,7 @@ class HookManager { /** * @param array|IHook $instances - * - This accepts either a single instance of IHook or an array of instances of IHook + * - This accepts either a single instance of IHook or an array of instances of IHook * @return bool */ public function registerHook($instances) { diff --git a/apps/encryption/lib/KeyManager.php b/apps/encryption/lib/KeyManager.php index 9fd6c7655af..7b55a04f069 100644 --- a/apps/encryption/lib/KeyManager.php +++ b/apps/encryption/lib/KeyManager.php @@ -42,7 +42,7 @@ class KeyManager { $this->recoveryKeyId = $this->config->getAppValue('encryption', 'recoveryKeyId'); if (empty($this->recoveryKeyId)) { - $this->recoveryKeyId = 'recoveryKey_' . substr(md5((string)time()), 0, 8); + $this->recoveryKeyId = 'recoveryKey_' . substr(md5((string) time()), 0, 8); $this->config->setAppValue('encryption', 'recoveryKeyId', $this->recoveryKeyId); @@ -51,14 +51,14 @@ class KeyManager { $this->publicShareKeyId = $this->config->getAppValue('encryption', 'publicShareKeyId'); if (empty($this->publicShareKeyId)) { - $this->publicShareKeyId = 'pubShare_' . substr(md5((string)time()), 0, 8); + $this->publicShareKeyId = 'pubShare_' . substr(md5((string) time()), 0, 8); $this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId); } $this->masterKeyId = $this->config->getAppValue('encryption', 'masterKeyId'); if (empty($this->masterKeyId)) { - $this->masterKeyId = 'master_' . substr(md5((string)time()), 0, 8); + $this->masterKeyId = 'master_' . substr(md5((string) time()), 0, 8); $this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId); } diff --git a/apps/encryption/lib/Migration/SetMasterKeyStatus.php b/apps/encryption/lib/Migration/SetMasterKeyStatus.php index 598f2dd516a..91c8e8acac6 100644 --- a/apps/encryption/lib/Migration/SetMasterKeyStatus.php +++ b/apps/encryption/lib/Migration/SetMasterKeyStatus.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -17,7 +18,7 @@ use OCP\Migration\IRepairStep; class SetMasterKeyStatus implements IRepairStep { - /** @var IConfig */ + /** @var IConfig */ private $config; diff --git a/apps/encryption/lib/Settings/Admin.php b/apps/encryption/lib/Settings/Admin.php index ea313225d82..4cbf1a4e715 100644 --- a/apps/encryption/lib/Settings/Admin.php +++ b/apps/encryption/lib/Settings/Admin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -71,8 +72,8 @@ class Admin implements ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/encryption/lib/Settings/Personal.php b/apps/encryption/lib/Settings/Personal.php index 93609acdd03..1e3a93c28c4 100644 --- a/apps/encryption/lib/Settings/Personal.php +++ b/apps/encryption/lib/Settings/Personal.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -64,8 +65,8 @@ class Personal implements ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 * @since 9.1 diff --git a/apps/encryption/templates/settings-admin.php b/apps/encryption/templates/settings-admin.php index 22b05f6efcf..6d06f28ffe7 100644 --- a/apps/encryption/templates/settings-admin.php +++ b/apps/encryption/templates/settings-admin.php @@ -11,9 +11,9 @@ script('encryption', 'settings-admin'); style('encryption', 'settings-admin'); ?> <form id="ocDefaultEncryptionModule" class="sub-section"> - <h3><?php p($l->t("Default encryption module")); ?></h3> - <?php if (!$_["initStatus"] && $_['masterKeyEnabled'] === false): ?> - <?php p($l->t("Encryption app is enabled but your keys are not initialized, please log-out and log-in again")); ?> + <h3><?php p($l->t('Default encryption module')); ?></h3> + <?php if (!$_['initStatus'] && $_['masterKeyEnabled'] === false): ?> + <?php p($l->t('Encryption app is enabled but your keys are not initialized, please log-out and log-in again')); ?> <?php else: ?> <p id="encryptHomeStorageSetting"> <input type="checkbox" class="checkbox" name="encrypt_home_storage" id="encryptHomeStorage" @@ -21,61 +21,61 @@ style('encryption', 'settings-admin'); print_unescaped('checked="checked"'); } ?> /> <label for="encryptHomeStorage"><?php p($l->t('Encrypt the home storage'));?></label></br> - <em><?php p($l->t("Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted")); ?></em> + <em><?php p($l->t('Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted')); ?></em> </p> <br /> <?php if ($_['masterKeyEnabled'] === false): ?> <p id="encryptionSetRecoveryKey"> - <?php $_["recoveryEnabled"] === '0' ? p($l->t("Enable recovery key")) : p($l->t("Disable recovery key")); ?> + <?php $_['recoveryEnabled'] === '0' ? p($l->t('Enable recovery key')) : p($l->t('Disable recovery key')); ?> <span class="msg"></span> <br/> <em> - <?php p($l->t("The recovery key is an additional encryption key used to encrypt files. It is used to recover files from an account if the password is forgotten.")) ?> + <?php p($l->t('The recovery key is an additional encryption key used to encrypt files. It is used to recover files from an account if the password is forgotten.')) ?> </em> <br/> <input type="password" name="encryptionRecoveryPassword" id="encryptionRecoveryPassword" - placeholder="<?php p($l->t("Recovery key password")); ?>"/> + placeholder="<?php p($l->t('Recovery key password')); ?>"/> <input type="password" name="encryptionRecoveryPassword" id="repeatEncryptionRecoveryPassword" - placeholder="<?php p($l->t("Repeat recovery key password")); ?>"/> + placeholder="<?php p($l->t('Repeat recovery key password')); ?>"/> <input type="button" name="enableRecoveryKey" id="enableRecoveryKey" - status="<?php p($_["recoveryEnabled"]) ?>" - value="<?php $_["recoveryEnabled"] === '0' ? p($l->t("Enable recovery key")) : p($l->t("Disable recovery key")); ?>"/> + status="<?php p($_['recoveryEnabled']) ?>" + value="<?php $_['recoveryEnabled'] === '0' ? p($l->t('Enable recovery key')) : p($l->t('Disable recovery key')); ?>"/> </p> <br/><br/> <p name="changeRecoveryPasswordBlock" id="encryptionChangeRecoveryKey" <?php if ($_['recoveryEnabled'] === '0') { print_unescaped('class="hidden"'); }?>> - <?php p($l->t("Change recovery key password:")); ?> + <?php p($l->t('Change recovery key password:')); ?> <span class="msg"></span> <br/> <input type="password" name="changeRecoveryPassword" id="oldEncryptionRecoveryPassword" - placeholder="<?php p($l->t("Old recovery key password")); ?>"/> + placeholder="<?php p($l->t('Old recovery key password')); ?>"/> <br /> <input type="password" name="changeRecoveryPassword" id="newEncryptionRecoveryPassword" - placeholder="<?php p($l->t("New recovery key password")); ?>"/> + placeholder="<?php p($l->t('New recovery key password')); ?>"/> <input type="password" name="changeRecoveryPassword" id="repeatedNewEncryptionRecoveryPassword" - placeholder="<?php p($l->t("Repeat new recovery key password")); ?>"/> + placeholder="<?php p($l->t('Repeat new recovery key password')); ?>"/> <button type="button" name="submitChangeRecoveryKey"> - <?php p($l->t("Change Password")); ?> + <?php p($l->t('Change Password')); ?> </button> </p> <?php endif; ?> diff --git a/apps/encryption/templates/settings-personal.php b/apps/encryption/templates/settings-personal.php index a875c3c6ed6..18b5ef341b9 100644 --- a/apps/encryption/templates/settings-personal.php +++ b/apps/encryption/templates/settings-personal.php @@ -12,19 +12,19 @@ script('encryption', 'settings-personal'); <form id="ocDefaultEncryptionModule" class="section"> <h2 data-anchor-name="basic-encryption-module"><?php p($l->t('Basic encryption module')); ?></h2> - <?php if ($_["initialized"] === \OCA\Encryption\Session::NOT_INITIALIZED): ?> + <?php if ($_['initialized'] === \OCA\Encryption\Session::NOT_INITIALIZED): ?> - <?php p($l->t("Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again.")); ?> + <?php p($l->t('Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again.')); ?> - <?php elseif ($_["initialized"] === \OCA\Encryption\Session::INIT_EXECUTED): ?> + <?php elseif ($_['initialized'] === \OCA\Encryption\Session::INIT_EXECUTED): ?> <p> <a name="changePKPasswd" /> <label for="changePrivateKeyPasswd"> - <em><?php p($l->t("Your private key password no longer matches your log-in password.")); ?></em> + <em><?php p($l->t('Your private key password no longer matches your log-in password.')); ?></em> </label> <br /> - <?php p($l->t("Set your old private key password to your current log-in password:")); ?> - <?php if ($_["recoveryEnabledForUser"]): + <?php p($l->t('Set your old private key password to your current log-in password:')); ?> + <?php if ($_['recoveryEnabledForUser']): p(' ' . $l->t('If you do not remember your old password you can ask your administrator to recover your files.')); endif; ?> <br /> @@ -32,29 +32,29 @@ script('encryption', 'settings-personal'); type="password" name="changePrivateKeyPassword" id="oldPrivateKeyPassword" /> - <label for="oldPrivateKeyPassword"><?php p($l->t("Old log-in password")); ?></label> + <label for="oldPrivateKeyPassword"><?php p($l->t('Old log-in password')); ?></label> <br /> <input type="password" name="changePrivateKeyPassword" id="newPrivateKeyPassword" /> - <label for="newRecoveryPassword"><?php p($l->t("Current log-in password")); ?></label> + <label for="newRecoveryPassword"><?php p($l->t('Current log-in password')); ?></label> <br /> <button type="button" name="submitChangePrivateKeyPassword" - disabled><?php p($l->t("Update Private Key Password")); ?> + disabled><?php p($l->t('Update Private Key Password')); ?> </button> <span class="msg"></span> </p> - <?php elseif ($_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL): ?> + <?php elseif ($_['recoveryEnabled'] && $_['privateKeySet'] && $_['initialized'] === \OCA\Encryption\Session::INIT_SUCCESSFUL): ?> <br /> <p id="userEnableRecovery"> - <label for="userEnableRecovery"><?php p($l->t("Enable password recovery:")); ?></label> + <label for="userEnableRecovery"><?php p($l->t('Enable password recovery:')); ?></label> <span class="msg"></span> <br /> - <em><?php p($l->t("Enabling this option will allow you to reobtain access to your encrypted files in case of password loss")); ?></em> + <em><?php p($l->t('Enabling this option will allow you to reobtain access to your encrypted files in case of password loss')); ?></em> <br /> <input type="radio" @@ -62,8 +62,8 @@ script('encryption', 'settings-personal'); id="userEnableRecoveryCheckbox" name="userEnableRecovery" value="1" - <?php echo($_["recoveryEnabledForUser"] ? 'checked="checked"' : ''); ?> /> - <label for="userEnableRecoveryCheckbox"><?php p($l->t("Enabled")); ?></label> + <?php echo($_['recoveryEnabledForUser'] ? 'checked="checked"' : ''); ?> /> + <label for="userEnableRecoveryCheckbox"><?php p($l->t('Enabled')); ?></label> <br /> <input @@ -72,8 +72,8 @@ script('encryption', 'settings-personal'); id="userDisableRecoveryCheckbox" name="userEnableRecovery" value="0" - <?php echo($_["recoveryEnabledForUser"] === false ? 'checked="checked"' : ''); ?> /> - <label for="userDisableRecoveryCheckbox"><?php p($l->t("Disabled")); ?></label> + <?php echo($_['recoveryEnabledForUser'] === false ? 'checked="checked"' : ''); ?> /> + <label for="userDisableRecoveryCheckbox"><?php p($l->t('Disabled')); ?></label> </p> <?php endif; ?> </form> diff --git a/apps/encryption/tests/Command/FixEncryptedVersionTest.php b/apps/encryption/tests/Command/FixEncryptedVersionTest.php index 9ea981e355d..c021c366ad8 100644 --- a/apps/encryption/tests/Command/FixEncryptedVersionTest.php +++ b/apps/encryption/tests/Command/FixEncryptedVersionTest.php @@ -79,7 +79,7 @@ class FixEncryptedVersionTest extends TestCase { $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); - $view = new View("/" . $this->userId . "/files"); + $view = new View('/' . $this->userId . '/files'); $view->touch('hello.txt'); $view->touch('world.txt'); @@ -147,7 +147,7 @@ Fixed the file: \"/$this->userId/files/world.txt\" with version 4", $output); $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); - $view = new View("/" . $this->userId . "/files"); + $view = new View('/' . $this->userId . '/files'); $view->touch('hello.txt'); $view->touch('world.txt'); @@ -206,7 +206,7 @@ Fixed the file: \"/$this->userId/files/world.txt\" with version 4", $output); $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); - $view = new View("/" . $this->userId . "/files"); + $view = new View('/' . $this->userId . '/files'); $view->touch('bar.txt'); for ($i = 0; $i < 40; $i++) { @@ -227,7 +227,7 @@ Fixed the file: \"/$this->userId/files/world.txt\" with version 4", $output); ]); $cacheInfo = $cache->get($fileInfo->getId()); - $encryptedVersion = $cacheInfo["encryptedVersion"]; + $encryptedVersion = $cacheInfo['encryptedVersion']; $this->assertEquals(15, $encryptedVersion); } @@ -236,7 +236,7 @@ Fixed the file: \"/$this->userId/files/world.txt\" with version 4", $output); $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); - $view = new View("/" . $this->userId . "/files"); + $view = new View('/' . $this->userId . '/files'); // create a file, it's encrypted and also the version is set in the database $view->touch('hello.txt'); @@ -279,14 +279,14 @@ Fixed the file: \"/$this->userId/files/hello.txt\" with version 0 (unencrypted)" $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); - $view = new View("/" . $this->userId . "/files"); + $view = new View('/' . $this->userId . '/files'); $view->touch('hello.txt'); $view->touch('world.txt'); $this->commandTester->execute([ 'user' => $this->userId, - '--path' => "/hello.txt" + '--path' => '/hello.txt' ]); $output = $this->commandTester->getDisplay(); @@ -303,7 +303,7 @@ The file \"/$this->userId/files/hello.txt\" is: OK", $output); $this->util->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); - $view = new View("/" . $this->userId . "/files"); + $view = new View('/' . $this->userId . '/files'); $view->mkdir('sub'); $view->touch('sub/hello.txt'); @@ -311,7 +311,7 @@ The file \"/$this->userId/files/hello.txt\" is: OK", $output); $this->commandTester->execute([ 'user' => $this->userId, - '--path' => "/sub" + '--path' => '/sub' ]); $output = $this->commandTester->getDisplay(); @@ -327,7 +327,7 @@ The file \"/$this->userId/files/sub/hello.txt\" is: OK", $output); $this->commandTester->execute([ 'user' => null, - '--path' => "/" + '--path' => '/' ]); $output = $this->commandTester->getDisplay(); @@ -341,7 +341,7 @@ The file \"/$this->userId/files/sub/hello.txt\" is: OK", $output); $this->commandTester->execute([ 'user' => 'nonexisting', - '--path' => "/" + '--path' => '/' ]); $output = $this->commandTester->getDisplay(); diff --git a/apps/encryption/tests/Command/TestEnableMasterKey.php b/apps/encryption/tests/Command/TestEnableMasterKey.php index 8e7dabf8bb6..47bc978627d 100644 --- a/apps/encryption/tests/Command/TestEnableMasterKey.php +++ b/apps/encryption/tests/Command/TestEnableMasterKey.php @@ -17,22 +17,22 @@ use Test\TestCase; class TestEnableMasterKey extends TestCase { - /** @var EnableMasterKey */ + /** @var EnableMasterKey */ protected $enableMasterKey; - /** @var Util | \PHPUnit\Framework\MockObject\MockObject */ + /** @var Util | \PHPUnit\Framework\MockObject\MockObject */ protected $util; - /** @var \OCP\IConfig | \PHPUnit\Framework\MockObject\MockObject */ + /** @var \OCP\IConfig | \PHPUnit\Framework\MockObject\MockObject */ protected $config; /** @var \Symfony\Component\Console\Helper\QuestionHelper | \PHPUnit\Framework\MockObject\MockObject */ protected $questionHelper; - /** @var \Symfony\Component\Console\Output\OutputInterface | \PHPUnit\Framework\MockObject\MockObject */ + /** @var \Symfony\Component\Console\Output\OutputInterface | \PHPUnit\Framework\MockObject\MockObject */ protected $output; - /** @var \Symfony\Component\Console\Input\InputInterface | \PHPUnit\Framework\MockObject\MockObject */ + /** @var \Symfony\Component\Console\Input\InputInterface | \PHPUnit\Framework\MockObject\MockObject */ protected $input; protected function setUp(): void { diff --git a/apps/encryption/tests/Controller/StatusControllerTest.php b/apps/encryption/tests/Controller/StatusControllerTest.php index 3c59a80fe15..26210946cce 100644 --- a/apps/encryption/tests/Controller/StatusControllerTest.php +++ b/apps/encryption/tests/Controller/StatusControllerTest.php @@ -22,10 +22,10 @@ class StatusControllerTest extends TestCase { /** @var \OCP\IL10N|\PHPUnit\Framework\MockObject\MockObject */ private $l10nMock; - /** @var \OCA\Encryption\Session | \PHPUnit\Framework\MockObject\MockObject */ + /** @var \OCA\Encryption\Session | \PHPUnit\Framework\MockObject\MockObject */ protected $sessionMock; - /** @var IManager | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IManager | \PHPUnit\Framework\MockObject\MockObject */ protected $encryptionManagerMock; /** @var StatusController */ diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php index eea4186377c..97f78b66856 100644 --- a/apps/encryption/tests/Crypto/CryptTest.php +++ b/apps/encryption/tests/Crypto/CryptTest.php @@ -125,9 +125,9 @@ class CryptTest extends TestCase { public function testGetCipherWithInvalidCipher() { $this->config->expects($this->once()) - ->method('getSystemValueString') - ->with($this->equalTo('cipher'), $this->equalTo('AES-256-CTR')) - ->willReturn('Not-Existing-Cipher'); + ->method('getSystemValueString') + ->with($this->equalTo('cipher'), $this->equalTo('AES-256-CTR')) + ->willReturn('Not-Existing-Cipher'); $this->logger ->expects($this->once()) ->method('warning') diff --git a/apps/encryption/tests/Crypto/DecryptAllTest.php b/apps/encryption/tests/Crypto/DecryptAllTest.php index 7723fd5ce4f..2a46e542804 100644 --- a/apps/encryption/tests/Crypto/DecryptAllTest.php +++ b/apps/encryption/tests/Crypto/DecryptAllTest.php @@ -17,22 +17,22 @@ use Test\TestCase; class DecryptAllTest extends TestCase { - /** @var DecryptAll */ + /** @var DecryptAll */ protected $instance; - /** @var Util | \PHPUnit\Framework\MockObject\MockObject */ + /** @var Util | \PHPUnit\Framework\MockObject\MockObject */ protected $util; - /** @var KeyManager | \PHPUnit\Framework\MockObject\MockObject */ + /** @var KeyManager | \PHPUnit\Framework\MockObject\MockObject */ protected $keyManager; - /** @var Crypt | \PHPUnit\Framework\MockObject\MockObject */ + /** @var Crypt | \PHPUnit\Framework\MockObject\MockObject */ protected $crypt; - /** @var Session | \PHPUnit\Framework\MockObject\MockObject */ + /** @var Session | \PHPUnit\Framework\MockObject\MockObject */ protected $session; - /** @var QuestionHelper | \PHPUnit\Framework\MockObject\MockObject */ + /** @var QuestionHelper | \PHPUnit\Framework\MockObject\MockObject */ protected $questionHelper; protected function setUp(): void { diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php index ec05c422dd4..a63b826bf3c 100644 --- a/apps/encryption/tests/Crypto/EncryptAllTest.php +++ b/apps/encryption/tests/Crypto/EncryptAllTest.php @@ -29,49 +29,49 @@ use Test\TestCase; class EncryptAllTest extends TestCase { - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCA\Encryption\KeyManager */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCA\Encryption\KeyManager */ protected $keyManager; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCA\Encryption\Util */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCA\Encryption\Util */ protected $util; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IUserManager */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IUserManager */ protected $userManager; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCA\Encryption\Users\Setup */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCA\Encryption\Users\Setup */ protected $setupUser; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Files\View */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Files\View */ protected $view; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IConfig */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IConfig */ protected $config; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Mail\IMailer */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Mail\IMailer */ protected $mailer; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IL10N */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IL10N */ protected $l; - /** @var \PHPUnit\Framework\MockObject\MockObject | IFactory */ + /** @var \PHPUnit\Framework\MockObject\MockObject | IFactory */ protected $l10nFactory; - /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Helper\QuestionHelper */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Helper\QuestionHelper */ protected $questionHelper; - /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ protected $inputInterface; - /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */ protected $outputInterface; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\UserInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\UserInterface */ protected $userInterface; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Security\ISecureRandom */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Security\ISecureRandom */ protected $secureRandom; - /** @var EncryptAll */ + /** @var EncryptAll */ protected $encryptAll; protected function setUp(): void { @@ -136,7 +136,7 @@ class EncryptAllTest extends TestCase { } public function testEncryptAll() { - /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ + /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ $encryptAll = $this->getMockBuilder(EncryptAll::class) ->setConstructorArgs( [ @@ -165,7 +165,7 @@ class EncryptAllTest extends TestCase { } public function testEncryptAllWithMasterKey() { - /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ + /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ $encryptAll = $this->getMockBuilder(EncryptAll::class) ->setConstructorArgs( [ @@ -195,7 +195,7 @@ class EncryptAllTest extends TestCase { } public function testCreateKeyPairs() { - /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ + /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ $encryptAll = $this->getMockBuilder(EncryptAll::class) ->setConstructorArgs( [ @@ -245,7 +245,7 @@ class EncryptAllTest extends TestCase { } public function testEncryptAllUsersFiles() { - /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ + /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ $encryptAll = $this->getMockBuilder(EncryptAll::class) ->setConstructorArgs( [ @@ -281,7 +281,7 @@ class EncryptAllTest extends TestCase { } public function testEncryptUsersFiles() { - /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ + /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */ $encryptAll = $this->getMockBuilder(EncryptAll::class) ->setConstructorArgs( [ diff --git a/apps/encryption/tests/EncryptedStorageTest.php b/apps/encryption/tests/EncryptedStorageTest.php index 8c38586eb33..26d5d9c4941 100644 --- a/apps/encryption/tests/EncryptedStorageTest.php +++ b/apps/encryption/tests/EncryptedStorageTest.php @@ -31,23 +31,23 @@ class EncryptedStorageTest extends TestCase { use UserTrait; public function testMoveFromEncrypted() { - $this->createUser("test1", "test2"); - $this->setupForUser("test1", 'test2'); + $this->createUser('test1', 'test2'); + $this->setupForUser('test1', 'test2'); $unwrapped = new Temporary(); - $this->registerMount("test1", new TemporaryNoEncrypted(), "/test1/files/unenc"); - $this->registerMount("test1", $unwrapped, "/test1/files/enc"); + $this->registerMount('test1', new TemporaryNoEncrypted(), '/test1/files/unenc'); + $this->registerMount('test1', $unwrapped, '/test1/files/enc'); - $this->loginWithEncryption("test1"); + $this->loginWithEncryption('test1'); - $view = new View("/test1/files"); + $view = new View('/test1/files'); /** @var IMountManager $mountManager */ $mountManager = \OC::$server->get(IMountManager::class); - $encryptedMount = $mountManager->find("/test1/files/enc"); - $unencryptedMount = $mountManager->find("/test1/files/unenc"); + $encryptedMount = $mountManager->find('/test1/files/enc'); + $unencryptedMount = $mountManager->find('/test1/files/unenc'); $encryptedStorage = $encryptedMount->getStorage(); $unencryptedStorage = $unencryptedMount->getStorage(); $encryptedCache = $encryptedStorage->getCache(); @@ -56,15 +56,15 @@ class EncryptedStorageTest extends TestCase { $this->assertTrue($encryptedStorage->instanceOfStorage(Encryption::class)); $this->assertFalse($unencryptedStorage->instanceOfStorage(Encryption::class)); - $encryptedStorage->file_put_contents("foo.txt", "bar"); - $this->assertEquals("bar", $encryptedStorage->file_get_contents("foo.txt")); - $this->assertStringStartsWith("HBEGIN:oc_encryption_module:", $unwrapped->file_get_contents("foo.txt")); + $encryptedStorage->file_put_contents('foo.txt', 'bar'); + $this->assertEquals('bar', $encryptedStorage->file_get_contents('foo.txt')); + $this->assertStringStartsWith('HBEGIN:oc_encryption_module:', $unwrapped->file_get_contents('foo.txt')); - $this->assertTrue($encryptedCache->get("foo.txt")->isEncrypted()); + $this->assertTrue($encryptedCache->get('foo.txt')->isEncrypted()); - $view->rename("enc/foo.txt", "unenc/foo.txt"); + $view->rename('enc/foo.txt', 'unenc/foo.txt'); - $this->assertEquals("bar", $unencryptedStorage->file_get_contents("foo.txt")); - $this->assertFalse($unencryptedCache->get("foo.txt")->isEncrypted()); + $this->assertEquals('bar', $unencryptedStorage->file_get_contents('foo.txt')); + $this->assertFalse($unencryptedCache->get('foo.txt')->isEncrypted()); } } diff --git a/apps/encryption/tests/SessionTest.php b/apps/encryption/tests/SessionTest.php index 098120e2b03..61e57f66611 100644 --- a/apps/encryption/tests/SessionTest.php +++ b/apps/encryption/tests/SessionTest.php @@ -183,15 +183,15 @@ class SessionTest extends TestCase { $this->sessionMock->expects($this->any()) ->method('set') - ->willReturnCallback([$this, "setValueTester"]); + ->willReturnCallback([$this, 'setValueTester']); $this->sessionMock->expects($this->any()) ->method('get') - ->willReturnCallback([$this, "getValueTester"]); + ->willReturnCallback([$this, 'getValueTester']); $this->sessionMock->expects($this->any()) ->method('remove') - ->willReturnCallback([$this, "removeValueTester"]); + ->willReturnCallback([$this, 'removeValueTester']); $this->instance = new Session($this->sessionMock); diff --git a/apps/encryption/tests/Settings/AdminTest.php b/apps/encryption/tests/Settings/AdminTest.php index 80f7803badd..05db5185cf4 100644 --- a/apps/encryption/tests/Settings/AdminTest.php +++ b/apps/encryption/tests/Settings/AdminTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/federatedfilesharing/appinfo/routes.php b/apps/federatedfilesharing/appinfo/routes.php index 93becd2517b..a7e135548c7 100644 --- a/apps/federatedfilesharing/appinfo/routes.php +++ b/apps/federatedfilesharing/appinfo/routes.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php index f72209642ba..4c1fc4936e8 100644 --- a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php +++ b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php @@ -55,7 +55,7 @@ class RetryJob extends Job { $token = $argument['token']; $action = $argument['action']; $data = json_decode($argument['data'], true); - $try = (int)$argument['try'] + 1; + $try = (int) $argument['try'] + 1; $result = $this->notifications->sendUpdateToRemote($remote, $remoteId, $token, $action, $data, $try); @@ -75,7 +75,7 @@ class RetryJob extends Job { 'token' => $argument['token'], 'data' => $argument['data'], 'action' => $argument['action'], - 'try' => (int)$argument['try'] + 1, + 'try' => (int) $argument['try'] + 1, 'lastRun' => $this->time->getTime() ] ); @@ -85,7 +85,7 @@ class RetryJob extends Job { * Test if it is time for the next run */ protected function shouldRun(array $argument): bool { - $lastRun = (int)$argument['lastRun']; + $lastRun = (int) $argument['lastRun']; return (($this->time->getTime() - $lastRun) > $this->interval); } } diff --git a/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php b/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php index b5b5806d335..249e0a42f98 100644 --- a/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php +++ b/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -64,8 +65,8 @@ class MountPublicLinkController extends Controller { * @param string $token Token of the share * @param string $password Password of the share * @return JSONResponse<Http::STATUS_OK, array{remoteUrl: string}, array{}>|JSONResponse<Http::STATUS_BAD_REQUEST, array{message: string}, array{}> - * 200: Remote URL returned - * 400: Creating share is not possible + * 200: Remote URL returned + * 400: Creating share is not possible */ #[NoCSRFRequired] #[PublicPage] diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php index 5edb80b016b..bfab62c9750 100644 --- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php +++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php @@ -51,7 +51,7 @@ class RequestHandlerController extends OCSController { /** @var AddressHandler */ private $addressHandler; - /** @var IUserManager */ + /** @var IUserManager */ private $userManager; /** @var string */ @@ -385,7 +385,7 @@ class RequestHandlerController extends OCSController { try { $provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file'); - $ocmPermissions = $this->ncPermissions2ocmPermissions((int)$ncPermissions); + $ocmPermissions = $this->ncPermissions2ocmPermissions((int) $ncPermissions); $notification = ['sharedSecret' => $token, 'permission' => $ocmPermissions]; $provider->notificationReceived('RESHARE_CHANGE_PERMISSION', $id, $notification); $this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent('Federated share with id "%s" has updated permissions "%s"', [$id, implode(', ', $ocmPermissions)])); diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 8a8f76ffaf5..29983c79812 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -271,7 +271,7 @@ class FederatedShareProvider implements IShareProvider { $result = $qResult->fetchAll(); $qResult->closeCursor(); - if (isset($result[0]) && (int)$result[0]['remote_id'] > 0) { + if (isset($result[0]) && (int) $result[0]['remote_id'] > 0) { return $result[0]; } @@ -329,12 +329,12 @@ class FederatedShareProvider implements IShareProvider { */ $qb = $this->dbConnection->getQueryBuilder(); $qb->update('share') - ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) - ->set('permissions', $qb->createNamedParameter($share->getPermissions())) - ->set('uid_owner', $qb->createNamedParameter($share->getShareOwner())) - ->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy())) - ->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE)) - ->execute(); + ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) + ->set('permissions', $qb->createNamedParameter($share->getPermissions())) + ->set('uid_owner', $qb->createNamedParameter($share->getShareOwner())) + ->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy())) + ->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE)) + ->execute(); // send the updated permission to the owner/initiator, if they are not the same if ($share->getShareOwner() !== $share->getSharedBy()) { @@ -405,7 +405,7 @@ class FederatedShareProvider implements IShareProvider { public function getRemoteId(IShare $share): string { $query = $this->dbConnection->getQueryBuilder(); $query->select('remote_id')->from('federated_reshares') - ->where($query->expr()->eq('share_id', $query->createNamedParameter((int)$share->getId()))); + ->where($query->expr()->eq('share_id', $query->createNamedParameter((int) $share->getId()))); $result = $query->execute(); $data = $result->fetch(); $result->closeCursor(); @@ -414,7 +414,7 @@ class FederatedShareProvider implements IShareProvider { throw new ShareNotFound(); } - return (string)$data['remote_id']; + return (string) $data['remote_id']; } /** @@ -549,7 +549,7 @@ class FederatedShareProvider implements IShareProvider { public function getSharesInFolder($userId, Folder $node, $reshares, $shallow = true) { if (!$shallow) { - throw new \Exception("non-shallow getSharesInFolder is no longer supported"); + throw new \Exception('non-shallow getSharesInFolder is no longer supported'); } $qb = $this->dbConnection->getQueryBuilder(); @@ -805,15 +805,15 @@ class FederatedShareProvider implements IShareProvider { */ private function createShareObject($data) { $share = new Share($this->rootFolder, $this->userManager); - $share->setId((int)$data['id']) - ->setShareType((int)$data['share_type']) - ->setPermissions((int)$data['permissions']) + $share->setId((int) $data['id']) + ->setShareType((int) $data['share_type']) + ->setPermissions((int) $data['permissions']) ->setTarget($data['file_target']) - ->setMailSend((bool)$data['mail_send']) + ->setMailSend((bool) $data['mail_send']) ->setToken($data['token']); $shareTime = new \DateTime(); - $shareTime->setTimestamp((int)$data['stime']); + $shareTime->setTimestamp((int) $data['stime']); $share->setShareTime($shareTime); $share->setSharedWith($data['share_with']); @@ -823,13 +823,13 @@ class FederatedShareProvider implements IShareProvider { } else { //OLD SHARE $share->setSharedBy($data['uid_owner']); - $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); + $path = $this->getNode($share->getSharedBy(), (int) $data['file_source']); $owner = $path->getOwner(); $share->setShareOwner($owner->getUID()); } - $share->setNodeId((int)$data['file_source']); + $share->setNodeId((int) $data['file_source']); $share->setNodeType($data['item_type']); $share->setProviderId($this->identifier()); diff --git a/apps/federatedfilesharing/lib/Notifications.php b/apps/federatedfilesharing/lib/Notifications.php index 947427141b3..1725e28832b 100644 --- a/apps/federatedfilesharing/lib/Notifications.php +++ b/apps/federatedfilesharing/lib/Notifications.php @@ -116,7 +116,7 @@ class Notifications { ]; $ocmFields = $fields; - $ocmFields['remoteId'] = (string)$id; + $ocmFields['remoteId'] = (string) $id; $ocmFields['localId'] = $shareId; $ocmFields['name'] = $filename; @@ -286,7 +286,7 @@ class Notifications { * @return array * @throws \Exception */ - protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields, $action = "share") { + protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields, $action = 'share') { if ($this->addressHandler->urlContainProtocol($remoteDomain) === false) { $remoteDomain = 'https://' . $remoteDomain; } diff --git a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php index e1bbbbc310f..9a06e7b349b 100644 --- a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php +++ b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -306,7 +307,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { */ protected function executeAcceptShare(IShare $share) { try { - $fileId = (int)$share->getNode()->getId(); + $fileId = (int) $share->getNode()->getId(); [$file, $link] = $this->getFile($this->getCorrectUid($share), $fileId); } catch (\Exception $e) { throw new ShareNotFound(); @@ -382,7 +383,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { $this->federatedShareProvider->removeShareFromTable($share); try { - $fileId = (int)$share->getNode()->getId(); + $fileId = (int) $share->getNode()->getId(); [$file, $link] = $this->getFile($this->getCorrectUid($share), $fileId); } catch (\Exception $e) { throw new ShareNotFound(); @@ -431,7 +432,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { */ private function unshare($id, array $notification) { if (!$this->isS2SEnabled(true)) { - throw new ActionNotSupportedException("incoming shares disabled!"); + throw new ActionNotSupportedException('incoming shares disabled!'); } if (!isset($notification['sharedSecret'])) { @@ -474,12 +475,12 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { // delete all child in case of a group share $qb = $this->connection->getQueryBuilder(); $qb->delete('share_external') - ->where($qb->expr()->eq('parent', $qb->createNamedParameter((int)$share['id']))); + ->where($qb->expr()->eq('parent', $qb->createNamedParameter((int) $share['id']))); $qb->execute(); $ownerDisplayName = $this->getUserDisplayName($owner->getId()); - if ((int)$share['share_type'] === IShare::TYPE_USER) { + if ((int) $share['share_type'] === IShare::TYPE_USER) { if ($share['accepted']) { $path = trim($mountpoint, '/'); } else { @@ -488,7 +489,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { $notification = $this->notificationManager->createNotification(); $notification->setApp('files_sharing') ->setUser($share['user']) - ->setObject('remote_share', (int)$share['id']); + ->setObject('remote_share', (int) $share['id']); $this->notificationManager->markProcessed($notification); $event = $this->activityManager->generateEvent(); @@ -496,7 +497,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { ->setType('remote_share') ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path, $ownerDisplayName]) ->setAffectedUser($user) - ->setObject('remote_share', (int)$share['id'], $path); + ->setObject('remote_share', (int) $share['id'], $path); \OC::$server->getActivityManager()->publish($event); } } @@ -540,7 +541,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { $share = $this->federatedShareProvider->getShareById($id); // We have to respect the default share permissions - $permissions = $share->getPermissions() & (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL); + $permissions = $share->getPermissions() & (int) $this->config->getAppValue('core', 'shareapi_default_permissions', (string) Constants::PERMISSION_ALL); $share->setPermissions($permissions); // don't allow to share a file back to the owner @@ -563,7 +564,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider { $share->setSharedBy($share->getSharedWith()); $share->setSharedWith($shareWith); $result = $this->federatedShareProvider->create($share); - $this->federatedShareProvider->storeRemoteId((int)$result->getId(), $senderId); + $this->federatedShareProvider->storeRemoteId((int) $result->getId(), $senderId); return ['token' => $result->getToken(), 'providerId' => $result->getId()]; } else { throw new ProviderCouldNotAddShareException('resharing not allowed for share: ' . $id); diff --git a/apps/federatedfilesharing/lib/Settings/Admin.php b/apps/federatedfilesharing/lib/Settings/Admin.php index bb41aede1c8..508eaab9665 100644 --- a/apps/federatedfilesharing/lib/Settings/Admin.php +++ b/apps/federatedfilesharing/lib/Settings/Admin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -64,8 +65,8 @@ class Admin implements IDelegatedSettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/federatedfilesharing/lib/Settings/Personal.php b/apps/federatedfilesharing/lib/Settings/Personal.php index 4eee4064740..bee6cc538c6 100644 --- a/apps/federatedfilesharing/lib/Settings/Personal.php +++ b/apps/federatedfilesharing/lib/Settings/Personal.php @@ -69,8 +69,8 @@ class Personal implements ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 * @since 9.1 diff --git a/apps/federatedfilesharing/lib/Settings/PersonalSection.php b/apps/federatedfilesharing/lib/Settings/PersonalSection.php index 90f1f8ddee0..885d82b08cc 100644 --- a/apps/federatedfilesharing/lib/Settings/PersonalSection.php +++ b/apps/federatedfilesharing/lib/Settings/PersonalSection.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -55,8 +56,8 @@ class PersonalSection implements IIconSection { /** * @return int whether the form should be rather on the top or bottom of - * the settings navigation. The sections are arranged in ascending order of - * the priority values. It is required to return a value between 0 and 99. + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. * * E.g.: 70 * @since 9.1 diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php index dc89316746e..3fb2a938a66 100644 --- a/apps/federatedfilesharing/tests/AddressHandlerTest.php +++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php @@ -20,13 +20,13 @@ class AddressHandlerTest extends \Test\TestCase { /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ protected $contactsManager; - /** @var AddressHandler */ + /** @var AddressHandler */ private $addressHandler; - /** @var IURLGenerator | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IURLGenerator | \PHPUnit\Framework\MockObject\MockObject */ private $urlGenerator; - /** @var IL10N | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IL10N | \PHPUnit\Framework\MockObject\MockObject */ private $il10n; /** @var CloudIdManager */ diff --git a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php index 61487689cde..4b242d2ad9d 100644 --- a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php index ba3abb149b4..dc128021b28 100644 --- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php @@ -39,22 +39,22 @@ class RequestHandlerControllerTest extends \Test\TestCase { /** @var RequestHandlerController */ private $requestHandler; - /** @var \OCA\FederatedFileSharing\FederatedShareProvider|\PHPUnit\Framework\MockObject\MockObject */ + /** @var \OCA\FederatedFileSharing\FederatedShareProvider|\PHPUnit\Framework\MockObject\MockObject */ private $federatedShareProvider; - /** @var \OCA\FederatedFileSharing\Notifications|\PHPUnit\Framework\MockObject\MockObject */ + /** @var \OCA\FederatedFileSharing\Notifications|\PHPUnit\Framework\MockObject\MockObject */ private $notifications; - /** @var \OCA\FederatedFileSharing\AddressHandler|\PHPUnit\Framework\MockObject\MockObject */ + /** @var \OCA\FederatedFileSharing\AddressHandler|\PHPUnit\Framework\MockObject\MockObject */ private $addressHandler; - /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */ private $userManager; - /** @var IShare|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IShare|\PHPUnit\Framework\MockObject\MockObject */ private $share; - /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */ private $cloudIdManager; /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 8a62a78c865..72a7b2adeb8 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -50,11 +50,11 @@ class FederatedShareProviderTest extends \Test\TestCase { protected $logger; /** @var IRootFolder|MockObject */ protected $rootFolder; - /** @var IConfig|MockObject */ + /** @var IConfig|MockObject */ protected $config; - /** @var IUserManager|MockObject */ + /** @var IUserManager|MockObject */ protected $userManager; - /** @var \OCP\GlobalScale\IConfig|MockObject */ + /** @var \OCP\GlobalScale\IConfig|MockObject */ protected $gsConfig; /** @var IManager */ @@ -64,7 +64,7 @@ class FederatedShareProviderTest extends \Test\TestCase { /** @var IContactsManager|MockObject */ protected $contactsManager; - /** @var ICloudIdManager */ + /** @var ICloudIdManager */ private $cloudIdManager; /** @var MockObject|ICloudFederationProviderManager */ diff --git a/apps/federatedfilesharing/tests/NotificationsTest.php b/apps/federatedfilesharing/tests/NotificationsTest.php index 669e118fdd3..d0f5283e7a9 100644 --- a/apps/federatedfilesharing/tests/NotificationsTest.php +++ b/apps/federatedfilesharing/tests/NotificationsTest.php @@ -22,7 +22,7 @@ class NotificationsTest extends \Test\TestCase { /** @var AddressHandler|MockObject */ private $addressHandler; - /** @var IClientService|MockObject*/ + /** @var IClientService|MockObject */ private $httpClientService; /** @var IDiscoveryService|MockObject */ diff --git a/apps/federatedfilesharing/tests/Settings/AdminTest.php b/apps/federatedfilesharing/tests/Settings/AdminTest.php index 29f15b0199d..06843540e2c 100644 --- a/apps/federatedfilesharing/tests/Settings/AdminTest.php +++ b/apps/federatedfilesharing/tests/Settings/AdminTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/federatedfilesharing/tests/TestCase.php b/apps/federatedfilesharing/tests/TestCase.php index d2148770f73..9564cb7ec09 100644 --- a/apps/federatedfilesharing/tests/TestCase.php +++ b/apps/federatedfilesharing/tests/TestCase.php @@ -18,8 +18,8 @@ use OC\Group\Database; * Base class for sharing tests. */ abstract class TestCase extends \Test\TestCase { - public const TEST_FILES_SHARING_API_USER1 = "test-share-user1"; - public const TEST_FILES_SHARING_API_USER2 = "test-share-user2"; + public const TEST_FILES_SHARING_API_USER1 = 'test-share-user1'; + public const TEST_FILES_SHARING_API_USER2 = 'test-share-user2'; public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); diff --git a/apps/federatedfilesharing/tests/TokenHandlerTest.php b/apps/federatedfilesharing/tests/TokenHandlerTest.php index fea13bf9d2d..f6b4a2fa9e9 100644 --- a/apps/federatedfilesharing/tests/TokenHandlerTest.php +++ b/apps/federatedfilesharing/tests/TokenHandlerTest.php @@ -12,10 +12,10 @@ use OCP\Security\ISecureRandom; class TokenHandlerTest extends \Test\TestCase { - /** @var TokenHandler */ + /** @var TokenHandler */ private $tokenHandler; - /** @var ISecureRandom | \PHPUnit\Framework\MockObject\MockObject */ + /** @var ISecureRandom | \PHPUnit\Framework\MockObject\MockObject */ private $secureRandom; /** @var int */ diff --git a/apps/federation/lib/BackgroundJob/GetSharedSecret.php b/apps/federation/lib/BackgroundJob/GetSharedSecret.php index 1a23d58a7d1..859b62d25cf 100644 --- a/apps/federation/lib/BackgroundJob/GetSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/GetSharedSecret.php @@ -81,7 +81,7 @@ class GetSharedSecret extends Job { protected function run($argument) { $target = $argument['url']; - $created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime(); + $created = isset($argument['created']) ? (int) $argument['created'] : $this->time->getTime(); $currentTime = $this->time->getTime(); $source = $this->urlGenerator->getAbsoluteURL('/'); $source = rtrim($source, '/'); diff --git a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php index a1d0d2b0df0..ce681b6fbd1 100644 --- a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php +++ b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php @@ -84,7 +84,7 @@ class RequestSharedSecret extends Job { */ protected function run($argument) { $target = $argument['url']; - $created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime(); + $created = isset($argument['created']) ? (int) $argument['created'] : $this->time->getTime(); $currentTime = $this->time->getTime(); $source = $this->urlGenerator->getAbsoluteURL('/'); $source = rtrim($source, '/'); @@ -149,7 +149,7 @@ class RequestSharedSecret extends Job { */ protected function reAddJob(array $argument): void { $url = $argument['url']; - $created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime(); + $created = isset($argument['created']) ? (int) $argument['created'] : $this->time->getTime(); $token = $argument['token']; $attempt = $this->getAttempt($argument) + 1; diff --git a/apps/federation/lib/DbHandler.php b/apps/federation/lib/DbHandler.php index ca05417d768..7d9fe4dd2f9 100644 --- a/apps/federation/lib/DbHandler.php +++ b/apps/federation/lib/DbHandler.php @@ -196,7 +196,7 @@ class DbHandler { $statement = $query->executeQuery(); $result = $statement->fetch(); $statement->closeCursor(); - return (string)$result['shared_secret']; + return (string) $result['shared_secret']; } /** @@ -206,8 +206,8 @@ class DbHandler { $hash = $this->hash($url); $query = $this->connection->getQueryBuilder(); $query->update($this->dbTable) - ->set('status', $query->createNamedParameter($status)) - ->where($query->expr()->eq('url_hash', $query->createNamedParameter($hash))); + ->set('status', $query->createNamedParameter($status)) + ->where($query->expr()->eq('url_hash', $query->createNamedParameter($hash))); if (!is_null($token)) { $query->set('sync_token', $query->createNamedParameter($token)); } @@ -221,13 +221,13 @@ class DbHandler { $hash = $this->hash($url); $query = $this->connection->getQueryBuilder(); $query->select('status')->from($this->dbTable) - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) - ->setParameter('url_hash', $hash); + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) + ->setParameter('url_hash', $hash); $statement = $query->executeQuery(); $result = $statement->fetch(); $statement->closeCursor(); - return (int)$result['status']; + return (int) $result['status']; } /** @@ -262,7 +262,7 @@ class DbHandler { } $query = $this->connection->getQueryBuilder(); $query->select('url')->from($this->dbTable) - ->where($query->expr()->eq('shared_secret', $query->createNamedParameter($password))); + ->where($query->expr()->eq('shared_secret', $query->createNamedParameter($password))); $statement = $query->executeQuery(); $result = $statement->fetch(); diff --git a/apps/federation/lib/Settings/Admin.php b/apps/federation/lib/Settings/Admin.php index 56e27eda2b9..88d81f7818e 100644 --- a/apps/federation/lib/Settings/Admin.php +++ b/apps/federation/lib/Settings/Admin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -39,8 +40,8 @@ class Admin implements IDelegatedSettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ @@ -49,7 +50,7 @@ class Admin implements IDelegatedSettings { } public function getName(): ?string { - return $this->l->t("Trusted servers"); + return $this->l->t('Trusted servers'); } public function getAuthorizedAppConfig(): array { diff --git a/apps/federation/lib/SyncFederationAddressBooks.php b/apps/federation/lib/SyncFederationAddressBooks.php index 1b47c92db1a..aaed6ca9d94 100644 --- a/apps/federation/lib/SyncFederationAddressBooks.php +++ b/apps/federation/lib/SyncFederationAddressBooks.php @@ -50,7 +50,7 @@ class SyncFederationAddressBooks { continue; } $targetBookId = $trustedServer['url_hash']; - $targetPrincipal = "principals/system/system"; + $targetPrincipal = 'principals/system/system'; $targetBookProperties = [ '{DAV:}displayname' => $url ]; diff --git a/apps/federation/templates/settings-admin.php b/apps/federation/templates/settings-admin.php index dabd341ce72..80340611b2e 100644 --- a/apps/federation/templates/settings-admin.php +++ b/apps/federation/templates/settings-admin.php @@ -19,12 +19,12 @@ style('federation', 'settings-admin') <ul id="listOfTrustedServers"> <?php foreach ($_['trustedServers'] as $trustedServer) { ?> <li id="<?php p($trustedServer['id']); ?>"> - <?php if ((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?> + <?php if ((int) $trustedServer['status'] === TrustedServers::STATUS_OK) { ?> <span class="status success"></span> <?php } elseif ( - (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || - (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED + (int) $trustedServer['status'] === TrustedServers::STATUS_PENDING || + (int) $trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED ) { ?> <span class="status indeterminate"></span> <?php } else {?> diff --git a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php index a53bfb8d4c1..bc3e971fad2 100644 --- a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php +++ b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php @@ -33,7 +33,7 @@ class GetSharedSecretTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject|IClient */ private $httpClient; - /** @var \PHPUnit\Framework\MockObject\MockObject|IClientService */ + /** @var \PHPUnit\Framework\MockObject\MockObject|IClientService */ private $httpClientService; /** @var \PHPUnit\Framework\MockObject\MockObject|IJobList */ @@ -42,7 +42,7 @@ class GetSharedSecretTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject|IURLGenerator */ private $urlGenerator; - /** @var \PHPUnit\Framework\MockObject\MockObject|TrustedServers */ + /** @var \PHPUnit\Framework\MockObject\MockObject|TrustedServers */ private $trustedServers; /** @var \PHPUnit\Framework\MockObject\MockObject|LoggerInterface */ diff --git a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php index 9bfc6239301..7d67de38f5f 100644 --- a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php +++ b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php @@ -50,7 +50,7 @@ class RequestSharedSecretTest extends TestCase { /** @var MockObject|ITimeFactory */ private $timeFactory; - /** @var RequestSharedSecret */ + /** @var RequestSharedSecret */ private $requestSharedSecret; protected function setUp(): void { diff --git a/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php b/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php index ef008b991f5..9f2d41a1072 100644 --- a/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php +++ b/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php @@ -23,7 +23,7 @@ class OCSAuthAPIControllerTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject|IRequest */ private $request; - /** @var \PHPUnit\Framework\MockObject\MockObject|ISecureRandom */ + /** @var \PHPUnit\Framework\MockObject\MockObject|ISecureRandom */ private $secureRandom; /** @var \PHPUnit\Framework\MockObject\MockObject|JobList */ diff --git a/apps/federation/tests/DbHandlerTest.php b/apps/federation/tests/DbHandlerTest.php index fa06807d110..2dc6a54dbbd 100644 --- a/apps/federation/tests/DbHandlerTest.php +++ b/apps/federation/tests/DbHandlerTest.php @@ -18,16 +18,16 @@ use Test\TestCase; */ class DbHandlerTest extends TestCase { - /** @var DbHandler */ + /** @var DbHandler */ private $dbHandler; /** @var IL10N | \PHPUnit\Framework\MockObject\MockObject */ private $il10n; - /** @var IDBConnection */ + /** @var IDBConnection */ private $connection; - /** @var string */ + /** @var string */ private $dbTable = 'trusted_servers'; protected function setUp(): void { @@ -72,9 +72,9 @@ class DbHandlerTest extends TestCase { $qResult->closeCursor(); $this->assertSame(1, count($result)); $this->assertSame($expectedUrl, $result[0]['url']); - $this->assertSame($id, (int)$result[0]['id']); + $this->assertSame($id, (int) $result[0]['id']); $this->assertSame($expectedHash, $result[0]['url_hash']); - $this->assertSame(TrustedServers::STATUS_PENDING, (int)$result[0]['status']); + $this->assertSame(TrustedServers::STATUS_PENDING, (int) $result[0]['status']); } public function dataTestAddServer() { @@ -97,8 +97,8 @@ class DbHandlerTest extends TestCase { $this->assertSame(2, count($result)); $this->assertSame('server1', $result[0]['url']); $this->assertSame('server2', $result[1]['url']); - $this->assertSame($id1, (int)$result[0]['id']); - $this->assertSame($id2, (int)$result[1]['id']); + $this->assertSame($id1, (int) $result[0]['id']); + $this->assertSame($id2, (int) $result[1]['id']); $this->dbHandler->removeServer($id2); $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); @@ -108,7 +108,7 @@ class DbHandlerTest extends TestCase { $qResult->closeCursor(); $this->assertSame(1, count($result)); $this->assertSame('server1', $result[0]['url']); - $this->assertSame($id1, (int)$result[0]['id']); + $this->assertSame($id1, (int) $result[0]['id']); } @@ -128,8 +128,8 @@ class DbHandlerTest extends TestCase { $this->assertSame(2, count($result)); $this->assertSame('server1', $result[0]['url']); $this->assertSame('server2', $result[1]['url']); - $this->assertSame($id1, (int)$result[0]['id']); - $this->assertSame($id2, (int)$result[1]['id']); + $this->assertSame($id1, (int) $result[0]['id']); + $this->assertSame($id2, (int) $result[1]['id']); } /** @@ -216,7 +216,7 @@ class DbHandlerTest extends TestCase { $result = $qResult->fetchAll(); $qResult->closeCursor(); $this->assertSame(1, count($result)); - $this->assertSame(TrustedServers::STATUS_PENDING, (int)$result[0]['status']); + $this->assertSame(TrustedServers::STATUS_PENDING, (int) $result[0]['status']); $this->dbHandler->setServerStatus('http://server1', TrustedServers::STATUS_OK); $query = $this->connection->getQueryBuilder()->select('*')->from($this->dbTable); @@ -224,7 +224,7 @@ class DbHandlerTest extends TestCase { $result = $qResult->fetchAll(); $qResult->closeCursor(); $this->assertSame(1, count($result)); - $this->assertSame(TrustedServers::STATUS_OK, (int)$result[0]['status']); + $this->assertSame(TrustedServers::STATUS_OK, (int) $result[0]['status']); } public function testGetServerStatus() { diff --git a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php index 5cdd255a497..85b918a80f1 100644 --- a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php +++ b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php @@ -17,7 +17,7 @@ use Test\TestCase; class AddServerMiddlewareTest extends TestCase { - /** @var \PHPUnit\Framework\MockObject\MockObject | LoggerInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | LoggerInterface */ private $logger; /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IL10N */ @@ -25,7 +25,7 @@ class AddServerMiddlewareTest extends TestCase { private AddServerMiddleware $middleware; - /** @var \PHPUnit\Framework\MockObject\MockObject | SettingsController */ + /** @var \PHPUnit\Framework\MockObject\MockObject | SettingsController */ private $controller; protected function setUp(): void { diff --git a/apps/federation/tests/Settings/AdminTest.php b/apps/federation/tests/Settings/AdminTest.php index 3bbf4c4a9e7..5b2ad29ea47 100644 --- a/apps/federation/tests/Settings/AdminTest.php +++ b/apps/federation/tests/Settings/AdminTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/federation/tests/SyncFederationAddressbooksTest.php b/apps/federation/tests/SyncFederationAddressbooksTest.php index 1b53f238bfa..0f13dd0ec51 100644 --- a/apps/federation/tests/SyncFederationAddressbooksTest.php +++ b/apps/federation/tests/SyncFederationAddressbooksTest.php @@ -18,10 +18,10 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { /** @var array */ private $callBacks = []; - /** @var MockObject | DiscoveryService */ + /** @var MockObject | DiscoveryService */ private $discoveryService; - /** @var MockObject|LoggerInterface */ + /** @var MockObject|LoggerInterface */ private $logger; protected function setUp(): void { diff --git a/apps/federation/tests/TrustedServersTest.php b/apps/federation/tests/TrustedServersTest.php index 52979cdc538..93c66ea8831 100644 --- a/apps/federation/tests/TrustedServersTest.php +++ b/apps/federation/tests/TrustedServersTest.php @@ -24,31 +24,31 @@ class TrustedServersTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject | TrustedServers */ private $trustedServers; - /** @var \PHPUnit\Framework\MockObject\MockObject | DbHandler */ + /** @var \PHPUnit\Framework\MockObject\MockObject | DbHandler */ private $dbHandler; /** @var \PHPUnit\Framework\MockObject\MockObject | IClientService */ private $httpClientService; - /** @var \PHPUnit\Framework\MockObject\MockObject | IClient */ + /** @var \PHPUnit\Framework\MockObject\MockObject | IClient */ private $httpClient; - /** @var \PHPUnit\Framework\MockObject\MockObject | IResponse */ + /** @var \PHPUnit\Framework\MockObject\MockObject | IResponse */ private $response; - /** @var \PHPUnit\Framework\MockObject\MockObject | LoggerInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | LoggerInterface */ private $logger; - /** @var \PHPUnit\Framework\MockObject\MockObject | IJobList */ + /** @var \PHPUnit\Framework\MockObject\MockObject | IJobList */ private $jobList; - /** @var \PHPUnit\Framework\MockObject\MockObject | ISecureRandom */ + /** @var \PHPUnit\Framework\MockObject\MockObject | ISecureRandom */ private $secureRandom; - /** @var \PHPUnit\Framework\MockObject\MockObject | IConfig */ + /** @var \PHPUnit\Framework\MockObject\MockObject | IConfig */ private $config; - /** @var \PHPUnit\Framework\MockObject\MockObject | IEventDispatcher */ + /** @var \PHPUnit\Framework\MockObject\MockObject | IEventDispatcher */ private $dispatcher; /** @var \PHPUnit\Framework\MockObject\MockObject|ITimeFactory */ @@ -100,7 +100,7 @@ class TrustedServersTest extends TestCase { ->setMethods(['normalizeUrl', 'updateProtocol']) ->getMock(); $trustedServers->expects($this->once())->method('updateProtocol') - ->with('url')->willReturn('https://url'); + ->with('url')->willReturn('https://url'); $this->timeFactory->method('getTime') ->willReturn(1234567); $this->dbHandler->expects($this->once())->method('addServer')->with('https://url') @@ -127,9 +127,9 @@ class TrustedServersTest extends TestCase { public function testGetSharedSecret(): void { $this->dbHandler->expects($this->once()) - ->method('getSharedSecret') - ->with('url') - ->willReturn('secret'); + ->method('getSharedSecret') + ->with('url') + ->willReturn('secret'); $this->assertSame( $this->trustedServers->getSharedSecret('url'), 'secret' diff --git a/apps/files/ajax/download.php b/apps/files/ajax/download.php index fc434f79e2c..b5129119afb 100644 --- a/apps/files/ajax/download.php +++ b/apps/files/ajax/download.php @@ -9,8 +9,8 @@ OC_Util::checkLoggedIn(); \OC::$server->getSession()->close(); -$files = isset($_GET['files']) ? (string)$_GET['files'] : ''; -$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : ''; +$files = isset($_GET['files']) ? (string) $_GET['files'] : ''; +$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : ''; $files_list = json_decode($files); // in case we get only a single file diff --git a/apps/files/lib/Activity/FavoriteProvider.php b/apps/files/lib/Activity/FavoriteProvider.php index 00f1387df94..de645dfc933 100644 --- a/apps/files/lib/Activity/FavoriteProvider.php +++ b/apps/files/lib/Activity/FavoriteProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files/lib/Activity/Filter/Favorites.php b/apps/files/lib/Activity/Filter/Favorites.php index 1e63f6d9aee..4e2bc64efeb 100644 --- a/apps/files/lib/Activity/Filter/Favorites.php +++ b/apps/files/lib/Activity/Filter/Favorites.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files/lib/Activity/Filter/FileChanges.php b/apps/files/lib/Activity/Filter/FileChanges.php index e3d04a7b91a..b39fe292164 100644 --- a/apps/files/lib/Activity/Filter/FileChanges.php +++ b/apps/files/lib/Activity/Filter/FileChanges.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php index 51690742292..f9027642862 100644 --- a/apps/files/lib/Activity/Provider.php +++ b/apps/files/lib/Activity/Provider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files/lib/Activity/Settings/FavoriteAction.php b/apps/files/lib/Activity/Settings/FavoriteAction.php index 583edd5d9bc..73b200341ec 100644 --- a/apps/files/lib/Activity/Settings/FavoriteAction.php +++ b/apps/files/lib/Activity/Settings/FavoriteAction.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,8 +25,8 @@ class FavoriteAction extends FileActivitySettings { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/files/lib/Activity/Settings/FileChanged.php b/apps/files/lib/Activity/Settings/FileChanged.php index dfd6183e20b..c33ed5e1eba 100644 --- a/apps/files/lib/Activity/Settings/FileChanged.php +++ b/apps/files/lib/Activity/Settings/FileChanged.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,8 +25,8 @@ class FileChanged extends FileActivitySettings { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/files/lib/Activity/Settings/FileFavoriteChanged.php b/apps/files/lib/Activity/Settings/FileFavoriteChanged.php index f1412331d30..5000902ed3f 100644 --- a/apps/files/lib/Activity/Settings/FileFavoriteChanged.php +++ b/apps/files/lib/Activity/Settings/FileFavoriteChanged.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,8 +25,8 @@ class FileFavoriteChanged extends FileActivitySettings { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/files/lib/App.php b/apps/files/lib/App.php index e24f204b744..ae07b73a226 100644 --- a/apps/files/lib/App.php +++ b/apps/files/lib/App.php @@ -42,7 +42,7 @@ class App { public static function extendJsConfig($settings): void { $appConfig = json_decode($settings['array']['oc_appconfig'], true); - $maxChunkSize = (int)Server::get(IConfig::class)->getAppValue('files', 'max_chunk_size', (string)(10 * 1024 * 1024)); + $maxChunkSize = (int) Server::get(IConfig::class)->getAppValue('files', 'max_chunk_size', (string) (10 * 1024 * 1024)); $appConfig['files'] = [ 'max_chunk_size' => $maxChunkSize ]; diff --git a/apps/files/lib/BackgroundJob/TransferOwnership.php b/apps/files/lib/BackgroundJob/TransferOwnership.php index de8d1989733..562cde15f73 100644 --- a/apps/files/lib/BackgroundJob/TransferOwnership.php +++ b/apps/files/lib/BackgroundJob/TransferOwnership.php @@ -99,7 +99,7 @@ class TransferOwnership extends QueuedJob { 'targetUser' => $transfer->getTargetUser(), 'nodeName' => $transfer->getNodeName(), ]) - ->setObject('transfer', (string)$transfer->getId()); + ->setObject('transfer', (string) $transfer->getId()); $this->notificationManager->notify($notification); // Send notification to source user $notification = $this->notificationManager->createNotification(); @@ -111,7 +111,7 @@ class TransferOwnership extends QueuedJob { 'targetUser' => $transfer->getTargetUser(), 'nodeName' => $transfer->getNodeName(), ]) - ->setObject('transfer', (string)$transfer->getId()); + ->setObject('transfer', (string) $transfer->getId()); $this->notificationManager->notify($notification); } @@ -126,7 +126,7 @@ class TransferOwnership extends QueuedJob { 'targetUser' => $transfer->getTargetUser(), 'nodeName' => $transfer->getNodeName(), ]) - ->setObject('transfer', (string)$transfer->getId()); + ->setObject('transfer', (string) $transfer->getId()); $this->notificationManager->notify($notification); // Send notification to source user @@ -139,7 +139,7 @@ class TransferOwnership extends QueuedJob { 'targetUser' => $transfer->getTargetUser(), 'nodeName' => $transfer->getNodeName(), ]) - ->setObject('transfer', (string)$transfer->getId()); + ->setObject('transfer', (string) $transfer->getId()); $this->notificationManager->notify($notification); } } diff --git a/apps/files/lib/Command/Copy.php b/apps/files/lib/Command/Copy.php index 9981497232f..e51a1689907 100644 --- a/apps/files/lib/Command/Copy.php +++ b/apps/files/lib/Command/Copy.php @@ -30,10 +30,10 @@ class Copy extends Command { $this ->setName('files:copy') ->setDescription('Copy a file or folder') - ->addArgument('source', InputArgument::REQUIRED, "Source file id or path") - ->addArgument('target', InputArgument::REQUIRED, "Target path") + ->addArgument('source', InputArgument::REQUIRED, 'Source file id or path') + ->addArgument('target', InputArgument::REQUIRED, 'Target path') ->addOption('force', 'f', InputOption::VALUE_NONE, "Don't ask for confirmation and don't output any warnings") - ->addOption('no-target-directory', 'T', InputOption::VALUE_NONE, "When target path is folder, overwrite the folder instead of copying into the folder"); + ->addOption('no-target-directory', 'T', InputOption::VALUE_NONE, 'When target path is folder, overwrite the folder instead of copying into the folder'); } public function execute(InputInterface $input, OutputInterface $output): int { @@ -98,7 +98,7 @@ class Copy extends Command { /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); - $question = new ConfirmationQuestion("<info>" . $targetInput . "</info> already exists, overwrite? [y/N] ", false); + $question = new ConfirmationQuestion('<info>' . $targetInput . '</info> already exists, overwrite? [y/N] ', false); if (!$helper->ask($input, $output, $question)) { return 1; } diff --git a/apps/files/lib/Command/Delete.php b/apps/files/lib/Command/Delete.php index 32aa52aed2f..d984f839c91 100644 --- a/apps/files/lib/Command/Delete.php +++ b/apps/files/lib/Command/Delete.php @@ -30,7 +30,7 @@ class Delete extends Command { $this ->setName('files:delete') ->setDescription('Delete a file or folder') - ->addArgument('file', InputArgument::REQUIRED, "File id or path") + ->addArgument('file', InputArgument::REQUIRED, 'File id or path') ->addOption('force', 'f', InputOption::VALUE_NONE, "Don't ask for configuration and don't output any warnings"); } @@ -59,30 +59,30 @@ class Delete extends Command { return self::SUCCESS; } else { $node = $storage->getShare()->getNode(); - $output->writeln(""); + $output->writeln(''); } } $filesByUsers = $this->fileUtils->getFilesByUser($node); if (count($filesByUsers) > 1) { - $output->writeln("Warning: the provided file is accessible by more than one user"); - $output->writeln(" all of the following users will lose access to the file when deleted:"); - $output->writeln(""); + $output->writeln('Warning: the provided file is accessible by more than one user'); + $output->writeln(' all of the following users will lose access to the file when deleted:'); + $output->writeln(''); foreach ($filesByUsers as $user => $filesByUser) { - $output->writeln($user . ":"); - foreach($filesByUser as $file) { - $output->writeln(" - " . $file->getPath()); + $output->writeln($user . ':'); + foreach ($filesByUser as $file) { + $output->writeln(' - ' . $file->getPath()); } } - $output->writeln(""); + $output->writeln(''); } if ($node instanceof Folder) { $maybeContents = " and all it's contents"; } else { - $maybeContents = ""; + $maybeContents = ''; } - $question = new ConfirmationQuestion("Delete " . $node->getPath() . $maybeContents . "? [y/N] ", false); + $question = new ConfirmationQuestion('Delete ' . $node->getPath() . $maybeContents . '? [y/N] ', false); $deleteConfirmed = $helper->ask($input, $output, $question); } @@ -90,7 +90,7 @@ class Delete extends Command { if ($node->isDeletable()) { $node->delete(); } else { - $output->writeln("<error>File cannot be deleted, insufficient permissions.</error>"); + $output->writeln('<error>File cannot be deleted, insufficient permissions.</error>'); } } diff --git a/apps/files/lib/Command/Get.php b/apps/files/lib/Command/Get.php index 0d901fe8250..60e028f615e 100644 --- a/apps/files/lib/Command/Get.php +++ b/apps/files/lib/Command/Get.php @@ -26,8 +26,8 @@ class Get extends Command { $this ->setName('files:get') ->setDescription('Get the contents of a file') - ->addArgument('file', InputArgument::REQUIRED, "Source file id or Nextcloud path") - ->addArgument('output', InputArgument::OPTIONAL, "Target local file to output to, defaults to STDOUT"); + ->addArgument('file', InputArgument::REQUIRED, 'Source file id or Nextcloud path') + ->addArgument('output', InputArgument::OPTIONAL, 'Target local file to output to, defaults to STDOUT'); } public function execute(InputInterface $input, OutputInterface $output): int { @@ -48,7 +48,7 @@ class Get extends Command { $isTTY = stream_isatty(STDOUT); if ($outputName === null && $isTTY && $node->getMimePart() !== 'text') { $output->writeln([ - "<error>Warning: Binary output can mess up your terminal</error>", + '<error>Warning: Binary output can mess up your terminal</error>', " Use <info>occ files:get $fileInput -</info> to output it to the terminal anyway", " Or <info>occ files:get $fileInput <FILE></info> to save to a file instead" ]); diff --git a/apps/files/lib/Command/Move.php b/apps/files/lib/Command/Move.php index dd1cd1aae76..cd9e56f8e29 100644 --- a/apps/files/lib/Command/Move.php +++ b/apps/files/lib/Command/Move.php @@ -31,8 +31,8 @@ class Move extends Command { $this ->setName('files:move') ->setDescription('Move a file or folder') - ->addArgument('source', InputArgument::REQUIRED, "Source file id or path") - ->addArgument('target', InputArgument::REQUIRED, "Target path") + ->addArgument('source', InputArgument::REQUIRED, 'Source file id or path') + ->addArgument('target', InputArgument::REQUIRED, 'Target path') ->addOption('force', 'f', InputOption::VALUE_NONE, "Don't ask for configuration and don't output any warnings"); } @@ -88,7 +88,7 @@ class Move extends Command { /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); - $question = new ConfirmationQuestion("<info>" . $targetInput . "</info> already exists, overwrite? [y/N] ", false); + $question = new ConfirmationQuestion('<info>' . $targetInput . '</info> already exists, overwrite? [y/N] ', false); if (!$helper->ask($input, $output, $question)) { return 1; } diff --git a/apps/files/lib/Command/Object/Delete.php b/apps/files/lib/Command/Object/Delete.php index f9fc3a58229..07613ecc616 100644 --- a/apps/files/lib/Command/Object/Delete.php +++ b/apps/files/lib/Command/Object/Delete.php @@ -27,13 +27,13 @@ class Delete extends Command { $this ->setName('files:object:delete') ->setDescription('Delete an object from the object store') - ->addArgument('object', InputArgument::REQUIRED, "Object to delete") + ->addArgument('object', InputArgument::REQUIRED, 'Object to delete') ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket to delete the object from, only required in cases where it can't be determined from the config"); } public function execute(InputInterface $input, OutputInterface $output): int { $object = $input->getArgument('object'); - $objectStore = $this->objectUtils->getObjectStore($input->getOption("bucket"), $output); + $objectStore = $this->objectUtils->getObjectStore($input->getOption('bucket'), $output); if (!$objectStore) { return -1; } @@ -41,7 +41,7 @@ class Delete extends Command { if ($fileId = $this->objectUtils->objectExistsInDb($object)) { $output->writeln("<error>Warning, object $object belongs to an existing file, deleting the object will lead to unexpected behavior if not replaced</error>"); $output->writeln(" Note: use <info>occ files:delete $fileId</info> to delete the file cleanly or <info>occ info:file $fileId</info> for more information about the file"); - $output->writeln(""); + $output->writeln(''); } if (!$objectStore->objectExists($object)) { diff --git a/apps/files/lib/Command/Object/Get.php b/apps/files/lib/Command/Object/Get.php index 054278211f6..c32de020c5a 100644 --- a/apps/files/lib/Command/Object/Get.php +++ b/apps/files/lib/Command/Object/Get.php @@ -25,15 +25,15 @@ class Get extends Command { $this ->setName('files:object:get') ->setDescription('Get the contents of an object') - ->addArgument('object', InputArgument::REQUIRED, "Object to get") - ->addArgument('output', InputArgument::REQUIRED, "Target local file to output to, use - for STDOUT") + ->addArgument('object', InputArgument::REQUIRED, 'Object to get') + ->addArgument('output', InputArgument::REQUIRED, 'Target local file to output to, use - for STDOUT') ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket to get the object from, only required in cases where it can't be determined from the config"); } public function execute(InputInterface $input, OutputInterface $output): int { $object = $input->getArgument('object'); $outputName = $input->getArgument('output'); - $objectStore = $this->objectUtils->getObjectStore($input->getOption("bucket"), $output); + $objectStore = $this->objectUtils->getObjectStore($input->getOption('bucket'), $output); if (!$objectStore) { return self::FAILURE; } diff --git a/apps/files/lib/Command/Object/ObjectUtil.php b/apps/files/lib/Command/Object/ObjectUtil.php index 7021c815490..b85591e8a32 100644 --- a/apps/files/lib/Command/Object/ObjectUtil.php +++ b/apps/files/lib/Command/Object/ObjectUtil.php @@ -41,19 +41,19 @@ class ObjectUtil { public function getObjectStore(?string $bucket, OutputInterface $output): ?IObjectStore { $config = $this->getObjectStoreConfig(); if (!$config) { - $output->writeln("<error>Instance is not using primary object store</error>"); + $output->writeln('<error>Instance is not using primary object store</error>'); return null; } if ($config['multibucket'] && !$bucket) { - $output->writeln("<error>--bucket option required</error> because <info>multi bucket</info> is enabled."); + $output->writeln('<error>--bucket option required</error> because <info>multi bucket</info> is enabled.'); return null; } if (!isset($config['arguments'])) { - throw new \Exception("no arguments configured for object store configuration"); + throw new \Exception('no arguments configured for object store configuration'); } if (!isset($config['class'])) { - throw new \Exception("no class configured for object store configuration"); + throw new \Exception('no class configured for object store configuration'); } if ($bucket) { @@ -65,7 +65,7 @@ class ObjectUtil { $store = new $config['class']($config['arguments']); if (!$store instanceof IObjectStore) { - throw new \Exception("configured object store class is not an object store implementation"); + throw new \Exception('configured object store class is not an object store implementation'); } return $store; } @@ -78,7 +78,7 @@ class ObjectUtil { return false; } - $fileId = (int)substr($object, strlen('urn:oid:')); + $fileId = (int) substr($object, strlen('urn:oid:')); $query = $this->connection->getQueryBuilder(); $query->select('fileid') ->from('filecache') diff --git a/apps/files/lib/Command/Object/Put.php b/apps/files/lib/Command/Object/Put.php index 34e4ceb854b..fc49e28c70a 100644 --- a/apps/files/lib/Command/Object/Put.php +++ b/apps/files/lib/Command/Object/Put.php @@ -29,16 +29,16 @@ class Put extends Command { $this ->setName('files:object:put') ->setDescription('Write a file to the object store') - ->addArgument('input', InputArgument::REQUIRED, "Source local path, use - to read from STDIN") - ->addArgument('object', InputArgument::REQUIRED, "Object to write") + ->addArgument('input', InputArgument::REQUIRED, 'Source local path, use - to read from STDIN') + ->addArgument('object', InputArgument::REQUIRED, 'Object to write') ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket where to store the object, only required in cases where it can't be determined from the config"); ; } public function execute(InputInterface $input, OutputInterface $output): int { $object = $input->getArgument('object'); - $inputName = (string)$input->getArgument('input'); - $objectStore = $this->objectUtils->getObjectStore($input->getOption("bucket"), $output); + $inputName = (string) $input->getArgument('input'); + $objectStore = $this->objectUtils->getObjectStore($input->getOption('bucket'), $output); if (!$objectStore) { return -1; } @@ -46,11 +46,11 @@ class Put extends Command { if ($fileId = $this->objectUtils->objectExistsInDb($object)) { $output->writeln("<error>Warning, object $object belongs to an existing file, overwriting the object contents can lead to unexpected behavior.</error>"); $output->writeln("You can use <info>occ files:put $inputName $fileId</info> to write to the file safely."); - $output->writeln(""); + $output->writeln(''); /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); - $question = new ConfirmationQuestion("Write to the object anyway? [y/N] ", false); + $question = new ConfirmationQuestion('Write to the object anyway? [y/N] ', false); if (!$helper->ask($input, $output, $question)) { return -1; } diff --git a/apps/files/lib/Command/Put.php b/apps/files/lib/Command/Put.php index f72fa902346..fd9d75db78c 100644 --- a/apps/files/lib/Command/Put.php +++ b/apps/files/lib/Command/Put.php @@ -29,8 +29,8 @@ class Put extends Command { $this ->setName('files:put') ->setDescription('Write contents of a file') - ->addArgument('input', InputArgument::REQUIRED, "Source local path, use - to read from STDIN") - ->addArgument('file', InputArgument::REQUIRED, "Target Nextcloud file path to write to or fileid of existing file"); + ->addArgument('input', InputArgument::REQUIRED, 'Source local path, use - to read from STDIN') + ->addArgument('file', InputArgument::REQUIRED, 'Target Nextcloud file path to write to or fileid of existing file'); } public function execute(InputInterface $input, OutputInterface $output): int { diff --git a/apps/files/lib/Command/RepairTree.php b/apps/files/lib/Command/RepairTree.php index 99e92741a2e..ca4aa102647 100644 --- a/apps/files/lib/Command/RepairTree.php +++ b/apps/files/lib/Command/RepairTree.php @@ -33,7 +33,7 @@ class RepairTree extends Command { $rows = $this->findBrokenTreeBits(); $fix = !$input->getOption('dry-run'); - $output->writeln("Found " . count($rows) . " file entries with an invalid path"); + $output->writeln('Found ' . count($rows) . ' file entries with an invalid path'); if ($fix) { $this->connection->beginTransaction(); @@ -50,10 +50,10 @@ class RepairTree extends Command { $output->writeln("Path of file {$row['fileid']} is {$row['path']} but should be {$row['parent_path']}/{$row['name']} based on its parent", OutputInterface::VERBOSITY_VERBOSE); if ($fix) { - $fileId = $this->getFileId((int)$row['parent_storage'], $row['parent_path'] . '/' . $row['name']); + $fileId = $this->getFileId((int) $row['parent_storage'], $row['parent_path'] . '/' . $row['name']); if ($fileId > 0) { $output->writeln("Cache entry has already be recreated with id $fileId, deleting instead"); - $this->deleteById((int)$row['fileid']); + $this->deleteById((int) $row['fileid']); } else { $query->setParameters([ 'fileid' => $row['fileid'], diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index 68c80f6559a..6b192797ae6 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -302,9 +302,9 @@ class Scan extends Base { * Formats microtime into a human-readable format */ protected function formatExecTime(): string { - $secs = (int)round($this->execTime); + $secs = (int) round($this->execTime); # convert seconds into HH:MM:SS form - return sprintf('%02d:%02d:%02d', (int)($secs / 3600), ((int)($secs / 60) % 60), $secs % 60); + return sprintf('%02d:%02d:%02d', (int) ($secs / 3600), ((int) ($secs / 60) % 60), $secs % 60); } protected function reconnectToDatabase(OutputInterface $output): Connection { diff --git a/apps/files/lib/Command/ScanAppData.php b/apps/files/lib/Command/ScanAppData.php index 61f4b6f3ba2..635651c8160 100644 --- a/apps/files/lib/Command/ScanAppData.php +++ b/apps/files/lib/Command/ScanAppData.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -206,11 +207,11 @@ class ScanAppData extends Base { protected function formatExecTime(): string { $secs = round($this->execTime); # convert seconds into HH:MM:SS form - return sprintf('%02d:%02d:%02d', (int)($secs / 3600), ((int)($secs / 60) % 60), (int)$secs % 60); + return sprintf('%02d:%02d:%02d', (int) ($secs / 3600), ((int) ($secs / 60) % 60), (int) $secs % 60); } protected function reconnectToDatabase(OutputInterface $output): Connection { - /** @var Connection $connection*/ + /** @var Connection $connection */ $connection = \OC::$server->get(Connection::class); try { $connection->close(); diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php index db4c19dc54e..edc73e62c38 100644 --- a/apps/files/lib/Command/TransferOwnership.php +++ b/apps/files/lib/Command/TransferOwnership.php @@ -78,12 +78,12 @@ class TransferOwnership extends Command { $destinationUserObject = $this->userManager->get($input->getArgument('destination-user')); if (!$sourceUserObject instanceof IUser) { - $output->writeln("<error>Unknown source user " . $input->getArgument('source-user') . "</error>"); + $output->writeln('<error>Unknown source user ' . $input->getArgument('source-user') . '</error>'); return self::FAILURE; } if (!$destinationUserObject instanceof IUser) { - $output->writeln("<error>Unknown destination user " . $input->getArgument('destination-user') . "</error>"); + $output->writeln('<error>Unknown destination user ' . $input->getArgument('destination-user') . '</error>'); return self::FAILURE; } @@ -105,7 +105,7 @@ class TransferOwnership extends Command { } break; default: - $output->writeln("<error>Option --transfer-incoming-shares: wrong usage. Transfer aborted.</error>"); + $output->writeln('<error>Option --transfer-incoming-shares: wrong usage. Transfer aborted.</error>'); return self::FAILURE; } @@ -119,7 +119,7 @@ class TransferOwnership extends Command { $includeIncoming ); } catch (TransferOwnershipException $e) { - $output->writeln("<error>" . $e->getMessage() . "</error>"); + $output->writeln('<error>' . $e->getMessage() . '</error>'); return $e->getCode() !== 0 ? $e->getCode() : self::FAILURE; } diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index eb30601a937..27d41f8a016 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -339,7 +339,7 @@ class ApiController extends Controller { #[NoAdminRequired] public function setViewConfig(string $view, string $key, $value): JSONResponse { try { - $this->viewConfig->setConfig($view, $key, (string)$value); + $this->viewConfig->setConfig($view, $key, (string) $value); } catch (\InvalidArgumentException $e) { return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST); } @@ -368,7 +368,7 @@ class ApiController extends Controller { #[NoAdminRequired] public function setConfig(string $key, $value): JSONResponse { try { - $this->userConfig->setConfig($key, (string)$value); + $this->userConfig->setConfig($key, (string) $value); } catch (\InvalidArgumentException $e) { return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST); } diff --git a/apps/files/lib/Controller/DirectEditingController.php b/apps/files/lib/Controller/DirectEditingController.php index 693587f9c8a..422bacf9448 100644 --- a/apps/files/lib/Controller/DirectEditingController.php +++ b/apps/files/lib/Controller/DirectEditingController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files/lib/Controller/DirectEditingViewController.php b/apps/files/lib/Controller/DirectEditingViewController.php index 1d78e2af0e0..b13e68f7766 100644 --- a/apps/files/lib/Controller/DirectEditingViewController.php +++ b/apps/files/lib/Controller/DirectEditingViewController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files/lib/Controller/TransferOwnershipController.php b/apps/files/lib/Controller/TransferOwnershipController.php index 4ef6e392039..7edfd6d6b32 100644 --- a/apps/files/lib/Controller/TransferOwnershipController.php +++ b/apps/files/lib/Controller/TransferOwnershipController.php @@ -110,7 +110,7 @@ class TransferOwnershipController extends OCSController { 'targetUser' => $recipient, 'nodeName' => $node->getName(), ]) - ->setObject('transfer', (string)$transferOwnership->getId()); + ->setObject('transfer', (string) $transferOwnership->getId()); $this->notificationManager->notify($notification); @@ -146,7 +146,7 @@ class TransferOwnershipController extends OCSController { $notification = $this->notificationManager->createNotification(); $notification->setApp('files') - ->setObject('transfer', (string)$id); + ->setObject('transfer', (string) $id); $this->notificationManager->markProcessed($notification); return new DataResponse([], Http::STATUS_OK); @@ -177,7 +177,7 @@ class TransferOwnershipController extends OCSController { $notification = $this->notificationManager->createNotification(); $notification->setApp('files') - ->setObject('transfer', (string)$id); + ->setObject('transfer', (string) $id); $this->notificationManager->markProcessed($notification); $this->mapper->delete($transferOwnership); diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 66c0c1cf8f0..5c7b021ffb3 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -88,7 +88,7 @@ class ViewController extends Controller { // This is the entry point from the `/f/{fileid}` URL which is hardcoded in the server. try { - return $this->redirectToFile((int)$fileid, $openfile); + return $this->redirectToFile((int) $fileid, $openfile); } catch (NotFoundException $e) { // Keep the fileid even if not found, it will be used // to detect the file could not be found and warn the user @@ -132,7 +132,7 @@ class ViewController extends Controller { public function index($dir = '', $view = '', $fileid = null) { if ($fileid !== null && $view !== 'trashbin') { try { - return $this->redirectToFileIfInTrashbin((int)$fileid); + return $this->redirectToFileIfInTrashbin((int) $fileid); } catch (NotFoundException $e) { } } @@ -149,14 +149,14 @@ class ViewController extends Controller { // in the correct folder if ($fileid && $dir !== '') { $baseFolder = $this->rootFolder->getUserFolder($userId); - $nodes = $baseFolder->getById((int)$fileid); + $nodes = $baseFolder->getById((int) $fileid); if (!empty($nodes)) { $nodePath = $baseFolder->getRelativePath($nodes[0]->getPath()); $relativePath = $nodePath ? dirname($nodePath) : ''; // If the requested path does not contain the file id // or if the requested path is not the file id itself if (count($nodes) === 1 && $relativePath !== $dir && $nodePath !== $dir) { - return $this->redirectToFile((int)$fileid); + return $this->redirectToFile((int) $fileid); } } } diff --git a/apps/files/lib/Listener/SyncLivePhotosListener.php b/apps/files/lib/Listener/SyncLivePhotosListener.php index 6df9b8d6e95..17242d448a9 100644 --- a/apps/files/lib/Listener/SyncLivePhotosListener.php +++ b/apps/files/lib/Listener/SyncLivePhotosListener.php @@ -94,7 +94,7 @@ class SyncLivePhotosListener implements IEventListener { $targetName = $targetFile->getName(); $peerTargetName = substr($targetName, 0, -strlen($sourceExtension)) . $peerFileExtension; - if (!str_ends_with($targetName, "." . $sourceExtension)) { + if (!str_ends_with($targetName, '.' . $sourceExtension)) { throw new AbortedEventException('Cannot change the extension of a Live Photo'); } @@ -165,12 +165,12 @@ class SyncLivePhotosListener implements IEventListener { /** @var FilesMetadata $targetMetadata */ $targetMetadata = $this->filesMetadataManager->getMetadata($targetFile->getId(), true); $targetMetadata->setStorageId($targetFile->getStorage()->getCache()->getNumericStorageId()); - $targetMetadata->setString('files-live-photo', (string)$targetPeerFile->getId()); + $targetMetadata->setString('files-live-photo', (string) $targetPeerFile->getId()); $this->filesMetadataManager->saveMetadata($targetMetadata); /** @var FilesMetadata $peerMetadata */ $peerMetadata = $this->filesMetadataManager->getMetadata($targetPeerFile->getId(), true); $peerMetadata->setStorageId($targetPeerFile->getStorage()->getCache()->getNumericStorageId()); - $peerMetadata->setString('files-live-photo', (string)$targetFile->getId()); + $peerMetadata->setString('files-live-photo', (string) $targetFile->getId()); $this->filesMetadataManager->saveMetadata($peerMetadata); } @@ -188,7 +188,7 @@ class SyncLivePhotosListener implements IEventListener { unset($this->pendingDeletion[$peerFile->getId()]); return; } else { - throw new AbortedEventException("Cannot delete the video part of a live photo"); + throw new AbortedEventException('Cannot delete the video part of a live photo'); } } else { $this->pendingDeletion[$deletedFile->getId()] = true; diff --git a/apps/files/lib/Notification/Notifier.php b/apps/files/lib/Notification/Notifier.php index 89ddbb9b6ec..12ae2593e87 100644 --- a/apps/files/lib/Notification/Notifier.php +++ b/apps/files/lib/Notification/Notifier.php @@ -275,7 +275,7 @@ class Notifier implements INotifier, IDismissableNotifier { // TODO: This should all be moved to a service that also the transferownershipController uses. try { - $transferOwnership = $this->mapper->getById((int)$notification->getObjectId()); + $transferOwnership = $this->mapper->getById((int) $notification->getObjectId()); } catch (DoesNotExistException $e) { return; } @@ -295,7 +295,7 @@ class Notifier implements INotifier, IDismissableNotifier { 'targetUser' => $transferOwnership->getTargetUser(), 'nodeName' => $transferOwnership->getNodeName() ]) - ->setObject('transfer', (string)$transferOwnership->getId()); + ->setObject('transfer', (string) $transferOwnership->getId()); $this->notificationManager->notify($notification); $this->mapper->delete($transferOwnership); diff --git a/apps/files/lib/Search/FilesSearchProvider.php b/apps/files/lib/Search/FilesSearchProvider.php index 950c8b14ab6..bcb8c1482aa 100644 --- a/apps/files/lib/Search/FilesSearchProvider.php +++ b/apps/files/lib/Search/FilesSearchProvider.php @@ -144,7 +144,7 @@ class FilesSearchProvider implements IFilteringProvider { $this->urlGenerator->getAbsoluteURL($link), $icon, ); - $searchResultEntry->addAttribute('fileId', (string)$result->getId()); + $searchResultEntry->addAttribute('fileId', (string) $result->getId()); $searchResultEntry->addAttribute('path', $path); return $searchResultEntry; }, $userFolder->search($fileQuery)), diff --git a/apps/files/lib/Service/DirectEditingService.php b/apps/files/lib/Service/DirectEditingService.php index c21742d25ea..8816c11bb01 100644 --- a/apps/files/lib/Service/DirectEditingService.php +++ b/apps/files/lib/Service/DirectEditingService.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files/lib/Service/LivePhotosService.php b/apps/files/lib/Service/LivePhotosService.php index 3ac6601d5dc..e4faf222950 100644 --- a/apps/files/lib/Service/LivePhotosService.php +++ b/apps/files/lib/Service/LivePhotosService.php @@ -31,6 +31,6 @@ class LivePhotosService { return null; } - return (int)$metadata->getString('files-live-photo'); + return (int) $metadata->getString('files-live-photo'); } } diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index 2f3cb6788c4..055b3233bc0 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -80,7 +80,7 @@ class OwnershipTransferService { // If encryption is on we have to ensure the user has logged in before and that all encryption modules are ready if (($this->encryptionManager->isEnabled() && $destinationUser->getLastLogin() === 0) || !$this->encryptionManager->isReadyForUser($destinationUid)) { - throw new TransferOwnershipException("The target user is not ready to accept files. The user has at least to have logged in once.", 2); + throw new TransferOwnershipException('The target user is not ready to accept files. The user has at least to have logged in once.', 2); } // setup filesystem @@ -121,7 +121,7 @@ class OwnershipTransferService { } if ($move && !$firstLogin && count($view->getDirectoryContent($finalTarget)) > 0) { - throw new TransferOwnershipException("Destination path does not exists or is not empty", 1); + throw new TransferOwnershipException('Destination path does not exists or is not empty', 1); } @@ -277,10 +277,10 @@ class OwnershipTransferService { // no file is allowed to be encrypted if (!empty($encryptedFiles)) { - $output->writeln("<error>Some files are encrypted - please decrypt them first.</error>"); + $output->writeln('<error>Some files are encrypted - please decrypt them first.</error>'); foreach ($encryptedFiles as $encryptedFile) { /** @var FileInfo $encryptedFile */ - $output->writeln(" " . $encryptedFile->getPath()); + $output->writeln(' ' . $encryptedFile->getPath()); } throw new TransferOwnershipException('Some files are encrypted - please decrypt them first.', 1); } @@ -414,7 +414,7 @@ class OwnershipTransferService { $finalTarget = $finalTarget . '/' . basename($sourcePath); } if ($view->rename($sourcePath, $finalTarget, ['checkSubMounts' => false]) === false) { - throw new TransferOwnershipException("Could not transfer files.", 1); + throw new TransferOwnershipException('Could not transfer files.', 1); } if (!is_dir("$sourceUid/files")) { // because the files folder is moved away we need to recreate it @@ -433,7 +433,7 @@ class OwnershipTransferService { array $shares, OutputInterface $output, ):void { - $output->writeln("Restoring shares ..."); + $output->writeln('Restoring shares ...'); $progress = new ProgressBar($output, count($shares)); foreach ($shares as ['share' => $share, 'suffix' => $suffix]) { @@ -502,7 +502,7 @@ class OwnershipTransferService { string $path, string $finalTarget, bool $move): void { - $output->writeln("Restoring incoming shares ..."); + $output->writeln('Restoring incoming shares ...'); $progress = new ProgressBar($output, count($sourceShares)); $prefix = "$destinationUid/files"; $finalShareTarget = ''; diff --git a/apps/files/lib/Service/TagService.php b/apps/files/lib/Service/TagService.php index 4737938ab52..4bb43145e4a 100644 --- a/apps/files/lib/Service/TagService.php +++ b/apps/files/lib/Service/TagService.php @@ -53,7 +53,7 @@ class TagService { * replace the actual tag selection. * * @param string $path path - * @param array $tags array of tags + * @param array $tags array of tags * @return array list of tags * @throws \OCP\Files\NotFoundException if the file does not exist */ diff --git a/apps/files/lib/Service/UserConfig.php b/apps/files/lib/Service/UserConfig.php index c2339965793..f2e5982bff7 100644 --- a/apps/files/lib/Service/UserConfig.php +++ b/apps/files/lib/Service/UserConfig.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files/lib/Service/ViewConfig.php b/apps/files/lib/Service/ViewConfig.php index f28bf9cd3c9..40922924be2 100644 --- a/apps/files/lib/Service/ViewConfig.php +++ b/apps/files/lib/Service/ViewConfig.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 9ba105e240d..5281220282a 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files/tests/Activity/Filter/GenericTest.php b/apps/files/tests/Activity/Filter/GenericTest.php index 6f4dd594582..9b2823663f9 100644 --- a/apps/files/tests/Activity/Filter/GenericTest.php +++ b/apps/files/tests/Activity/Filter/GenericTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files/tests/Activity/ProviderTest.php b/apps/files/tests/Activity/ProviderTest.php index 1716ccfe100..3ffc134f39d 100644 --- a/apps/files/tests/Activity/ProviderTest.php +++ b/apps/files/tests/Activity/ProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files/tests/Activity/Setting/GenericTest.php b/apps/files/tests/Activity/Setting/GenericTest.php index c124106140a..177dba2b2a2 100644 --- a/apps/files/tests/Activity/Setting/GenericTest.php +++ b/apps/files/tests/Activity/Setting/GenericTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/ajax/applicable.php b/apps/files_external/ajax/applicable.php index c1b7748ad15..1bd7b22d15d 100644 --- a/apps/files_external/ajax/applicable.php +++ b/apps/files_external/ajax/applicable.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -13,13 +14,13 @@ $pattern = ''; $limit = null; $offset = null; if (isset($_GET['pattern'])) { - $pattern = (string)$_GET['pattern']; + $pattern = (string) $_GET['pattern']; } if (isset($_GET['limit'])) { - $limit = (int)$_GET['limit']; + $limit = (int) $_GET['limit']; } if (isset($_GET['offset'])) { - $offset = (int)$_GET['offset']; + $offset = (int) $_GET['offset']; } $groups = []; diff --git a/apps/files_external/ajax/oauth2.php b/apps/files_external/ajax/oauth2.php index 9dd8ceec2d2..d961d41ea6b 100644 --- a/apps/files_external/ajax/oauth2.php +++ b/apps/files_external/ajax/oauth2.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/appinfo/routes.php b/apps/files_external/appinfo/routes.php index 18418cc19c3..39b15e2a956 100644 --- a/apps/files_external/appinfo/routes.php +++ b/apps/files_external/appinfo/routes.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/AppInfo/Application.php b/apps/files_external/lib/AppInfo/Application.php index fc4f012cd02..07a05461062 100644 --- a/apps/files_external/lib/AppInfo/Application.php +++ b/apps/files_external/lib/AppInfo/Application.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Command/Applicable.php b/apps/files_external/lib/Command/Applicable.php index ecb635c052a..4d5e264bfaf 100644 --- a/apps/files_external/lib/Command/Applicable.php +++ b/apps/files_external/lib/Command/Applicable.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Command/Backends.php b/apps/files_external/lib/Command/Backends.php index c2d844dc781..262977ec1f3 100644 --- a/apps/files_external/lib/Command/Backends.php +++ b/apps/files_external/lib/Command/Backends.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Command/Config.php b/apps/files_external/lib/Command/Config.php index 0736749f6d9..cf324fc21fc 100644 --- a/apps/files_external/lib/Command/Config.php +++ b/apps/files_external/lib/Command/Config.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -73,7 +74,7 @@ class Config extends Base { if (!is_string($value) && json_decode(json_encode($value)) === $value) { // show bools and objects correctly $value = json_encode($value); } - $output->writeln((string)$value); + $output->writeln((string) $value); } /** diff --git a/apps/files_external/lib/Command/Create.php b/apps/files_external/lib/Command/Create.php index 4396d2e2b13..6c29485e0eb 100644 --- a/apps/files_external/lib/Command/Create.php +++ b/apps/files_external/lib/Command/Create.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -78,7 +79,7 @@ class Create extends Base { } protected function execute(InputInterface $input, OutputInterface $output): int { - $user = (string)$input->getOption('user'); + $user = (string) $input->getOption('user'); $mountPoint = $input->getArgument('mount_point'); $storageIdentifier = $input->getArgument('storage_backend'); $authIdentifier = $input->getArgument('authentication_backend'); @@ -140,7 +141,7 @@ class Create extends Base { if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) { $output->writeln('<info>Storage created with id ' . $mount->getId() . '</info>'); } else { - $output->writeln((string)$mount->getId()); + $output->writeln((string) $mount->getId()); } } return self::SUCCESS; diff --git a/apps/files_external/lib/Command/Delete.php b/apps/files_external/lib/Command/Delete.php index 1c2bfe39fb0..4a2b3e08c40 100644 --- a/apps/files_external/lib/Command/Delete.php +++ b/apps/files_external/lib/Command/Delete.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Command/Export.php b/apps/files_external/lib/Command/Export.php index 0735d94d89d..59484d0e788 100644 --- a/apps/files_external/lib/Command/Export.php +++ b/apps/files_external/lib/Command/Export.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Command/Import.php b/apps/files_external/lib/Command/Import.php index 858a70b8c14..1f238613e66 100644 --- a/apps/files_external/lib/Command/Import.php +++ b/apps/files_external/lib/Command/Import.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -117,7 +118,7 @@ class Import extends Base { $existingMount->getApplicableUsers() === $mount->getApplicableUsers() && $existingMount->getBackendOptions() === $mount->getBackendOptions() ) { - $output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>"); + $output->writeln('<error>Duplicate mount (' . $mount->getMountPoint() . ')</error>'); return self::FAILURE; } } diff --git a/apps/files_external/lib/Command/ListCommand.php b/apps/files_external/lib/Command/ListCommand.php index fabcce67775..b077db55290 100644 --- a/apps/files_external/lib/Command/ListCommand.php +++ b/apps/files_external/lib/Command/ListCommand.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -65,7 +66,7 @@ class ListCommand extends Base { $mounts = $this->globalService->getStorageForAllUsers(); $userId = self::ALL; } else { - $userId = (string)$input->getArgument('user_id'); + $userId = (string) $input->getArgument('user_id'); $storageService = $this->getStorageService($userId); $mounts = $storageService->getAllStorages(); } @@ -85,11 +86,11 @@ class ListCommand extends Base { $output->writeln('[]'); } else { if ($userId === self::ALL) { - $output->writeln("<info>No mounts configured</info>"); + $output->writeln('<info>No mounts configured</info>'); } elseif ($userId) { $output->writeln("<info>No mounts configured by $userId</info>"); } else { - $output->writeln("<info>No admin mounts configured</info>"); + $output->writeln('<info>No admin mounts configured</info>'); } } return; diff --git a/apps/files_external/lib/Command/Notify.php b/apps/files_external/lib/Command/Notify.php index a4e7edf0207..6dfbfdc976d 100644 --- a/apps/files_external/lib/Command/Notify.php +++ b/apps/files_external/lib/Command/Notify.php @@ -136,7 +136,7 @@ class Notify extends StorageAuthBase { $storageIds = array_values(array_unique($storageIds)); if ($dryRun) { - $output->writeln(" dry-run: skipping database write"); + $output->writeln(' dry-run: skipping database write'); } else { $result = $this->updateParent($storageIds, $parent); if ($result === 0) { @@ -168,7 +168,7 @@ class Notify extends StorageAuthBase { } private function getStorageIds(int $mountId, string $path): array { - $pathHash = md5(trim((string)\OC_Util::normalizeUnicode($path), '/')); + $pathHash = md5(trim((string) \OC_Util::normalizeUnicode($path), '/')); $qb = $this->connection->getQueryBuilder(); return $qb ->select('storage_id', 'user_id') @@ -181,7 +181,7 @@ class Notify extends StorageAuthBase { } private function updateParent(array $storageIds, string $parent): int { - $pathHash = md5(trim((string)\OC_Util::normalizeUnicode($parent), '/')); + $pathHash = md5(trim((string) \OC_Util::normalizeUnicode($parent), '/')); $qb = $this->connection->getQueryBuilder(); return $qb ->update('filecache') @@ -215,7 +215,7 @@ class Notify extends StorageAuthBase { private function selfTest(IStorage $storage, INotifyHandler $notifyHandler, OutputInterface $output): void { usleep(100 * 1000); //give time for the notify to start if (!$storage->file_put_contents('/.nc_test_file.txt', 'test content')) { - $output->writeln("Failed to create test file for self-test"); + $output->writeln('Failed to create test file for self-test'); return; } $storage->mkdir('/.nc_test_folder'); diff --git a/apps/files_external/lib/Command/Option.php b/apps/files_external/lib/Command/Option.php index 6051c9c5fbd..5567dd37694 100644 --- a/apps/files_external/lib/Command/Option.php +++ b/apps/files_external/lib/Command/Option.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -38,7 +39,7 @@ class Option extends Config { if (!is_string($value)) { // show bools and objects correctly $value = json_encode($value); } - $output->writeln((string)$value); + $output->writeln((string) $value); } /** diff --git a/apps/files_external/lib/Command/StorageAuthBase.php b/apps/files_external/lib/Command/StorageAuthBase.php index 6f830a08a60..3decc6a50e0 100644 --- a/apps/files_external/lib/Command/StorageAuthBase.php +++ b/apps/files_external/lib/Command/StorageAuthBase.php @@ -29,7 +29,7 @@ abstract class StorageAuthBase extends Base { private function getUserOption(InputInterface $input): ?string { if ($input->getOption('user')) { - return (string)$input->getOption('user'); + return (string) $input->getOption('user'); } return $_ENV['NOTIFY_USER'] ?? $_SERVER['NOTIFY_USER'] ?? null; @@ -37,7 +37,7 @@ abstract class StorageAuthBase extends Base { private function getPasswordOption(InputInterface $input): ?string { if ($input->getOption('password')) { - return (string)$input->getOption('password'); + return (string) $input->getOption('password'); } return $_ENV['NOTIFY_PASSWORD'] ?? $_SERVER['NOTIFY_PASSWORD'] ?? null; @@ -52,7 +52,7 @@ abstract class StorageAuthBase extends Base { protected function createStorage(InputInterface $input, OutputInterface $output): array { try { /** @var StorageConfig|null $mount */ - $mount = $this->globalService->getStorage((int)$input->getArgument('mount_id')); + $mount = $this->globalService->getStorage((int) $input->getArgument('mount_id')); } catch (NotFoundException $e) { $output->writeln('<error>Mount not found</error>'); return [null, null]; diff --git a/apps/files_external/lib/Command/Verify.php b/apps/files_external/lib/Command/Verify.php index 1455e427b77..37ea93d7df5 100644 --- a/apps/files_external/lib/Command/Verify.php +++ b/apps/files_external/lib/Command/Verify.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Config/ConfigAdapter.php b/apps/files_external/lib/Config/ConfigAdapter.php index 97bc4f78142..0d2a4c5103f 100644 --- a/apps/files_external/lib/Config/ConfigAdapter.php +++ b/apps/files_external/lib/Config/ConfigAdapter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Config/ExternalMountPoint.php b/apps/files_external/lib/Config/ExternalMountPoint.php index fea1976780e..fc1eacea6a9 100644 --- a/apps/files_external/lib/Config/ExternalMountPoint.php +++ b/apps/files_external/lib/Config/ExternalMountPoint.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/lib/Config/IConfigHandler.php b/apps/files_external/lib/Config/IConfigHandler.php index 2f1604e232b..9e8283cc58b 100644 --- a/apps/files_external/lib/Config/IConfigHandler.php +++ b/apps/files_external/lib/Config/IConfigHandler.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/lib/Config/SimpleSubstitutionTrait.php b/apps/files_external/lib/Config/SimpleSubstitutionTrait.php index 21269d7526e..6fdcc7c2121 100644 --- a/apps/files_external/lib/Config/SimpleSubstitutionTrait.php +++ b/apps/files_external/lib/Config/SimpleSubstitutionTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -44,7 +45,7 @@ trait SimpleSubstitutionTrait { */ protected function checkPlaceholder(): void { $this->sanitizedPlaceholder = trim(strtolower($this->placeholder)); - if (!(bool)\preg_match('/^[a-z0-9]*$/', $this->sanitizedPlaceholder)) { + if (!(bool) \preg_match('/^[a-z0-9]*$/', $this->sanitizedPlaceholder)) { throw new \RuntimeException(sprintf( 'Invalid placeholder %s, only [a-z0-9] are allowed', $this->sanitizedPlaceholder )); diff --git a/apps/files_external/lib/Config/UserContext.php b/apps/files_external/lib/Config/UserContext.php index 5d9d2910ea2..ac5870c9487 100644 --- a/apps/files_external/lib/Config/UserContext.php +++ b/apps/files_external/lib/Config/UserContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/lib/Config/UserPlaceholderHandler.php b/apps/files_external/lib/Config/UserPlaceholderHandler.php index ec91df5fb7a..d158e6923c1 100644 --- a/apps/files_external/lib/Config/UserPlaceholderHandler.php +++ b/apps/files_external/lib/Config/UserPlaceholderHandler.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/lib/Controller/AjaxController.php b/apps/files_external/lib/Controller/AjaxController.php index 5c5c4742757..817f8d8beb8 100644 --- a/apps/files_external/lib/Controller/AjaxController.php +++ b/apps/files_external/lib/Controller/AjaxController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -21,7 +22,7 @@ use OCP\IUserSession; class AjaxController extends Controller { /** @var RSA */ private $rsaMechanism; - /** @var GlobalAuth */ + /** @var GlobalAuth */ private $globalAuth; /** @var IUserSession */ private $userSession; diff --git a/apps/files_external/lib/Controller/GlobalStoragesController.php b/apps/files_external/lib/Controller/GlobalStoragesController.php index f3442e2507f..61d36ff432f 100644 --- a/apps/files_external/lib/Controller/GlobalStoragesController.php +++ b/apps/files_external/lib/Controller/GlobalStoragesController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Controller/StoragesController.php b/apps/files_external/lib/Controller/StoragesController.php index a94645095ab..1e7c05d2273 100644 --- a/apps/files_external/lib/Controller/StoragesController.php +++ b/apps/files_external/lib/Controller/StoragesController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -231,12 +232,12 @@ abstract class StoragesController extends Controller { } catch (InsufficientDataForMeaningfulAnswerException $e) { $status = $e->getCode() ? $e->getCode() : StorageNotAvailableException::STATUS_INDETERMINATE; $storage->setStatus( - (int)$status, + (int) $status, $this->l10n->t('Insufficient data: %s', [$e->getMessage()]) ); } catch (StorageNotAvailableException $e) { $storage->setStatus( - (int)$e->getCode(), + (int) $e->getCode(), $this->l10n->t('%s', [$e->getMessage()]) ); } catch (\Exception $e) { diff --git a/apps/files_external/lib/Controller/UserGlobalStoragesController.php b/apps/files_external/lib/Controller/UserGlobalStoragesController.php index 3896eb4b2dc..ec6a25ecc44 100644 --- a/apps/files_external/lib/Controller/UserGlobalStoragesController.php +++ b/apps/files_external/lib/Controller/UserGlobalStoragesController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Controller/UserStoragesController.php b/apps/files_external/lib/Controller/UserStoragesController.php index c8cb2e8abf9..17dbf1f8153 100644 --- a/apps/files_external/lib/Controller/UserStoragesController.php +++ b/apps/files_external/lib/Controller/UserStoragesController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php b/apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php index 04019404a90..c86c88a13d7 100644 --- a/apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php +++ b/apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/AuthMechanism.php b/apps/files_external/lib/Lib/Auth/AuthMechanism.php index ebdf768cda3..dfe4a74b1b2 100644 --- a/apps/files_external/lib/Lib/Auth/AuthMechanism.php +++ b/apps/files_external/lib/Lib/Auth/AuthMechanism.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/Builtin.php b/apps/files_external/lib/Lib/Auth/Builtin.php index cd4b8a22af4..8e12a6daca6 100644 --- a/apps/files_external/lib/Lib/Auth/Builtin.php +++ b/apps/files_external/lib/Lib/Auth/Builtin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/IUserProvided.php b/apps/files_external/lib/Lib/Auth/IUserProvided.php index 60f978f673d..2350d7f6db4 100644 --- a/apps/files_external/lib/Lib/Auth/IUserProvided.php +++ b/apps/files_external/lib/Lib/Auth/IUserProvided.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/files_external/lib/Lib/Auth/InvalidAuth.php b/apps/files_external/lib/Lib/Auth/InvalidAuth.php index d5a6fdcbe5d..2af24f1ea07 100644 --- a/apps/files_external/lib/Lib/Auth/InvalidAuth.php +++ b/apps/files_external/lib/Lib/Auth/InvalidAuth.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud GmbH. diff --git a/apps/files_external/lib/Lib/Auth/NullMechanism.php b/apps/files_external/lib/Lib/Auth/NullMechanism.php index 7847c111415..8e2e5b656b2 100644 --- a/apps/files_external/lib/Lib/Auth/NullMechanism.php +++ b/apps/files_external/lib/Lib/Auth/NullMechanism.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php b/apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php index b215201b4f4..f3bb84d29d6 100644 --- a/apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php +++ b/apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php b/apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php index 6b41fef90d5..1a98022c33e 100644 --- a/apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php +++ b/apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php b/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php index 3be4169831b..3b1c9f123af 100644 --- a/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php +++ b/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php b/apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php index a47d2ea0ca8..b1d1068e586 100644 --- a/apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php +++ b/apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php index f11dab2785f..388952ebadf 100644 --- a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php +++ b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2015 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php index dc45db99ba7..cbbee796198 100644 --- a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php +++ b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2015 ownCloud, Inc. @@ -103,7 +104,7 @@ class LoginCredentials extends AuthMechanism { } $credentials = $this->getCredentials($user); - $loginKey = $storage->getBackendOption("login_ldap_attr"); + $loginKey = $storage->getBackendOption('login_ldap_attr'); if ($loginKey) { $backend = $user->getBackend(); if ($backend instanceof IUserBackend && $backend->getBackendName() === 'LDAP') { diff --git a/apps/files_external/lib/Lib/Auth/Password/Password.php b/apps/files_external/lib/Lib/Auth/Password/Password.php index e3393233840..d4291148e3e 100644 --- a/apps/files_external/lib/Lib/Auth/Password/Password.php +++ b/apps/files_external/lib/Lib/Auth/Password/Password.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php index b69b64a9fd5..a1e50158e9a 100644 --- a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php +++ b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php index a7c51d7353a..66d082b359c 100644 --- a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php +++ b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2015 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php index 9b47cf72bb7..e47f8f16abd 100644 --- a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php +++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php b/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php index ab770d25d09..8e298778183 100644 --- a/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php +++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/lib/Lib/Auth/SMB/KerberosAuth.php b/apps/files_external/lib/Lib/Auth/SMB/KerberosAuth.php index e7a0884d1bd..9210209192a 100644 --- a/apps/files_external/lib/Lib/Auth/SMB/KerberosAuth.php +++ b/apps/files_external/lib/Lib/Auth/SMB/KerberosAuth.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/lib/Lib/Backend/AmazonS3.php b/apps/files_external/lib/Lib/Backend/AmazonS3.php index e345ed53f70..2e07452dffb 100644 --- a/apps/files_external/lib/Lib/Backend/AmazonS3.php +++ b/apps/files_external/lib/Lib/Backend/AmazonS3.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Backend/Backend.php b/apps/files_external/lib/Lib/Backend/Backend.php index f965e246d42..f7500ee24a4 100644 --- a/apps/files_external/lib/Lib/Backend/Backend.php +++ b/apps/files_external/lib/Lib/Backend/Backend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Backend/DAV.php b/apps/files_external/lib/Lib/Backend/DAV.php index 9eb206f0272..dea9e7c5e77 100644 --- a/apps/files_external/lib/Lib/Backend/DAV.php +++ b/apps/files_external/lib/Lib/Backend/DAV.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Backend/FTP.php b/apps/files_external/lib/Lib/Backend/FTP.php index 2093531789f..71a4a5ece70 100644 --- a/apps/files_external/lib/Lib/Backend/FTP.php +++ b/apps/files_external/lib/Lib/Backend/FTP.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Backend/InvalidBackend.php b/apps/files_external/lib/Lib/Backend/InvalidBackend.php index 22d0287244a..8b8bd486101 100644 --- a/apps/files_external/lib/Lib/Backend/InvalidBackend.php +++ b/apps/files_external/lib/Lib/Backend/InvalidBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud GmbH. diff --git a/apps/files_external/lib/Lib/Backend/LegacyBackend.php b/apps/files_external/lib/Lib/Backend/LegacyBackend.php index 11396913fbd..c6a4afdc6b9 100644 --- a/apps/files_external/lib/Lib/Backend/LegacyBackend.php +++ b/apps/files_external/lib/Lib/Backend/LegacyBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Backend/Local.php b/apps/files_external/lib/Lib/Backend/Local.php index 2902ba770c6..56940b8e83b 100644 --- a/apps/files_external/lib/Lib/Backend/Local.php +++ b/apps/files_external/lib/Lib/Backend/Local.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Backend/OwnCloud.php b/apps/files_external/lib/Lib/Backend/OwnCloud.php index c0bd6891864..0c0e2c6d300 100644 --- a/apps/files_external/lib/Lib/Backend/OwnCloud.php +++ b/apps/files_external/lib/Lib/Backend/OwnCloud.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Backend/SFTP.php b/apps/files_external/lib/Lib/Backend/SFTP.php index 93a5d87a5ff..0926cf7fd93 100644 --- a/apps/files_external/lib/Lib/Backend/SFTP.php +++ b/apps/files_external/lib/Lib/Backend/SFTP.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Backend/SFTP_Key.php b/apps/files_external/lib/Lib/Backend/SFTP_Key.php index a657dce66e5..278fae3fba7 100644 --- a/apps/files_external/lib/Lib/Backend/SFTP_Key.php +++ b/apps/files_external/lib/Lib/Backend/SFTP_Key.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Backend/SMB.php b/apps/files_external/lib/Lib/Backend/SMB.php index c4a68fea6e1..dd3478c65c7 100644 --- a/apps/files_external/lib/Lib/Backend/SMB.php +++ b/apps/files_external/lib/Lib/Backend/SMB.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Backend/SMB_OC.php b/apps/files_external/lib/Lib/Backend/SMB_OC.php index 55edec8a464..bcb8d0fbf16 100644 --- a/apps/files_external/lib/Lib/Backend/SMB_OC.php +++ b/apps/files_external/lib/Lib/Backend/SMB_OC.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Backend/Swift.php b/apps/files_external/lib/Lib/Backend/Swift.php index 386604e6e1d..37527ba3dbb 100644 --- a/apps/files_external/lib/Lib/Backend/Swift.php +++ b/apps/files_external/lib/Lib/Backend/Swift.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php b/apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php index 1d0cc3cca78..0c2e90a243c 100644 --- a/apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php +++ b/apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Config/IBackendProvider.php b/apps/files_external/lib/Lib/Config/IBackendProvider.php index 3f66966950d..44c460c3138 100644 --- a/apps/files_external/lib/Lib/Config/IBackendProvider.php +++ b/apps/files_external/lib/Lib/Config/IBackendProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/DefinitionParameter.php b/apps/files_external/lib/Lib/DefinitionParameter.php index 584fee1e498..1c8dd03a073 100644 --- a/apps/files_external/lib/Lib/DefinitionParameter.php +++ b/apps/files_external/lib/Lib/DefinitionParameter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -150,7 +151,7 @@ class DefinitionParameter implements \JsonSerializable { * @return bool */ public function isFlagSet(int $flag): bool { - return (bool)($this->flags & $flag); + return (bool) ($this->flags & $flag); } /** diff --git a/apps/files_external/lib/Lib/DependencyTrait.php b/apps/files_external/lib/Lib/DependencyTrait.php index 1d112532128..644132b82bc 100644 --- a/apps/files_external/lib/Lib/DependencyTrait.php +++ b/apps/files_external/lib/Lib/DependencyTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/FrontendDefinitionTrait.php b/apps/files_external/lib/Lib/FrontendDefinitionTrait.php index 65f46eb4dbc..0f280d1d486 100644 --- a/apps/files_external/lib/Lib/FrontendDefinitionTrait.php +++ b/apps/files_external/lib/Lib/FrontendDefinitionTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -12,7 +13,7 @@ namespace OCA\Files_External\Lib; trait FrontendDefinitionTrait { /** @var string human-readable mechanism name */ - private string $text = ""; + private string $text = ''; /** @var array<string, DefinitionParameter> parameters for mechanism */ private array $parameters = []; diff --git a/apps/files_external/lib/Lib/IFrontendDefinition.php b/apps/files_external/lib/Lib/IFrontendDefinition.php index 0184d5f536c..c8b06a1c30b 100644 --- a/apps/files_external/lib/Lib/IFrontendDefinition.php +++ b/apps/files_external/lib/Lib/IFrontendDefinition.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/lib/Lib/IIdentifier.php b/apps/files_external/lib/Lib/IIdentifier.php index df77d02b542..0677409a3cf 100644 --- a/apps/files_external/lib/Lib/IIdentifier.php +++ b/apps/files_external/lib/Lib/IIdentifier.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/lib/Lib/IdentifierTrait.php b/apps/files_external/lib/Lib/IdentifierTrait.php index ff7bb8a465e..f5ffde32307 100644 --- a/apps/files_external/lib/Lib/IdentifierTrait.php +++ b/apps/files_external/lib/Lib/IdentifierTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php b/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php index b2400f4be28..1e872b35072 100644 --- a/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php +++ b/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php b/apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php index 313d4ae8cb2..f6311fae83e 100644 --- a/apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php +++ b/apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/MissingDependency.php b/apps/files_external/lib/Lib/MissingDependency.php index 9f48a523861..987bd226675 100644 --- a/apps/files_external/lib/Lib/MissingDependency.php +++ b/apps/files_external/lib/Lib/MissingDependency.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php b/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php index 153cae1bd38..4ea56e456f0 100644 --- a/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php +++ b/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/lib/Lib/PersonalMount.php b/apps/files_external/lib/Lib/PersonalMount.php index 64e8fdcea69..ee4cd403c22 100644 --- a/apps/files_external/lib/Lib/PersonalMount.php +++ b/apps/files_external/lib/Lib/PersonalMount.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/PriorityTrait.php b/apps/files_external/lib/Lib/PriorityTrait.php index fef308a56dd..fad2c07e58c 100644 --- a/apps/files_external/lib/Lib/PriorityTrait.php +++ b/apps/files_external/lib/Lib/PriorityTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/SessionStorageWrapper.php b/apps/files_external/lib/Lib/SessionStorageWrapper.php index 38e86905386..8d65be92186 100644 --- a/apps/files_external/lib/Lib/SessionStorageWrapper.php +++ b/apps/files_external/lib/Lib/SessionStorageWrapper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 895bd00c462..bf97690cac1 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -128,9 +129,9 @@ class AmazonS3 extends \OC\Files\Storage\Common { } } - if (is_array($this->objectCache[$key]) && !isset($this->objectCache[$key]["Key"])) { + if (is_array($this->objectCache[$key]) && !isset($this->objectCache[$key]['Key'])) { /** @psalm-suppress InvalidArgument Psalm doesn't understand nested arrays well */ - $this->objectCache[$key]["Key"] = $key; + $this->objectCache[$key]['Key'] = $key; } return $this->objectCache[$key]; } @@ -340,12 +341,12 @@ class AmazonS3 extends \OC\Files\Storage\Common { */ private function getContentLength($path) { if (isset($this->filesCache[$path])) { - return (int)$this->filesCache[$path]['ContentLength']; + return (int) $this->filesCache[$path]['ContentLength']; } $result = $this->headObject($path); if (isset($result['ContentLength'])) { - return (int)$result['ContentLength']; + return (int) $result['ContentLength']; } return 0; @@ -690,7 +691,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { 'storage_mtime' => strtotime($object['LastModified']), 'etag' => trim($object['ETag'], '"'), 'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE, - 'size' => (int)($object['Size'] ?? $object['ContentLength']), + 'size' => (int) ($object['Size'] ?? $object['ContentLength']), ]; } @@ -766,7 +767,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { } if (!is_resource($stream)) { - throw new \InvalidArgumentException("Invalid stream provided"); + throw new \InvalidArgumentException('Invalid stream provided'); } $path = $this->normalizePath($path); diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php index 0af6ca141bb..9f75269aa70 100644 --- a/apps/files_external/lib/Lib/Storage/FTP.php +++ b/apps/files_external/lib/Lib/Storage/FTP.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only @@ -38,7 +39,7 @@ class FTP extends Common { if (is_string($params['secure'])) { $this->secure = ($params['secure'] === 'true'); } else { - $this->secure = (bool)$params['secure']; + $this->secure = (bool) $params['secure']; } } else { $this->secure = false; @@ -66,11 +67,11 @@ class FTP extends Common { $this->password ); } catch (\Exception $e) { - throw new StorageNotAvailableException("Failed to create ftp connection", 0, $e); + throw new StorageNotAvailableException('Failed to create ftp connection', 0, $e); } if ($this->utf8Mode) { if (!$this->connection->setUtf8Mode()) { - throw new StorageNotAvailableException("Could not set UTF-8 mode"); + throw new StorageNotAvailableException('Could not set UTF-8 mode'); } } } @@ -219,7 +220,7 @@ class FTP extends Common { } public function is_dir($path) { - if ($path === "") { + if ($path === '') { return true; } if ($this->getConnection()->chdir($this->buildPath($path)) === true) { diff --git a/apps/files_external/lib/Lib/Storage/FtpConnection.php b/apps/files_external/lib/Lib/Storage/FtpConnection.php index 8855dffbc0f..ee960313371 100644 --- a/apps/files_external/lib/Lib/Storage/FtpConnection.php +++ b/apps/files_external/lib/Lib/Storage/FtpConnection.php @@ -23,11 +23,11 @@ class FtpConnection { } if ($connection === false) { - throw new \Exception("Failed to connect to ftp"); + throw new \Exception('Failed to connect to ftp'); } if (ftp_login($connection, $username, $password) === false) { - throw new \Exception("Failed to connect to login to ftp"); + throw new \Exception('Failed to connect to login to ftp'); } ftp_pasv($connection, true); @@ -39,7 +39,7 @@ class FtpConnection { } public function setUtf8Mode(): bool { - $response = ftp_raw($this->connection, "OPTS UTF8 ON"); + $response = ftp_raw($this->connection, 'OPTS UTF8 ON'); return substr($response[0], 0, 3) === '200'; } @@ -75,8 +75,8 @@ class FtpConnection { $result = @ftp_mdtm($this->connection, $path); // filezilla doesn't like empty path with mdtm - if ($result === -1 && $path === "") { - $result = @ftp_mdtm($this->connection, "/"); + if ($result === -1 && $path === '') { + $result = @ftp_mdtm($this->connection, '/'); } return $result; } @@ -150,13 +150,13 @@ class FtpConnection { $parsedDate = (new \DateTime()) ->setTimestamp(strtotime("$month $day $time")); - $tomorrow = (new \DateTime())->add(new \DateInterval("P1D")); + $tomorrow = (new \DateTime())->add(new \DateInterval('P1D')); // since the provided date doesn't include the year, we either set it to the correct year // or when the date would otherwise be in the future (by more then 1 day to account for timezone errors) // we use last year if ($parsedDate > $tomorrow) { - $parsedDate = $parsedDate->sub(new \DateInterval("P1Y")); + $parsedDate = $parsedDate->sub(new \DateInterval('P1Y')); } $formattedDate = $parsedDate @@ -167,7 +167,7 @@ class FtpConnection { 'name' => $name, 'modify' => $formattedDate, 'perm' => $this->normalizePermissions($permissions), - 'size' => (int)$size, + 'size' => (int) $size, ]; } @@ -216,7 +216,7 @@ class FtpConnection { 'name' => $name, 'modify' => $formattedDate, 'perm' => ($type === 'file') ? 'adfrw' : 'flcdmpe', - 'size' => (int)$size, + 'size' => (int) $size, ]; } } diff --git a/apps/files_external/lib/Lib/Storage/OwnCloud.php b/apps/files_external/lib/Lib/Storage/OwnCloud.php index d5562a3cb32..20175e897f9 100644 --- a/apps/files_external/lib/Lib/Storage/OwnCloud.php +++ b/apps/files_external/lib/Lib/Storage/OwnCloud.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -24,10 +25,10 @@ class OwnCloud extends \OC\Files\Storage\DAV implements IDisableEncryptionStorag // (owncloud install path on host) $host = $params['host']; // strip protocol - if (substr($host, 0, 8) === "https://") { + if (substr($host, 0, 8) === 'https://') { $host = substr($host, 8); $params['secure'] = true; - } elseif (substr($host, 0, 7) === "http://") { + } elseif (substr($host, 0, 7) === 'http://') { $host = substr($host, 7); $params['secure'] = false; } diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index 120059c29ea..5474669584a 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -239,7 +240,7 @@ class SFTP extends Common { $lines = file($keyPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if ($lines) { foreach ($lines as $line) { - $hostKeyArray = explode("::", $line, 2); + $hostKeyArray = explode('::', $line, 2); if (count($hostKeyArray) === 2) { $hosts[] = $hostKeyArray[0]; $keys[] = $hostKeyArray[1]; @@ -441,8 +442,8 @@ class SFTP extends Common { try { $stat = $this->getConnection()->stat($this->absPath($path)); - $mtime = isset($stat['mtime']) ? (int)$stat['mtime'] : -1; - $size = isset($stat['size']) ? (int)$stat['size'] : 0; + $mtime = isset($stat['mtime']) ? (int) $stat['mtime'] : -1; + $size = isset($stat['size']) ? (int) $stat['size'] : 0; return [ 'mtime' => $mtime, @@ -482,7 +483,7 @@ class SFTP extends Common { $size = $writtenSize; }); if (!$stream) { - throw new \Exception("Failed to wrap stream"); + throw new \Exception('Failed to wrap stream'); } } /** @psalm-suppress InternalMethod */ @@ -490,11 +491,11 @@ class SFTP extends Common { fclose($stream); if ($result) { if ($size === null) { - throw new \Exception("Failed to get written size from sftp storage wrapper"); + throw new \Exception('Failed to get written size from sftp storage wrapper'); } return $size; } else { - throw new \Exception("Failed to write steam to sftp storage"); + throw new \Exception('Failed to write steam to sftp storage'); } } diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 50ba29ecf13..7ea615c7394 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -97,7 +98,7 @@ class SMB extends Common implements INotifyStorage { $options = new Options(); if (isset($params['timeout'])) { - $timeout = (int)$params['timeout']; + $timeout = (int) $params['timeout']; if ($timeout > 0) { $options->setTimeout($timeout); } @@ -271,7 +272,7 @@ class SMB extends Common implements INotifyStorage { } } catch (ConnectException $e) { $this->logger->error('Error while getting folder content', ['exception' => $e]); - throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int) $e->getCode(), $e); } catch (NotFoundException $e) { throw new \OCP\Files\NotFoundException($e->getMessage(), 0, $e); } @@ -425,7 +426,7 @@ class SMB extends Common implements INotifyStorage { return false; } catch (ConnectException $e) { $this->logger->error('Error while deleting file', ['exception' => $e]); - throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int) $e->getCode(), $e); } } @@ -509,10 +510,10 @@ class SMB extends Common implements INotifyStorage { } catch (ForbiddenException $e) { return false; } catch (OutOfSpaceException $e) { - throw new EntityTooLargeException("not enough available space to create file", 0, $e); + throw new EntityTooLargeException('not enough available space to create file', 0, $e); } catch (ConnectException $e) { $this->logger->error('Error while opening file', ['exception' => $e]); - throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int) $e->getCode(), $e); } } @@ -539,7 +540,7 @@ class SMB extends Common implements INotifyStorage { return false; } catch (ConnectException $e) { $this->logger->error('Error while removing folder', ['exception' => $e]); - throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int) $e->getCode(), $e); } } @@ -552,10 +553,10 @@ class SMB extends Common implements INotifyStorage { } return false; } catch (OutOfSpaceException $e) { - throw new EntityTooLargeException("not enough available space to create file", 0, $e); + throw new EntityTooLargeException('not enough available space to create file', 0, $e); } catch (ConnectException $e) { $this->logger->error('Error while creating file', ['exception' => $e]); - throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int) $e->getCode(), $e); } } @@ -652,7 +653,7 @@ class SMB extends Common implements INotifyStorage { return true; } catch (ConnectException $e) { $this->logger->error('Error while creating folder', ['exception' => $e]); - throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int) $e->getCode(), $e); } catch (Exception $e) { return false; } @@ -678,7 +679,7 @@ class SMB extends Common implements INotifyStorage { } catch (\OCP\Files\ForbiddenException $e) { return false; } catch (ConnectException $e) { - throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e); + throw new StorageNotAvailableException($e->getMessage(), (int) $e->getCode(), $e); } } @@ -722,7 +723,7 @@ class SMB extends Common implements INotifyStorage { */ public static function checkDependencies() { return ( - (bool)\OC_Helper::findBinaryPath('smbclient') + (bool) \OC_Helper::findBinaryPath('smbclient') || NativeServer::available(new System()) ) ? true : ['smbclient']; } diff --git a/apps/files_external/lib/Lib/Storage/StreamWrapper.php b/apps/files_external/lib/Lib/Storage/StreamWrapper.php index 2928c081505..bff6b3de545 100644 --- a/apps/files_external/lib/Lib/Storage/StreamWrapper.php +++ b/apps/files_external/lib/Lib/Storage/StreamWrapper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php index f25c3cb304b..6fb1c16b96f 100644 --- a/apps/files_external/lib/Lib/Storage/Swift.php +++ b/apps/files_external/lib/Lib/Storage/Swift.php @@ -88,7 +88,7 @@ class Swift extends \OC\Files\Storage\Common { * * @param string $path * @return StorageObject|bool object - * or false if the object did not exist + * or false if the object did not exist * @throws \OCP\Files\StorageAuthException * @throws \OCP\Files\StorageNotAvailableException */ @@ -134,7 +134,7 @@ class Swift extends \OC\Files\Storage\Common { or (empty($params['user']) && empty($params['userid'])) or empty($params['bucket']) or empty($params['region']) ) { - throw new StorageBadConfigException("API Key or password, Login, Bucket and Region have to be configured."); + throw new StorageBadConfigException('API Key or password, Login, Bucket and Region have to be configured.'); } $user = $params['user']; @@ -143,7 +143,7 @@ class Swift extends \OC\Files\Storage\Common { $bucketUrl = new Uri($params['bucket']); if ($bucketUrl->getHost()) { $params['bucket'] = basename($bucketUrl->getPath()); - $params['endpoint_url'] = (string)$bucketUrl->withPath(dirname($bucketUrl->getPath())); + $params['endpoint_url'] = (string) $bucketUrl->withPath(dirname($bucketUrl->getPath())); } if (empty($params['url'])) { @@ -324,7 +324,7 @@ class Swift extends \OC\Files\Storage\Common { } $stat = []; - $stat['size'] = (int)$object->contentLength; + $stat['size'] = (int) $object->contentLength; $stat['mtime'] = $mtime; $stat['atime'] = time(); return $stat; @@ -425,7 +425,7 @@ class Swift extends \OC\Files\Storage\Common { if (is_null($mtime)) { $mtime = time(); } - $metadata = ['timestamp' => (string)$mtime]; + $metadata = ['timestamp' => (string) $mtime]; if ($this->file_exists($path)) { if ($this->is_dir($path) && $path !== '.') { $path .= '/'; diff --git a/apps/files_external/lib/Lib/StorageConfig.php b/apps/files_external/lib/Lib/StorageConfig.php index 682516c73ba..be3b123083d 100644 --- a/apps/files_external/lib/Lib/StorageConfig.php +++ b/apps/files_external/lib/Lib/StorageConfig.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -204,7 +205,7 @@ class StorageConfig implements \JsonSerializable { if (isset($parameters[$key])) { switch ($parameters[$key]->getType()) { case \OCA\Files_External\Lib\DefinitionParameter::VALUE_BOOLEAN: - $value = (bool)$value; + $value = (bool) $value; break; } $backendOptions[$key] = $value; diff --git a/apps/files_external/lib/Lib/StorageModifierTrait.php b/apps/files_external/lib/Lib/StorageModifierTrait.php index 7cc7a15605c..f0f62a8b1d6 100644 --- a/apps/files_external/lib/Lib/StorageModifierTrait.php +++ b/apps/files_external/lib/Lib/StorageModifierTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Lib/VisibilityTrait.php b/apps/files_external/lib/Lib/VisibilityTrait.php index 63aa709b21c..62b26f3edb1 100644 --- a/apps/files_external/lib/Lib/VisibilityTrait.php +++ b/apps/files_external/lib/Lib/VisibilityTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Migration/DummyUserSession.php b/apps/files_external/lib/Migration/DummyUserSession.php index 3d9412bd755..1ebf0e1ec4f 100644 --- a/apps/files_external/lib/Migration/DummyUserSession.php +++ b/apps/files_external/lib/Migration/DummyUserSession.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Migration/Version1015Date20211104103506.php b/apps/files_external/lib/Migration/Version1015Date20211104103506.php index 0cd8ffdf275..1f1266365f0 100644 --- a/apps/files_external/lib/Migration/Version1015Date20211104103506.php +++ b/apps/files_external/lib/Migration/Version1015Date20211104103506.php @@ -42,7 +42,7 @@ class Version1015Date20211104103506 extends SimpleMigrationStep { } while ($mount = $mounts->fetch()) { - $config = $this->getStorageConfig((int)$mount['mount_id']); + $config = $this->getStorageConfig((int) $mount['mount_id']); $hostname = $config['hostname']; $bucket = $config['bucket']; $key = $config['key']; diff --git a/apps/files_external/lib/MountConfig.php b/apps/files_external/lib/MountConfig.php index b057fb810bd..f81537a7cf4 100644 --- a/apps/files_external/lib/MountConfig.php +++ b/apps/files_external/lib/MountConfig.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/NotFoundException.php b/apps/files_external/lib/NotFoundException.php index 78fbda2a4b8..411a2212513 100644 --- a/apps/files_external/lib/NotFoundException.php +++ b/apps/files_external/lib/NotFoundException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Service/BackendService.php b/apps/files_external/lib/Service/BackendService.php index 5eb0276be65..8fe1ff31a7c 100644 --- a/apps/files_external/lib/Service/BackendService.php +++ b/apps/files_external/lib/Service/BackendService.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -303,7 +304,7 @@ class BackendService { */ public function registerConfigHandler(string $placeholder, callable $configHandlerLoader) { $placeholder = trim(strtolower($placeholder)); - if (!(bool)\preg_match('/^[a-z0-9]*$/', $placeholder)) { + if (!(bool) \preg_match('/^[a-z0-9]*$/', $placeholder)) { throw new \RuntimeException(sprintf( 'Invalid placeholder %s, only [a-z0-9] are allowed', $placeholder )); diff --git a/apps/files_external/lib/Service/DBConfigService.php b/apps/files_external/lib/Service/DBConfigService.php index 6fb7e01271e..a8ad681db09 100644 --- a/apps/files_external/lib/Service/DBConfigService.php +++ b/apps/files_external/lib/Service/DBConfigService.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -117,7 +118,7 @@ class DBConfigService { $stmt->closeCursor(); foreach ($result as $row) { - if ((int)$row['count'] > 1) { + if ((int) $row['count'] > 1) { $this->removeApplicable($row['mount_id'], $applicableType, $applicableId); } else { $this->removeMount($row['mount_id']); @@ -402,8 +403,8 @@ class DBConfigService { $options = $this->getOptionsForMounts($mountIds); return array_map(function ($mount, $applicable, $config, $options) { - $mount['type'] = (int)$mount['type']; - $mount['priority'] = (int)$mount['priority']; + $mount['type'] = (int) $mount['type']; + $mount['priority'] = (int) $mount['priority']; $mount['applicable'] = $applicable; $mount['config'] = $config; $mount['options'] = $options; @@ -442,7 +443,7 @@ class DBConfigService { } foreach ($rows as $row) { if (isset($row['type'])) { - $row['type'] = (int)$row['type']; + $row['type'] = (int) $row['type']; } $result[$row['mount_id']][] = $row; } diff --git a/apps/files_external/lib/Service/GlobalStoragesService.php b/apps/files_external/lib/Service/GlobalStoragesService.php index c799007cc6d..8d29d520472 100644 --- a/apps/files_external/lib/Service/GlobalStoragesService.php +++ b/apps/files_external/lib/Service/GlobalStoragesService.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Service/ImportLegacyStoragesService.php b/apps/files_external/lib/Service/ImportLegacyStoragesService.php index fe5e71c1a47..7d9840e9f5e 100644 --- a/apps/files_external/lib/Service/ImportLegacyStoragesService.php +++ b/apps/files_external/lib/Service/ImportLegacyStoragesService.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/files_external/lib/Service/LegacyStoragesService.php b/apps/files_external/lib/Service/LegacyStoragesService.php index ac9273f2afc..51d212c5a28 100644 --- a/apps/files_external/lib/Service/LegacyStoragesService.php +++ b/apps/files_external/lib/Service/LegacyStoragesService.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -137,7 +138,7 @@ abstract class LegacyStoragesService { $storageOptions['authMechanism'] = null; // ensure config hash works } if (isset($storageOptions['id'])) { - $configId = (int)$storageOptions['id']; + $configId = (int) $storageOptions['id']; if (isset($storages[$configId])) { $currentStorage = $storages[$configId]; } diff --git a/apps/files_external/lib/Service/StoragesService.php b/apps/files_external/lib/Service/StoragesService.php index c6a77b45b27..011bb52cc55 100644 --- a/apps/files_external/lib/Service/StoragesService.php +++ b/apps/files_external/lib/Service/StoragesService.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -89,7 +90,7 @@ abstract class StoragesService { $mount['priority'] ); $config->setType($mount['type']); - $config->setId((int)$mount['mount_id']); + $config->setId((int) $mount['mount_id']); return $config; } catch (\UnexpectedValueException $e) { // don't die if a storage backend doesn't exist diff --git a/apps/files_external/lib/Service/UserGlobalStoragesService.php b/apps/files_external/lib/Service/UserGlobalStoragesService.php index 58590b8d682..89f850d3910 100644 --- a/apps/files_external/lib/Service/UserGlobalStoragesService.php +++ b/apps/files_external/lib/Service/UserGlobalStoragesService.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Service/UserStoragesService.php b/apps/files_external/lib/Service/UserStoragesService.php index ba678156368..842c1827b3c 100644 --- a/apps/files_external/lib/Service/UserStoragesService.php +++ b/apps/files_external/lib/Service/UserStoragesService.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Service/UserTrait.php b/apps/files_external/lib/Service/UserTrait.php index 25713894e1f..679066283a5 100644 --- a/apps/files_external/lib/Service/UserTrait.php +++ b/apps/files_external/lib/Service/UserTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/lib/Settings/Admin.php b/apps/files_external/lib/Settings/Admin.php index f8235778b7c..cf4777e0a00 100644 --- a/apps/files_external/lib/Settings/Admin.php +++ b/apps/files_external/lib/Settings/Admin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -23,7 +24,7 @@ class Admin implements ISettings { /** @var BackendService */ private $backendService; - /** @var GlobalAuth */ + /** @var GlobalAuth */ private $globalAuth; public function __construct( @@ -66,8 +67,8 @@ class Admin implements ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/files_external/lib/Settings/Personal.php b/apps/files_external/lib/Settings/Personal.php index 4efa7af6060..c021bdf6249 100644 --- a/apps/files_external/lib/Settings/Personal.php +++ b/apps/files_external/lib/Settings/Personal.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,7 +25,7 @@ class Personal implements ISettings { /** @var BackendService */ private $backendService; - /** @var GlobalAuth */ + /** @var GlobalAuth */ private $globalAuth; /** @var IUserSession */ @@ -74,8 +75,8 @@ class Personal implements ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/files_external/lib/Settings/PersonalSection.php b/apps/files_external/lib/Settings/PersonalSection.php index 41db1fcd906..69454fe49bb 100644 --- a/apps/files_external/lib/Settings/PersonalSection.php +++ b/apps/files_external/lib/Settings/PersonalSection.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/lib/Settings/Section.php b/apps/files_external/lib/Settings/Section.php index eae46471e94..9a1e3bdfe74 100644 --- a/apps/files_external/lib/Settings/Section.php +++ b/apps/files_external/lib/Settings/Section.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -46,8 +47,8 @@ class Section implements IIconSection { /** * @return int whether the form should be rather on the top or bottom of - * the settings navigation. The sections are arranged in ascending order of - * the priority values. It is required to return a value between 0 and 99. + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. * * E.g.: 70 */ diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 84c54a7ad3a..e2af1fe501d 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -14,12 +14,12 @@ use OCA\Files_External\Service\BackendService; $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || $_['allowUserMounting']; -$l->t("Enable encryption"); -$l->t("Enable previews"); -$l->t("Enable sharing"); -$l->t("Check for changes"); -$l->t("Never"); -$l->t("Once every direct access"); +$l->t('Enable encryption'); +$l->t('Enable previews'); +$l->t('Enable sharing'); +$l->t('Check for changes'); +$l->t('Never'); +$l->t('Once every direct access'); $l->t('Read only'); \OCP\Util::addScript('files_external', 'settings'); @@ -64,7 +64,7 @@ function writeParameterInput($parameter, $options, $classes = []) { <?php break; case DefinitionParameter::VALUE_BOOLEAN: ?> - <?php $checkboxId = uniqid("checkbox_"); ?> + <?php $checkboxId = uniqid('checkbox_'); ?> <div> <label> <input type="checkbox" @@ -164,7 +164,7 @@ uasort($sortedBackends, function ($a, $b) { }); ?> <?php foreach ($sortedBackends as $backend): ?> - <?php if ($backend->getDeprecateTo() || (!$canCreateNewLocalStorage && $backend->getIdentifier() == "local")) { + <?php if ($backend->getDeprecateTo() || (!$canCreateNewLocalStorage && $backend->getIdentifier() == 'local')) { continue; } // ignore deprecated backends?> <option value="<?php p($backend->getIdentifier()); ?>"><?php p($backend->getText()); ?></option> @@ -225,7 +225,7 @@ uasort($sortedBackends, function ($a, $b) { <form autocomplete="false" action="#" id="global_credentials" method="post" class="<?php if (isset($_['visibilityType']) && $_['visibilityType'] === BackendService::VISIBILITY_PERSONAL) { - print_unescaped("global_credentials__personal"); + print_unescaped('global_credentials__personal'); } ?>"> <h2><?php p($l->t('Global credentials')); ?></h2> <p class="settings-hint"><?php p($l->t('Global credentials can be used to authenticate with multiple external storages that have the same credentials.')); ?></p> diff --git a/apps/files_external/tests/Auth/AuthMechanismTest.php b/apps/files_external/tests/Auth/AuthMechanismTest.php index 3297d93fe94..48f436e3ff7 100644 --- a/apps/files_external/tests/Auth/AuthMechanismTest.php +++ b/apps/files_external/tests/Auth/AuthMechanismTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Auth/Password/GlobalAuth.php b/apps/files_external/tests/Auth/Password/GlobalAuth.php index 85a2c1fb27c..4fa6c98f26d 100644 --- a/apps/files_external/tests/Auth/Password/GlobalAuth.php +++ b/apps/files_external/tests/Auth/Password/GlobalAuth.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Backend/BackendTest.php b/apps/files_external/tests/Backend/BackendTest.php index 771c053982c..9d7a66c33fa 100644 --- a/apps/files_external/tests/Backend/BackendTest.php +++ b/apps/files_external/tests/Backend/BackendTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Backend/LegacyBackendTest.php b/apps/files_external/tests/Backend/LegacyBackendTest.php index 2d041e69f26..afc6714a72f 100644 --- a/apps/files_external/tests/Backend/LegacyBackendTest.php +++ b/apps/files_external/tests/Backend/LegacyBackendTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Command/ApplicableTest.php b/apps/files_external/tests/Command/ApplicableTest.php index d4caadad343..edbf03ef482 100644 --- a/apps/files_external/tests/Command/ApplicableTest.php +++ b/apps/files_external/tests/Command/ApplicableTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Command/CommandTest.php b/apps/files_external/tests/Command/CommandTest.php index eb47fe08ac4..b264b1db7d4 100644 --- a/apps/files_external/tests/Command/CommandTest.php +++ b/apps/files_external/tests/Command/CommandTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Command/ListCommandTest.php b/apps/files_external/tests/Command/ListCommandTest.php index 8375ba89f2a..06ae4046791 100644 --- a/apps/files_external/tests/Command/ListCommandTest.php +++ b/apps/files_external/tests/Command/ListCommandTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php b/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php index 767ae04fc79..943fe000fe8 100644 --- a/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php +++ b/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/tests/Controller/AjaxControllerTest.php b/apps/files_external/tests/Controller/AjaxControllerTest.php index 3f81245c303..560d7be9923 100644 --- a/apps/files_external/tests/Controller/AjaxControllerTest.php +++ b/apps/files_external/tests/Controller/AjaxControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php b/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php index cc905a20ff4..2c3b7f7a132 100644 --- a/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php +++ b/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Controller/StoragesControllerTest.php b/apps/files_external/tests/Controller/StoragesControllerTest.php index 85f3ca81498..51b74d04fe9 100644 --- a/apps/files_external/tests/Controller/StoragesControllerTest.php +++ b/apps/files_external/tests/Controller/StoragesControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Controller/UserStoragesControllerTest.php b/apps/files_external/tests/Controller/UserStoragesControllerTest.php index 0ac2197f67c..587d1b459e5 100644 --- a/apps/files_external/tests/Controller/UserStoragesControllerTest.php +++ b/apps/files_external/tests/Controller/UserStoragesControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/DefinitionParameterTest.php b/apps/files_external/tests/DefinitionParameterTest.php index f9d50e7a34c..84a9550943a 100644 --- a/apps/files_external/tests/DefinitionParameterTest.php +++ b/apps/files_external/tests/DefinitionParameterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/FrontendDefinitionTraitTest.php b/apps/files_external/tests/FrontendDefinitionTraitTest.php index e5dc0547d74..69751ce1a91 100644 --- a/apps/files_external/tests/FrontendDefinitionTraitTest.php +++ b/apps/files_external/tests/FrontendDefinitionTraitTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php b/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php index 931421551eb..647917e2369 100644 --- a/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php +++ b/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/OwnCloudFunctionsTest.php b/apps/files_external/tests/OwnCloudFunctionsTest.php index 9efefe8e4dd..89b1bfafda5 100644 --- a/apps/files_external/tests/OwnCloudFunctionsTest.php +++ b/apps/files_external/tests/OwnCloudFunctionsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/PersonalMountTest.php b/apps/files_external/tests/PersonalMountTest.php index aec0a8b6f75..bcfa0836fd6 100644 --- a/apps/files_external/tests/PersonalMountTest.php +++ b/apps/files_external/tests/PersonalMountTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Service/BackendServiceTest.php b/apps/files_external/tests/Service/BackendServiceTest.php index bda96550317..97e40afee13 100644 --- a/apps/files_external/tests/Service/BackendServiceTest.php +++ b/apps/files_external/tests/Service/BackendServiceTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Service/DBConfigServiceTest.php b/apps/files_external/tests/Service/DBConfigServiceTest.php index 1c2cafc93f0..92343530233 100644 --- a/apps/files_external/tests/Service/DBConfigServiceTest.php +++ b/apps/files_external/tests/Service/DBConfigServiceTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Service/GlobalStoragesServiceTest.php b/apps/files_external/tests/Service/GlobalStoragesServiceTest.php index 18fd9d174f2..50cf02cfd68 100644 --- a/apps/files_external/tests/Service/GlobalStoragesServiceTest.php +++ b/apps/files_external/tests/Service/GlobalStoragesServiceTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Service/StoragesServiceTest.php b/apps/files_external/tests/Service/StoragesServiceTest.php index 705d5fa276f..0d00659b7d6 100644 --- a/apps/files_external/tests/Service/StoragesServiceTest.php +++ b/apps/files_external/tests/Service/StoragesServiceTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -62,7 +63,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { */ protected $dataDir; - /** @var CleaningDBConfig */ + /** @var CleaningDBConfig */ protected $dbConfig; /** @@ -345,7 +346,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { $result = $storageCheckQuery->execute(); $storages = $result->fetchAll(); $result->closeCursor(); - $this->assertCount(0, $storages, "expected 0 storages, got " . json_encode($storages)); + $this->assertCount(0, $storages, 'expected 0 storages, got ' . json_encode($storages)); } protected function actualDeletedUnexistingStorageTest() { diff --git a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php index e08f3bd4d7d..f8d279ba902 100644 --- a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Service/UserStoragesServiceTest.php b/apps/files_external/tests/Service/UserStoragesServiceTest.php index 370b34245c2..20ad800dd6a 100644 --- a/apps/files_external/tests/Service/UserStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserStoragesServiceTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Settings/AdminTest.php b/apps/files_external/tests/Settings/AdminTest.php index 1d584814da8..9144e72e125 100644 --- a/apps/files_external/tests/Settings/AdminTest.php +++ b/apps/files_external/tests/Settings/AdminTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/tests/Settings/SectionTest.php b/apps/files_external/tests/Settings/SectionTest.php index e9f47cab19d..c02f871df4c 100644 --- a/apps/files_external/tests/Settings/SectionTest.php +++ b/apps/files_external/tests/Settings/SectionTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/tests/Storage/Amazons3MultiPartTest.php b/apps/files_external/tests/Storage/Amazons3MultiPartTest.php index 3db468b0fa0..fc3aeef35a3 100644 --- a/apps/files_external/tests/Storage/Amazons3MultiPartTest.php +++ b/apps/files_external/tests/Storage/Amazons3MultiPartTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_external/tests/Storage/Amazons3Test.php b/apps/files_external/tests/Storage/Amazons3Test.php index bffe98c3f4d..2e12b1b371c 100644 --- a/apps/files_external/tests/Storage/Amazons3Test.php +++ b/apps/files_external/tests/Storage/Amazons3Test.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Storage/FtpTest.php b/apps/files_external/tests/Storage/FtpTest.php index 24f7c511e93..ec24cf6cba8 100644 --- a/apps/files_external/tests/Storage/FtpTest.php +++ b/apps/files_external/tests/Storage/FtpTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Storage/OwncloudTest.php b/apps/files_external/tests/Storage/OwncloudTest.php index 28041a665f8..e516d053379 100644 --- a/apps/files_external/tests/Storage/OwncloudTest.php +++ b/apps/files_external/tests/Storage/OwncloudTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Storage/SFTP_KeyTest.php b/apps/files_external/tests/Storage/SFTP_KeyTest.php index c1aaf0b13a3..6214d1a16b1 100644 --- a/apps/files_external/tests/Storage/SFTP_KeyTest.php +++ b/apps/files_external/tests/Storage/SFTP_KeyTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Storage/SftpTest.php b/apps/files_external/tests/Storage/SftpTest.php index ce7d7461ba8..1208b40bec8 100644 --- a/apps/files_external/tests/Storage/SftpTest.php +++ b/apps/files_external/tests/Storage/SftpTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Storage/SmbTest.php b/apps/files_external/tests/Storage/SmbTest.php index 1040158cf19..a377d27f6ff 100644 --- a/apps/files_external/tests/Storage/SmbTest.php +++ b/apps/files_external/tests/Storage/SmbTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -75,7 +76,7 @@ class SmbTest extends \Test\Files\Storage\Storage { public function testNotifyGetChanges() { $lastError = null; - for($i = 0; $i < 5; $i++) { + for ($i = 0; $i < 5; $i++) { try { $this->tryTestNotifyGetChanges(); return; diff --git a/apps/files_external/tests/Storage/SwiftTest.php b/apps/files_external/tests/Storage/SwiftTest.php index 53ca499e4eb..6f32c60ecdb 100644 --- a/apps/files_external/tests/Storage/SwiftTest.php +++ b/apps/files_external/tests/Storage/SwiftTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/Storage/WebdavTest.php b/apps/files_external/tests/Storage/WebdavTest.php index a063ddebb0d..ca4cd6b6e10 100644 --- a/apps/files_external/tests/Storage/WebdavTest.php +++ b/apps/files_external/tests/Storage/WebdavTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/StorageConfigTest.php b/apps/files_external/tests/StorageConfigTest.php index fbbd9de94be..699da11d2e3 100644 --- a/apps/files_external/tests/StorageConfigTest.php +++ b/apps/files_external/tests/StorageConfigTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_external/tests/config.php b/apps/files_external/tests/config.php index 13fc0c2401e..ec860cf05a4 100644 --- a/apps/files_external/tests/config.php +++ b/apps/files_external/tests/config.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2012-2016 ownCloud, Inc. diff --git a/apps/files_external/tests/sso-setup/apps.config.php b/apps/files_external/tests/sso-setup/apps.config.php index 71190f44291..b3889956a53 100644 --- a/apps/files_external/tests/sso-setup/apps.config.php +++ b/apps/files_external/tests/sso-setup/apps.config.php @@ -5,16 +5,16 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ $CONFIG = [ - "apps_paths" => [ + 'apps_paths' => [ [ - "path" => "/var/www/html/apps", - "url" => "/apps", - "writable" => false, + 'path' => '/var/www/html/apps', + 'url' => '/apps', + 'writable' => false, ], [ - "path" => "/var/www/html/extra-apps", - "url" => "/extra-apps", - "writable" => true, + 'path' => '/var/www/html/extra-apps', + 'url' => '/extra-apps', + 'writable' => true, ], ], ]; diff --git a/apps/files_reminders/lib/Notification/Notifier.php b/apps/files_reminders/lib/Notification/Notifier.php index fd858a01cc5..975d48cf30e 100644 --- a/apps/files_reminders/lib/Notification/Notifier.php +++ b/apps/files_reminders/lib/Notification/Notifier.php @@ -75,7 +75,7 @@ class Notifier implements INotifier { [ 'name' => [ 'type' => 'highlight', - 'id' => (string)$node->getId(), + 'id' => (string) $node->getId(), 'name' => $node->getName(), ], ], diff --git a/apps/files_reminders/lib/Service/ReminderService.php b/apps/files_reminders/lib/Service/ReminderService.php index 8bd6887e754..49c707f379c 100644 --- a/apps/files_reminders/lib/Service/ReminderService.php +++ b/apps/files_reminders/lib/Service/ReminderService.php @@ -138,7 +138,7 @@ class ReminderService { ->setApp(Application::APP_ID) ->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('files', 'folder.svg'))) ->setUser($user->getUID()) - ->setObject('reminder', (string)$reminder->getId()) + ->setObject('reminder', (string) $reminder->getId()) ->setSubject('reminder-due', [ 'fileId' => $reminder->getFileId(), ]) diff --git a/apps/files_sharing/appinfo/routes.php b/apps/files_sharing/appinfo/routes.php index 91f8271c143..9d8c5761c64 100644 --- a/apps/files_sharing/appinfo/routes.php +++ b/apps/files_sharing/appinfo/routes.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/Activity/Filter.php b/apps/files_sharing/lib/Activity/Filter.php index 84e59598229..fe4d6385621 100644 --- a/apps/files_sharing/lib/Activity/Filter.php +++ b/apps/files_sharing/lib/Activity/Filter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/lib/Activity/Providers/Base.php b/apps/files_sharing/lib/Activity/Providers/Base.php index 9e652952969..bbb6f91dae8 100644 --- a/apps/files_sharing/lib/Activity/Providers/Base.php +++ b/apps/files_sharing/lib/Activity/Providers/Base.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -122,7 +123,7 @@ abstract class Base implements IProvider { $id = (string) key($parameter); } elseif ($event !== null) { $path = $parameter; - $id = (string)$event->getObjectId(); + $id = (string) $event->getObjectId(); } else { throw new \InvalidArgumentException('Could not generate file parameter'); } diff --git a/apps/files_sharing/lib/Activity/Providers/Downloads.php b/apps/files_sharing/lib/Activity/Providers/Downloads.php index ac9522ef93b..95c9fca6117 100644 --- a/apps/files_sharing/lib/Activity/Providers/Downloads.php +++ b/apps/files_sharing/lib/Activity/Providers/Downloads.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/lib/Activity/Providers/Groups.php b/apps/files_sharing/lib/Activity/Providers/Groups.php index fffa74258c9..ad8b352b596 100644 --- a/apps/files_sharing/lib/Activity/Providers/Groups.php +++ b/apps/files_sharing/lib/Activity/Providers/Groups.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php index 6cf5c05d874..15ffaf2cdb0 100644 --- a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php +++ b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php index 1971f935d30..750d0747b62 100644 --- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php +++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/lib/Activity/Providers/Users.php b/apps/files_sharing/lib/Activity/Providers/Users.php index 6c136d1f383..5c833ffae93 100644 --- a/apps/files_sharing/lib/Activity/Providers/Users.php +++ b/apps/files_sharing/lib/Activity/Providers/Users.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/lib/Activity/Settings/PublicLinks.php b/apps/files_sharing/lib/Activity/Settings/PublicLinks.php index 9a97893a190..0d3d00d2a7b 100644 --- a/apps/files_sharing/lib/Activity/Settings/PublicLinks.php +++ b/apps/files_sharing/lib/Activity/Settings/PublicLinks.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,8 +25,8 @@ class PublicLinks extends ShareActivitySettings { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/files_sharing/lib/Activity/Settings/PublicLinksUpload.php b/apps/files_sharing/lib/Activity/Settings/PublicLinksUpload.php index 5c5c7a3e07b..339f297020e 100644 --- a/apps/files_sharing/lib/Activity/Settings/PublicLinksUpload.php +++ b/apps/files_sharing/lib/Activity/Settings/PublicLinksUpload.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,8 +25,8 @@ class PublicLinksUpload extends ShareActivitySettings { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/files_sharing/lib/Activity/Settings/RemoteShare.php b/apps/files_sharing/lib/Activity/Settings/RemoteShare.php index 2ff0c141bd3..c04364bef20 100644 --- a/apps/files_sharing/lib/Activity/Settings/RemoteShare.php +++ b/apps/files_sharing/lib/Activity/Settings/RemoteShare.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,8 +25,8 @@ class RemoteShare extends ShareActivitySettings { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/files_sharing/lib/Activity/Settings/Shared.php b/apps/files_sharing/lib/Activity/Settings/Shared.php index ada09d1e444..3717512eebd 100644 --- a/apps/files_sharing/lib/Activity/Settings/Shared.php +++ b/apps/files_sharing/lib/Activity/Settings/Shared.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,8 +25,8 @@ class Shared extends ShareActivitySettings { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index 98c2d280856..df77f88b401 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index de427ea8177..7c4efe479cd 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/Capabilities.php b/apps/files_sharing/lib/Capabilities.php index 9afa077fac3..5548d9526ee 100644 --- a/apps/files_sharing/lib/Capabilities.php +++ b/apps/files_sharing/lib/Capabilities.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -155,7 +156,7 @@ class Capabilities implements ICapability { $res['group'] = []; $res['group']['enabled'] = $this->shareManager->allowGroupSharing(); $res['group']['expire_date']['enabled'] = true; - $res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL); + $res['default_permissions'] = (int) $this->config->getAppValue('core', 'shareapi_default_permissions', (string) Constants::PERMISSION_ALL); } //Federated sharing diff --git a/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php b/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php index f383424fd78..f4649293918 100644 --- a/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php +++ b/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -38,7 +39,7 @@ class ShareRecipientSorter implements ISorter { } $userFolder = $this->rootFolder->getUserFolder($user->getUID()); /** @var Node[] $nodes */ - $node = $userFolder->getFirstNodeById((int)$context['itemId']); + $node = $userFolder->getFirstNodeById((int) $context['itemId']); if (!$node) { return; } @@ -79,8 +80,8 @@ class ShareRecipientSorter implements ISorter { $a = $a['value']['shareWith']; $b = $b['value']['shareWith']; - $valueA = (int)in_array($a, $al, true); - $valueB = (int)in_array($b, $al, true); + $valueA = (int) in_array($a, $al, true); + $valueB = (int) in_array($b, $al, true); return $valueB - $valueA; } diff --git a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php index bb7f374de58..d4b23844d9e 100644 --- a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php +++ b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud GmbH. diff --git a/apps/files_sharing/lib/Command/DeleteOrphanShares.php b/apps/files_sharing/lib/Command/DeleteOrphanShares.php index 028738a4318..cd3ff5c08f8 100644 --- a/apps/files_sharing/lib/Command/DeleteOrphanShares.php +++ b/apps/files_sharing/lib/Command/DeleteOrphanShares.php @@ -49,7 +49,7 @@ class DeleteOrphanShares extends Base { if ($exists) { $output->writeln(" file still exists but the share owner lost access to it, run <info>occ info:file {$share['fileid']}</info> for more information about the file"); } else { - $output->writeln(" file no longer exists"); + $output->writeln(' file no longer exists'); } } } @@ -57,14 +57,14 @@ class DeleteOrphanShares extends Base { $count = count($orphans); if ($count === 0) { - $output->writeln("No orphan shares detected"); + $output->writeln('No orphan shares detected'); return 0; } if ($force) { $doDelete = true; } else { - $output->writeln(""); + $output->writeln(''); /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); $question = new ConfirmationQuestion("Delete <info>$count</info> orphan shares? [y/N] ", false); diff --git a/apps/files_sharing/lib/Controller/ExternalSharesController.php b/apps/files_sharing/lib/Controller/ExternalSharesController.php index e7189dabfbd..be7764f2f6d 100644 --- a/apps/files_sharing/lib/Controller/ExternalSharesController.php +++ b/apps/files_sharing/lib/Controller/ExternalSharesController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/Controller/PublicPreviewController.php b/apps/files_sharing/lib/Controller/PublicPreviewController.php index 4dc3989f866..c011b02664d 100644 --- a/apps/files_sharing/lib/Controller/PublicPreviewController.php +++ b/apps/files_sharing/lib/Controller/PublicPreviewController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/lib/Controller/RemoteController.php b/apps/files_sharing/lib/Controller/RemoteController.php index fd3bdf15613..d902941117f 100644 --- a/apps/files_sharing/lib/Controller/RemoteController.php +++ b/apps/files_sharing/lib/Controller/RemoteController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 8b866c1c395..d71e4fff401 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -214,7 +214,7 @@ class ShareAPIController extends OCSController { 'message' => $userStatus->getMessage(), 'icon' => $userStatus->getIcon(), 'clearAt' => $userStatus->getClearAt() - ? (int)$userStatus->getClearAt()->format('U') + ? (int) $userStatus->getClearAt()->format('U') : null, ]; } @@ -308,7 +308,7 @@ class ShareAPIController extends OCSController { $result['attributes'] = null; if ($attributes = $share->getAttributes()) { - $result['attributes'] = (string)\json_encode($attributes->toArray()); + $result['attributes'] = (string) \json_encode($attributes->toArray()); } return $result; @@ -538,7 +538,7 @@ class ShareAPIController extends OCSController { * @param string $password Password for the share * @param string|null $sendPasswordByTalk Send the password for the share over Talk * @param ?string $expireDate The expiry date of the share in the user's timezone at 00:00. - * If $expireDate is not supplied or set to `null`, the system default will be used. + * If $expireDate is not supplied or set to `null`, the system default will be used. * @param string $note Note for the share * @param string $label Label for the share (only used in link and email) * @param string|null $attributes Additional attributes for the share @@ -609,7 +609,7 @@ class ShareAPIController extends OCSController { } else { // Use default permissions only for non-link shares to keep legacy behavior if ($permissions === null) { - $permissions = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL); + $permissions = (int) $this->config->getAppValue('core', 'shareapi_default_permissions', (string) Constants::PERMISSION_ALL); } // Non-link shares always require read permissions (link shares could be file drop) $permissions |= Constants::PERMISSION_READ; @@ -1082,7 +1082,7 @@ class ShareAPIController extends OCSController { if (!$resharingRight && $this->shareProviderResharingRights($this->currentUser, $share, $node)) { $resharingRight = true; } - } catch (InvalidPathException | NotFoundException $e) { + } catch (InvalidPathException|NotFoundException $e) { } } @@ -1137,7 +1137,7 @@ class ShareAPIController extends OCSController { // initiate real owner. $owner = $node->getOwner() - ->getUID(); + ->getUID(); if (!$this->userManager->userExists($owner)) { return new DataResponse([]); } @@ -1146,7 +1146,7 @@ class ShareAPIController extends OCSController { $userFolder = $this->rootFolder->getUserFolder($owner); if ($node->getId() !== $userFolder->getId() && !$userFolder->isSubNode($node)) { $owner = $node->getOwner() - ->getUID(); + ->getUID(); $userFolder = $this->rootFolder->getUserFolder($owner); $node = $userFolder->getFirstNodeById($node->getId()); } @@ -1209,8 +1209,8 @@ class ShareAPIController extends OCSController { * @param string|null $hideDownload New condition if the download should be hidden * @param string|null $attributes New additional attributes * @param string|null $sendMail if the share should be send by mail. - * Considering the share already exists, no mail will be send after the share is updated. - * You will have to use the sendMail action to send the mail. + * Considering the share already exists, no mail will be send after the share is updated. + * You will have to use the sendMail action to send the mail. * @param string|null $shareWith New recipient for email shares * @return DataResponse<Http::STATUS_OK, Files_SharingShare, array{}> * @throws OCSBadRequestException Share could not be updated because the requested changes are invalid @@ -1319,7 +1319,7 @@ class ShareAPIController extends OCSController { if ($label !== null) { if (strlen($label) > 255) { - throw new OCSBadRequestException("Maximum label length is 255"); + throw new OCSBadRequestException('Maximum label length is 255'); } $share->setLabel($label); } @@ -1358,7 +1358,7 @@ class ShareAPIController extends OCSController { $share = $this->shareManager->updateShare($share); } catch (HintException $e) { $code = $e->getCode() === 0 ? 403 : $e->getCode(); - throw new OCSException($e->getHint(), (int)$code); + throw new OCSException($e->getHint(), (int) $code); } catch (\Exception $e) { $this->logger->error($e->getMessage(), ['exception' => $e]); throw new OCSBadRequestException('Failed to update share.', $e); @@ -1446,7 +1446,7 @@ class ShareAPIController extends OCSController { $this->shareManager->acceptShare($share, $this->currentUser); } catch (HintException $e) { $code = $e->getCode() === 0 ? 403 : $e->getCode(); - throw new OCSException($e->getHint(), (int)$code); + throw new OCSException($e->getHint(), (int) $code); } catch (\Exception $e) { $this->logger->error($e->getMessage(), ['exception' => $e]); throw new OCSBadRequestException('Failed to accept share.', $e); @@ -1666,7 +1666,7 @@ class ShareAPIController extends OCSController { */ private function parseDate(string $expireDate): \DateTime { try { - $date = new \DateTime(trim($expireDate, "\""), $this->dateTimeZone->getTimeZone()); + $date = new \DateTime(trim($expireDate, '"'), $this->dateTimeZone->getTimeZone()); // Make sure it expires at midnight in owner timezone $date->setTime(0, 0, 0); } catch (\Exception $e) { @@ -1898,7 +1898,7 @@ class ShareAPIController extends OCSController { if ($this->shareProviderResharingRights($viewer, $share, $node)) { return true; } - } catch (InvalidPathException | NotFoundException $e) { + } catch (InvalidPathException|NotFoundException $e) { } } } @@ -2113,7 +2113,7 @@ class ShareAPIController extends OCSController { * @throws OCSBadRequestException Invalid request or wrong password * @throws OCSException Error while sending mail notification * @return DataResponse<Http::STATUS_OK, array<empty>, array{}> - * 200: The email notification was sent successfully + * 200: The email notification was sent successfully */ #[NoAdminRequired] #[UserRateLimit(limit: 10, period: 600)] diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php index 642065c9983..33600b609ab 100644 --- a/apps/files_sharing/lib/Controller/ShareController.php +++ b/apps/files_sharing/lib/Controller/ShareController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -204,7 +205,7 @@ class ShareController extends AuthPublicShareController { * throws hooks when a share is attempted to be accessed * * @param \OCP\Share\IShare|string $share the Share instance if available, - * otherwise token + * otherwise token * @param int $errorCode * @param string $errorMessage * diff --git a/apps/files_sharing/lib/Controller/ShareInfoController.php b/apps/files_sharing/lib/Controller/ShareInfoController.php index df93b485e11..2cb8e604f4c 100644 --- a/apps/files_sharing/lib/Controller/ShareInfoController.php +++ b/apps/files_sharing/lib/Controller/ShareInfoController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php b/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php index 477bc9f82ce..1daea5cc0c9 100644 --- a/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php +++ b/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php @@ -111,7 +111,7 @@ class DefaultPublicShareTemplateProvider implements IPublicShareTemplateProvider */ $freeSpace = $share->getNode()->getStorage()->free_space($share->getNode()->getInternalPath()); if ($freeSpace < FileInfo::SPACE_UNLIMITED) { - $freeSpace = (int)max($freeSpace, 0); + $freeSpace = (int) max($freeSpace, 0); } else { $freeSpace = (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188 } @@ -212,12 +212,12 @@ class DefaultPublicShareTemplateProvider implements IPublicShareTemplateProvider $this->eventDispatcher->dispatchTyped(new LoadViewer()); } // OpenGraph Support: http://ogp.me/ - Util::addHeader('meta', ['property' => "og:title", 'content' => $shareTmpl['filename']]); - Util::addHeader('meta', ['property' => "og:description", 'content' => $this->defaults->getName() . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')]); - Util::addHeader('meta', ['property' => "og:site_name", 'content' => $this->defaults->getName()]); - Util::addHeader('meta', ['property' => "og:url", 'content' => $shareTmpl['shareUrl']]); - Util::addHeader('meta', ['property' => "og:type", 'content' => "object"]); - Util::addHeader('meta', ['property' => "og:image", 'content' => $ogPreview]); + Util::addHeader('meta', ['property' => 'og:title', 'content' => $shareTmpl['filename']]); + Util::addHeader('meta', ['property' => 'og:description', 'content' => $this->defaults->getName() . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')]); + Util::addHeader('meta', ['property' => 'og:site_name', 'content' => $this->defaults->getName()]); + Util::addHeader('meta', ['property' => 'og:url', 'content' => $shareTmpl['shareUrl']]); + Util::addHeader('meta', ['property' => 'og:type', 'content' => 'object']); + Util::addHeader('meta', ['property' => 'og:image', 'content' => $ogPreview]); $this->eventDispatcher->dispatchTyped(new BeforeTemplateRenderedEvent($share)); diff --git a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php index be082f990bc..2315ff5c120 100644 --- a/apps/files_sharing/lib/DeleteOrphanedSharesJob.php +++ b/apps/files_sharing/lib/DeleteOrphanedSharesJob.php @@ -93,7 +93,7 @@ class DeleteOrphanedSharesJob extends TimedJob { $result->closeCursor(); $deleteQb->setParameter('ids', $ids, IQueryBuilder::PARAM_INT_ARRAY); $deleted = $deleteQb->executeStatement(); - $this->logger->debug("{deleted} orphaned share(s) deleted", [ + $this->logger->debug('{deleted} orphaned share(s) deleted', [ 'app' => 'DeleteOrphanedSharesJob', 'deleted' => $deleted, ]); diff --git a/apps/files_sharing/lib/Exceptions/BrokenPath.php b/apps/files_sharing/lib/Exceptions/BrokenPath.php index 11b3599d609..a68a8fc05d4 100644 --- a/apps/files_sharing/lib/Exceptions/BrokenPath.php +++ b/apps/files_sharing/lib/Exceptions/BrokenPath.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/Exceptions/S2SException.php b/apps/files_sharing/lib/Exceptions/S2SException.php index fb60b20774a..10360820432 100644 --- a/apps/files_sharing/lib/Exceptions/S2SException.php +++ b/apps/files_sharing/lib/Exceptions/S2SException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/files_sharing/lib/Exceptions/SharingRightsException.php b/apps/files_sharing/lib/Exceptions/SharingRightsException.php index 548873cfbfd..2ffe72c4e69 100644 --- a/apps/files_sharing/lib/Exceptions/SharingRightsException.php +++ b/apps/files_sharing/lib/Exceptions/SharingRightsException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/lib/ExpireSharesJob.php b/apps/files_sharing/lib/ExpireSharesJob.php index 06b9f57efed..5e84d415450 100644 --- a/apps/files_sharing/lib/ExpireSharesJob.php +++ b/apps/files_sharing/lib/ExpireSharesJob.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -63,9 +64,9 @@ class ExpireSharesJob extends TimedJob { $shares = $qb->executeQuery(); while ($share = $shares->fetch()) { - if ((int)$share['share_type'] === IShare::TYPE_LINK) { + if ((int) $share['share_type'] === IShare::TYPE_LINK) { $id = 'ocinternal'; - } elseif ((int)$share['share_type'] === IShare::TYPE_EMAIL) { + } elseif ((int) $share['share_type'] === IShare::TYPE_EMAIL) { $id = 'ocMailShare'; } diff --git a/apps/files_sharing/lib/External/Cache.php b/apps/files_sharing/lib/External/Cache.php index 7fad71b9084..dd6b42106a3 100644 --- a/apps/files_sharing/lib/External/Cache.php +++ b/apps/files_sharing/lib/External/Cache.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php index abddcde4dae..ddc30d28820 100644 --- a/apps/files_sharing/lib/External/Manager.php +++ b/apps/files_sharing/lib/External/Manager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -241,10 +242,10 @@ class Manager { $validShare = is_array($share) && isset($share['share_type']) && isset($share['user']); // check if the user is allowed to access it - if ($validShare && (int)$share['share_type'] === IShare::TYPE_USER && $share['user'] === $this->uid) { + if ($validShare && (int) $share['share_type'] === IShare::TYPE_USER && $share['user'] === $this->uid) { return $share; - } elseif ($validShare && (int)$share['share_type'] === IShare::TYPE_GROUP) { - $parentId = (int)$share['parent']; + } elseif ($validShare && (int) $share['share_type'] === IShare::TYPE_GROUP) { + $parentId = (int) $share['parent']; if ($parentId !== -1) { // we just retrieved a sub-share, switch to the parent entry for verification $groupShare = $this->fetchShare($parentId); @@ -292,7 +293,7 @@ class Manager { $hash = md5($mountPoint); $userShareAccepted = false; - if ((int)$share['share_type'] === IShare::TYPE_USER) { + if ((int) $share['share_type'] === IShare::TYPE_USER) { $acceptShare = $this->connection->prepare(' UPDATE `*PREFIX*share_external` SET `accepted` = ?, @@ -301,7 +302,7 @@ class Manager { WHERE `id` = ? AND `user` = ?'); $userShareAccepted = $acceptShare->execute([1, $mountPoint, $hash, $id, $this->uid]); } else { - $parentId = (int)$share['parent']; + $parentId = (int) $share['parent']; if ($parentId !== -1) { // this is the sub-share $subshare = $share; @@ -368,7 +369,7 @@ class Manager { $share = $this->getShare($id); $result = false; - if ($share && (int)$share['share_type'] === IShare::TYPE_USER) { + if ($share && (int) $share['share_type'] === IShare::TYPE_USER) { $removeShare = $this->connection->prepare(' DELETE FROM `*PREFIX*share_external` WHERE `id` = ? AND `user` = ?'); $removeShare->execute([$id, $this->uid]); @@ -376,8 +377,8 @@ class Manager { $this->processNotification($id); $result = true; - } elseif ($share && (int)$share['share_type'] === IShare::TYPE_GROUP) { - $parentId = (int)$share['parent']; + } elseif ($share && (int) $share['share_type'] === IShare::TYPE_GROUP) { + $parentId = (int) $share['parent']; if ($parentId !== -1) { // this is the sub-share $subshare = $share; @@ -387,7 +388,7 @@ class Manager { if ($subshare !== null) { try { - $this->updateAccepted((int)$subshare['id'], false); + $this->updateAccepted((int) $subshare['id'], false); $result = true; } catch (Exception $e) { $this->logger->emergency('Could not update share', ['exception' => $e]); @@ -424,7 +425,7 @@ class Manager { $filter = $this->notificationManager->createNotification(); $filter->setApp('files_sharing') ->setUser($this->uid) - ->setObject('remote_share', (string)$remoteShare); + ->setObject('remote_share', (string) $remoteShare); $this->notificationManager->markProcessed($filter); } @@ -565,7 +566,7 @@ class Manager { WHERE `mountpoint_hash` = ? AND `user` = ? '); - $result = (bool)$query->execute([$target, $targetHash, $sourceHash, $this->uid]); + $result = (bool) $query->execute([$target, $targetHash, $sourceHash, $this->uid]); $this->eventDispatcher->dispatchTyped(new Files\Events\InvalidateMountCacheEvent($this->userManager->get($this->uid))); @@ -596,7 +597,7 @@ class Manager { $result = $getShare->execute([$hash, $this->uid]); $share = $result->fetch(); $result->closeCursor(); - if ($share !== false && (int)$share['share_type'] === IShare::TYPE_USER) { + if ($share !== false && (int) $share['share_type'] === IShare::TYPE_USER) { try { $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); } catch (\Throwable $e) { @@ -608,10 +609,10 @@ class Manager { DELETE FROM `*PREFIX*share_external` WHERE `id` = ? '); - $deleteResult = $query->execute([(int)$share['id']]); + $deleteResult = $query->execute([(int) $share['id']]); $deleteResult->closeCursor(); - } elseif ($share !== false && (int)$share['share_type'] === IShare::TYPE_GROUP) { - $this->updateAccepted((int)$share['id'], false); + } elseif ($share !== false && (int) $share['share_type'] === IShare::TYPE_GROUP) { + $this->updateAccepted((int) $share['id'], false); } $this->removeReShares($id); @@ -706,12 +707,12 @@ class Manager { $qb = $this->connection->getQueryBuilder(); // delete group share entry and matching sub-entries $qb->delete('share_external') - ->where( - $qb->expr()->orX( - $qb->expr()->eq('id', $qb->createParameter('share_id')), - $qb->expr()->eq('parent', $qb->createParameter('share_parent_id')) - ) - ); + ->where( + $qb->expr()->orX( + $qb->expr()->eq('id', $qb->createParameter('share_id')), + $qb->expr()->eq('parent', $qb->createParameter('share_parent_id')) + ) + ); foreach ($shares as $share) { $qb->setParameter('share_id', $share['id']); @@ -782,7 +783,7 @@ class Manager { // remove parent group share entry if we have a specific user share entry for the user $toRemove = []; foreach ($shares as $share) { - if ((int)$share['share_type'] === IShare::TYPE_GROUP && (int)$share['parent'] > 0) { + if ((int) $share['share_type'] === IShare::TYPE_GROUP && (int) $share['parent'] > 0) { $toRemove[] = $share['parent']; } } @@ -792,7 +793,7 @@ class Manager { if (!is_null($accepted)) { $shares = array_filter($shares, function ($share) use ($accepted) { - return (bool)$share['accepted'] === $accepted; + return (bool) $share['accepted'] === $accepted; }); } return array_values($shares); diff --git a/apps/files_sharing/lib/External/Mount.php b/apps/files_sharing/lib/External/Mount.php index 685e931e3bc..a273e2296b1 100644 --- a/apps/files_sharing/lib/External/Mount.php +++ b/apps/files_sharing/lib/External/Mount.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/External/MountProvider.php b/apps/files_sharing/lib/External/MountProvider.php index 2c639543a87..5abd3269ac7 100644 --- a/apps/files_sharing/lib/External/MountProvider.php +++ b/apps/files_sharing/lib/External/MountProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/External/Scanner.php b/apps/files_sharing/lib/External/Scanner.php index 63757d44f46..c51b6a65b90 100644 --- a/apps/files_sharing/lib/External/Scanner.php +++ b/apps/files_sharing/lib/External/Scanner.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php index 2a53bffb87e..03fd031f0f7 100644 --- a/apps/files_sharing/lib/External/Storage.php +++ b/apps/files_sharing/lib/External/Storage.php @@ -86,7 +86,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, 'root' => $webDavEndpoint, 'user' => $options['token'], 'authType' => \Sabre\DAV\Client::AUTH_BASIC, - 'password' => (string)$options['password'] + 'password' => (string) $options['password'] ] ); } @@ -214,20 +214,20 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, // we remove the invalid storage $this->manager->removeShare($this->mountPoint); $this->manager->getMountManager()->removeMount($this->mountPoint); - throw new StorageInvalidException("Remote share not found", 0, $e); + throw new StorageInvalidException('Remote share not found', 0, $e); } else { // Nextcloud instance is gone, likely to be a temporary server configuration error - throw new StorageNotAvailableException("No nextcloud instance found at remote", 0, $e); + throw new StorageNotAvailableException('No nextcloud instance found at remote', 0, $e); } } catch (ForbiddenException $e) { // auth error, remove share for now (provide a dialog in the future) $this->manager->removeShare($this->mountPoint); $this->manager->getMountManager()->removeMount($this->mountPoint); - throw new StorageInvalidException("Auth error when getting remote share"); + throw new StorageInvalidException('Auth error when getting remote share'); } catch (\GuzzleHttp\Exception\ConnectException $e) { - throw new StorageNotAvailableException("Failed to connect to remote instance", 0, $e); + throw new StorageNotAvailableException('Failed to connect to remote instance', 0, $e); } catch (\GuzzleHttp\Exception\RequestException $e) { - throw new StorageNotAvailableException("Error while sending request to remote instance", 0, $e); + throw new StorageNotAvailableException('Error while sending request to remote instance', 0, $e); } } @@ -258,7 +258,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, $cache = $this->memcacheFactory->createDistributed('files_sharing_remote_url'); $cached = $cache->get($url); if ($cached !== null) { - return (bool)$cached; + return (bool) $cached; } $client = $this->httpClient->newClient(); @@ -352,7 +352,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) { return false; } - return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE); + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_SHARE); } public function getPermissions($path): int { @@ -366,7 +366,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, $ocPermissions = $response['{http://owncloud.org/ns}permissions'] ?? null; // old federated sharing permissions if ($ocsPermissions !== null) { - $permissions = (int)$ocsPermissions; + $permissions = (int) $ocsPermissions; } elseif ($ocmPermissions !== null) { // permissions provided by the OCM API $permissions = $this->ocmPermissions2ncPermissions($ocmPermissions, $path); @@ -431,6 +431,6 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, } public function free_space($path) { - return parent::free_space(""); + return parent::free_space(''); } } diff --git a/apps/files_sharing/lib/External/Watcher.php b/apps/files_sharing/lib/External/Watcher.php index ccd6bd179b3..f3616feabba 100644 --- a/apps/files_sharing/lib/External/Watcher.php +++ b/apps/files_sharing/lib/External/Watcher.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/Helper.php b/apps/files_sharing/lib/Helper.php index f2f92679e2f..7834d7f7462 100644 --- a/apps/files_sharing/lib/Helper.php +++ b/apps/files_sharing/lib/Helper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/Hooks.php b/apps/files_sharing/lib/Hooks.php index a6ab3f16f29..d81ff9152e1 100644 --- a/apps/files_sharing/lib/Hooks.php +++ b/apps/files_sharing/lib/Hooks.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/ISharedStorage.php b/apps/files_sharing/lib/ISharedStorage.php index dfd8b134db1..9bd3e4c9476 100644 --- a/apps/files_sharing/lib/ISharedStorage.php +++ b/apps/files_sharing/lib/ISharedStorage.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php b/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php index 91b8b73579e..173e48b30a1 100644 --- a/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php +++ b/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php b/apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php index 0be662fbe0d..aa1385fe687 100644 --- a/apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php +++ b/apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php b/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php index 23a2ded0968..74ad70b9889 100644 --- a/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php +++ b/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -21,7 +22,7 @@ class OwncloudGuestShareType implements IRepairStep { /** @var IDBConnection */ private $connection; - /** @var IConfig */ + /** @var IConfig */ private $config; diff --git a/apps/files_sharing/lib/Migration/SetAcceptedStatus.php b/apps/files_sharing/lib/Migration/SetAcceptedStatus.php index d54c22d3d7d..43a3c4aad74 100644 --- a/apps/files_sharing/lib/Migration/SetAcceptedStatus.php +++ b/apps/files_sharing/lib/Migration/SetAcceptedStatus.php @@ -20,7 +20,7 @@ class SetAcceptedStatus implements IRepairStep { /** @var IDBConnection */ private $connection; - /** @var IConfig */ + /** @var IConfig */ private $config; diff --git a/apps/files_sharing/lib/Migration/SetPasswordColumn.php b/apps/files_sharing/lib/Migration/SetPasswordColumn.php index 0ce1e276566..a04a42d8c64 100644 --- a/apps/files_sharing/lib/Migration/SetPasswordColumn.php +++ b/apps/files_sharing/lib/Migration/SetPasswordColumn.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -21,7 +22,7 @@ class SetPasswordColumn implements IRepairStep { /** @var IDBConnection */ private $connection; - /** @var IConfig */ + /** @var IConfig */ private $config; diff --git a/apps/files_sharing/lib/MountProvider.php b/apps/files_sharing/lib/MountProvider.php index 8968f6fa4d1..50565f3eba0 100644 --- a/apps/files_sharing/lib/MountProvider.php +++ b/apps/files_sharing/lib/MountProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -126,7 +127,7 @@ class MountProvider implements IMountProvider { * * @param \OCP\Share\IShare[] $shares * @return \OCP\Share\IShare[][] array of grouped shares, each element in the - * array is a group which itself is an array of shares + * array is a group which itself is an array of shares */ private function groupShares(array $shares) { $tmp = []; diff --git a/apps/files_sharing/lib/Notification/Notifier.php b/apps/files_sharing/lib/Notification/Notifier.php index 3947e5aa5f2..dd09fb6e20e 100644 --- a/apps/files_sharing/lib/Notification/Notifier.php +++ b/apps/files_sharing/lib/Notification/Notifier.php @@ -34,9 +34,9 @@ class Notifier implements INotifier { private $shareManager; /** @var IRootFolder */ private $rootFolder; - /** @var IGroupManager */ + /** @var IGroupManager */ protected $groupManager; - /** @var IUserManager */ + /** @var IUserManager */ protected $userManager; /** @var IURLGenerator */ protected $url; diff --git a/apps/files_sharing/lib/OrphanHelper.php b/apps/files_sharing/lib/OrphanHelper.php index 556794bcc78..e4433671a81 100644 --- a/apps/files_sharing/lib/OrphanHelper.php +++ b/apps/files_sharing/lib/OrphanHelper.php @@ -69,10 +69,10 @@ class OrphanHelper { $result = $query->executeQuery(); while ($row = $result->fetch()) { yield [ - 'id' => (int)$row['id'], - 'owner' => (string)$row['uid_owner'], - 'fileid' => (int)$row['file_source'], - 'target' => (string)$row['file_target'], + 'id' => (int) $row['id'], + 'owner' => (string) $row['uid_owner'], + 'fileid' => (int) $row['file_source'], + 'target' => (string) $row['file_target'], ]; } } diff --git a/apps/files_sharing/lib/Scanner.php b/apps/files_sharing/lib/Scanner.php index 1ff1046bce7..7a412a2e763 100644 --- a/apps/files_sharing/lib/Scanner.php +++ b/apps/files_sharing/lib/Scanner.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/ShareBackend/File.php b/apps/files_sharing/lib/ShareBackend/File.php index 93f98c9e18a..623e5574ed9 100644 --- a/apps/files_sharing/lib/ShareBackend/File.php +++ b/apps/files_sharing/lib/ShareBackend/File.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php index 9908381ef1e..7b345808c3a 100644 --- a/apps/files_sharing/lib/ShareBackend/Folder.php +++ b/apps/files_sharing/lib/ShareBackend/Folder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/lib/SharedMount.php b/apps/files_sharing/lib/SharedMount.php index 6c7178132ad..ce5dade0376 100644 --- a/apps/files_sharing/lib/SharedMount.php +++ b/apps/files_sharing/lib/SharedMount.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -272,7 +273,7 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint $row = $result->fetch(); $result->closeCursor(); if ($row) { - return (int)$row['storage']; + return (int) $row['storage']; } return -1; } diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index a70632d6faa..f43901740c3 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -60,7 +61,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha private LoggerInterface $logger; - /** @var IStorage */ + /** @var IStorage */ private $nonMaskedStorage; private array $mountOptions = []; @@ -139,7 +140,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha try { if (self::$initDepth > 10) { - throw new \Exception("Maximum share depth reached"); + throw new \Exception('Maximum share depth reached'); } /** @var IRootFolder $rootFolder */ @@ -263,7 +264,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha } public function isCreatable($path): bool { - return (bool)($this->getPermissions($path) & \OCP\Constants::PERMISSION_CREATE); + return (bool) ($this->getPermissions($path) & \OCP\Constants::PERMISSION_CREATE); } public function isReadable($path): bool { @@ -280,18 +281,18 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha } public function isUpdatable($path): bool { - return (bool)($this->getPermissions($path) & \OCP\Constants::PERMISSION_UPDATE); + return (bool) ($this->getPermissions($path) & \OCP\Constants::PERMISSION_UPDATE); } public function isDeletable($path): bool { - return (bool)($this->getPermissions($path) & \OCP\Constants::PERMISSION_DELETE); + return (bool) ($this->getPermissions($path) & \OCP\Constants::PERMISSION_DELETE); } public function isSharable($path): bool { if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) { return false; } - return (bool)($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE); + return (bool) ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE); } public function fopen($path, $mode) { @@ -561,7 +562,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha * @psalm-suppress DocblockTypeContradiction */ if (!$this->storage) { - $message = "no storage set after init for share " . $this->getShareId(); + $message = 'no storage set after init for share ' . $this->getShareId(); $this->logger->error($message); $this->storage = new FailedStorage(['exception' => new \Exception($message)]); } diff --git a/apps/files_sharing/lib/Updater.php b/apps/files_sharing/lib/Updater.php index 294f7a81d3c..2836c50facb 100644 --- a/apps/files_sharing/lib/Updater.php +++ b/apps/files_sharing/lib/Updater.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -42,7 +43,7 @@ class Updater { } $user = $userFolder->getOwner(); if (!$user) { - throw new \Exception("user folder has no owner"); + throw new \Exception('user folder has no owner'); } $src = $userFolder->get($path); diff --git a/apps/files_sharing/lib/ViewOnly.php b/apps/files_sharing/lib/ViewOnly.php index 7b52d79f4d0..607d869660a 100644 --- a/apps/files_sharing/lib/ViewOnly.php +++ b/apps/files_sharing/lib/ViewOnly.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2019 ownCloud GmbH diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index 9884465c973..01cb4fd6116 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -1181,7 +1182,7 @@ class ApiTest extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER2); $view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files'); - $view->mkdir("localDir"); + $view->mkdir('localDir'); // move mount point to the folder "localDir" $result = $view->rename($this->folder, 'localDir/'.$this->folder); diff --git a/apps/files_sharing/tests/ApplicationTest.php b/apps/files_sharing/tests/ApplicationTest.php index b1a635406b2..3ccaedcf568 100644 --- a/apps/files_sharing/tests/ApplicationTest.php +++ b/apps/files_sharing/tests/ApplicationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php index 1991f3e123a..2f58ebe7376 100644 --- a/apps/files_sharing/tests/CacheTest.php +++ b/apps/files_sharing/tests/CacheTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -564,7 +565,7 @@ class CacheTest extends TestCase { /** @var SharedStorage $sharedStorage */ [$sharedStorage] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/sub'); - $results = $sharedStorage->getCache()->search("foo.txt"); + $results = $sharedStorage->getCache()->search('foo.txt'); $this->assertCount(1, $results); } diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php index 69911100f56..9e5273e9aa0 100644 --- a/apps/files_sharing/tests/CapabilitiesTest.php +++ b/apps/files_sharing/tests/CapabilitiesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php b/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php index f2c019e4a72..e97f2ff2f54 100644 --- a/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php +++ b/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -15,13 +16,13 @@ use OCP\Share\IManager; use Test\TestCase; class ShareRecipientSorterTest extends TestCase { - /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ protected $shareManager; - /** @var IRootFolder|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IRootFolder|\PHPUnit\Framework\MockObject\MockObject */ protected $rootFolder; - /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */ protected $userSession; - /** @var ShareRecipientSorter */ + /** @var ShareRecipientSorter */ protected $sorter; protected function setUp(): void { diff --git a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php index 803ee1d02c9..d2f03953503 100644 --- a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php +++ b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud GmbH. diff --git a/apps/files_sharing/tests/Command/FixShareOwnersTest.php b/apps/files_sharing/tests/Command/FixShareOwnersTest.php index 939fad03d7c..0fde61895b1 100644 --- a/apps/files_sharing/tests/Command/FixShareOwnersTest.php +++ b/apps/files_sharing/tests/Command/FixShareOwnersTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php b/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php index 3b4173ba7fa..dc9110da83c 100644 --- a/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php b/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php index d1e542cc5d9..b5b7cfcfe08 100644 --- a/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php +++ b/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index 097dc631280..5437f61d8bd 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -763,27 +764,27 @@ class ShareAPIControllerTest extends TestCase { public function testGetShare(IShare $share, array $result): void { /** @var ShareAPIController&MockObject $ocs */ $ocs = $this->getMockBuilder(ShareAPIController::class) - ->setConstructorArgs([ - Application::APP_ID, - $this->request, - $this->shareManager, - $this->groupManager, - $this->userManager, - $this->rootFolder, - $this->urlGenerator, - $this->l, - $this->config, - $this->appManager, - $this->serverContainer, - $this->userStatusManager, - $this->previewManager, - $this->dateTimeZone, - $this->logger, - $this->factory, - $this->mailer, - $this->currentUser, - - ]) + ->setConstructorArgs([ + Application::APP_ID, + $this->request, + $this->shareManager, + $this->groupManager, + $this->userManager, + $this->rootFolder, + $this->urlGenerator, + $this->l, + $this->config, + $this->appManager, + $this->serverContainer, + $this->userStatusManager, + $this->previewManager, + $this->dateTimeZone, + $this->logger, + $this->factory, + $this->mailer, + $this->currentUser, + + ]) ->onlyMethods(['canAccessShare']) ->getMock(); @@ -1762,14 +1763,14 @@ class ShareAPIControllerTest extends TestCase { [$userFolder, $path] = $this->getNonSharedUserFile(); $this->rootFolder->expects($this->exactly(2)) - ->method('getUserFolder') - ->with('currentUser') - ->willReturn($userFolder); + ->method('getUserFolder') + ->with('currentUser') + ->willReturn($userFolder); $userFolder->expects($this->once()) - ->method('get') - ->with('valid-path') - ->willReturn($path); + ->method('get') + ->with('valid-path') + ->willReturn($path); $userFolder->method('getById') ->willReturn([]); @@ -1816,9 +1817,9 @@ class ShareAPIControllerTest extends TestCase { ->willReturn($userFolder); $userFolder->expects($this->once()) - ->method('get') - ->with('valid-path') - ->willReturn($path); + ->method('get') + ->with('valid-path') + ->willReturn($path); $userFolder->method('getById') ->willReturn([]); @@ -2284,14 +2285,14 @@ class ShareAPIControllerTest extends TestCase { [$userFolder, $path] = $this->getNonSharedUserFile(); $this->rootFolder->expects($this->exactly(2)) - ->method('getUserFolder') - ->with('currentUser') - ->willReturn($userFolder); + ->method('getUserFolder') + ->with('currentUser') + ->willReturn($userFolder); $userFolder->expects($this->once()) - ->method('get') - ->with('valid-path') - ->willReturn($path); + ->method('get') + ->with('valid-path') + ->willReturn($path); $userFolder->method('getById') ->willReturn([]); @@ -2354,14 +2355,14 @@ class ShareAPIControllerTest extends TestCase { [$userFolder, $path] = $this->getNonSharedUserFile(); $this->rootFolder->expects($this->exactly(2)) - ->method('getUserFolder') - ->with('currentUser') - ->willReturn($userFolder); + ->method('getUserFolder') + ->with('currentUser') + ->willReturn($userFolder); $userFolder->expects($this->once()) - ->method('get') - ->with('valid-path') - ->willReturn($path); + ->method('get') + ->with('valid-path') + ->willReturn($path); $userFolder->method('getById') ->willReturn([]); @@ -2402,14 +2403,14 @@ class ShareAPIControllerTest extends TestCase { [$userFolder, $path] = $this->getNonSharedUserFile(); $this->rootFolder->expects($this->exactly(2)) - ->method('getUserFolder') - ->with('currentUser') - ->willReturn($userFolder); + ->method('getUserFolder') + ->with('currentUser') + ->willReturn($userFolder); $userFolder->expects($this->once()) - ->method('get') - ->with('valid-path') - ->willReturn($path); + ->method('get') + ->with('valid-path') + ->willReturn($path); $userFolder->method('getById') ->willReturn([]); @@ -2477,9 +2478,9 @@ class ShareAPIControllerTest extends TestCase { $path->method('getPath')->willReturn('valid-path'); $userFolder->expects($this->once()) - ->method('get') - ->with('valid-path') - ->willReturn($path); + ->method('get') + ->with('valid-path') + ->willReturn($path); $userFolder->method('getById') ->willReturn([]); @@ -2513,9 +2514,9 @@ class ShareAPIControllerTest extends TestCase { ->willReturn($userFolder); $userFolder->expects($this->once()) - ->method('get') - ->with('valid-path') - ->willReturn($path); + ->method('get') + ->with('valid-path') + ->willReturn($path); $userFolder->method('getById') ->willReturn([]); @@ -2538,7 +2539,7 @@ class ShareAPIControllerTest extends TestCase { '' )->willReturnCallback( function ($share) { - throw new OCSNotFoundException("Exception thrown by the helper"); + throw new OCSNotFoundException('Exception thrown by the helper'); } ); diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php index d2e6471eafa..975c647b783 100644 --- a/apps/files_sharing/tests/Controller/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -67,11 +68,11 @@ class ShareControllerTest extends \Test\TestCase { private $previewManager; /** @var \OCP\IConfig|MockObject */ private $config; - /** @var \OC\Share20\Manager|MockObject */ + /** @var \OC\Share20\Manager|MockObject */ private $shareManager; /** @var IUserManager|MockObject */ private $userManager; - /** @var FederatedShareProvider|MockObject */ + /** @var FederatedShareProvider|MockObject */ private $federatedShareProvider; /** @var IAccountManager|MockObject */ private $accountManager; diff --git a/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php b/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php index 59d7afc28d6..41eb9cdd0fe 100644 --- a/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php index e462e3bc5c5..7a925f91d01 100644 --- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -40,7 +41,7 @@ class ShareesAPIControllerTest extends TestCase { /** @var IManager|MockObject */ protected $shareManager; - /** @var ISearch|MockObject */ + /** @var ISearch|MockObject */ protected $collaboratorSearch; /** @var IConfig|MockObject */ diff --git a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php index 20365ebb842..0183abe0d0c 100644 --- a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php +++ b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/EncryptedSizePropagationTest.php b/apps/files_sharing/tests/EncryptedSizePropagationTest.php index af2cf379358..04dab3ace30 100644 --- a/apps/files_sharing/tests/EncryptedSizePropagationTest.php +++ b/apps/files_sharing/tests/EncryptedSizePropagationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/EtagPropagationTest.php b/apps/files_sharing/tests/EtagPropagationTest.php index 3f9ddfc413d..78224f0d6dd 100644 --- a/apps/files_sharing/tests/EtagPropagationTest.php +++ b/apps/files_sharing/tests/EtagPropagationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -184,7 +185,7 @@ class EtagPropagationTest extends PropagationTestCase { public function testOwnerWritesToSingleFileShare() { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::file_put_contents('/foo.txt', 'longer_bar'); - $t = (int)Filesystem::filemtime('/foo.txt') - 1; + $t = (int) Filesystem::filemtime('/foo.txt') - 1; Filesystem::touch('/foo.txt', $t); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4, self::TEST_FILES_SHARING_API_USER3]); $this->assertEtagsChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2]); diff --git a/apps/files_sharing/tests/ExpireSharesJobTest.php b/apps/files_sharing/tests/ExpireSharesJobTest.php index e6383d12ded..305597aa01d 100644 --- a/apps/files_sharing/tests/ExpireSharesJobTest.php +++ b/apps/files_sharing/tests/ExpireSharesJobTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php index 6f076cb475b..cb82c8f63c4 100644 --- a/apps/files_sharing/tests/External/CacheTest.php +++ b/apps/files_sharing/tests/External/CacheTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -42,7 +43,7 @@ class CacheTest extends TestCase { */ private $remoteUser; - /** @var ICloudIdManager */ + /** @var ICloudIdManager */ private $cloudIdManager; protected function setUp(): void { diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php index de04550fc59..9aadbff48c6 100644 --- a/apps/files_sharing/tests/External/ManagerTest.php +++ b/apps/files_sharing/tests/External/ManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -45,7 +46,7 @@ class ManagerTest extends TestCase { /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ protected $contactsManager; - /** @var Manager|\PHPUnit\Framework\MockObject\MockObject **/ + /** @var Manager|\PHPUnit\Framework\MockObject\MockObject * */ private $manager; /** @var \OC\Files\Mount\Manager */ diff --git a/apps/files_sharing/tests/External/ScannerTest.php b/apps/files_sharing/tests/External/ScannerTest.php index c828fd59a08..087b07b90e8 100644 --- a/apps/files_sharing/tests/External/ScannerTest.php +++ b/apps/files_sharing/tests/External/ScannerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/ExternalStorageTest.php b/apps/files_sharing/tests/ExternalStorageTest.php index 4d807526f0d..352a1b78735 100644 --- a/apps/files_sharing/tests/ExternalStorageTest.php +++ b/apps/files_sharing/tests/ExternalStorageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/GroupEtagPropagationTest.php b/apps/files_sharing/tests/GroupEtagPropagationTest.php index 280b091b5f7..f1d62f99acc 100644 --- a/apps/files_sharing/tests/GroupEtagPropagationTest.php +++ b/apps/files_sharing/tests/GroupEtagPropagationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/HelperTest.php b/apps/files_sharing/tests/HelperTest.php index cc5c0d27e60..cd8a0279273 100644 --- a/apps/files_sharing/tests/HelperTest.php +++ b/apps/files_sharing/tests/HelperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/LockingTest.php b/apps/files_sharing/tests/LockingTest.php index 0ca204ef215..29af1c2525e 100644 --- a/apps/files_sharing/tests/LockingTest.php +++ b/apps/files_sharing/tests/LockingTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php index b5c7e1ce890..357b24176ba 100644 --- a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php index 5ba21255a8d..c8aefded875 100644 --- a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php index 672b65fd92e..e562d8715d9 100644 --- a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -35,9 +36,9 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { private $controllerMock; /** @var IControllerMethodReflector|\PHPUnit\Framework\MockObject\MockObject */ private $reflector; - /** @var IManager | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IManager | \PHPUnit\Framework\MockObject\MockObject */ private $shareManager; - /** @var IRequest | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IRequest | \PHPUnit\Framework\MockObject\MockObject */ private $request; protected function setUp(): void { diff --git a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php index eb377412a2e..c6bebe8628d 100644 --- a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php +++ b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2017 ownCloud, Inc. @@ -93,7 +94,7 @@ class SetPasswordColumnTest extends TestCase { $result->closeCursor(); foreach ($allShares as $share) { - if ((int)$share['share_type'] === IShare::TYPE_LINK) { + if ((int) $share['share_type'] === IShare::TYPE_LINK) { $this->assertNull($share['share_with']); $this->assertSame('shareWith', $share['password']); } else { diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php index f565d2e3656..3b54756c82b 100644 --- a/apps/files_sharing/tests/MountProviderTest.php +++ b/apps/files_sharing/tests/MountProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/PropagationTestCase.php b/apps/files_sharing/tests/PropagationTestCase.php index dee056f0658..c07f1367332 100644 --- a/apps/files_sharing/tests/PropagationTestCase.php +++ b/apps/files_sharing/tests/PropagationTestCase.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php index a1580c97fcf..4f1bc14aecb 100644 --- a/apps/files_sharing/tests/ShareTest.php +++ b/apps/files_sharing/tests/ShareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index 9bf9e1dc0ad..24ba10cd73f 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -371,7 +372,7 @@ class SharedMountTest extends TestCase { // hack to overwrite the cache factory, we can't use the proper "overwriteService" since the mount provider is created before this test is called $mountProvider = \OCP\Server::get(MountProvider::class); $reflectionClass = new \ReflectionClass($mountProvider); - $reflectionCacheFactory = $reflectionClass->getProperty("cacheFactory"); + $reflectionCacheFactory = $reflectionClass->getProperty('cacheFactory'); $reflectionCacheFactory->setAccessible(true); $reflectionCacheFactory->setValue($mountProvider, $cacheFactory); diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index e8824cca734..10a497aaa56 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -33,8 +34,8 @@ class SharedStorageTest extends TestCase { $this->view->mkdir($this->folder); // save file with content - $this->view->file_put_contents($this->filename, "root file"); - $this->view->file_put_contents($this->folder . $this->filename, "file in subfolder"); + $this->view->file_put_contents($this->filename, 'root file'); + $this->view->file_put_contents($this->folder . $this->filename, 'file in subfolder'); } protected function tearDown(): void { diff --git a/apps/files_sharing/tests/SizePropagationTest.php b/apps/files_sharing/tests/SizePropagationTest.php index 1112cb03425..fcb4053f627 100644 --- a/apps/files_sharing/tests/SizePropagationTest.php +++ b/apps/files_sharing/tests/SizePropagationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/TestCase.php b/apps/files_sharing/tests/TestCase.php index 3fe2993e189..01ae7909126 100644 --- a/apps/files_sharing/tests/TestCase.php +++ b/apps/files_sharing/tests/TestCase.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -25,12 +26,12 @@ use Test\Traits\MountProviderTrait; abstract class TestCase extends \Test\TestCase { use MountProviderTrait; - public const TEST_FILES_SHARING_API_USER1 = "test-share-user1"; - public const TEST_FILES_SHARING_API_USER2 = "test-share-user2"; - public const TEST_FILES_SHARING_API_USER3 = "test-share-user3"; - public const TEST_FILES_SHARING_API_USER4 = "test-share-user4"; + public const TEST_FILES_SHARING_API_USER1 = 'test-share-user1'; + public const TEST_FILES_SHARING_API_USER2 = 'test-share-user2'; + public const TEST_FILES_SHARING_API_USER3 = 'test-share-user3'; + public const TEST_FILES_SHARING_API_USER4 = 'test-share-user4'; - public const TEST_FILES_SHARING_API_GROUP1 = "test-share-group1"; + public const TEST_FILES_SHARING_API_GROUP1 = 'test-share-group1'; public $filename; public $data; diff --git a/apps/files_sharing/tests/UnshareChildrenTest.php b/apps/files_sharing/tests/UnshareChildrenTest.php index 70445635e38..6dbeec1dfe1 100644 --- a/apps/files_sharing/tests/UnshareChildrenTest.php +++ b/apps/files_sharing/tests/UnshareChildrenTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php index aeefbac5934..175941b506d 100644 --- a/apps/files_sharing/tests/UpdaterTest.php +++ b/apps/files_sharing/tests/UpdaterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/WatcherTest.php b/apps/files_sharing/tests/WatcherTest.php index c116f542fba..052d69b0187 100644 --- a/apps/files_sharing/tests/WatcherTest.php +++ b/apps/files_sharing/tests/WatcherTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_trashbin/lib/AppInfo/Application.php b/apps/files_trashbin/lib/AppInfo/Application.php index e1a8e02afaf..413c0bfc371 100644 --- a/apps/files_trashbin/lib/AppInfo/Application.php +++ b/apps/files_trashbin/lib/AppInfo/Application.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php b/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php index 7a9a2a094c6..35e4d91e539 100644 --- a/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php +++ b/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_trashbin/lib/Capabilities.php b/apps/files_trashbin/lib/Capabilities.php index 863d3692fb6..ab1392c4bf7 100644 --- a/apps/files_trashbin/lib/Capabilities.php +++ b/apps/files_trashbin/lib/Capabilities.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_trashbin/lib/Command/CleanUp.php b/apps/files_trashbin/lib/Command/CleanUp.php index 405abd3015a..45265dfe7f6 100644 --- a/apps/files_trashbin/lib/Command/CleanUp.php +++ b/apps/files_trashbin/lib/Command/CleanUp.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -108,11 +109,11 @@ class CleanUp extends Command { $node = $this->rootFolder->get($path); if ($verbose) { - $output->writeln("Deleting <info>" . \OC_Helper::humanFileSize($node->getSize()) . "</info> in trash for <info>$uid</info>."); + $output->writeln('Deleting <info>' . \OC_Helper::humanFileSize($node->getSize()) . "</info> in trash for <info>$uid</info>."); } $node->delete(); if ($this->rootFolder->nodeExists($path)) { - $output->writeln("<error>Trash folder sill exists after attempting to delete it</error>"); + $output->writeln('<error>Trash folder sill exists after attempting to delete it</error>'); return; } $query = $this->dbConnection->getQueryBuilder(); diff --git a/apps/files_trashbin/lib/Command/Expire.php b/apps/files_trashbin/lib/Command/Expire.php index b31e540ee38..b5c571af98e 100644 --- a/apps/files_trashbin/lib/Command/Expire.php +++ b/apps/files_trashbin/lib/Command/Expire.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_trashbin/lib/Command/ExpireTrash.php b/apps/files_trashbin/lib/Command/ExpireTrash.php index 1966a51a2ef..0348e08f87c 100644 --- a/apps/files_trashbin/lib/Command/ExpireTrash.php +++ b/apps/files_trashbin/lib/Command/ExpireTrash.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud GmbH. @@ -57,7 +58,7 @@ class ExpireTrash extends Command { protected function execute(InputInterface $input, OutputInterface $output): int { $maxAge = $this->expiration->getMaxAgeAsTimestamp(); if (!$maxAge) { - $output->writeln("Auto expiration is configured - keeps files and folders in the trash bin for 30 days and automatically deletes anytime after that if space is needed (note: files may not be deleted if space is not needed)"); + $output->writeln('Auto expiration is configured - keeps files and folders in the trash bin for 30 days and automatically deletes anytime after that if space is needed (note: files may not be deleted if space is not needed)'); return 1; } diff --git a/apps/files_trashbin/lib/Command/RestoreAllFiles.php b/apps/files_trashbin/lib/Command/RestoreAllFiles.php index 103ada3f18f..f0edf8b2fce 100644 --- a/apps/files_trashbin/lib/Command/RestoreAllFiles.php +++ b/apps/files_trashbin/lib/Command/RestoreAllFiles.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only @@ -167,13 +168,13 @@ class RestoreAllFiles extends Base { $trashCount = count($userTrashItems); if ($trashCount == 0) { - $output->writeln("User has no deleted files in the trashbin matching the given filters"); + $output->writeln('User has no deleted files in the trashbin matching the given filters'); return; } $prepMsg = $dryRun ? 'Would restore' : 'Preparing to restore'; $output->writeln("$prepMsg <info>$trashCount</info> files..."); $count = 0; - foreach($userTrashItems as $trashItem) { + foreach ($userTrashItems as $trashItem) { $filename = $trashItem->getName(); $humanTime = $this->l10n->l('datetime', $trashItem->getDeletedTime()); // We use getTitle() here instead of getOriginalLocation() because @@ -191,13 +192,13 @@ class RestoreAllFiles extends Base { try { $trashItem->getTrashBackend()->restoreItem($trashItem); } catch (\Throwable $e) { - $output->writeln(" <error>Failed: " . $e->getMessage() . "</error>"); - $output->writeln(" <error>" . $e->getTraceAsString() . "</error>", OutputInterface::VERBOSITY_VERY_VERBOSE); + $output->writeln(' <error>Failed: ' . $e->getMessage() . '</error>'); + $output->writeln(' <error>' . $e->getTraceAsString() . '</error>', OutputInterface::VERBOSITY_VERY_VERBOSE); continue; } $count++; - $output->writeln(" <info>success</info>"); + $output->writeln(' <info>success</info>'); } if (!$dryRun) { @@ -247,7 +248,7 @@ class RestoreAllFiles extends Base { // Check scope with exact class name for locally deleted files if ($scope === self::SCOPE_USER && $trashItemClass !== \OCA\Files_Trashbin\Trash\TrashItem::class) { - $output->writeln("Skipping <info>" . $trashItem->getName() . "</info> because it is not a user trash item", OutputInterface::VERBOSITY_VERBOSE); + $output->writeln('Skipping <info>' . $trashItem->getName() . '</info> because it is not a user trash item', OutputInterface::VERBOSITY_VERBOSE); continue; } @@ -257,19 +258,19 @@ class RestoreAllFiles extends Base { * @psalm-suppress RedundantCondition */ if ($scope === self::SCOPE_GROUPFOLDERS && $trashItemClass !== 'OCA\GroupFolders\Trash\GroupTrashItem') { - $output->writeln("Skipping <info>" . $trashItem->getName() . "</info> because it is not a groupfolders trash item", OutputInterface::VERBOSITY_VERBOSE); + $output->writeln('Skipping <info>' . $trashItem->getName() . '</info> because it is not a groupfolders trash item', OutputInterface::VERBOSITY_VERBOSE); continue; } // Check left timestamp boundary if ($since !== null && $trashItem->getDeletedTime() <= $since) { - $output->writeln("Skipping <info>" . $trashItem->getName() . "</info> because it was deleted before the 'since' timestamp", OutputInterface::VERBOSITY_VERBOSE); + $output->writeln('Skipping <info>' . $trashItem->getName() . "</info> because it was deleted before the 'since' timestamp", OutputInterface::VERBOSITY_VERBOSE); continue; } // Check right timestamp boundary if ($until !== null && $trashItem->getDeletedTime() >= $until) { - $output->writeln("Skipping <info>" . $trashItem->getName() . "</info> because it was deleted after the 'until' timestamp", OutputInterface::VERBOSITY_VERBOSE); + $output->writeln('Skipping <info>' . $trashItem->getName() . "</info> because it was deleted after the 'until' timestamp", OutputInterface::VERBOSITY_VERBOSE); continue; } diff --git a/apps/files_trashbin/lib/Command/Size.php b/apps/files_trashbin/lib/Command/Size.php index 6d0e745bf5c..b0581071c1c 100644 --- a/apps/files_trashbin/lib/Command/Size.php +++ b/apps/files_trashbin/lib/Command/Size.php @@ -55,16 +55,16 @@ class Size extends Base { if ($size) { $parsedSize = \OC_Helper::computerFileSize($size); if ($parsedSize === false) { - $output->writeln("<error>Failed to parse input size</error>"); + $output->writeln('<error>Failed to parse input size</error>'); return -1; } if ($user) { - $this->config->setUserValue($user, 'files_trashbin', 'trashbin_size', (string)$parsedSize); + $this->config->setUserValue($user, 'files_trashbin', 'trashbin_size', (string) $parsedSize); $this->commandBus->push(new Expire($user)); } else { - $this->config->setAppValue('files_trashbin', 'trashbin_size', (string)$parsedSize); - $output->writeln("<info>Warning: changing the default trashbin size will automatically trigger cleanup of existing trashbins,</info>"); - $output->writeln("<info>a users trashbin can exceed the configured size until they move a new file to the trashbin.</info>"); + $this->config->setAppValue('files_trashbin', 'trashbin_size', (string) $parsedSize); + $output->writeln('<info>Warning: changing the default trashbin size will automatically trigger cleanup of existing trashbins,</info>'); + $output->writeln('<info>a users trashbin can exceed the configured size until they move a new file to the trashbin.</info>'); } } else { $this->printTrashbinSize($input, $output, $user); @@ -74,15 +74,15 @@ class Size extends Base { } private function printTrashbinSize(InputInterface $input, OutputInterface $output, ?string $user) { - $globalSize = (int)$this->config->getAppValue('files_trashbin', 'trashbin_size', '-1'); + $globalSize = (int) $this->config->getAppValue('files_trashbin', 'trashbin_size', '-1'); if ($globalSize < 0) { - $globalHumanSize = "default (50% of available space)"; + $globalHumanSize = 'default (50% of available space)'; } else { $globalHumanSize = \OC_Helper::humanFileSize($globalSize); } if ($user) { - $userSize = (int)$this->config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1'); + $userSize = (int) $this->config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1'); if ($userSize < 0) { $userHumanSize = ($globalSize < 0) ? $globalHumanSize : "default($globalHumanSize)"; @@ -110,14 +110,14 @@ class Size extends Base { if ($input->getOption('output') == self::OUTPUT_FORMAT_PLAIN) { $output->writeln("Default size: $globalHumanSize"); - $output->writeln(""); + $output->writeln(''); if (count($userValues)) { - $output->writeln("Per-user sizes:"); + $output->writeln('Per-user sizes:'); $this->writeArrayInOutputFormat($input, $output, array_map(function ($size) { return \OC_Helper::humanFileSize($size); }, $userValues)); } else { - $output->writeln("No per-user sizes configured"); + $output->writeln('No per-user sizes configured'); } } else { $globalValue = ($globalSize < 0) ? 'default' : $globalSize; diff --git a/apps/files_trashbin/lib/Events/MoveToTrashEvent.php b/apps/files_trashbin/lib/Events/MoveToTrashEvent.php index ff54c67e178..40cb0bbf4e4 100644 --- a/apps/files_trashbin/lib/Events/MoveToTrashEvent.php +++ b/apps/files_trashbin/lib/Events/MoveToTrashEvent.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_trashbin/lib/Exceptions/CopyRecursiveException.php b/apps/files_trashbin/lib/Exceptions/CopyRecursiveException.php index 9da2631c97b..3ea1293e5d7 100644 --- a/apps/files_trashbin/lib/Exceptions/CopyRecursiveException.php +++ b/apps/files_trashbin/lib/Exceptions/CopyRecursiveException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/files_trashbin/lib/Expiration.php b/apps/files_trashbin/lib/Expiration.php index 26826f63931..05aa2e8c38b 100644 --- a/apps/files_trashbin/lib/Expiration.php +++ b/apps/files_trashbin/lib/Expiration.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -129,13 +130,13 @@ class Expiration { $this->canPurgeToSaveSpace = true; } elseif ($minValue !== 'auto' && $maxValue === 'auto') { // Keep for X days but delete anytime if space needed - $this->minAge = (int)$minValue; + $this->minAge = (int) $minValue; $this->maxAge = self::NO_OBLIGATION; $this->canPurgeToSaveSpace = true; } elseif ($minValue === 'auto' && $maxValue !== 'auto') { // Delete anytime if space needed, Delete all older than max automatically $this->minAge = self::NO_OBLIGATION; - $this->maxAge = (int)$maxValue; + $this->maxAge = (int) $maxValue; $this->canPurgeToSaveSpace = true; } elseif ($minValue !== 'auto' && $maxValue !== 'auto') { // Delete all older than max OR older than min if space needed @@ -145,8 +146,8 @@ class Expiration { $maxValue = $minValue; } - $this->minAge = (int)$minValue; - $this->maxAge = (int)$maxValue; + $this->minAge = (int) $minValue; + $this->maxAge = (int) $maxValue; $this->canPurgeToSaveSpace = false; } } diff --git a/apps/files_trashbin/lib/Helper.php b/apps/files_trashbin/lib/Helper.php index e08753b1783..71a1d54207d 100644 --- a/apps/files_trashbin/lib/Helper.php +++ b/apps/files_trashbin/lib/Helper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -15,7 +16,7 @@ class Helper { * Retrieves the contents of a trash bin directory. * * @param string $dir path to the directory inside the trashbin - * or empty to retrieve the root of the trashbin + * or empty to retrieve the root of the trashbin * @param string $user * @param string $sortAttribute attribute to sort on or empty to disable sorting * @param bool $sortDescending true for descending sort, false otherwise diff --git a/apps/files_trashbin/lib/Hooks.php b/apps/files_trashbin/lib/Hooks.php index 1e2a8d41098..0f2a8600502 100644 --- a/apps/files_trashbin/lib/Hooks.php +++ b/apps/files_trashbin/lib/Hooks.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php b/apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php index cf76c8f3616..db9a43be6fc 100644 --- a/apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php +++ b/apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php @@ -76,7 +76,7 @@ class SyncLivePhotosListener implements IEventListener { unset($this->pendingRestores[$peerFile->getId()]); return; } else { - $event->abortOperation(new NotPermittedException("Cannot restore the video part of a live photo")); + $event->abortOperation(new NotPermittedException('Cannot restore the video part of a live photo')); } } else { $user = $this->userSession?->getUser(); @@ -112,9 +112,9 @@ class SyncLivePhotosListener implements IEventListener { * TODO: This should be replaced by a proper method in the TrashManager. */ private function getTrashItem(array $trashFolder, string $path): ?ITrashItem { - foreach($trashFolder as $trashItem) { - if (str_starts_with($path, "files_trashbin/files".$trashItem->getTrashPath())) { - if ($path === "files_trashbin/files".$trashItem->getTrashPath()) { + foreach ($trashFolder as $trashItem) { + if (str_starts_with($path, 'files_trashbin/files'.$trashItem->getTrashPath())) { + if ($path === 'files_trashbin/files'.$trashItem->getTrashPath()) { return $trashItem; } diff --git a/apps/files_trashbin/lib/Sabre/TrashRoot.php b/apps/files_trashbin/lib/Sabre/TrashRoot.php index ff2ea3aaa02..3421a56bd5a 100644 --- a/apps/files_trashbin/lib/Sabre/TrashRoot.php +++ b/apps/files_trashbin/lib/Sabre/TrashRoot.php @@ -21,7 +21,7 @@ class TrashRoot implements ICollection { /** @var IUser */ private $user; - /** @var ITrashManager */ + /** @var ITrashManager */ private $trashManager; public function __construct(IUser $user, ITrashManager $trashManager) { diff --git a/apps/files_trashbin/lib/Storage.php b/apps/files_trashbin/lib/Storage.php index 90eaf57da67..79a659da714 100644 --- a/apps/files_trashbin/lib/Storage.php +++ b/apps/files_trashbin/lib/Storage.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -73,7 +74,7 @@ class Storage extends Wrapper { // in case of a encryption exception we delete the file right away $this->logger->info( "Can't move file " . $path . - " to the trash bin, therefore it was deleted right away"); + ' to the trash bin, therefore it was deleted right away'); return $this->storage->unlink($path); } diff --git a/apps/files_trashbin/lib/Trash/BackendNotFoundException.php b/apps/files_trashbin/lib/Trash/BackendNotFoundException.php index 8e23a04851a..292b6ee293c 100644 --- a/apps/files_trashbin/lib/Trash/BackendNotFoundException.php +++ b/apps/files_trashbin/lib/Trash/BackendNotFoundException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_trashbin/lib/Trash/ITrashBackend.php b/apps/files_trashbin/lib/Trash/ITrashBackend.php index f5d4657bfbc..11b3132bfba 100644 --- a/apps/files_trashbin/lib/Trash/ITrashBackend.php +++ b/apps/files_trashbin/lib/Trash/ITrashBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_trashbin/lib/Trash/ITrashItem.php b/apps/files_trashbin/lib/Trash/ITrashItem.php index f67276e6f54..299cac49a69 100644 --- a/apps/files_trashbin/lib/Trash/ITrashItem.php +++ b/apps/files_trashbin/lib/Trash/ITrashItem.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_trashbin/lib/Trash/ITrashManager.php b/apps/files_trashbin/lib/Trash/ITrashManager.php index 4a2eaead11b..743ea01358a 100644 --- a/apps/files_trashbin/lib/Trash/ITrashManager.php +++ b/apps/files_trashbin/lib/Trash/ITrashManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php index 862c746c239..dc3215e56c0 100644 --- a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php +++ b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_trashbin/lib/Trash/TrashItem.php b/apps/files_trashbin/lib/Trash/TrashItem.php index 31dbb10def2..2ae999a2069 100644 --- a/apps/files_trashbin/lib/Trash/TrashItem.php +++ b/apps/files_trashbin/lib/Trash/TrashItem.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_trashbin/lib/Trash/TrashManager.php b/apps/files_trashbin/lib/Trash/TrashManager.php index bf3eaebdc2a..5d17db51a79 100644 --- a/apps/files_trashbin/lib/Trash/TrashManager.php +++ b/apps/files_trashbin/lib/Trash/TrashManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 087811c5766..908b865002a 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -105,8 +106,8 @@ class Trashbin { $array = []; while ($row = $result->fetch()) { $array[$row['id']][$row['timestamp']] = [ - 'location' => (string)$row['location'], - 'deletedBy' => (string)$row['deleted_by'], + 'location' => (string) $row['location'], + 'deletedBy' => (string) $row['deleted_by'], ]; } $result->closeCursor(); @@ -439,7 +440,7 @@ class Trashbin { * Restore a file or folder from trash bin * * @param string $file path to the deleted file/folder relative to "files_trashbin/files/", - * including the timestamp suffix ".d12345678" + * including the timestamp suffix ".d12345678" * @param string $filename name of the file/folder * @param int $timestamp time when the file/folder was deleted * @@ -1051,9 +1052,9 @@ class Trashbin { if ($view->file_exists('files' . $location . '/' . $filename)) { $i = 2; - $uniqueName = $name . " (" . $l->t("restored") . ")" . $ext; + $uniqueName = $name . ' (' . $l->t('restored') . ')' . $ext; while ($view->file_exists('files' . $location . '/' . $uniqueName)) { - $uniqueName = $name . " (" . $l->t("restored") . " " . $i . ")" . $ext; + $uniqueName = $name . ' (' . $l->t('restored') . ' ' . $i . ')' . $ext; $i++; } diff --git a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php index b0eb1cda797..277c176d191 100644 --- a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php +++ b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php @@ -77,7 +77,7 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator { if (!$trashbinFolder instanceof Folder) { throw new UserMigrationException('/'.$uid.'/files_trashbin is not a folder'); } - $output->writeln("Exporting trashbin files…"); + $output->writeln('Exporting trashbin files…'); $exportDestination->copyFolder($trashbinFolder, static::PATH_FILES_FOLDER); $originalLocations = []; // TODO Export all extra data and bump migrator to v2 @@ -90,9 +90,9 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator { } $exportDestination->addFileContents(static::PATH_LOCATIONS_FILE, json_encode($originalLocations)); } catch (NotFoundException $e) { - $output->writeln("No trashbin to export…"); + $output->writeln('No trashbin to export…'); } catch (\Throwable $e) { - throw new UserMigrationException("Could not export trashbin: ".$e->getMessage(), 0, $e); + throw new UserMigrationException('Could not export trashbin: '.$e->getMessage(), 0, $e); } } @@ -118,11 +118,11 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator { } catch (NotFoundException $e) { $trashbinFolder = $this->root->newFolder('/'.$uid.'/files_trashbin'); } - $output->writeln("Importing trashbin files…"); + $output->writeln('Importing trashbin files…'); try { $importSource->copyToFolder($trashbinFolder, static::PATH_FILES_FOLDER); } catch (\Throwable $e) { - throw new UserMigrationException("Could not import trashbin.", 0, $e); + throw new UserMigrationException('Could not import trashbin.', 0, $e); } $locations = json_decode($importSource->getFileContents(static::PATH_LOCATIONS_FILE), true, 512, JSON_THROW_ON_ERROR); $qb = $this->dbc->getQueryBuilder(); @@ -145,7 +145,7 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator { } } } else { - $output->writeln("No trashbin to import…"); + $output->writeln('No trashbin to import…'); } } diff --git a/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php b/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php index ee833e6beb8..2a860851e99 100644 --- a/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php +++ b/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_trashbin/tests/CapabilitiesTest.php b/apps/files_trashbin/tests/CapabilitiesTest.php index f5d3bdd9a9b..c2b79173924 100644 --- a/apps/files_trashbin/tests/CapabilitiesTest.php +++ b/apps/files_trashbin/tests/CapabilitiesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_trashbin/tests/Command/CleanUpTest.php b/apps/files_trashbin/tests/Command/CleanUpTest.php index 278f800e1b6..e56229d750f 100644 --- a/apps/files_trashbin/tests/Command/CleanUpTest.php +++ b/apps/files_trashbin/tests/Command/CleanUpTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -25,7 +26,7 @@ use Test\TestCase; */ class CleanUpTest extends TestCase { - /** @var CleanUp */ + /** @var CleanUp */ protected $cleanup; /** @var \PHPUnit\Framework\MockObject\MockObject | Manager */ @@ -37,10 +38,10 @@ class CleanUpTest extends TestCase { /** @var IDBConnection */ protected $dbConnection; - /** @var string */ + /** @var string */ protected $trashTable = 'files_trash'; - /** @var string */ + /** @var string */ protected $user0 = 'user0'; protected function setUp(): void { diff --git a/apps/files_trashbin/tests/Command/ExpireTest.php b/apps/files_trashbin/tests/Command/ExpireTest.php index 5a7f857adbe..464a6b79ba8 100644 --- a/apps/files_trashbin/tests/Command/ExpireTest.php +++ b/apps/files_trashbin/tests/Command/ExpireTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_trashbin/tests/Controller/PreviewControllerTest.php b/apps/files_trashbin/tests/Controller/PreviewControllerTest.php index f834b324f2b..32049f8e896 100644 --- a/apps/files_trashbin/tests/Controller/PreviewControllerTest.php +++ b/apps/files_trashbin/tests/Controller/PreviewControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_trashbin/tests/ExpirationTest.php b/apps/files_trashbin/tests/ExpirationTest.php index bf4e1ef2ad9..8de280be9f8 100644 --- a/apps/files_trashbin/tests/ExpirationTest.php +++ b/apps/files_trashbin/tests/ExpirationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php index 8c3a82846fa..746b27113ee 100644 --- a/apps/files_trashbin/tests/StorageTest.php +++ b/apps/files_trashbin/tests/StorageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -677,7 +678,7 @@ class StorageTest extends \Test\TestCase { $externalStorage = new TemporaryNoCross([]); $externalStorage->getScanner()->scan(''); - Filesystem::mount($externalStorage, [], "/" . $this->user . "/files/storage"); + Filesystem::mount($externalStorage, [], '/' . $this->user . '/files/storage'); $this->assertTrue($this->userView->rename('test.txt', 'storage/test.txt')); $this->assertTrue($externalStorage->file_exists('test.txt')); diff --git a/apps/files_trashbin/tests/TrashbinTest.php b/apps/files_trashbin/tests/TrashbinTest.php index 6474021b92e..745078f3ba0 100644 --- a/apps/files_trashbin/tests/TrashbinTest.php +++ b/apps/files_trashbin/tests/TrashbinTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -16,8 +17,8 @@ use OCP\Share\IShare; * @group DB */ class TrashbinTest extends \Test\TestCase { - public const TEST_TRASHBIN_USER1 = "test-trashbin-user1"; - public const TEST_TRASHBIN_USER2 = "test-trashbin-user2"; + public const TEST_TRASHBIN_USER1 = 'test-trashbin-user1'; + public const TEST_TRASHBIN_USER2 = 'test-trashbin-user2'; private $trashRoot1; private $trashRoot2; @@ -200,7 +201,7 @@ class TrashbinTest extends \Test\TestCase { */ public function testExpireOldFilesShared() { $currentTime = time(); - $folder = "trashTest-" . $currentTime . '/'; + $folder = 'trashTest-' . $currentTime . '/'; $expiredDate = $currentTime - 3 * 24 * 60 * 60; // create some files @@ -235,7 +236,7 @@ class TrashbinTest extends \Test\TestCase { // login as user2 self::loginHelper(self::TEST_TRASHBIN_USER2); - $this->assertTrue(\OC\Files\Filesystem::file_exists($folder . "user1-4.txt")); + $this->assertTrue(\OC\Files\Filesystem::file_exists($folder . 'user1-4.txt')); // create some files \OC\Files\Filesystem::file_put_contents('user2-1.txt', 'file1'); diff --git a/apps/files_versions/appinfo/routes.php b/apps/files_versions/appinfo/routes.php index bce2c8faead..c964b0937af 100644 --- a/apps/files_versions/appinfo/routes.php +++ b/apps/files_versions/appinfo/routes.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -18,7 +19,7 @@ $application->registerRoutes($this, [ ], ]); -/** @var $this \OCP\Route\IRouter */ +/** @var \OCP\Route\IRouter $this */ $this->create('files_versions_download', 'apps/files_versions/download.php') ->actionInclude('files_versions/download.php'); $this->create('files_versions_ajax_getVersions', 'apps/files_versions/ajax/getVersions.php') diff --git a/apps/files_versions/lib/AppInfo/Application.php b/apps/files_versions/lib/AppInfo/Application.php index a31e9823efd..f6851cf13a1 100644 --- a/apps/files_versions/lib/AppInfo/Application.php +++ b/apps/files_versions/lib/AppInfo/Application.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_versions/lib/BackgroundJob/ExpireVersions.php b/apps/files_versions/lib/BackgroundJob/ExpireVersions.php index 7e5ea74d9f9..9cc99098491 100644 --- a/apps/files_versions/lib/BackgroundJob/ExpireVersions.php +++ b/apps/files_versions/lib/BackgroundJob/ExpireVersions.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_versions/lib/Capabilities.php b/apps/files_versions/lib/Capabilities.php index ce7239a4bf5..2a823773336 100644 --- a/apps/files_versions/lib/Capabilities.php +++ b/apps/files_versions/lib/Capabilities.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_versions/lib/Command/CleanUp.php b/apps/files_versions/lib/Command/CleanUp.php index bf6dc6a7687..e8c46afef16 100644 --- a/apps/files_versions/lib/Command/CleanUp.php +++ b/apps/files_versions/lib/Command/CleanUp.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -49,7 +50,7 @@ class CleanUp extends Command { $path = $input->getOption('path'); if ($path) { if (!preg_match('#^/([^/]+)/files(/.*)?$#', $path, $pathMatches)) { - $output->writeln("<error>Invalid path given</error>"); + $output->writeln('<error>Invalid path given</error>'); return self::FAILURE; } diff --git a/apps/files_versions/lib/Command/Expire.php b/apps/files_versions/lib/Command/Expire.php index 6ec7a4fd32a..5536fa51021 100644 --- a/apps/files_versions/lib/Command/Expire.php +++ b/apps/files_versions/lib/Command/Expire.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_versions/lib/Command/ExpireVersions.php b/apps/files_versions/lib/Command/ExpireVersions.php index 9492d0fbe7d..31698cb9d41 100644 --- a/apps/files_versions/lib/Command/ExpireVersions.php +++ b/apps/files_versions/lib/Command/ExpireVersions.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud GmbH. @@ -38,7 +39,7 @@ class ExpireVersions extends Command { protected function execute(InputInterface $input, OutputInterface $output): int { $maxAge = $this->expiration->getMaxAgeAsTimestamp(); if (!$maxAge) { - $output->writeln("Auto expiration is configured - expiration will be handled automatically according to the expiration patterns detailed at the following link https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/file_versioning.html."); + $output->writeln('Auto expiration is configured - expiration will be handled automatically according to the expiration patterns detailed at the following link https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/file_versioning.html.'); return self::FAILURE; } diff --git a/apps/files_versions/lib/Controller/PreviewController.php b/apps/files_versions/lib/Controller/PreviewController.php index 0733c42af62..7d67851dfca 100644 --- a/apps/files_versions/lib/Controller/PreviewController.php +++ b/apps/files_versions/lib/Controller/PreviewController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_versions/lib/Db/VersionsMapper.php b/apps/files_versions/lib/Db/VersionsMapper.php index 289e5ce7b7e..318dd8f0d82 100644 --- a/apps/files_versions/lib/Db/VersionsMapper.php +++ b/apps/files_versions/lib/Db/VersionsMapper.php @@ -28,8 +28,8 @@ class VersionsMapper extends QBMapper { $qb = $this->db->getQueryBuilder(); $qb->select('*') - ->from($this->getTableName()) - ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId))); + ->from($this->getTableName()) + ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId))); return $this->findEntities($qb); } @@ -41,10 +41,10 @@ class VersionsMapper extends QBMapper { $qb = $this->db->getQueryBuilder(); $qb->select('*') - ->from($this->getTableName()) - ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId))) - ->orderBy('timestamp', 'DESC') - ->setMaxResults(1); + ->from($this->getTableName()) + ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId))) + ->orderBy('timestamp', 'DESC') + ->setMaxResults(1); return $this->findEntity($qb); } @@ -53,9 +53,9 @@ class VersionsMapper extends QBMapper { $qb = $this->db->getQueryBuilder(); $qb->select('*') - ->from($this->getTableName()) - ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId))) - ->andWhere($qb->expr()->eq('timestamp', $qb->createNamedParameter($timestamp))); + ->from($this->getTableName()) + ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId))) + ->andWhere($qb->expr()->eq('timestamp', $qb->createNamedParameter($timestamp))); return $this->findEntity($qb); } @@ -64,8 +64,8 @@ class VersionsMapper extends QBMapper { $qb = $this->db->getQueryBuilder(); return $qb->delete($this->getTableName()) - ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId))) - ->executeStatement(); + ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId))) + ->executeStatement(); } public function deleteAllVersionsForUser(int $storageId, ?string $path = null): void { diff --git a/apps/files_versions/lib/Events/CreateVersionEvent.php b/apps/files_versions/lib/Events/CreateVersionEvent.php index ea372ba8a05..7b63a6d1b5d 100644 --- a/apps/files_versions/lib/Events/CreateVersionEvent.php +++ b/apps/files_versions/lib/Events/CreateVersionEvent.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_versions/lib/Expiration.php b/apps/files_versions/lib/Expiration.php index 50b9c02dc38..1335f0ef826 100644 --- a/apps/files_versions/lib/Expiration.php +++ b/apps/files_versions/lib/Expiration.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -179,13 +180,13 @@ class Expiration { $this->canPurgeToSaveSpace = true; } elseif ($minValue !== 'auto' && $maxValue === 'auto') { // Keep for X days but delete anytime if space needed - $this->minAge = (int)$minValue; + $this->minAge = (int) $minValue; $this->maxAge = self::NO_OBLIGATION; $this->canPurgeToSaveSpace = true; } elseif ($minValue === 'auto' && $maxValue !== 'auto') { // Delete anytime if space needed, Delete all older than max automatically $this->minAge = self::NO_OBLIGATION; - $this->maxAge = (int)$maxValue; + $this->maxAge = (int) $maxValue; $this->canPurgeToSaveSpace = true; } elseif ($minValue !== 'auto' && $maxValue !== 'auto') { // Delete all older than max OR older than min if space needed @@ -195,8 +196,8 @@ class Expiration { $maxValue = $minValue; } - $this->minAge = (int)$minValue; - $this->maxAge = (int)$maxValue; + $this->minAge = (int) $minValue; + $this->maxAge = (int) $maxValue; $this->canPurgeToSaveSpace = false; } } diff --git a/apps/files_versions/lib/Listener/VersionStorageMoveListener.php b/apps/files_versions/lib/Listener/VersionStorageMoveListener.php index 8bf1d4dce7b..d0a0bcf4a92 100644 --- a/apps/files_versions/lib/Listener/VersionStorageMoveListener.php +++ b/apps/files_versions/lib/Listener/VersionStorageMoveListener.php @@ -65,7 +65,7 @@ class VersionStorageMoveListener implements IEventListener { $user = $this->userSession->getUser() ?? $source->getOwner(); if ($user === null) { - throw new Exception("Cannot move versions across storages without a user."); + throw new Exception('Cannot move versions across storages without a user.'); } if ($event instanceof BeforeNodeRenamedEvent) { diff --git a/apps/files_versions/lib/Migration/Version1020Date20221114144058.php b/apps/files_versions/lib/Migration/Version1020Date20221114144058.php index 71bfeab0a02..77c8c2201f3 100644 --- a/apps/files_versions/lib/Migration/Version1020Date20221114144058.php +++ b/apps/files_versions/lib/Migration/Version1020Date20221114144058.php @@ -29,11 +29,11 @@ class Version1020Date20221114144058 extends SimpleMigrationStep { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); - if ($schema->hasTable("files_versions")) { + if ($schema->hasTable('files_versions')) { return null; } - $table = $schema->createTable("files_versions"); + $table = $schema->createTable('files_versions'); $table->addColumn('id', Types::BIGINT, [ 'autoincrement' => true, 'notnull' => true, diff --git a/apps/files_versions/lib/Sabre/Plugin.php b/apps/files_versions/lib/Sabre/Plugin.php index c2ffcdebe47..10a1896773d 100644 --- a/apps/files_versions/lib/Sabre/Plugin.php +++ b/apps/files_versions/lib/Sabre/Plugin.php @@ -77,7 +77,7 @@ class Plugin extends ServerPlugin { public function propFind(PropFind $propFind, INode $node): void { if ($node instanceof VersionFile) { $propFind->handle(self::VERSION_LABEL, fn () => $node->getMetadataValue('label')); - $propFind->handle(self::VERSION_AUTHOR, fn () => $node->getMetadataValue("author")); + $propFind->handle(self::VERSION_AUTHOR, fn () => $node->getMetadataValue('author')); $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, fn () => $this->previewManager->isMimeSupported($node->getContentType())); } } diff --git a/apps/files_versions/lib/Sabre/RootCollection.php b/apps/files_versions/lib/Sabre/RootCollection.php index 8ed397069f7..91a63ce41f6 100644 --- a/apps/files_versions/lib/Sabre/RootCollection.php +++ b/apps/files_versions/lib/Sabre/RootCollection.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_versions/lib/Sabre/VersionCollection.php b/apps/files_versions/lib/Sabre/VersionCollection.php index 57510b72ff6..8e08b99da5a 100644 --- a/apps/files_versions/lib/Sabre/VersionCollection.php +++ b/apps/files_versions/lib/Sabre/VersionCollection.php @@ -76,7 +76,7 @@ class VersionCollection implements ICollection { } public function getName(): string { - return (string)$this->file->getId(); + return (string) $this->file->getId(); } public function setName($name) { diff --git a/apps/files_versions/lib/Sabre/VersionFile.php b/apps/files_versions/lib/Sabre/VersionFile.php index 94fc101f05e..9f165a3f596 100644 --- a/apps/files_versions/lib/Sabre/VersionFile.php +++ b/apps/files_versions/lib/Sabre/VersionFile.php @@ -44,7 +44,7 @@ class VersionFile implements IFile { } public function getETag(): string { - return (string)$this->version->getRevisionId(); + return (string) $this->version->getRevisionId(); } /** @@ -64,7 +64,7 @@ class VersionFile implements IFile { } public function getName(): string { - return (string)$this->version->getRevisionId(); + return (string) $this->version->getRevisionId(); } public function setName($name) { diff --git a/apps/files_versions/lib/Sabre/VersionHome.php b/apps/files_versions/lib/Sabre/VersionHome.php index d89291a8cf8..c5a4eb7ac4e 100644 --- a/apps/files_versions/lib/Sabre/VersionHome.php +++ b/apps/files_versions/lib/Sabre/VersionHome.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_versions/lib/Sabre/VersionRoot.php b/apps/files_versions/lib/Sabre/VersionRoot.php index 014f06069ab..1af61593c2f 100644 --- a/apps/files_versions/lib/Sabre/VersionRoot.php +++ b/apps/files_versions/lib/Sabre/VersionRoot.php @@ -56,7 +56,7 @@ class VersionRoot implements ICollection { public function getChild($name) { $userFolder = $this->rootFolder->getUserFolder($this->user->getUID()); - $fileId = (int)$name; + $fileId = (int) $name; $node = $userFolder->getFirstNodeById($fileId); if (!$node) { diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index 34d57416274..36e93372d9e 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -276,9 +277,9 @@ class Storage { * Rename or copy versions of a file of the given paths * * @param string $sourcePath source path of the file to move, relative to - * the currently logged in user's "files" folder + * the currently logged in user's "files" folder * @param string $targetPath target path of the file to move, relative to - * the currently logged in user's "files" folder + * the currently logged in user's "files" folder * @param string $operation can be 'copy' or 'rename' */ public static function renameOrCopy($sourcePath, $targetPath, $operation) { @@ -484,7 +485,7 @@ class Storage { $filename = $pathparts['filename']; $key = $timestamp . '#' . $filename; $versions[$key]['version'] = $timestamp; - $versions[$key]['humanReadableTimestamp'] = self::getHumanReadableTimestamp((int)$timestamp); + $versions[$key]['humanReadableTimestamp'] = self::getHumanReadableTimestamp((int) $timestamp); if (empty($userFullPath)) { $versions[$key]['preview'] = ''; } else { @@ -552,7 +553,7 @@ class Storage { return false; } - $version = (int)substr($info->getName(), $versionsBegin + 2); + $version = (int) substr($info->getName(), $versionsBegin + 2); // Check that the version does not have a label. $path = $versionsRoot->getRelativePath($info->getPath()); @@ -571,7 +572,7 @@ class Storage { } catch (NotFoundException $e) { // Original node not found, delete the version return true; - } catch (StorageNotAvailableException | StorageInvalidException $e) { + } catch (StorageNotAvailableException|StorageInvalidException $e) { // Storage can't be used, but it might only be temporary so we can't always delete the version // since we can't determine if the version is named we take the safe route and don't expire return false; @@ -612,19 +613,19 @@ class Storage { $diff = time() - $timestamp; if ($diff < 60) { // first minute - return $diff . " seconds ago"; + return $diff . ' seconds ago'; } elseif ($diff < 3600) { //first hour - return round($diff / 60) . " minutes ago"; + return round($diff / 60) . ' minutes ago'; } elseif ($diff < 86400) { // first day - return round($diff / 3600) . " hours ago"; + return round($diff / 3600) . ' hours ago'; } elseif ($diff < 604800) { //first week - return round($diff / 86400) . " days ago"; + return round($diff / 86400) . ' days ago'; } elseif ($diff < 2419200) { //first month - return round($diff / 604800) . " weeks ago"; + return round($diff / 604800) . ' weeks ago'; } elseif ($diff < 29030400) { // first year - return round($diff / 2419200) . " months ago"; + return round($diff / 2419200) . ' months ago'; } else { - return round($diff / 29030400) . " years ago"; + return round($diff / 29030400) . ' years ago'; } } @@ -714,7 +715,7 @@ class Storage { ['app' => 'files_versions']); continue; } - if ($expiration->isExpired((int)($version['version']), $quotaExceeded) && !isset($toDelete[$key])) { + if ($expiration->isExpired((int) ($version['version']), $quotaExceeded) && !isset($toDelete[$key])) { $size += $version['size']; $toDelete[$key] = $version['path'] . '.v' . $version['version']; } @@ -760,7 +761,7 @@ class Storage { //distance between two version too small, mark to delete $toDelete[$key] = $version['path'] . '.v' . $version['version']; $size += $version['size']; - \OC::$server->get(LoggerInterface::class)->info('Mark to expire '. $version['path'] .' next version should be ' . $nextVersion . " or smaller. (prevTimestamp: " . $prevTimestamp . "; step: " . $step, ['app' => 'files_versions']); + \OC::$server->get(LoggerInterface::class)->info('Mark to expire '. $version['path'] .' next version should be ' . $nextVersion . ' or smaller. (prevTimestamp: ' . $prevTimestamp . '; step: ' . $step, ['app' => 'files_versions']); } else { $nextVersion = $version['version'] - $step; $prevTimestamp = $version['version']; @@ -906,7 +907,7 @@ class Storage { $versionsMapper = \OC::$server->get(VersionsMapper::class); $file = \OC::$server->get(IRootFolder::class)->getUserFolder($uid)->get($filename); $pathparts = pathinfo($path); - $timestamp = (int)substr($pathparts['extension'] ?? '', 1); + $timestamp = (int) substr($pathparts['extension'] ?? '', 1); $versionEntity = $versionsMapper->findVersionForFileId($file->getId(), $timestamp); if ($versionEntity->getMetadataValue('label') !== null && $versionEntity->getMetadataValue('label') !== '') { continue; @@ -953,13 +954,13 @@ class Storage { * that match the given path to a file. * * @param string $filename $path to a file, relative to the user's - * "files" folder + * "files" folder * @param View $view view on data/user/ */ public static function createMissingDirectories($filename, $view) { $dirname = Filesystem::normalizePath(dirname($filename)); $dirParts = explode('/', $dirname); - $dir = "/files_versions"; + $dir = '/files_versions'; foreach ($dirParts as $part) { $dir = $dir . '/' . $part; if (!$view->file_exists($dir)) { diff --git a/apps/files_versions/lib/Versions/BackendNotFoundException.php b/apps/files_versions/lib/Versions/BackendNotFoundException.php index af903e9abeb..f1fbecb852a 100644 --- a/apps/files_versions/lib/Versions/BackendNotFoundException.php +++ b/apps/files_versions/lib/Versions/BackendNotFoundException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_versions/lib/Versions/LegacyVersionsBackend.php b/apps/files_versions/lib/Versions/LegacyVersionsBackend.php index 90e521abfb4..f2f59d5c724 100644 --- a/apps/files_versions/lib/Versions/LegacyVersionsBackend.php +++ b/apps/files_versions/lib/Versions/LegacyVersionsBackend.php @@ -65,7 +65,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend $file = $userFolder->getFirstNodeById($fileId); if (!$file) { - throw new NotFoundException("version file not found for share owner"); + throw new NotFoundException('version file not found for share owner'); } } else { $userFolder = $this->rootFolder->getUserFolder($user->getUID()); @@ -83,7 +83,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend } $currentVersion = [ - 'version' => (string)$file->getMtime(), + 'version' => (string) $file->getMtime(), 'size' => $file->getSize(), 'mimetype' => $file->getMimetype(), ]; @@ -113,8 +113,8 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend if (empty($versions['db']) && !empty($versions['fs'])) { $versions['db'] = new VersionEntity(); $versions['db']->setFileId($fileId); - $versions['db']->setTimestamp((int)$versions['fs']['version']); - $versions['db']->setSize((int)$versions['fs']['size']); + $versions['db']->setTimestamp((int) $versions['fs']['version']); + $versions['db']->setSize((int) $versions['fs']['size']); $versions['db']->setMimetype($this->mimeTypeLoader->getId($versions['fs']['mimetype'])); $versions['db']->setMetadata([]); $this->versionsMapper->insert($versions['db']); @@ -276,7 +276,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend $currentUserId = $this->userSession->getUser()?->getUID(); if ($currentUserId === null) { - throw new NotFoundException("No user logged in"); + throw new NotFoundException('No user logged in'); } if ($sourceFile->getOwner()?->getUID() === $currentUserId) { @@ -286,7 +286,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend $nodes = $this->rootFolder->getUserFolder($currentUserId)->getById($sourceFile->getId()); if (count($nodes) === 0) { - throw new NotFoundException("Version file not accessible by current user"); + throw new NotFoundException('Version file not accessible by current user'); } foreach ($nodes as $node) { @@ -366,14 +366,14 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend $relativePath = $userFolder->getRelativePath($source->getPath()); if ($relativePath === null) { - throw new Exception("Relative path not found for node with path: " . $source->getPath()); + throw new Exception('Relative path not found for node with path: ' . $source->getPath()); } $versions = Storage::getVersions($user->getUID(), $relativePath); /** @var Folder versionFolder */ $versionFolder = $this->rootFolder->get('admin/files_versions'); foreach ($versions as $version) { - $versionFolder->get($version['path'] . '.v' . (int)$version['version'])->delete(); + $versionFolder->get($version['path'] . '.v' . (int) $version['version'])->delete(); } $this->versionsMapper->deleteAllVersionsForFileId($target->getId()); diff --git a/apps/files_versions/lib/Versions/VersionManager.php b/apps/files_versions/lib/Versions/VersionManager.php index c666192f3c0..315fca1d69f 100644 --- a/apps/files_versions/lib/Versions/VersionManager.php +++ b/apps/files_versions/lib/Versions/VersionManager.php @@ -168,7 +168,7 @@ class VersionManager implements IVersionManager, IDeletableVersionBackend, INeed return $callback(); } catch (ManuallyLockedException $e) { $owner = (string) $e->getOwner(); - $appsThatHandleUpdates = ["text", "richdocuments"]; + $appsThatHandleUpdates = ['text', 'richdocuments']; if (!in_array($owner, $appsThatHandleUpdates)) { throw $e; } diff --git a/apps/files_versions/tests/BackgroundJob/ExpireVersionsTest.php b/apps/files_versions/tests/BackgroundJob/ExpireVersionsTest.php index 7a35e9f5f39..799cfbb2381 100644 --- a/apps/files_versions/tests/BackgroundJob/ExpireVersionsTest.php +++ b/apps/files_versions/tests/BackgroundJob/ExpireVersionsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_versions/tests/Command/CleanupTest.php b/apps/files_versions/tests/Command/CleanupTest.php index 3b834ed974b..c22e9d12e86 100644 --- a/apps/files_versions/tests/Command/CleanupTest.php +++ b/apps/files_versions/tests/Command/CleanupTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -23,7 +24,7 @@ use Test\TestCase; */ class CleanupTest extends TestCase { - /** @var CleanUp */ + /** @var CleanUp */ protected $cleanup; /** @var \PHPUnit\Framework\MockObject\MockObject | Manager */ @@ -164,8 +165,8 @@ class CleanupTest extends TestCase { ->disableOriginalConstructor()->getMock(); $this->userManager->expects($this->once()) - ->method('getBackends') - ->willReturn([$backend]); + ->method('getBackends') + ->willReturn([$backend]); $this->invokePrivate($instance, 'execute', [$inputInterface, $outputInterface]); } diff --git a/apps/files_versions/tests/Command/ExpireTest.php b/apps/files_versions/tests/Command/ExpireTest.php index ac1fc4ada7f..fc749e4562c 100644 --- a/apps/files_versions/tests/Command/ExpireTest.php +++ b/apps/files_versions/tests/Command/ExpireTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_versions/tests/Controller/PreviewControllerTest.php b/apps/files_versions/tests/Controller/PreviewControllerTest.php index 6b46c65cd0c..49fa3cef11c 100644 --- a/apps/files_versions/tests/Controller/PreviewControllerTest.php +++ b/apps/files_versions/tests/Controller/PreviewControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_versions/tests/ExpirationTest.php b/apps/files_versions/tests/ExpirationTest.php index a998d3a3e9a..269382e6129 100644 --- a/apps/files_versions/tests/ExpirationTest.php +++ b/apps/files_versions/tests/ExpirationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_versions/tests/StorageTest.php b/apps/files_versions/tests/StorageTest.php index ead125e905c..f6a7f03b9f2 100644 --- a/apps/files_versions/tests/StorageTest.php +++ b/apps/files_versions/tests/StorageTest.php @@ -51,7 +51,7 @@ class StorageTest extends TestCase { } catch (NotFoundException $e) { $file = $this->userFolder->newFile($path); } - $file->putContent((string)$mtime); + $file->putContent((string) $mtime); $file->touch($mtime); } diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php index 1560dc984f7..c92cb5c162a 100644 --- a/apps/files_versions/tests/VersioningTest.php +++ b/apps/files_versions/tests/VersioningTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -137,12 +138,12 @@ class VersioningTest extends \Test\TestCase { // the deleted array should only contain versions which should be deleted foreach ($deleted as $key => $path) { unset($versions[$key]); - $this->assertEquals("delete", substr($path, 0, strlen("delete"))); + $this->assertEquals('delete', substr($path, 0, strlen('delete'))); } // the versions array should only contain versions which should be kept foreach ($versions as $version) { - $this->assertEquals("keep", $version['path']); + $this->assertEquals('keep', $version['path']); } } @@ -152,46 +153,46 @@ class VersioningTest extends \Test\TestCase { [ [ // first slice (10sec) keep one version every 2 seconds - ["version" => 4999999, "path" => "keep", "size" => 1], - ["version" => 4999998, "path" => "delete", "size" => 1], - ["version" => 4999997, "path" => "keep", "size" => 1], - ["version" => 4999995, "path" => "keep", "size" => 1], - ["version" => 4999994, "path" => "delete", "size" => 1], + ['version' => 4999999, 'path' => 'keep', 'size' => 1], + ['version' => 4999998, 'path' => 'delete', 'size' => 1], + ['version' => 4999997, 'path' => 'keep', 'size' => 1], + ['version' => 4999995, 'path' => 'keep', 'size' => 1], + ['version' => 4999994, 'path' => 'delete', 'size' => 1], //next slice (60sec) starts at 4999990 keep one version every 10 secons - ["version" => 4999988, "path" => "keep", "size" => 1], - ["version" => 4999978, "path" => "keep", "size" => 1], - ["version" => 4999975, "path" => "delete", "size" => 1], - ["version" => 4999972, "path" => "delete", "size" => 1], - ["version" => 4999967, "path" => "keep", "size" => 1], - ["version" => 4999958, "path" => "delete", "size" => 1], - ["version" => 4999957, "path" => "keep", "size" => 1], + ['version' => 4999988, 'path' => 'keep', 'size' => 1], + ['version' => 4999978, 'path' => 'keep', 'size' => 1], + ['version' => 4999975, 'path' => 'delete', 'size' => 1], + ['version' => 4999972, 'path' => 'delete', 'size' => 1], + ['version' => 4999967, 'path' => 'keep', 'size' => 1], + ['version' => 4999958, 'path' => 'delete', 'size' => 1], + ['version' => 4999957, 'path' => 'keep', 'size' => 1], //next slice (3600sec) start at 4999940 keep one version every 60 seconds - ["version" => 4999900, "path" => "keep", "size" => 1], - ["version" => 4999841, "path" => "delete", "size" => 1], - ["version" => 4999840, "path" => "keep", "size" => 1], - ["version" => 4999780, "path" => "keep", "size" => 1], - ["version" => 4996401, "path" => "keep", "size" => 1], + ['version' => 4999900, 'path' => 'keep', 'size' => 1], + ['version' => 4999841, 'path' => 'delete', 'size' => 1], + ['version' => 4999840, 'path' => 'keep', 'size' => 1], + ['version' => 4999780, 'path' => 'keep', 'size' => 1], + ['version' => 4996401, 'path' => 'keep', 'size' => 1], // next slice (86400sec) start at 4996400 keep one version every 3600 seconds - ["version" => 4996350, "path" => "delete", "size" => 1], - ["version" => 4992800, "path" => "keep", "size" => 1], - ["version" => 4989800, "path" => "delete", "size" => 1], - ["version" => 4989700, "path" => "delete", "size" => 1], - ["version" => 4989200, "path" => "keep", "size" => 1], + ['version' => 4996350, 'path' => 'delete', 'size' => 1], + ['version' => 4992800, 'path' => 'keep', 'size' => 1], + ['version' => 4989800, 'path' => 'delete', 'size' => 1], + ['version' => 4989700, 'path' => 'delete', 'size' => 1], + ['version' => 4989200, 'path' => 'keep', 'size' => 1], // next slice (2592000sec) start at 4913600 keep one version every 86400 seconds - ["version" => 4913600, "path" => "keep", "size" => 1], - ["version" => 4852800, "path" => "delete", "size" => 1], - ["version" => 4827201, "path" => "delete", "size" => 1], - ["version" => 4827200, "path" => "keep", "size" => 1], - ["version" => 4777201, "path" => "delete", "size" => 1], - ["version" => 4777501, "path" => "delete", "size" => 1], - ["version" => 4740000, "path" => "keep", "size" => 1], + ['version' => 4913600, 'path' => 'keep', 'size' => 1], + ['version' => 4852800, 'path' => 'delete', 'size' => 1], + ['version' => 4827201, 'path' => 'delete', 'size' => 1], + ['version' => 4827200, 'path' => 'keep', 'size' => 1], + ['version' => 4777201, 'path' => 'delete', 'size' => 1], + ['version' => 4777501, 'path' => 'delete', 'size' => 1], + ['version' => 4740000, 'path' => 'keep', 'size' => 1], // final slice starts at 2408000 keep one version every 604800 secons - ["version" => 2408000, "path" => "keep", "size" => 1], - ["version" => 1803201, "path" => "delete", "size" => 1], - ["version" => 1803200, "path" => "keep", "size" => 1], - ["version" => 1800199, "path" => "delete", "size" => 1], - ["version" => 1800100, "path" => "delete", "size" => 1], - ["version" => 1198300, "path" => "keep", "size" => 1], + ['version' => 2408000, 'path' => 'keep', 'size' => 1], + ['version' => 1803201, 'path' => 'delete', 'size' => 1], + ['version' => 1803200, 'path' => 'keep', 'size' => 1], + ['version' => 1800199, 'path' => 'delete', 'size' => 1], + ['version' => 1800100, 'path' => 'delete', 'size' => 1], + ['version' => 1198300, 'path' => 'keep', 'size' => 1], ], 16 // size of all deleted files (every file has the size 1) ], @@ -202,28 +203,28 @@ class VersioningTest extends \Test\TestCase { // next slice (60sec) starts at 4999990 keep one version every 10 secons // next slice (3600sec) start at 4999940 keep one version every 60 seconds // next slice (86400sec) start at 4996400 keep one version every 3600 seconds - ["version" => 4996400, "path" => "keep", "size" => 1], - ["version" => 4996350, "path" => "delete", "size" => 1], - ["version" => 4996350, "path" => "delete", "size" => 1], - ["version" => 4992800, "path" => "keep", "size" => 1], - ["version" => 4989800, "path" => "delete", "size" => 1], - ["version" => 4989700, "path" => "delete", "size" => 1], - ["version" => 4989200, "path" => "keep", "size" => 1], + ['version' => 4996400, 'path' => 'keep', 'size' => 1], + ['version' => 4996350, 'path' => 'delete', 'size' => 1], + ['version' => 4996350, 'path' => 'delete', 'size' => 1], + ['version' => 4992800, 'path' => 'keep', 'size' => 1], + ['version' => 4989800, 'path' => 'delete', 'size' => 1], + ['version' => 4989700, 'path' => 'delete', 'size' => 1], + ['version' => 4989200, 'path' => 'keep', 'size' => 1], // next slice (2592000sec) start at 4913600 keep one version every 86400 seconds - ["version" => 4913600, "path" => "keep", "size" => 1], - ["version" => 4852800, "path" => "delete", "size" => 1], - ["version" => 4827201, "path" => "delete", "size" => 1], - ["version" => 4827200, "path" => "keep", "size" => 1], - ["version" => 4777201, "path" => "delete", "size" => 1], - ["version" => 4777501, "path" => "delete", "size" => 1], - ["version" => 4740000, "path" => "keep", "size" => 1], + ['version' => 4913600, 'path' => 'keep', 'size' => 1], + ['version' => 4852800, 'path' => 'delete', 'size' => 1], + ['version' => 4827201, 'path' => 'delete', 'size' => 1], + ['version' => 4827200, 'path' => 'keep', 'size' => 1], + ['version' => 4777201, 'path' => 'delete', 'size' => 1], + ['version' => 4777501, 'path' => 'delete', 'size' => 1], + ['version' => 4740000, 'path' => 'keep', 'size' => 1], // final slice starts at 2408000 keep one version every 604800 secons - ["version" => 2408000, "path" => "keep", "size" => 1], - ["version" => 1803201, "path" => "delete", "size" => 1], - ["version" => 1803200, "path" => "keep", "size" => 1], - ["version" => 1800199, "path" => "delete", "size" => 1], - ["version" => 1800100, "path" => "delete", "size" => 1], - ["version" => 1198300, "path" => "keep", "size" => 1], + ['version' => 2408000, 'path' => 'keep', 'size' => 1], + ['version' => 1803201, 'path' => 'delete', 'size' => 1], + ['version' => 1803200, 'path' => 'keep', 'size' => 1], + ['version' => 1800199, 'path' => 'delete', 'size' => 1], + ['version' => 1800100, 'path' => 'delete', 'size' => 1], + ['version' => 1198300, 'path' => 'keep', 'size' => 1], ], 11 // size of all deleted files (every file has the size 1) ], @@ -231,32 +232,32 @@ class VersioningTest extends \Test\TestCase { [ [ // first slice (10sec) keep one version every 2 seconds - ["version" => 4999999, "path" => "keep", "size" => 1], - ["version" => 4999998, "path" => "delete", "size" => 1], - ["version" => 4999997, "path" => "keep", "size" => 1], - ["version" => 4999995, "path" => "keep", "size" => 1], - ["version" => 4999994, "path" => "delete", "size" => 1], + ['version' => 4999999, 'path' => 'keep', 'size' => 1], + ['version' => 4999998, 'path' => 'delete', 'size' => 1], + ['version' => 4999997, 'path' => 'keep', 'size' => 1], + ['version' => 4999995, 'path' => 'keep', 'size' => 1], + ['version' => 4999994, 'path' => 'delete', 'size' => 1], //next slice (60sec) starts at 4999990 keep one version every 10 secons - ["version" => 4999988, "path" => "keep", "size" => 1], - ["version" => 4999978, "path" => "keep", "size" => 1], + ['version' => 4999988, 'path' => 'keep', 'size' => 1], + ['version' => 4999978, 'path' => 'keep', 'size' => 1], //next slice (3600sec) start at 4999940 keep one version every 60 seconds // next slice (86400sec) start at 4996400 keep one version every 3600 seconds - ["version" => 4989200, "path" => "keep", "size" => 1], + ['version' => 4989200, 'path' => 'keep', 'size' => 1], // next slice (2592000sec) start at 4913600 keep one version every 86400 seconds - ["version" => 4913600, "path" => "keep", "size" => 1], - ["version" => 4852800, "path" => "delete", "size" => 1], - ["version" => 4827201, "path" => "delete", "size" => 1], - ["version" => 4827200, "path" => "keep", "size" => 1], - ["version" => 4777201, "path" => "delete", "size" => 1], - ["version" => 4777501, "path" => "delete", "size" => 1], - ["version" => 4740000, "path" => "keep", "size" => 1], + ['version' => 4913600, 'path' => 'keep', 'size' => 1], + ['version' => 4852800, 'path' => 'delete', 'size' => 1], + ['version' => 4827201, 'path' => 'delete', 'size' => 1], + ['version' => 4827200, 'path' => 'keep', 'size' => 1], + ['version' => 4777201, 'path' => 'delete', 'size' => 1], + ['version' => 4777501, 'path' => 'delete', 'size' => 1], + ['version' => 4740000, 'path' => 'keep', 'size' => 1], // final slice starts at 2408000 keep one version every 604800 secons - ["version" => 2408000, "path" => "keep", "size" => 1], - ["version" => 1803201, "path" => "delete", "size" => 1], - ["version" => 1803200, "path" => "keep", "size" => 1], - ["version" => 1800199, "path" => "delete", "size" => 1], - ["version" => 1800100, "path" => "delete", "size" => 1], - ["version" => 1198300, "path" => "keep", "size" => 1], + ['version' => 2408000, 'path' => 'keep', 'size' => 1], + ['version' => 1803201, 'path' => 'delete', 'size' => 1], + ['version' => 1803200, 'path' => 'keep', 'size' => 1], + ['version' => 1800199, 'path' => 'delete', 'size' => 1], + ['version' => 1800100, 'path' => 'delete', 'size' => 1], + ['version' => 1198300, 'path' => 'keep', 'size' => 1], ], 9 // size of all deleted files (every file has the size 1) ], @@ -270,7 +271,7 @@ class VersioningTest extends \Test\TestCase { } public function testRename() { - \OC\Files\Filesystem::file_put_contents("test.txt", "test file"); + \OC\Files\Filesystem::file_put_contents('test.txt', 'test file'); $t1 = time(); // second version is two weeks older, this way we make sure that no @@ -287,7 +288,7 @@ class VersioningTest extends \Test\TestCase { $this->rootView->file_put_contents($v2, 'version2'); // execute rename hook of versions app - \OC\Files\Filesystem::rename("test.txt", "test2.txt"); + \OC\Files\Filesystem::rename('test.txt', 'test2.txt'); $this->runCommands(); @@ -301,7 +302,7 @@ class VersioningTest extends \Test\TestCase { public function testRenameInSharedFolder() { \OC\Files\Filesystem::mkdir('folder1'); \OC\Files\Filesystem::mkdir('folder1/folder2'); - \OC\Files\Filesystem::file_put_contents("folder1/test.txt", "test file"); + \OC\Files\Filesystem::file_put_contents('folder1/test.txt', 'test file'); $t1 = time(); // second version is two weeks older, this way we make sure that no @@ -483,7 +484,7 @@ class VersioningTest extends \Test\TestCase { } public function testRenameSharedFile() { - \OC\Files\Filesystem::file_put_contents("test.txt", "test file"); + \OC\Files\Filesystem::file_put_contents('test.txt', 'test file'); $t1 = time(); // second version is two weeks older, this way we make sure that no @@ -532,7 +533,7 @@ class VersioningTest extends \Test\TestCase { } public function testCopy() { - \OC\Files\Filesystem::file_put_contents("test.txt", "test file"); + \OC\Files\Filesystem::file_put_contents('test.txt', 'test file'); $t1 = time(); // second version is two weeks older, this way we make sure that no @@ -549,7 +550,7 @@ class VersioningTest extends \Test\TestCase { $this->rootView->file_put_contents($v2, 'version2'); // execute copy hook of versions app - \OC\Files\Filesystem::copy("test.txt", "test2.txt"); + \OC\Files\Filesystem::copy('test.txt', 'test2.txt'); $this->runCommands(); @@ -621,7 +622,7 @@ class VersioningTest extends \Test\TestCase { $this->logout(); // needed to have a FS setup (the background job does this) \OC_Util::setupFS(self::TEST_VERSIONS_USER); - \OC\Files\Filesystem::file_put_contents("test.txt", "test file"); + \OC\Files\Filesystem::file_put_contents('test.txt', 'test file'); $this->assertFalse(\OCA\Files_Versions\Storage::expire('test.txt', 'unexist')); } @@ -694,7 +695,7 @@ class VersioningTest extends \Test\TestCase { $shareManager = \OC::$server->getShareManager(); $shareManager->acceptShare($share, self::TEST_VERSIONS_USER2); - $share->setTarget("subfolder/folder"); + $share->setTarget('subfolder/folder'); $shareManager->moveShare($share, self::TEST_VERSIONS_USER2); $versions = $this->createAndCheckVersions( diff --git a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php index f34f9345f0e..e3e723a58c0 100644 --- a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php +++ b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php @@ -157,7 +157,7 @@ class RetryJob extends Job { $user->getUID(), 'lookup_server_connector', 'update_retries', - (string)($this->retries + 1), + (string) ($this->retries + 1), ); } } diff --git a/apps/oauth2/appinfo/routes.php b/apps/oauth2/appinfo/routes.php index f40eaf96406..b34aff05552 100644 --- a/apps/oauth2/appinfo/routes.php +++ b/apps/oauth2/appinfo/routes.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/oauth2/lib/Db/AccessToken.php b/apps/oauth2/lib/Db/AccessToken.php index 543d512e0ce..649b9923ed0 100644 --- a/apps/oauth2/lib/Db/AccessToken.php +++ b/apps/oauth2/lib/Db/AccessToken.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/oauth2/lib/Db/Client.php b/apps/oauth2/lib/Db/Client.php index c48ca4edfc0..6f42b225b27 100644 --- a/apps/oauth2/lib/Db/Client.php +++ b/apps/oauth2/lib/Db/Client.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php b/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php index dde50374cdf..7305459c98b 100644 --- a/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php +++ b/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/oauth2/tests/Controller/OauthApiControllerTest.php b/apps/oauth2/tests/Controller/OauthApiControllerTest.php index 803bdce16b1..3aed2e668e7 100644 --- a/apps/oauth2/tests/Controller/OauthApiControllerTest.php +++ b/apps/oauth2/tests/Controller/OauthApiControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/oauth2/tests/Controller/SettingsControllerTest.php b/apps/oauth2/tests/Controller/SettingsControllerTest.php index d915969e0da..f0dfdf41464 100644 --- a/apps/oauth2/tests/Controller/SettingsControllerTest.php +++ b/apps/oauth2/tests/Controller/SettingsControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/oauth2/tests/Db/AccessTokenMapperTest.php b/apps/oauth2/tests/Db/AccessTokenMapperTest.php index a248c1e0d38..7b447249807 100644 --- a/apps/oauth2/tests/Db/AccessTokenMapperTest.php +++ b/apps/oauth2/tests/Db/AccessTokenMapperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -26,7 +27,7 @@ class AccessTokenMapperTest extends TestCase { $this->accessTokenMapper->deleteByClientId(1234); $token = new AccessToken(); $token->setClientId(1234); - $token->setTokenId((string)time()); + $token->setTokenId((string) time()); $token->setEncryptedToken('MyEncryptedToken'); $token->setHashedCode(hash('sha512', 'MyAwesomeToken')); $this->accessTokenMapper->insert($token); @@ -44,7 +45,7 @@ class AccessTokenMapperTest extends TestCase { $this->accessTokenMapper->deleteByClientId(1234); $token = new AccessToken(); $token->setClientId(1234); - $token->setTokenId((string)time()); + $token->setTokenId((string) time()); $token->setEncryptedToken('MyEncryptedToken'); $token->setHashedCode(hash('sha512', 'MyAwesomeToken')); $this->accessTokenMapper->insert($token); diff --git a/apps/oauth2/tests/Db/ClientMapperTest.php b/apps/oauth2/tests/Db/ClientMapperTest.php index 3d8b25acbef..64eda6800db 100644 --- a/apps/oauth2/tests/Db/ClientMapperTest.php +++ b/apps/oauth2/tests/Db/ClientMapperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/oauth2/tests/Settings/AdminTest.php b/apps/oauth2/tests/Settings/AdminTest.php index 9cbefb74671..9a7a531dd78 100644 --- a/apps/oauth2/tests/Settings/AdminTest.php +++ b/apps/oauth2/tests/Settings/AdminTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/provisioning_api/lib/AppInfo/Application.php b/apps/provisioning_api/lib/AppInfo/Application.php index b13f2b0eba5..57de9dad416 100644 --- a/apps/provisioning_api/lib/AppInfo/Application.php +++ b/apps/provisioning_api/lib/AppInfo/Application.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/provisioning_api/lib/Capabilities.php b/apps/provisioning_api/lib/Capabilities.php index 4c8b1ce3ec7..1d2f2ba52b8 100644 --- a/apps/provisioning_api/lib/Capabilities.php +++ b/apps/provisioning_api/lib/Capabilities.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/provisioning_api/lib/Controller/AUserData.php b/apps/provisioning_api/lib/Controller/AUserData.php index 65c793920af..e891a71ff6d 100644 --- a/apps/provisioning_api/lib/Controller/AUserData.php +++ b/apps/provisioning_api/lib/Controller/AUserData.php @@ -274,7 +274,7 @@ abstract class AUserData extends OCSController { ]; } catch (\Exception $e) { \OC::$server->get(\Psr\Log\LoggerInterface::class)->error( - "Could not load storage info for {user}", + 'Could not load storage info for {user}', [ 'app' => 'provisioning_api', 'user' => $userId, diff --git a/apps/provisioning_api/lib/Controller/AppConfigController.php b/apps/provisioning_api/lib/Controller/AppConfigController.php index 2ff82213997..7cca913bdfa 100644 --- a/apps/provisioning_api/lib/Controller/AppConfigController.php +++ b/apps/provisioning_api/lib/Controller/AppConfigController.php @@ -113,7 +113,7 @@ class AppConfigController extends OCSController { public function setValue(string $app, string $key, string $value): DataResponse { $user = $this->userSession->getUser(); if ($user === null) { - throw new \Exception("User is not logged in."); // Should not happen, since method is guarded by middleware + throw new \Exception('User is not logged in.'); // Should not happen, since method is guarded by middleware } if (!$this->isAllowedToChangedKey($user, $app, $key)) { @@ -136,9 +136,9 @@ class AppConfigController extends OCSController { /** @psalm-suppress InternalMethod */ match ($type) { - IAppConfig::VALUE_BOOL => $this->appConfig->setValueBool($app, $key, (bool)$value), - IAppConfig::VALUE_FLOAT => $this->appConfig->setValueFloat($app, $key, (float)$value), - IAppConfig::VALUE_INT => $this->appConfig->setValueInt($app, $key, (int)$value), + IAppConfig::VALUE_BOOL => $this->appConfig->setValueBool($app, $key, (bool) $value), + IAppConfig::VALUE_FLOAT => $this->appConfig->setValueFloat($app, $key, (float) $value), + IAppConfig::VALUE_INT => $this->appConfig->setValueInt($app, $key, (int) $value), IAppConfig::VALUE_STRING => $this->appConfig->setValueString($app, $key, $value), IAppConfig::VALUE_ARRAY => $this->appConfig->setValueArray($app, $key, \json_decode($value, true)), default => $this->appConfig->setValueMixed($app, $key, $value), diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php index f0712d12261..f58c77aa7c6 100644 --- a/apps/provisioning_api/lib/Controller/GroupsController.php +++ b/apps/provisioning_api/lib/Controller/GroupsController.php @@ -211,7 +211,7 @@ class GroupsController extends AUserData { foreach ($users as $user) { try { /** @var IUser $user */ - $userId = (string)$user->getUID(); + $userId = (string) $user->getUID(); $userData = $this->getUserData($userId); // Do not insert empty entry if ($userData !== null) { diff --git a/apps/provisioning_api/lib/Controller/PreferencesController.php b/apps/provisioning_api/lib/Controller/PreferencesController.php index affacb4fb32..c5162721882 100644 --- a/apps/provisioning_api/lib/Controller/PreferencesController.php +++ b/apps/provisioning_api/lib/Controller/PreferencesController.php @@ -134,8 +134,8 @@ class PreferencesController extends OCSController { * @param string[] $configKeys Keys to delete * * @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST, array<empty>, array{}> - * 200: Preferences deleted successfully - * 400: Preference invalid + * 200: Preferences deleted successfully + * 400: Preference invalid */ #[NoAdminRequired] public function deleteMultiplePreference(string $appId, array $configKeys): DataResponse { diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index 2106a599712..a866090dce8 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -1088,7 +1088,7 @@ class UsersController extends AUserData { $this->config->setUserValue($targetUser->getUID(), 'core', 'locale', $value); break; case self::USER_FIELD_FIRST_DAY_OF_WEEK: - $intValue = (int)$value; + $intValue = (int) $value; if ($intValue < -1 || $intValue > 6) { throw new OCSException($this->l10n->t('Invalid first day of week'), 101); } diff --git a/apps/provisioning_api/lib/Middleware/Exceptions/NotSubAdminException.php b/apps/provisioning_api/lib/Middleware/Exceptions/NotSubAdminException.php index c7be073b8af..b014d6a1495 100644 --- a/apps/provisioning_api/lib/Middleware/Exceptions/NotSubAdminException.php +++ b/apps/provisioning_api/lib/Middleware/Exceptions/NotSubAdminException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/provisioning_api/tests/CapabilitiesTest.php b/apps/provisioning_api/tests/CapabilitiesTest.php index 389dd37301d..d92be910c2f 100644 --- a/apps/provisioning_api/tests/CapabilitiesTest.php +++ b/apps/provisioning_api/tests/CapabilitiesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -64,8 +65,8 @@ class CapabilitiesTest extends TestCase { $this->overwriteService(FederatedShareProvider::class, $federatedShareProvider); $federatedShareProvider->expects($this->any()) - ->method('isLookupServerUploadEnabled') - ->willReturn($lookupServerEnabled); + ->method('isLookupServerUploadEnabled') + ->willReturn($lookupServerEnabled); $expected = [ 'provisioning_api' => [ diff --git a/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php b/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php index 0bdee39cebc..959c0ac5e5f 100644 --- a/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php +++ b/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -264,7 +265,7 @@ class AppConfigControllerTest extends TestCase { 'value' => '', // 🤷 'type' => $type, 'lazy' => false, - 'typeString' => (string)$type, // this is not accurate, but acceptable + 'typeString' => (string) $type, // this is not accurate, but acceptable 'sensitive' => ($type & IAppConfig::VALUE_SENSITIVE) !== 0, ]); } diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php index 9bbc548ffb3..9c439632826 100644 --- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php @@ -58,8 +58,8 @@ class GroupsControllerTest extends \Test\TestCase { $this->logger = $this->createMock(LoggerInterface::class); $this->groupManager - ->method('getSubAdmin') - ->willReturn($this->subAdminManager); + ->method('getSubAdmin') + ->willReturn($this->subAdminManager); $this->api = $this->getMockBuilder(GroupsController::class) ->setConstructorArgs([ diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php index bea13db9baa..c4e24842a5a 100644 --- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php +++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php @@ -604,7 +604,7 @@ class UsersControllerTest extends TestCase { ->method('generate') ->with(10) ->willReturnCallback(function () { - return (string)rand(100000000, 999999999); + return (string) rand(100000000, 999999999); }); $this->assertTrue(key_exists( diff --git a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php index df3ae0bd358..b1b82183aa0 100644 --- a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php +++ b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/lib/Activity/GroupProvider.php b/apps/settings/lib/Activity/GroupProvider.php index bad2c0c7a35..f588e358f30 100644 --- a/apps/settings/lib/Activity/GroupProvider.php +++ b/apps/settings/lib/Activity/GroupProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/lib/Activity/GroupSetting.php b/apps/settings/lib/Activity/GroupSetting.php index e50e59a0916..7ae97d30c6a 100644 --- a/apps/settings/lib/Activity/GroupSetting.php +++ b/apps/settings/lib/Activity/GroupSetting.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -38,8 +39,8 @@ class GroupSetting implements ISetting { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority(): int { diff --git a/apps/settings/lib/Activity/Provider.php b/apps/settings/lib/Activity/Provider.php index 1e139484f23..b2013f02781 100644 --- a/apps/settings/lib/Activity/Provider.php +++ b/apps/settings/lib/Activity/Provider.php @@ -142,7 +142,7 @@ class Provider implements IProvider { return [ 'token' => [ 'type' => 'highlight', - 'id' => (string)$event->getObjectId(), + 'id' => (string) $event->getObjectId(), 'name' => $parameters['name'], ] ]; @@ -150,12 +150,12 @@ class Provider implements IProvider { return [ 'token' => [ 'type' => 'highlight', - 'id' => (string)$event->getObjectId(), + 'id' => (string) $event->getObjectId(), 'name' => $parameters['name'], ], 'newToken' => [ 'type' => 'highlight', - 'id' => (string)$event->getObjectId(), + 'id' => (string) $event->getObjectId(), 'name' => $parameters['newName'], ] ]; diff --git a/apps/settings/lib/Activity/SecurityFilter.php b/apps/settings/lib/Activity/SecurityFilter.php index 61d657193fd..da434e4b515 100644 --- a/apps/settings/lib/Activity/SecurityFilter.php +++ b/apps/settings/lib/Activity/SecurityFilter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/lib/Activity/SecuritySetting.php b/apps/settings/lib/Activity/SecuritySetting.php index 3253640aca3..a93bae639e5 100644 --- a/apps/settings/lib/Activity/SecuritySetting.php +++ b/apps/settings/lib/Activity/SecuritySetting.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/lib/Activity/Setting.php b/apps/settings/lib/Activity/Setting.php index d627a70b766..602f7ee4dc0 100644 --- a/apps/settings/lib/Activity/Setting.php +++ b/apps/settings/lib/Activity/Setting.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -38,8 +39,8 @@ class Setting implements ISetting { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/settings/lib/BackgroundJobs/VerifyUserData.php b/apps/settings/lib/BackgroundJobs/VerifyUserData.php index fc51ee6ffa0..17e16b83f9b 100644 --- a/apps/settings/lib/BackgroundJobs/VerifyUserData.php +++ b/apps/settings/lib/BackgroundJobs/VerifyUserData.php @@ -20,7 +20,7 @@ use OCP\IUserManager; use Psr\Log\LoggerInterface; class VerifyUserData extends Job { - /** @var bool */ + /** @var bool */ private bool $retainJob = true; /** @var int max number of attempts to send the request */ @@ -57,7 +57,7 @@ class VerifyUserData extends Job { } protected function run($argument) { - $try = (int)$argument['try'] + 1; + $try = (int) $argument['try'] + 1; switch ($argument['type']) { case IAccountManager::PROPERTY_WEBSITE: @@ -206,7 +206,7 @@ class VerifyUserData extends Job { 'data' => $argument['data'], 'type' => $argument['type'], 'uid' => $argument['uid'], - 'try' => (int)$argument['try'] + 1, + 'try' => (int) $argument['try'] + 1, 'lastRun' => time() ] ); @@ -219,7 +219,7 @@ class VerifyUserData extends Job { * @return bool */ protected function shouldRun(array $argument) { - $lastRun = (int)$argument['lastRun']; + $lastRun = (int) $argument['lastRun']; return ((time() - $lastRun) > $this->interval); } diff --git a/apps/settings/lib/Controller/AdminSettingsController.php b/apps/settings/lib/Controller/AdminSettingsController.php index 9ba1892afaf..8fb8dac44b9 100644 --- a/apps/settings/lib/Controller/AdminSettingsController.php +++ b/apps/settings/lib/Controller/AdminSettingsController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index 5687f9a93db..d38adbf06f9 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -622,8 +623,8 @@ class AppSettingsController extends Controller { } private function sortApps($a, $b) { - $a = (string)$a['name']; - $b = (string)$b['name']; + $a = (string) $a['name']; + $b = (string) $b['name']; if ($a === $b) { return 0; } diff --git a/apps/settings/lib/Controller/ChangePasswordController.php b/apps/settings/lib/Controller/ChangePasswordController.php index 32bbebb210c..8535b131403 100644 --- a/apps/settings/lib/Controller/ChangePasswordController.php +++ b/apps/settings/lib/Controller/ChangePasswordController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/lib/Controller/CommonSettingsTrait.php b/apps/settings/lib/Controller/CommonSettingsTrait.php index eaf8e6c3774..2f820fc644a 100644 --- a/apps/settings/lib/Controller/CommonSettingsTrait.php +++ b/apps/settings/lib/Controller/CommonSettingsTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/lib/Controller/MailSettingsController.php b/apps/settings/lib/Controller/MailSettingsController.php index f6b86c7970e..b44e5230659 100644 --- a/apps/settings/lib/Controller/MailSettingsController.php +++ b/apps/settings/lib/Controller/MailSettingsController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/settings/lib/Controller/PersonalSettingsController.php b/apps/settings/lib/Controller/PersonalSettingsController.php index db74d26e1f6..a5dba0a44cf 100644 --- a/apps/settings/lib/Controller/PersonalSettingsController.php +++ b/apps/settings/lib/Controller/PersonalSettingsController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/lib/Controller/UsersController.php b/apps/settings/lib/Controller/UsersController.php index 5bb15e9b9ed..6e92f4788bb 100644 --- a/apps/settings/lib/Controller/UsersController.php +++ b/apps/settings/lib/Controller/UsersController.php @@ -144,7 +144,7 @@ class UsersController extends Controller { ]; if (!$isLDAPUsed && $this->appManager->isEnabledForUser('user_ldap')) { - $isLDAPUsed = (bool)array_reduce($this->userManager->getBackends(), function ($ldapFound, $backend) { + $isLDAPUsed = (bool) array_reduce($this->userManager->getBackends(), function ($ldapFound, $backend) { return $ldapFound || $backend instanceof User_Proxy; }); } @@ -156,7 +156,7 @@ class UsersController extends Controller { if ($isAdmin || $isDelegatedAdmin) { $disabledUsers = $this->userManager->countDisabledUsers(); $userCount = array_reduce($this->userManager->countUsers(), function ($v, $w) { - return $v + (int)$w; + return $v + (int) $w; }, 0); } else { // User is subadmin ! @@ -217,7 +217,7 @@ class UsersController extends Controller { $serverData['isDelegatedAdmin'] = $isDelegatedAdmin; $serverData['sortGroups'] = $forceSortGroupByName ? \OC\Group\MetaData::SORT_GROUPNAME - : (int)$this->config->getAppValue('core', 'group.sortBy', (string)\OC\Group\MetaData::SORT_USERCOUNT); + : (int) $this->config->getAppValue('core', 'group.sortBy', (string) \OC\Group\MetaData::SORT_USERCOUNT); $serverData['forceSortGroupByName'] = $forceSortGroupByName; $serverData['quotaPreset'] = $quotaPreset; $serverData['allowUnlimitedQuota'] = $allowUnlimitedQuota; @@ -432,7 +432,7 @@ class UsersController extends Controller { ], Http::STATUS_OK ); - } catch (ForbiddenException | InvalidArgumentException | PropertyDoesNotExistException $e) { + } catch (ForbiddenException|InvalidArgumentException|PropertyDoesNotExistException $e) { return new DataResponse([ 'status' => 'error', 'data' => [ @@ -459,7 +459,7 @@ class UsersController extends Controller { } $oldEmailAddress = $userAccount->getUser()->getSystemEMailAddress(); - $oldEmailAddress = strtolower((string)$oldEmailAddress); + $oldEmailAddress = strtolower((string) $oldEmailAddress); if ($oldEmailAddress !== strtolower($userAccount->getProperty(IAccountManager::PROPERTY_EMAIL)->getValue())) { // this is the only permission a backend provides and is also used // for the permission of setting a email address diff --git a/apps/settings/lib/Hooks.php b/apps/settings/lib/Hooks.php index eb77b676914..78fcd1a0b21 100644 --- a/apps/settings/lib/Hooks.php +++ b/apps/settings/lib/Hooks.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/lib/Listener/MailProviderListener.php b/apps/settings/lib/Listener/MailProviderListener.php index 974378c0006..5e7cbb0c602 100644 --- a/apps/settings/lib/Listener/MailProviderListener.php +++ b/apps/settings/lib/Listener/MailProviderListener.php @@ -44,7 +44,7 @@ class MailProviderListener implements IEventListener { private function handleGetValue(DeclarativeSettingsGetValueEvent $event): void { if ($event->getFieldId() === 'mail_providers_enabled') { - $event->setValue((int)$this->config->getValueBool('core', 'mail_providers_enabled', true)); + $event->setValue((int) $this->config->getValueBool('core', 'mail_providers_enabled', true)); } } @@ -52,7 +52,7 @@ class MailProviderListener implements IEventListener { private function handleSetValue(DeclarativeSettingsSetValueEvent $event): void { if ($event->getFieldId() === 'mail_providers_enabled') { - $this->config->setValueBool('core', 'mail_providers_enabled', (bool)$event->getValue()); + $this->config->setValueBool('core', 'mail_providers_enabled', (bool) $event->getValue()); $event->stopPropagation(); } diff --git a/apps/settings/lib/Mailer/NewUserMailHelper.php b/apps/settings/lib/Mailer/NewUserMailHelper.php index 737da8d7b9a..9832b593f98 100644 --- a/apps/settings/lib/Mailer/NewUserMailHelper.php +++ b/apps/settings/lib/Mailer/NewUserMailHelper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/lib/Middleware/SubadminMiddleware.php b/apps/settings/lib/Middleware/SubadminMiddleware.php index f985cdf278c..33e767a717a 100644 --- a/apps/settings/lib/Middleware/SubadminMiddleware.php +++ b/apps/settings/lib/Middleware/SubadminMiddleware.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors/** * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/settings/lib/Sections/Admin/Delegation.php b/apps/settings/lib/Sections/Admin/Delegation.php index cc8aa3e3e84..0446108417b 100644 --- a/apps/settings/lib/Sections/Admin/Delegation.php +++ b/apps/settings/lib/Sections/Admin/Delegation.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/lib/Service/AuthorizedGroupService.php b/apps/settings/lib/Service/AuthorizedGroupService.php index 9dea37b0c2e..31ffc765f32 100644 --- a/apps/settings/lib/Service/AuthorizedGroupService.php +++ b/apps/settings/lib/Service/AuthorizedGroupService.php @@ -46,7 +46,7 @@ class AuthorizedGroupService { private function handleException(\Exception $e): void { if ($e instanceof DoesNotExistException || $e instanceof MultipleObjectsReturnedException) { - throw new NotFoundException("AuthorizedGroup not found"); + throw new NotFoundException('AuthorizedGroup not found'); } else { throw $e; } diff --git a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php index 57cd555f1f2..4092acecab8 100644 --- a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php +++ b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php @@ -141,7 +141,7 @@ class ArtificialIntelligence implements IDelegatedSettings { $json = $this->config->getAppValue('core', $key, ''); if ($json !== '') { $value = json_decode($json, true); - switch($key) { + switch ($key) { case 'ai.taskprocessing_provider_preferences': case 'ai.textprocessing_provider_preferences': // fill $value with $defaultValue values @@ -176,8 +176,8 @@ class ArtificialIntelligence implements IDelegatedSettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/settings/lib/Settings/Admin/Mail.php b/apps/settings/lib/Settings/Admin/Mail.php index 03b24d90854..b9eb8c82300 100644 --- a/apps/settings/lib/Settings/Admin/Mail.php +++ b/apps/settings/lib/Settings/Admin/Mail.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -68,8 +69,8 @@ class Mail implements IDelegatedSettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/settings/lib/Settings/Admin/Overview.php b/apps/settings/lib/Settings/Admin/Overview.php index ac581cfb4c5..1744057c599 100644 --- a/apps/settings/lib/Settings/Admin/Overview.php +++ b/apps/settings/lib/Settings/Admin/Overview.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -14,7 +15,7 @@ class Overview implements IDelegatedSettings { /** @var IConfig */ private $config; - /** @var IL10N $l*/ + /** @var IL10N $l */ private $l; public function __construct(IConfig $config, IL10N $l) { @@ -42,8 +43,8 @@ class Overview implements IDelegatedSettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/settings/lib/Settings/Admin/Security.php b/apps/settings/lib/Settings/Admin/Security.php index 5e4366511eb..c17174c5c54 100644 --- a/apps/settings/lib/Settings/Admin/Security.php +++ b/apps/settings/lib/Settings/Admin/Security.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -67,8 +68,8 @@ class Security implements ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/settings/lib/Settings/Admin/Server.php b/apps/settings/lib/Settings/Admin/Server.php index d96228e6ec6..2cd205d9577 100644 --- a/apps/settings/lib/Settings/Admin/Server.php +++ b/apps/settings/lib/Settings/Admin/Server.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -85,8 +86,8 @@ class Server implements IDelegatedSettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/settings/lib/Settings/Admin/Sharing.php b/apps/settings/lib/Settings/Admin/Sharing.php index a5a5d020075..b43ba479359 100644 --- a/apps/settings/lib/Settings/Admin/Sharing.php +++ b/apps/settings/lib/Settings/Admin/Sharing.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -64,7 +65,7 @@ class Sharing implements IDelegatedSettings { 'excludeGroupsList' => json_decode($excludedGroups, true) ?? [], 'publicShareDisclaimerText' => $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null), 'enableLinkPasswordByDefault' => $this->getHumanBooleanConfig('core', 'shareapi_enable_link_password_by_default'), - 'defaultPermissions' => (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL), + 'defaultPermissions' => (int) $this->config->getAppValue('core', 'shareapi_default_permissions', (string) Constants::PERMISSION_ALL), 'defaultInternalExpireDate' => $this->getHumanBooleanConfig('core', 'shareapi_default_internal_expire_date'), 'internalExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'), 'enforceInternalExpireDate' => $this->getHumanBooleanConfig('core', 'shareapi_enforce_internal_expire_date'), @@ -97,8 +98,8 @@ class Sharing implements IDelegatedSettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/settings/lib/Settings/Admin/Users.php b/apps/settings/lib/Settings/Admin/Users.php index 3af018e0cf1..c569890a0dc 100644 --- a/apps/settings/lib/Settings/Admin/Users.php +++ b/apps/settings/lib/Settings/Admin/Users.php @@ -42,8 +42,8 @@ class Users implements IDelegatedSettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/settings/lib/Settings/Personal/Additional.php b/apps/settings/lib/Settings/Personal/Additional.php index 96de4f20c51..58fe08a63b7 100644 --- a/apps/settings/lib/Settings/Personal/Additional.php +++ b/apps/settings/lib/Settings/Personal/Additional.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -28,8 +29,8 @@ class Additional implements ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 * @since 9.1 diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index 9610ef173fc..dc70bd38ff3 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -198,8 +198,8 @@ class PersonalInfo implements ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 * @since 9.1 @@ -251,7 +251,7 @@ class PersonalInfo implements ISettings { $emailMap = [ 'primaryEmail' => $systemEmail, 'additionalEmails' => $additionalEmails, - 'notificationEmail' => (string)$account->getUser()->getPrimaryEMailAddress(), + 'notificationEmail' => (string) $account->getUser()->getPrimaryEMailAddress(), ]; return $emailMap; diff --git a/apps/settings/lib/Settings/Personal/ServerDevNotice.php b/apps/settings/lib/Settings/Personal/ServerDevNotice.php index 702daf08494..9bf0799d1aa 100644 --- a/apps/settings/lib/Settings/Personal/ServerDevNotice.php +++ b/apps/settings/lib/Settings/Personal/ServerDevNotice.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -89,8 +90,8 @@ class ServerDevNotice implements ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php b/apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php index 4f6941e10f7..97e80c2aaa9 100644 --- a/apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php +++ b/apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php @@ -81,7 +81,7 @@ class DatabaseHasMissingIndices implements ISetupCheck { $processed++; $list .= "\n " . $this->l10n->t('"%s" in table "%s"', [$missingIndex['indexName'], $missingIndex['tableName']]); if (count($missingIndices) > $processed) { - $list .= ", "; + $list .= ', '; } } return SetupResult::warning( diff --git a/apps/settings/lib/SetupChecks/PhpMaxFileSize.php b/apps/settings/lib/SetupChecks/PhpMaxFileSize.php index d81cbe6d45c..d19e1d511b4 100644 --- a/apps/settings/lib/SetupChecks/PhpMaxFileSize.php +++ b/apps/settings/lib/SetupChecks/PhpMaxFileSize.php @@ -33,10 +33,10 @@ class PhpMaxFileSize implements ISetupCheck { } public function run(): SetupResult { - $upload_max_filesize = (string)$this->iniGetWrapper->getString('upload_max_filesize'); - $post_max_size = (string)$this->iniGetWrapper->getString('post_max_size'); - $max_input_time = (int)$this->iniGetWrapper->getString('max_input_time'); - $max_execution_time = (int)$this->iniGetWrapper->getString('max_execution_time'); + $upload_max_filesize = (string) $this->iniGetWrapper->getString('upload_max_filesize'); + $post_max_size = (string) $this->iniGetWrapper->getString('post_max_size'); + $max_input_time = (int) $this->iniGetWrapper->getString('max_input_time'); + $max_execution_time = (int) $this->iniGetWrapper->getString('max_execution_time'); $warnings = []; $recommendedSize = 16 * 1024 * 1024 * 1024; diff --git a/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php b/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php index 22605012058..3f264b379b8 100644 --- a/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php +++ b/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php @@ -46,7 +46,7 @@ class PhpOpcacheSetup implements ISetupCheck { // Check whether Nextcloud is allowed to use the OPcache API $isPermitted = true; - $permittedPath = (string)$this->iniGetWrapper->getString('opcache.restrict_api'); + $permittedPath = (string) $this->iniGetWrapper->getString('opcache.restrict_api'); if ($permittedPath !== '' && !str_starts_with(\OC::$SERVERROOT, rtrim($permittedPath, '/'))) { $isPermitted = false; } diff --git a/apps/settings/lib/SetupChecks/SecurityHeaders.php b/apps/settings/lib/SetupChecks/SecurityHeaders.php index f00e92ef496..8b7ec351b35 100644 --- a/apps/settings/lib/SetupChecks/SecurityHeaders.php +++ b/apps/settings/lib/SetupChecks/SecurityHeaders.php @@ -100,7 +100,7 @@ class SecurityHeaders implements ISetupCheck { $transportSecurityValidity = $response->getHeader('Strict-Transport-Security'); $minimumSeconds = 15552000; if (preg_match('/^max-age=(\d+)(;.*)?$/', $transportSecurityValidity, $m)) { - $transportSecurityValidity = (int)$m[1]; + $transportSecurityValidity = (int) $m[1]; if ($transportSecurityValidity < $minimumSeconds) { $msg .= $this->l10n->t('- The `Strict-Transport-Security` HTTP header is not set to at least `%d` seconds (current value: `%d`). For enhanced security, it is recommended to use a long HSTS policy.', [$minimumSeconds, $transportSecurityValidity])."\n"; } @@ -131,7 +131,7 @@ class SecurityHeaders implements ISetupCheck { // Otherwise if we fail we can abort here if ($works === false) { return SetupResult::warning( - $this->l10n->t("Could not check that your web server serves security headers correctly, unable to query `%s`", [$url]), + $this->l10n->t('Could not check that your web server serves security headers correctly, unable to query `%s`', [$url]), $this->urlGenerator->linkToDocs('admin-security'), ); } diff --git a/apps/settings/lib/WellKnown/SecurityTxtHandler.php b/apps/settings/lib/WellKnown/SecurityTxtHandler.php index b140d48efc6..60ab2d57a38 100644 --- a/apps/settings/lib/WellKnown/SecurityTxtHandler.php +++ b/apps/settings/lib/WellKnown/SecurityTxtHandler.php @@ -21,13 +21,13 @@ class SecurityTxtHandler implements IHandler { return $previousResponse; } - $response = "Contact: https://hackerone.com/nextcloud + $response = 'Contact: https://hackerone.com/nextcloud Expires: 2025-08-31T23:00:00.000Z Acknowledgments: https://hackerone.com/nextcloud/thanks Acknowledgments: https://github.com/nextcloud/security-advisories/security/advisories Policy: https://hackerone.com/nextcloud Preferred-Languages: en -"; +'; return new GenericResponse(new TextPlainResponse($response, 200)); } diff --git a/apps/settings/templates/settings/empty.php b/apps/settings/templates/settings/empty.php index f7ae4113ac6..ce4477fa9df 100644 --- a/apps/settings/templates/settings/empty.php +++ b/apps/settings/templates/settings/empty.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/tests/Activity/SecurityFilterTest.php b/apps/settings/tests/Activity/SecurityFilterTest.php index 637c717da02..20cf973a40d 100644 --- a/apps/settings/tests/Activity/SecurityFilterTest.php +++ b/apps/settings/tests/Activity/SecurityFilterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/tests/Activity/SecurityProviderTest.php b/apps/settings/tests/Activity/SecurityProviderTest.php index 9d10b1e596e..81d195a024c 100644 --- a/apps/settings/tests/Activity/SecurityProviderTest.php +++ b/apps/settings/tests/Activity/SecurityProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/tests/Activity/SecuritySettingTest.php b/apps/settings/tests/Activity/SecuritySettingTest.php index dd28d757e72..812ac6b9cb4 100644 --- a/apps/settings/tests/Activity/SecuritySettingTest.php +++ b/apps/settings/tests/Activity/SecuritySettingTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/tests/AppInfo/ApplicationTest.php b/apps/settings/tests/AppInfo/ApplicationTest.php index 60c37e42015..df51220a394 100644 --- a/apps/settings/tests/AppInfo/ApplicationTest.php +++ b/apps/settings/tests/AppInfo/ApplicationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/tests/Controller/AdminSettingsControllerTest.php b/apps/settings/tests/Controller/AdminSettingsControllerTest.php index 578348a3031..e312e15cc73 100644 --- a/apps/settings/tests/Controller/AdminSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AdminSettingsControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/tests/Controller/AppSettingsControllerTest.php b/apps/settings/tests/Controller/AppSettingsControllerTest.php index 71d263ac935..305def463dd 100644 --- a/apps/settings/tests/Controller/AppSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AppSettingsControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2015 ownCloud, Inc. diff --git a/apps/settings/tests/Controller/AuthSettingsControllerTest.php b/apps/settings/tests/Controller/AuthSettingsControllerTest.php index 4cc8be641c2..ccfab415260 100644 --- a/apps/settings/tests/Controller/AuthSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AuthSettingsControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -37,7 +38,7 @@ class AuthSettingsControllerTest extends TestCase { private $tokenProvider; /** @var ISession|MockObject */ private $session; - /**@var IUserSession|MockObject */ + /** @var IUserSession|MockObject */ private $userSession; /** @var ISecureRandom|MockObject */ private $secureRandom; diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index cb9ca57fe65..fde13cfee31 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -63,7 +63,7 @@ class CheckSetupControllerTest extends TestCase { return vsprintf($message, $replace); }); $this->checker = $this->getMockBuilder('\OC\IntegrityCheck\Checker') - ->disableOriginalConstructor()->getMock(); + ->disableOriginalConstructor()->getMock(); $this->logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); $this->setupCheckManager = $this->createMock(ISetupCheckManager::class); $this->checkSetupController = $this->getMockBuilder(CheckSetupController::class) @@ -193,9 +193,9 @@ class CheckSetupControllerTest extends TestCase { ->method('isCodeCheckEnforced') ->willReturn(true); $this->checker - ->expects($this->once()) - ->method('getResults') - ->willReturn([ 'core' => [ 'EXTRA_FILE' => ['/testfile' => []], 'INVALID_HASH' => [ '/.idea/workspace.xml' => [ 'expected' => 'f1c5e2630d784bc9cb02d5a28f55d6f24d06dae2a0fee685f3c2521b050955d9d452769f61454c9ddfa9c308146ade10546cfa829794448eaffbc9a04a29d216', 'current' => 'ce08bf30bcbb879a18b49239a9bec6b8702f52452f88a9d32142cad8d2494d5735e6bfa0d8642b2762c62ca5be49f9bf4ec231d4a230559d4f3e2c471d3ea094', ], '/lib/private/integritycheck/checker.php' => [ 'expected' => 'c5a03bacae8dedf8b239997901ba1fffd2fe51271d13a00cc4b34b09cca5176397a89fc27381cbb1f72855fa18b69b6f87d7d5685c3b45aee373b09be54742ea', 'current' => '88a3a92c11db91dec1ac3be0e1c87f862c95ba6ffaaaa3f2c3b8f682187c66f07af3a3b557a868342ef4a271218fe1c1e300c478e6c156c5955ed53c40d06585', ], '/settings/controller/checksetupcontroller.php' => [ 'expected' => '3e1de26ce93c7bfe0ede7c19cb6c93cadc010340225b375607a7178812e9de163179b0dc33809f451e01f491d93f6f5aaca7929685d21594cccf8bda732327c4', 'current' => '09563164f9904a837f9ca0b5f626db56c838e5098e0ccc1d8b935f68fa03a25c5ec6f6b2d9e44a868e8b85764dafd1605522b4af8db0ae269d73432e9a01e63a', ], ], ], 'bookmarks' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'dav' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'encryption' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'external' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'federation' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_antivirus' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_drop' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_external' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_pdfviewer' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_sharing' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_trashbin' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_versions' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_videoviewer' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'firstrunwizard' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'gitsmart' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'logreader' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature could not get verified.', ], ], 'password_policy' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'provisioning_api' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'sketch' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'threatblock' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'two_factor_auth' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'user_ldap' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'user_shibboleth' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], ]); + ->expects($this->once()) + ->method('getResults') + ->willReturn([ 'core' => [ 'EXTRA_FILE' => ['/testfile' => []], 'INVALID_HASH' => [ '/.idea/workspace.xml' => [ 'expected' => 'f1c5e2630d784bc9cb02d5a28f55d6f24d06dae2a0fee685f3c2521b050955d9d452769f61454c9ddfa9c308146ade10546cfa829794448eaffbc9a04a29d216', 'current' => 'ce08bf30bcbb879a18b49239a9bec6b8702f52452f88a9d32142cad8d2494d5735e6bfa0d8642b2762c62ca5be49f9bf4ec231d4a230559d4f3e2c471d3ea094', ], '/lib/private/integritycheck/checker.php' => [ 'expected' => 'c5a03bacae8dedf8b239997901ba1fffd2fe51271d13a00cc4b34b09cca5176397a89fc27381cbb1f72855fa18b69b6f87d7d5685c3b45aee373b09be54742ea', 'current' => '88a3a92c11db91dec1ac3be0e1c87f862c95ba6ffaaaa3f2c3b8f682187c66f07af3a3b557a868342ef4a271218fe1c1e300c478e6c156c5955ed53c40d06585', ], '/settings/controller/checksetupcontroller.php' => [ 'expected' => '3e1de26ce93c7bfe0ede7c19cb6c93cadc010340225b375607a7178812e9de163179b0dc33809f451e01f491d93f6f5aaca7929685d21594cccf8bda732327c4', 'current' => '09563164f9904a837f9ca0b5f626db56c838e5098e0ccc1d8b935f68fa03a25c5ec6f6b2d9e44a868e8b85764dafd1605522b4af8db0ae269d73432e9a01e63a', ], ], ], 'bookmarks' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'dav' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'encryption' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'external' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'federation' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_antivirus' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_drop' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_external' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_pdfviewer' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_sharing' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_trashbin' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_versions' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'files_videoviewer' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'firstrunwizard' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'gitsmart' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'logreader' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature could not get verified.', ], ], 'password_policy' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'provisioning_api' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'sketch' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'threatblock' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'two_factor_auth' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'user_ldap' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], 'user_shibboleth' => [ 'EXCEPTION' => [ 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ], ], ]); $expected = new DataDisplayResponse( 'Technical information diff --git a/apps/settings/tests/Controller/MailSettingsControllerTest.php b/apps/settings/tests/Controller/MailSettingsControllerTest.php index 52642884d23..2fbf9953f7c 100644 --- a/apps/settings/tests/Controller/MailSettingsControllerTest.php +++ b/apps/settings/tests/Controller/MailSettingsControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php b/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php index 91b532b05f8..40408f8ec7f 100644 --- a/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php +++ b/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php index d27b06007e3..935d5833253 100644 --- a/apps/settings/tests/Controller/UsersControllerTest.php +++ b/apps/settings/tests/Controller/UsersControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2014-2015 ownCloud, Inc. @@ -58,19 +59,19 @@ class UsersControllerTest extends \Test\TestCase { private $l; /** @var AccountManager|\PHPUnit\Framework\MockObject\MockObject */ private $accountManager; - /** @var IJobList | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IJobList | \PHPUnit\Framework\MockObject\MockObject */ private $jobList; - /** @var \OC\Security\IdentityProof\Manager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var \OC\Security\IdentityProof\Manager|\PHPUnit\Framework\MockObject\MockObject */ private $securityManager; - /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ private $encryptionManager; /** @var KnownUserService|\PHPUnit\Framework\MockObject\MockObject */ private $knownUserService; - /** @var IEncryptionModule|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IEncryptionModule|\PHPUnit\Framework\MockObject\MockObject */ private $encryptionModule; /** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */ private $dispatcher; - /** @var IInitialState|\PHPUnit\Framework\MockObject\MockObject*/ + /** @var IInitialState|\PHPUnit\Framework\MockObject\MockObject */ private $initialState; protected function setUp(): void { @@ -563,7 +564,7 @@ class UsersControllerTest extends \Test\TestCase { if (!empty($email)) { $this->mailer->expects($this->once())->method('validateMailAddress') - ->willReturn(true); + ->willReturn(true); } $controller->expects($this->once()) diff --git a/apps/settings/tests/Mailer/NewUserMailHelperTest.php b/apps/settings/tests/Mailer/NewUserMailHelperTest.php index 2f9f7bcba7b..ccda4611fbd 100644 --- a/apps/settings/tests/Mailer/NewUserMailHelperTest.php +++ b/apps/settings/tests/Mailer/NewUserMailHelperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php index 1a832c528bf..dd0f2906188 100644 --- a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php +++ b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2014 ownCloud, Inc. diff --git a/apps/settings/tests/Settings/Admin/MailTest.php b/apps/settings/tests/Settings/Admin/MailTest.php index 87e561ba457..82e7488dc39 100644 --- a/apps/settings/tests/Settings/Admin/MailTest.php +++ b/apps/settings/tests/Settings/Admin/MailTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/tests/Settings/Admin/SecurityTest.php b/apps/settings/tests/Settings/Admin/SecurityTest.php index 4af8ad496ce..2313015d8cb 100644 --- a/apps/settings/tests/Settings/Admin/SecurityTest.php +++ b/apps/settings/tests/Settings/Admin/SecurityTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php index af76b738696..94c58ea67c7 100644 --- a/apps/settings/tests/Settings/Admin/SharingTest.php +++ b/apps/settings/tests/Settings/Admin/SharingTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -22,13 +23,13 @@ class SharingTest extends TestCase { private $admin; /** @var IConfig */ private $config; - /** @var IL10N|MockObject */ + /** @var IL10N|MockObject */ private $l10n; - /** @var IManager|MockObject */ + /** @var IManager|MockObject */ private $shareManager; /** @var IAppManager|MockObject */ private $appManager; - /** @var IURLGenerator|MockObject */ + /** @var IURLGenerator|MockObject */ private $urlGenerator; /** @var IInitialState|MockObject */ private $initialState; @@ -56,7 +57,7 @@ class SharingTest extends TestCase { $this->appManager, $this->urlGenerator, $this->initialState, - "settings", + 'settings', ); } @@ -84,7 +85,7 @@ class SharingTest extends TestCase { ['core', 'shareapi_exclude_groups', 'no', 'no'], ['core', 'shareapi_public_link_disclaimertext', null, 'Lorem ipsum'], ['core', 'shareapi_enable_link_password_by_default', 'no', 'yes'], - ['core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL, Constants::PERMISSION_ALL], + ['core', 'shareapi_default_permissions', (string) Constants::PERMISSION_ALL, Constants::PERMISSION_ALL], ['core', 'shareapi_default_internal_expire_date', 'no', 'no'], ['core', 'shareapi_internal_expire_after_n_days', '7', '7'], ['core', 'shareapi_enforce_internal_expire_date', 'no', 'no'], @@ -177,7 +178,7 @@ class SharingTest extends TestCase { ['core', 'shareapi_exclude_groups', 'no', 'yes'], ['core', 'shareapi_public_link_disclaimertext', null, 'Lorem ipsum'], ['core', 'shareapi_enable_link_password_by_default', 'no', 'yes'], - ['core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL, Constants::PERMISSION_ALL], + ['core', 'shareapi_default_permissions', (string) Constants::PERMISSION_ALL, Constants::PERMISSION_ALL], ['core', 'shareapi_default_internal_expire_date', 'no', 'no'], ['core', 'shareapi_internal_expire_after_n_days', '7', '7'], ['core', 'shareapi_enforce_internal_expire_date', 'no', 'no'], diff --git a/apps/sharebymail/lib/Activity.php b/apps/sharebymail/lib/Activity.php index bee75c48264..1c823136fec 100644 --- a/apps/sharebymail/lib/Activity.php +++ b/apps/sharebymail/lib/Activity.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/sharebymail/lib/Settings/Admin.php b/apps/sharebymail/lib/Settings/Admin.php index b39eced3c86..61e71377efa 100644 --- a/apps/sharebymail/lib/Settings/Admin.php +++ b/apps/sharebymail/lib/Settings/Admin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -40,8 +41,8 @@ class Admin implements IDelegatedSettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index 89ab40b0e85..5f7a78059b3 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -127,7 +128,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider if ($initiatorEMailAddress === null && !$allowPasswordByMail) { throw new \Exception( - $this->l->t("We cannot send you the auto-generated password. Please set a valid email address in your personal settings and try again.") + $this->l->t('We cannot send you the auto-generated password. Please set a valid email address in your personal settings and try again.') ); } @@ -247,7 +248,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider }); if (count($validEmails) === 0) { - $this->removeShareFromTable((int)$shareId); + $this->removeShareFromTable((int) $shareId); $e = new HintException('Failed to send share by mail. Could not find a valid email address: ' . join(', ', $emails), $this->l->t('Failed to send share by email. Got an invalid email address')); $this->logger->error('Failed to send share by mail. Could not find a valid email address ' . join(', ', $emails), [ @@ -282,14 +283,14 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider 'app' => 'sharebymail', 'exception' => $hintException, ]); - $this->removeShareFromTable((int)$shareId); + $this->removeShareFromTable((int) $shareId); throw $hintException; } catch (\Exception $e) { $this->logger->error('Failed to send share by mail.', [ 'app' => 'sharebymail', 'exception' => $e, ]); - $this->removeShareFromTable((int)$shareId); + $this->removeShareFromTable((int) $shareId); throw new HintException( 'Failed to send share by mail', $this->l->t('Failed to send share by email'), @@ -342,7 +343,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider } if ($expiration !== null) { - $dateString = (string)$this->l->l('date', $expiration, ['width' => 'medium']); + $dateString = (string) $this->l->l('date', $expiration, ['width' => 'medium']); $emailTemplate->addBodyListItem( $this->l->t('This share is valid until %s at midnight', [$dateString]), $this->l->t('Expiration:'), @@ -569,7 +570,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider if ($initiatorEMailAddress === null) { throw new \Exception( - $this->l->t("We cannot send you the auto-generated password. Please set a valid email address in your personal settings and try again.") + $this->l->t('We cannot send you the auto-generated password. Please set a valid email address in your personal settings and try again.') ); } @@ -694,10 +695,10 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider ->setValue('password_expiration_time', $qb->createNamedParameter($passwordExpirationTime, IQueryBuilder::PARAM_DATE)) ->setValue('password_by_talk', $qb->createNamedParameter($sendPasswordByTalk, IQueryBuilder::PARAM_BOOL)) ->setValue('stime', $qb->createNamedParameter(time())) - ->setValue('hide_download', $qb->createNamedParameter((int)$hideDownload, IQueryBuilder::PARAM_INT)) + ->setValue('hide_download', $qb->createNamedParameter((int) $hideDownload, IQueryBuilder::PARAM_INT)) ->setValue('label', $qb->createNamedParameter($label)) ->setValue('note', $qb->createNamedParameter($note)) - ->setValue('mail_send', $qb->createNamedParameter((int)$mailSend, IQueryBuilder::PARAM_INT)); + ->setValue('mail_send', $qb->createNamedParameter((int) $mailSend, IQueryBuilder::PARAM_INT)); // set share attributes $shareAttributes = $this->formatShareAttributes($attributes); @@ -749,9 +750,9 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider ->set('password_by_talk', $qb->createNamedParameter($share->getSendPasswordByTalk(), IQueryBuilder::PARAM_BOOL)) ->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE)) ->set('note', $qb->createNamedParameter($share->getNote())) - ->set('hide_download', $qb->createNamedParameter((int)$share->getHideDownload(), IQueryBuilder::PARAM_INT)) + ->set('hide_download', $qb->createNamedParameter((int) $share->getHideDownload(), IQueryBuilder::PARAM_INT)) ->set('attributes', $qb->createNamedParameter($shareAttributes)) - ->set('mail_send', $qb->createNamedParameter((int)$share->getMailSend(), IQueryBuilder::PARAM_INT)) + ->set('mail_send', $qb->createNamedParameter((int) $share->getMailSend(), IQueryBuilder::PARAM_INT)) ->executeStatement(); if ($originalShare->getNote() !== $share->getNote() && $share->getNote() !== '') { @@ -782,7 +783,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider } catch (\Exception $e) { } - $this->removeShareFromTable((int)$share->getId()); + $this->removeShareFromTable((int) $share->getId()); } /** @@ -990,24 +991,24 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider */ protected function createShareObject(array $data): IShare { $share = new Share($this->rootFolder, $this->userManager); - $share->setId((int)$data['id']) - ->setShareType((int)$data['share_type']) - ->setPermissions((int)$data['permissions']) + $share->setId((int) $data['id']) + ->setShareType((int) $data['share_type']) + ->setPermissions((int) $data['permissions']) ->setTarget($data['file_target']) - ->setMailSend((bool)$data['mail_send']) + ->setMailSend((bool) $data['mail_send']) ->setNote($data['note']) ->setToken($data['token']); $shareTime = new \DateTime(); - $shareTime->setTimestamp((int)$data['stime']); + $shareTime->setTimestamp((int) $data['stime']); $share->setShareTime($shareTime); $share->setSharedWith($data['share_with'] ?? ''); $share->setPassword($data['password']); $passwordExpirationTime = \DateTime::createFromFormat('Y-m-d H:i:s', $data['password_expiration_time'] ?? ''); $share->setPasswordExpirationTime($passwordExpirationTime !== false ? $passwordExpirationTime : null); $share->setLabel($data['label'] ?? ''); - $share->setSendPasswordByTalk((bool)$data['password_by_talk']); - $share->setHideDownload((bool)$data['hide_download']); + $share->setSendPasswordByTalk((bool) $data['password_by_talk']); + $share->setHideDownload((bool) $data['hide_download']); if ($data['uid_initiator'] !== null) { $share->setShareOwner($data['uid_owner']); @@ -1015,7 +1016,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider } else { //OLD SHARE $share->setSharedBy($data['uid_owner']); - $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); + $path = $this->getNode($share->getSharedBy(), (int) $data['file_source']); $owner = $path->getOwner(); $share->setShareOwner($owner->getUID()); @@ -1030,7 +1031,7 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider $share = $this->updateShareAttributes($share, $data['attributes']); - $share->setNodeId((int)$data['file_source']); + $share->setNodeId((int) $data['file_source']); $share->setNodeType($data['item_type']); $share->setProviderId($this->identifier()); diff --git a/apps/sharebymail/tests/CapabilitiesTest.php b/apps/sharebymail/tests/CapabilitiesTest.php index 3d8aca1a537..3ffc029883d 100644 --- a/apps/sharebymail/tests/CapabilitiesTest.php +++ b/apps/sharebymail/tests/CapabilitiesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php index 18ca9574d6f..d355e517ea1 100644 --- a/apps/sharebymail/tests/ShareByMailProviderTest.php +++ b/apps/sharebymail/tests/ShareByMailProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -41,46 +42,46 @@ class ShareByMailProviderTest extends TestCase { /** @var IConfig */ private $config; - /** @var IDBConnection */ + /** @var IDBConnection */ private $connection; - /** @var IManager | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IManager | \PHPUnit\Framework\MockObject\MockObject */ private $shareManager; - /** @var IL10N | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IL10N | \PHPUnit\Framework\MockObject\MockObject */ private $l; - /** @var LoggerInterface | \PHPUnit\Framework\MockObject\MockObject */ + /** @var LoggerInterface | \PHPUnit\Framework\MockObject\MockObject */ private $logger; - /** @var IRootFolder | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IRootFolder | \PHPUnit\Framework\MockObject\MockObject */ private $rootFolder; - /** @var IUserManager | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IUserManager | \PHPUnit\Framework\MockObject\MockObject */ private $userManager; - /** @var ISecureRandom | \PHPUnit\Framework\MockObject\MockObject */ + /** @var ISecureRandom | \PHPUnit\Framework\MockObject\MockObject */ private $secureRandom; - /** @var IMailer | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IMailer | \PHPUnit\Framework\MockObject\MockObject */ private $mailer; - /** @var IURLGenerator | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IURLGenerator | \PHPUnit\Framework\MockObject\MockObject */ private $urlGenerator; - /** @var IShare | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IShare | \PHPUnit\Framework\MockObject\MockObject */ private $share; - /** @var \OCP\Activity\IManager | \PHPUnit\Framework\MockObject\MockObject */ + /** @var \OCP\Activity\IManager | \PHPUnit\Framework\MockObject\MockObject */ private $activityManager; - /** @var SettingsManager | \PHPUnit\Framework\MockObject\MockObject */ + /** @var SettingsManager | \PHPUnit\Framework\MockObject\MockObject */ private $settingsManager; /** @var Defaults|\PHPUnit\Framework\MockObject\MockObject */ private $defaults; - /** @var IHasher | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IHasher | \PHPUnit\Framework\MockObject\MockObject */ private $hasher; /** @var IEventDispatcher */ @@ -738,17 +739,17 @@ class ShareByMailProviderTest extends TestCase { $this->assertSame(1, count($result)); - $this->assertSame($itemSource, (int)$result[0]['item_source']); + $this->assertSame($itemSource, (int) $result[0]['item_source']); $this->assertSame($itemType, $result[0]['item_type']); $this->assertSame($shareWith, $result[0]['share_with']); $this->assertSame($sharedBy, $result[0]['uid_initiator']); $this->assertSame($uidOwner, $result[0]['uid_owner']); - $this->assertSame($permissions, (int)$result[0]['permissions']); + $this->assertSame($permissions, (int) $result[0]['permissions']); $this->assertSame($token, $result[0]['token']); $this->assertSame($password, $result[0]['password']); $this->assertSame($passwordExpirationTime->getTimestamp(), \DateTime::createFromFormat('Y-m-d H:i:s', $result[0]['password_expiration_time'])->getTimestamp()); - $this->assertSame($sendPasswordByTalk, (bool)$result[0]['password_by_talk']); - $this->assertSame($hideDownload, (bool)$result[0]['hide_download']); + $this->assertSame($sendPasswordByTalk, (bool) $result[0]['password_by_talk']); + $this->assertSame($hideDownload, (bool) $result[0]['hide_download']); $this->assertSame($label, $result[0]['label']); $this->assertSame($expiration->getTimestamp(), \DateTime::createFromFormat('Y-m-d H:i:s', $result[0]['expiration'])->getTimestamp()); } @@ -791,12 +792,12 @@ class ShareByMailProviderTest extends TestCase { $this->assertSame(1, count($result)); - $this->assertSame($itemSource, (int)$result[0]['item_source']); + $this->assertSame($itemSource, (int) $result[0]['item_source']); $this->assertSame($itemType, $result[0]['item_type']); $this->assertSame($shareWith, $result[0]['share_with']); $this->assertSame($sharedBy, $result[0]['uid_initiator']); $this->assertSame($uidOwner, $result[0]['uid_owner']); - $this->assertSame($permissions + 1, (int)$result[0]['permissions']); + $this->assertSame($permissions + 1, (int) $result[0]['permissions']); $this->assertSame($token, $result[0]['token']); $this->assertSame($note, $result[0]['note']); } @@ -883,7 +884,7 @@ class ShareByMailProviderTest extends TestCase { $permissions = 1; $token = 'token'; - $this->createDummyShare($itemType, $itemSource, $shareWith, "user1wrong", "user2wrong", $permissions, $token); + $this->createDummyShare($itemType, $itemSource, $shareWith, 'user1wrong', 'user2wrong', $permissions, $token); $id2 = $this->createDummyShare($itemType, $itemSource, $shareWith, $sharedBy, $uidOwner, $permissions, $token); $instance->expects($this->once())->method('createShareObject') @@ -891,7 +892,7 @@ class ShareByMailProviderTest extends TestCase { function ($data) use ($uidOwner, $sharedBy, $id2) { $this->assertSame($uidOwner, $data['uid_owner']); $this->assertSame($sharedBy, $data['uid_initiator']); - $this->assertSame($id2, (int)$data['id']); + $this->assertSame($id2, (int) $data['id']); return $this->share; } ); @@ -943,7 +944,7 @@ class ShareByMailProviderTest extends TestCase { function ($data) use ($uidOwner, $sharedBy, $id) { $this->assertSame($uidOwner, $data['uid_owner']); $this->assertSame($sharedBy, $data['uid_initiator']); - $this->assertSame($id, (int)$data['id']); + $this->assertSame($id, (int) $data['id']); return $this->share; } ); @@ -974,7 +975,7 @@ class ShareByMailProviderTest extends TestCase { $instance->expects($this->once())->method('createShareObject') ->willReturnCallback( function ($data) use ($idMail) { - $this->assertSame($idMail, (int)$data['id']); + $this->assertSame($idMail, (int) $data['id']); return $this->share; } ); @@ -1000,7 +1001,7 @@ class ShareByMailProviderTest extends TestCase { $instance = $this->getInstance(['createShareObject']); $idMail = $this->createDummyShare($itemType, $itemSource, $shareWith, $sharedBy, $uidOwner, $permissions, $token); - $idPublic = $this->createDummyShare($itemType, $itemSource, $shareWith, $sharedBy, $uidOwner, $permissions, "token2", '', IShare::TYPE_LINK); + $idPublic = $this->createDummyShare($itemType, $itemSource, $shareWith, $sharedBy, $uidOwner, $permissions, 'token2', '', IShare::TYPE_LINK); $this->assertTrue($idMail !== $idPublic); @@ -1083,7 +1084,7 @@ class ShareByMailProviderTest extends TestCase { $this->assertTrue(is_array($after)); $this->assertSame(1, count($after)); - $this->assertSame($id, (int)$after[0]['id']); + $this->assertSame($id, (int) $after[0]['id']); } public function testGetRawShare() { @@ -1102,12 +1103,12 @@ class ShareByMailProviderTest extends TestCase { $result = $this->invokePrivate($instance, 'getRawShare', [$id]); $this->assertTrue(is_array($result)); - $this->assertSame($itemSource, (int)$result['item_source']); + $this->assertSame($itemSource, (int) $result['item_source']); $this->assertSame($itemType, $result['item_type']); $this->assertSame($shareWith, $result['share_with']); $this->assertSame($sharedBy, $result['uid_initiator']); $this->assertSame($uidOwner, $result['uid_owner']); - $this->assertSame($permissions, (int)$result['permissions']); + $this->assertSame($permissions, (int) $result['permissions']); $this->assertSame($token, $result['token']); } @@ -1154,7 +1155,7 @@ class ShareByMailProviderTest extends TestCase { $qb->execute(); $id = $qb->getLastInsertId(); - return (int)$id; + return (int) $id; } public function testGetSharesInFolder() { diff --git a/apps/systemtags/appinfo/routes.php b/apps/systemtags/appinfo/routes.php index d61a35ef630..53997646cc6 100644 --- a/apps/systemtags/appinfo/routes.php +++ b/apps/systemtags/appinfo/routes.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/systemtags/lib/Activity/Listener.php b/apps/systemtags/lib/Activity/Listener.php index c2e39fa9f70..e514f736942 100644 --- a/apps/systemtags/lib/Activity/Listener.php +++ b/apps/systemtags/lib/Activity/Listener.php @@ -93,7 +93,7 @@ class Listener { $activity->setApp('systemtags') ->setType('systemtags') ->setAuthor($actor) - ->setObject('systemtag', (int)$tag->getId(), $tag->getName()); + ->setObject('systemtag', (int) $tag->getId(), $tag->getName()); if ($event->getEvent() === ManagerEvent::EVENT_CREATE) { $activity->setSubject(Provider::CREATE_TAG, [ $actor, @@ -185,7 +185,7 @@ class Listener { ->setObject($event->getObjectType(), (int) $event->getObjectId()); foreach ($users as $user => $path) { - $user = (string)$user; // numerical ids could be ints which are not accepted everywhere + $user = (string) $user; // numerical ids could be ints which are not accepted everywhere $activity->setAffectedUser($user); foreach ($tags as $tag) { diff --git a/apps/systemtags/lib/Activity/Provider.php b/apps/systemtags/lib/Activity/Provider.php index ab8e326d8d9..125257eb3ac 100644 --- a/apps/systemtags/lib/Activity/Provider.php +++ b/apps/systemtags/lib/Activity/Provider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -285,7 +286,7 @@ class Provider implements IProvider { protected function getFileParameter($id, $path) { return [ 'type' => 'file', - 'id' => (string)$id, + 'id' => (string) $id, 'name' => basename($path), 'path' => trim($path, '/'), ]; @@ -305,7 +306,7 @@ class Provider implements IProvider { return [ 'type' => 'systemtag', - 'id' => (string)$tagData['id'], + 'id' => (string) $tagData['id'], 'name' => $tagData['name'], 'assignable' => $tagData['assignable'] ? '1' : '0', 'visibility' => $tagData['visible'] ? '1' : '0', diff --git a/apps/systemtags/lib/Activity/Setting.php b/apps/systemtags/lib/Activity/Setting.php index 5f03d348235..e08d33b3f97 100644 --- a/apps/systemtags/lib/Activity/Setting.php +++ b/apps/systemtags/lib/Activity/Setting.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -46,8 +47,8 @@ class Setting extends ActivitySettings { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority() { diff --git a/apps/systemtags/lib/Controller/LastUsedController.php b/apps/systemtags/lib/Controller/LastUsedController.php index 0dff3fa68de..a2ef72e9e71 100644 --- a/apps/systemtags/lib/Controller/LastUsedController.php +++ b/apps/systemtags/lib/Controller/LastUsedController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/systemtags/lib/Search/TagSearchProvider.php b/apps/systemtags/lib/Search/TagSearchProvider.php index 80f9d39c141..7ad8e430440 100644 --- a/apps/systemtags/lib/Search/TagSearchProvider.php +++ b/apps/systemtags/lib/Search/TagSearchProvider.php @@ -99,7 +99,7 @@ class TagSearchProvider implements IProvider { $fileQuery = new SearchQuery( new SearchComparison(ISearchComparison::COMPARE_LIKE, 'systemtag', '%' . $query->getTerm() . '%'), $query->getLimit(), - (int)$query->getCursor(), + (int) $query->getCursor(), $query->getSortOrder() === ISearchQuery::SORT_DATE_DESC ? [ new SearchOrder(ISearchOrder::DIRECTION_DESCENDING, 'mtime'), ] : [], @@ -151,7 +151,7 @@ class TagSearchProvider implements IProvider { $this->urlGenerator->getAbsoluteURL($link), $result->getMimetype() === FileInfo::MIMETYPE_FOLDER ? 'icon-folder' : $this->mimeTypeDetector->mimeTypeIcon($result->getMimetype()) ); - $searchResultEntry->addAttribute('fileId', (string)$result->getId()); + $searchResultEntry->addAttribute('fileId', (string) $result->getId()); $searchResultEntry->addAttribute('path', $path); return $searchResultEntry; }, $searchResults) diff --git a/apps/systemtags/lib/Settings/Admin.php b/apps/systemtags/lib/Settings/Admin.php index 641c6c96626..2e5cf005688 100644 --- a/apps/systemtags/lib/Settings/Admin.php +++ b/apps/systemtags/lib/Settings/Admin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -27,8 +28,8 @@ class Admin implements ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/systemtags/tests/Activity/SettingTest.php b/apps/systemtags/tests/Activity/SettingTest.php index 91aef57aeef..7c703e66f59 100644 --- a/apps/systemtags/tests/Activity/SettingTest.php +++ b/apps/systemtags/tests/Activity/SettingTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/systemtags/tests/Settings/AdminTest.php b/apps/systemtags/tests/Settings/AdminTest.php index b18019484ef..d31d11a38c0 100644 --- a/apps/systemtags/tests/Settings/AdminTest.php +++ b/apps/systemtags/tests/Settings/AdminTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/testing/clean_opcode_cache.php b/apps/testing/clean_opcode_cache.php index d87388a05fd..acfeece7e15 100644 --- a/apps/testing/clean_opcode_cache.php +++ b/apps/testing/clean_opcode_cache.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/testing/lib/AlternativeHomeUserBackend.php b/apps/testing/lib/AlternativeHomeUserBackend.php index 38ceb404208..6123288f5c1 100644 --- a/apps/testing/lib/AlternativeHomeUserBackend.php +++ b/apps/testing/lib/AlternativeHomeUserBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud GmbH. * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/testing/lib/AppInfo/Application.php b/apps/testing/lib/AppInfo/Application.php index 3502b78402e..6cd45b85b65 100644 --- a/apps/testing/lib/AppInfo/Application.php +++ b/apps/testing/lib/AppInfo/Application.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud GmbH diff --git a/apps/testing/lib/Controller/ConfigController.php b/apps/testing/lib/Controller/ConfigController.php index 7cd27b7ab58..acd0c46caed 100644 --- a/apps/testing/lib/Controller/ConfigController.php +++ b/apps/testing/lib/Controller/ConfigController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/testing/lib/Controller/LockingController.php b/apps/testing/lib/Controller/LockingController.php index 14135a4929d..cb226853882 100644 --- a/apps/testing/lib/Controller/LockingController.php +++ b/apps/testing/lib/Controller/LockingController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -109,7 +110,7 @@ class LockingController extends OCSController { try { $lockingProvider->acquireLock($path, $type); - $this->config->setAppValue('testing', 'locking_' . $path, (string)$type); + $this->config->setAppValue('testing', 'locking_' . $path, (string) $type); return new DataResponse(); } catch (LockedException $e) { throw new OCSException('', Http::STATUS_LOCKED, $e); @@ -132,7 +133,7 @@ class LockingController extends OCSController { try { $lockingProvider->changeLock($path, $type); - $this->config->setAppValue('testing', 'locking_' . $path, (string)$type); + $this->config->setAppValue('testing', 'locking_' . $path, (string) $type); return new DataResponse(); } catch (LockedException $e) { throw new OCSException('', Http::STATUS_LOCKED, $e); @@ -190,12 +191,12 @@ class LockingController extends OCSController { if (strpos($lock, 'locking_') === 0) { $path = substr($lock, strlen('locking_')); - if ($type === ILockingProvider::LOCK_EXCLUSIVE && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_EXCLUSIVE) { - $lockingProvider->releaseLock($path, (int)$this->config->getAppValue('testing', $lock)); - } elseif ($type === ILockingProvider::LOCK_SHARED && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_SHARED) { - $lockingProvider->releaseLock($path, (int)$this->config->getAppValue('testing', $lock)); + if ($type === ILockingProvider::LOCK_EXCLUSIVE && (int) $this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_EXCLUSIVE) { + $lockingProvider->releaseLock($path, (int) $this->config->getAppValue('testing', $lock)); + } elseif ($type === ILockingProvider::LOCK_SHARED && (int) $this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_SHARED) { + $lockingProvider->releaseLock($path, (int) $this->config->getAppValue('testing', $lock)); } else { - $lockingProvider->releaseLock($path, (int)$this->config->getAppValue('testing', $lock)); + $lockingProvider->releaseLock($path, (int) $this->config->getAppValue('testing', $lock)); } } } diff --git a/apps/testing/lib/Controller/RateLimitTestController.php b/apps/testing/lib/Controller/RateLimitTestController.php index b1df0d1d7b5..d3700b69858 100644 --- a/apps/testing/lib/Controller/RateLimitTestController.php +++ b/apps/testing/lib/Controller/RateLimitTestController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/testing/lib/Locking/FakeDBLockingProvider.php b/apps/testing/lib/Locking/FakeDBLockingProvider.php index 2c4d394fb0d..3d985528e99 100644 --- a/apps/testing/lib/Locking/FakeDBLockingProvider.php +++ b/apps/testing/lib/Locking/FakeDBLockingProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/testing/lib/Provider/FakeText2ImageProvider.php b/apps/testing/lib/Provider/FakeText2ImageProvider.php index 8e7ceca02f1..6b607f23347 100644 --- a/apps/testing/lib/Provider/FakeText2ImageProvider.php +++ b/apps/testing/lib/Provider/FakeText2ImageProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/testing/lib/Provider/FakeTextProcessingProvider.php b/apps/testing/lib/Provider/FakeTextProcessingProvider.php index ffa7d16ef24..d3b16c55c67 100644 --- a/apps/testing/lib/Provider/FakeTextProcessingProvider.php +++ b/apps/testing/lib/Provider/FakeTextProcessingProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/testing/lib/Provider/FakeTextProcessingProviderSync.php b/apps/testing/lib/Provider/FakeTextProcessingProviderSync.php index 55c0cfef3bf..ea822199109 100644 --- a/apps/testing/lib/Provider/FakeTextProcessingProviderSync.php +++ b/apps/testing/lib/Provider/FakeTextProcessingProviderSync.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/testing/lib/Provider/FakeTranslationProvider.php b/apps/testing/lib/Provider/FakeTranslationProvider.php index 91d82272231..cc2d13db646 100644 --- a/apps/testing/lib/Provider/FakeTranslationProvider.php +++ b/apps/testing/lib/Provider/FakeTranslationProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/testing/lib/TaskProcessing/FakeContextWriteProvider.php b/apps/testing/lib/TaskProcessing/FakeContextWriteProvider.php index 41797f87d8b..9a5574f5147 100644 --- a/apps/testing/lib/TaskProcessing/FakeContextWriteProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeContextWriteProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/testing/lib/TaskProcessing/FakeTextToImageProvider.php b/apps/testing/lib/TaskProcessing/FakeTextToImageProvider.php index cd508be9155..455d6c0b518 100644 --- a/apps/testing/lib/TaskProcessing/FakeTextToImageProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeTextToImageProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php b/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php index 6afa2539f10..5012823024e 100644 --- a/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/testing/lib/TaskProcessing/FakeTranscribeProvider.php b/apps/testing/lib/TaskProcessing/FakeTranscribeProvider.php index 933192c95c1..4827a07037a 100644 --- a/apps/testing/lib/TaskProcessing/FakeTranscribeProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeTranscribeProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/testing/lib/TaskProcessing/FakeTranslateProvider.php b/apps/testing/lib/TaskProcessing/FakeTranslateProvider.php index 728932acdb3..22be8e83049 100644 --- a/apps/testing/lib/TaskProcessing/FakeTranslateProvider.php +++ b/apps/testing/lib/TaskProcessing/FakeTranslateProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/appinfo/routes.php b/apps/theming/appinfo/routes.php index 21cc6aa6c2e..b0aedbbb803 100644 --- a/apps/theming/appinfo/routes.php +++ b/apps/theming/appinfo/routes.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/lib/AppInfo/Application.php b/apps/theming/lib/AppInfo/Application.php index c031243361f..d08a1903265 100644 --- a/apps/theming/lib/AppInfo/Application.php +++ b/apps/theming/lib/AppInfo/Application.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/lib/Capabilities.php b/apps/theming/lib/Capabilities.php index bd3dd45741d..f0ade74778b 100644 --- a/apps/theming/lib/Capabilities.php +++ b/apps/theming/lib/Capabilities.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/lib/Command/UpdateConfig.php b/apps/theming/lib/Command/UpdateConfig.php index 3a3f3f0c767..460f3a1f83b 100644 --- a/apps/theming/lib/Command/UpdateConfig.php +++ b/apps/theming/lib/Command/UpdateConfig.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php index bdd5a43ddc3..0b130eeed24 100644 --- a/apps/theming/lib/Controller/IconController.php +++ b/apps/theming/lib/Controller/IconController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index f26d2188c5e..8d07cc2ff35 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/lib/Controller/UserThemeController.php b/apps/theming/lib/Controller/UserThemeController.php index bef0f38f598..68602ed5978 100644 --- a/apps/theming/lib/Controller/UserThemeController.php +++ b/apps/theming/lib/Controller/UserThemeController.php @@ -155,7 +155,7 @@ class UserThemeController extends OCSController { */ #[NoAdminRequired] public function deleteBackground(): JSONResponse { - $currentVersion = (int)$this->config->getUserValue($this->userId, Application::APP_ID, 'userCacheBuster', '0'); + $currentVersion = (int) $this->config->getUserValue($this->userId, Application::APP_ID, 'userCacheBuster', '0'); $this->backgroundService->deleteBackgroundImage(); return new JSONResponse([ 'backgroundImage' => null, @@ -178,7 +178,7 @@ class UserThemeController extends OCSController { */ #[NoAdminRequired] public function setBackground(string $type = BackgroundService::BACKGROUND_DEFAULT, string $value = '', ?string $color = null): JSONResponse { - $currentVersion = (int)$this->config->getUserValue($this->userId, Application::APP_ID, 'userCacheBuster', '0'); + $currentVersion = (int) $this->config->getUserValue($this->userId, Application::APP_ID, 'userCacheBuster', '0'); // Set color if provided if ($color) { @@ -210,7 +210,7 @@ class UserThemeController extends OCSController { } $currentVersion++; - $this->config->setUserValue($this->userId, Application::APP_ID, 'userCacheBuster', (string)$currentVersion); + $this->config->setUserValue($this->userId, Application::APP_ID, 'userCacheBuster', (string) $currentVersion); return new JSONResponse([ 'backgroundImage' => $this->config->getUserValue($this->userId, Application::APP_ID, 'background_image', BackgroundService::BACKGROUND_DEFAULT), diff --git a/apps/theming/lib/IconBuilder.php b/apps/theming/lib/IconBuilder.php index 1eac09b1a19..a2db2860b5d 100644 --- a/apps/theming/lib/IconBuilder.php +++ b/apps/theming/lib/IconBuilder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -44,12 +45,12 @@ class IconBuilder { } try { $favicon = new Imagick(); - $favicon->setFormat("ico"); + $favicon->setFormat('ico'); $icon = $this->renderAppIcon($app, 128); if ($icon === false) { return false; } - $icon->setImageFormat("png32"); + $icon->setImageFormat('png32'); $clone = clone $icon; $clone->scaleImage(16, 0); @@ -87,7 +88,7 @@ class IconBuilder { if ($icon === false) { return false; } - $icon->setImageFormat("png32"); + $icon->setImageFormat('png32'); $data = $icon->getImageBlob(); $icon->destroy(); return $data; @@ -117,7 +118,7 @@ class IconBuilder { $mime = mime_content_type($appIcon); } - if ($appIconContent === false || $appIconContent === "") { + if ($appIconContent === false || $appIconContent === '') { return false; } @@ -130,9 +131,9 @@ class IconBuilder { '<rect x="0" y="0" rx="' . $cornerRadius . '" ry="' . $cornerRadius . '" width="' . $size. '" height="' . $size . '" style="fill:' . $color . ';" />' . '</svg>'; // resize svg magic as this seems broken in Imagemagick - if ($mime === "image/svg+xml" || substr($appIconContent, 0, 4) === "<svg") { - if (substr($appIconContent, 0, 5) !== "<?xml") { - $svg = "<?xml version=\"1.0\"?>".$appIconContent; + if ($mime === 'image/svg+xml' || substr($appIconContent, 0, 4) === '<svg') { + if (substr($appIconContent, 0, 5) !== '<?xml') { + $svg = '<?xml version="1.0"?>'.$appIconContent; } else { $svg = $appIconContent; } @@ -146,8 +147,8 @@ class IconBuilder { // convert svg to resized image $appIconFile = new Imagick(); - $resX = (int)(72 * $size / $x); - $resY = (int)(72 * $size / $y); + $resX = (int) (72 * $size / $x); + $resY = (int) (72 * $size / $y); $appIconFile->setResolution($resX, $resY); $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); $appIconFile->readImageBlob($svg); @@ -158,7 +159,7 @@ class IconBuilder { */ if ($this->util->isBrightColor($color) && !$appIcon instanceof ISimpleFile - && $app !== "core" + && $app !== 'core' ) { $appIconFile->negateImage(false); } @@ -169,23 +170,23 @@ class IconBuilder { } // offset for icon positioning $padding = 0.15; - $border_w = (int)($appIconFile->getImageWidth() * $padding); - $border_h = (int)($appIconFile->getImageHeight() * $padding); + $border_w = (int) ($appIconFile->getImageWidth() * $padding); + $border_h = (int) ($appIconFile->getImageHeight() * $padding); $innerWidth = ($appIconFile->getImageWidth() - $border_w * 2); $innerHeight = ($appIconFile->getImageHeight() - $border_h * 2); $appIconFile->adaptiveResizeImage($innerWidth, $innerHeight); // center icon - $offset_w = (int)($size / 2 - $innerWidth / 2); - $offset_h = (int)($size / 2 - $innerHeight / 2); + $offset_w = (int) ($size / 2 - $innerWidth / 2); + $offset_h = (int) ($size / 2 - $innerHeight / 2); $finalIconFile = new Imagick(); $finalIconFile->setBackgroundColor(new ImagickPixel('transparent')); $finalIconFile->readImageBlob($background); $finalIconFile->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); - $finalIconFile->setImageArtifact('compose:args', "1,0,-0.5,0.5"); + $finalIconFile->setImageArtifact('compose:args', '1,0,-0.5,0.5'); $finalIconFile->compositeImage($appIconFile, Imagick::COMPOSITE_ATOP, $offset_w, $offset_h); $finalIconFile->setImageFormat('png24'); - if (defined("Imagick::INTERPOLATE_BICUBIC") === true) { + if (defined('Imagick::INTERPOLATE_BICUBIC') === true) { $filter = Imagick::INTERPOLATE_BICUBIC; } else { $filter = Imagick::FILTER_LANCZOS; @@ -203,11 +204,11 @@ class IconBuilder { */ public function colorSvg($app, $image) { $imageFile = $this->util->getAppImage($app, $image); - if ($imageFile === false || $imageFile === "") { + if ($imageFile === false || $imageFile === '') { return false; } $svg = file_get_contents($imageFile); - if ($svg !== false && $svg !== "") { + if ($svg !== false && $svg !== '') { $color = $this->util->elementColor($this->themingDefaults->getColorPrimary()); $svg = $this->util->colorizeSvg($svg, $color); return $svg; diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php index 4afdedf5189..3dd9fb614fd 100644 --- a/apps/theming/lib/ImageManager.php +++ b/apps/theming/lib/ImageManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -365,7 +366,7 @@ class ImageManager { public function shouldReplaceIcons() { $cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl()); if ($value = $cache->get('shouldReplaceIcons')) { - return (bool)$value; + return (bool) $value; } $value = false; if (extension_loaded('imagick')) { diff --git a/apps/theming/lib/Jobs/RestoreBackgroundImageColor.php b/apps/theming/lib/Jobs/RestoreBackgroundImageColor.php index 1ec659d0646..a5cb80f78fe 100644 --- a/apps/theming/lib/Jobs/RestoreBackgroundImageColor.php +++ b/apps/theming/lib/Jobs/RestoreBackgroundImageColor.php @@ -101,7 +101,7 @@ class RestoreBackgroundImageColor extends QueuedJob { } $background = $this->config->getUserValue($userId, Application::APP_ID, 'background_image'); - switch($background) { + switch ($background) { case BackgroundService::BACKGROUND_DEFAULT: $this->service->setDefaultBackground($userId); break; diff --git a/apps/theming/lib/Service/BackgroundService.php b/apps/theming/lib/Service/BackgroundService.php index 8ed8478de71..c51288dd329 100644 --- a/apps/theming/lib/Service/BackgroundService.php +++ b/apps/theming/lib/Service/BackgroundService.php @@ -310,7 +310,7 @@ class BackgroundService { if ($background === self::BACKGROUND_CUSTOM) { try { return $this->getAppDataFolder()->getFile('background.jpg'); - } catch (NotFoundException | NotPermittedException $e) { + } catch (NotFoundException|NotPermittedException $e) { return null; } } @@ -358,7 +358,7 @@ class BackgroundService { $tempImage = new \OCP\Image(); // Crop to only analyze top bar - $resource = $image->cropNew(0, 0, $image->width(), min(max(50, (int)($image->height() * 0.125)), $image->height())); + $resource = $image->cropNew(0, 0, $image->width(), min(max(50, (int) ($image->height() * 0.125)), $image->height())); if ($resource === false) { return false; } @@ -387,9 +387,9 @@ class BackgroundService { $blues[] = $value & 0xFF; } } - $meanColor = '#' . toHex((int)(array_sum($reds) / count($reds))); - $meanColor .= toHex((int)(array_sum($greens) / count($greens))); - $meanColor .= toHex((int)(array_sum($blues) / count($blues))); + $meanColor = '#' . toHex((int) (array_sum($reds) / count($reds))); + $meanColor .= toHex((int) (array_sum($greens) / count($greens))); + $meanColor .= toHex((int) (array_sum($blues) / count($blues))); return $meanColor; } diff --git a/apps/theming/lib/Service/ThemeInjectionService.php b/apps/theming/lib/Service/ThemeInjectionService.php index f65dde076bc..8584bcdfe22 100644 --- a/apps/theming/lib/Service/ThemeInjectionService.php +++ b/apps/theming/lib/Service/ThemeInjectionService.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -45,19 +46,19 @@ class ThemeInjectionService { $defaultTheme = $themes[$this->defaultTheme->getId()]; $mediaThemes = array_filter($themes, function ($theme) { // Check if the theme provides a media query - return (bool)$theme->getMediaQuery(); + return (bool) $theme->getMediaQuery(); }); // Default theme fallback $this->addThemeHeaders($defaultTheme); // Themes applied by media queries - foreach($mediaThemes as $theme) { + foreach ($mediaThemes as $theme) { $this->addThemeHeaders($theme, true, $theme->getMediaQuery()); } // Themes - foreach($this->themesService->getThemes() as $theme) { + foreach ($this->themesService->getThemes() as $theme) { // Ignore default theme as already processed first if ($theme->getId() === $this->defaultTheme->getId()) { continue; @@ -99,9 +100,9 @@ class ThemeInjectionService { $metaHeaders = []; // Meta headers - foreach($this->themesService->getThemes() as $theme) { + foreach ($this->themesService->getThemes() as $theme) { if (!empty($theme->getMeta())) { - foreach($theme->getMeta() as $meta) { + foreach ($theme->getMeta() as $meta) { if (!isset($meta['name']) || !isset($meta['content'])) { continue; } @@ -114,7 +115,7 @@ class ThemeInjectionService { } } - foreach($metaHeaders as $name => $content) { + foreach ($metaHeaders as $name => $content) { \OCP\Util::addHeader('meta', [ 'name' => $name, 'content' => join(' ', array_unique($content)), diff --git a/apps/theming/lib/Service/ThemesService.php b/apps/theming/lib/Service/ThemesService.php index a269f86ecba..f0a3872163e 100644 --- a/apps/theming/lib/Service/ThemesService.php +++ b/apps/theming/lib/Service/ThemesService.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/lib/Settings/Admin.php b/apps/theming/lib/Settings/Admin.php index 8a7b47a44a0..e740761a660 100644 --- a/apps/theming/lib/Settings/Admin.php +++ b/apps/theming/lib/Settings/Admin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -87,8 +88,8 @@ class Admin implements IDelegatedSettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/theming/lib/Settings/AdminSection.php b/apps/theming/lib/Settings/AdminSection.php index 3170a826310..989bf299e64 100644 --- a/apps/theming/lib/Settings/AdminSection.php +++ b/apps/theming/lib/Settings/AdminSection.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -42,8 +43,8 @@ class AdminSection implements IIconSection { /** * @return int whether the form should be rather on the top or bottom of - * the settings navigation. The sections are arranged in ascending order of - * the priority values. It is required to return a value between 0 and 99. + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. * * E.g.: 70 */ diff --git a/apps/theming/lib/Settings/Personal.php b/apps/theming/lib/Settings/Personal.php index 43156515acd..cb3fcda1ba0 100644 --- a/apps/theming/lib/Settings/Personal.php +++ b/apps/theming/lib/Settings/Personal.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -96,8 +97,8 @@ class Personal implements ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 * @since 9.1 diff --git a/apps/theming/lib/Settings/PersonalSection.php b/apps/theming/lib/Settings/PersonalSection.php index 4411f605903..de6e0bd9479 100644 --- a/apps/theming/lib/Settings/PersonalSection.php +++ b/apps/theming/lib/Settings/PersonalSection.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -70,8 +71,8 @@ class PersonalSection implements IIconSection { /** * @return int whether the form should be rather on the top or bottom of - * the settings navigation. The sections are arranged in ascending order of - * the priority values. It is required to return a value between 0 and 99. + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. * * E.g.: 70 * @since 9.1 diff --git a/apps/theming/lib/Themes/CommonThemeTrait.php b/apps/theming/lib/Themes/CommonThemeTrait.php index 74979770b70..7fac2012d7f 100644 --- a/apps/theming/lib/Themes/CommonThemeTrait.php +++ b/apps/theming/lib/Themes/CommonThemeTrait.php @@ -117,7 +117,7 @@ trait CommonThemeTrait { $backgroundImage = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'background_image', BackgroundService::BACKGROUND_DEFAULT); $backgroundColor = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'background_color', $this->themingDefaults->getColorBackground()); - $currentVersion = (int)$this->config->getUserValue($user->getUID(), Application::APP_ID, 'userCacheBuster', '0'); + $currentVersion = (int) $this->config->getUserValue($user->getUID(), Application::APP_ID, 'userCacheBuster', '0'); $isBackgroundBright = $this->util->invertTextColor($backgroundColor); $backgroundTextColor = $this->util->invertTextColor($backgroundColor) ? '#000000' : '#ffffff'; diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php index 34084d4ccbc..1a301eb9820 100644 --- a/apps/theming/lib/Themes/DefaultTheme.php +++ b/apps/theming/lib/Themes/DefaultTheme.php @@ -152,7 +152,7 @@ class DefaultTheme implements ITheme { '--color-loading-dark' => '#444444', '--color-box-shadow-rgb' => $colorBoxShadowRGB, - '--color-box-shadow' => "rgba(var(--color-box-shadow-rgb), 0.5)", + '--color-box-shadow' => 'rgba(var(--color-box-shadow-rgb), 0.5)', '--color-border' => $this->util->darken($colorMainBackground, 7), '--color-border-dark' => $this->util->darken($colorMainBackground, 14), diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 9be830a61fd..7684336ef32 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -101,15 +102,15 @@ class ThemingDefaults extends \OC_Defaults { } public function getImprintUrl() { - return (string)$this->config->getAppValue('theming', 'imprintUrl', ''); + return (string) $this->config->getAppValue('theming', 'imprintUrl', ''); } public function getPrivacyUrl() { - return (string)$this->config->getAppValue('theming', 'privacyUrl', ''); + return (string) $this->config->getAppValue('theming', 'privacyUrl', ''); } public function getDocBaseUrl() { - return (string)$this->config->getAppValue('theming', 'docBaseUrl', $this->docBaseUrl); + return (string) $this->config->getAppValue('theming', 'docBaseUrl', $this->docBaseUrl); } public function getShortFooter() { @@ -131,11 +132,11 @@ class ThemingDefaults extends \OC_Defaults { $links = [ [ 'text' => $this->l->t('Legal notice'), - 'url' => (string)$this->getImprintUrl() + 'url' => (string) $this->getImprintUrl() ], [ 'text' => $this->l->t('Privacy policy'), - 'url' => (string)$this->getPrivacyUrl() + 'url' => (string) $this->getPrivacyUrl() ], ]; @@ -419,8 +420,8 @@ class ThemingDefaults extends \OC_Defaults { * Increases the cache buster key */ public function increaseCacheBuster(): void { - $cacheBusterKey = (int)$this->config->getAppValue('theming', 'cachebuster', '0'); - $this->config->setAppValue('theming', 'cachebuster', (string)($cacheBusterKey + 1)); + $cacheBusterKey = (int) $this->config->getAppValue('theming', 'cachebuster', '0'); + $this->config->setAppValue('theming', 'cachebuster', (string) ($cacheBusterKey + 1)); $this->cacheFactory->createDistributed('theming-')->clear(); $this->cacheFactory->createDistributed('imagePath')->clear(); } diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php index 3ed359f7e07..b9a5a98c3c2 100644 --- a/apps/theming/lib/Util.php +++ b/apps/theming/lib/Util.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -232,7 +233,7 @@ class Util { public function getAppImage($app, $image) { $app = str_replace(['\0', '/', '\\', '..'], '', $app); $image = str_replace(['\0', '\\', '..'], '', $image); - if ($app === "core") { + if ($app === 'core') { $icon = \OC::$SERVERROOT . '/core/img/' . $image; if (file_exists($icon)) { return $icon; @@ -315,7 +316,7 @@ class Util { $themingAppVersion = $this->appManager->getAppVersion('theming'); $userCacheBuster = ''; if ($userId) { - $userCacheBusterValue = (int)$this->config->getUserValue($userId, 'theming', 'userCacheBuster', '0'); + $userCacheBusterValue = (int) $this->config->getUserValue($userId, 'theming', 'userCacheBuster', '0'); $userCacheBuster = $userId . '_' . $userCacheBusterValue; } $systemCacheBuster = $this->config->getAppValue('theming', 'cachebuster', '0'); diff --git a/apps/theming/tests/CapabilitiesTest.php b/apps/theming/tests/CapabilitiesTest.php index 5accb30b6a1..ecc389bb5b7 100644 --- a/apps/theming/tests/CapabilitiesTest.php +++ b/apps/theming/tests/CapabilitiesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php index e0159c03082..2ab768cdde8 100644 --- a/apps/theming/tests/Controller/IconControllerTest.php +++ b/apps/theming/tests/Controller/IconControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php index f0c5ed744ea..549dcb76681 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Controller/UserThemeControllerTest.php b/apps/theming/tests/Controller/UserThemeControllerTest.php index 8c3ae7364cd..a2d350bd22c 100644 --- a/apps/theming/tests/Controller/UserThemeControllerTest.php +++ b/apps/theming/tests/Controller/UserThemeControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php index eb56287fede..a2058e9dd40 100644 --- a/apps/theming/tests/IconBuilderTest.php +++ b/apps/theming/tests/IconBuilderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -84,7 +85,7 @@ class IconBuilderTest extends TestCase { ->with('global/images') ->willThrowException(new NotFoundException()); - $expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file); + $expectedIcon = new \Imagick(realpath(dirname(__FILE__)). '/data/' . $file); $icon = $this->iconBuilder->renderAppIcon($app, 512); $this->assertEquals(true, $icon->valid()); @@ -113,7 +114,7 @@ class IconBuilderTest extends TestCase { ->with('global/images') ->willThrowException(new NotFoundException()); - $expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file); + $expectedIcon = new \Imagick(realpath(dirname(__FILE__)). '/data/' . $file); $icon = new \Imagick(); $icon->readImageBlob($this->iconBuilder->getTouchIcon($app)); @@ -146,7 +147,7 @@ class IconBuilderTest extends TestCase { ->with('global/images') ->willThrowException(new NotFoundException()); - $expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file); + $expectedIcon = new \Imagick(realpath(dirname(__FILE__)). '/data/' . $file); $actualIcon = $this->iconBuilder->getFavicon($app); $icon = new \Imagick(); diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php index f3c2156be7e..c1bbfa153a0 100644 --- a/apps/theming/tests/ImageManagerTest.php +++ b/apps/theming/tests/ImageManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Service/ThemesServiceTest.php b/apps/theming/tests/Service/ThemesServiceTest.php index 83036bb0ae6..21725bf9b53 100644 --- a/apps/theming/tests/Service/ThemesServiceTest.php +++ b/apps/theming/tests/Service/ThemesServiceTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/ServicesTest.php b/apps/theming/tests/ServicesTest.php index 2e404d6fd43..5e728de9e6e 100644 --- a/apps/theming/tests/ServicesTest.php +++ b/apps/theming/tests/ServicesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Settings/AdminSectionTest.php b/apps/theming/tests/Settings/AdminSectionTest.php index 8916313e9a2..663f695f48a 100644 --- a/apps/theming/tests/Settings/AdminSectionTest.php +++ b/apps/theming/tests/Settings/AdminSectionTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Settings/AdminTest.php b/apps/theming/tests/Settings/AdminTest.php index 489d807673f..9377f9ed799 100644 --- a/apps/theming/tests/Settings/AdminTest.php +++ b/apps/theming/tests/Settings/AdminTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Settings/PersonalTest.php b/apps/theming/tests/Settings/PersonalTest.php index 2313b3062a0..3455bc5a62c 100644 --- a/apps/theming/tests/Settings/PersonalTest.php +++ b/apps/theming/tests/Settings/PersonalTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Themes/AccessibleThemeTestCase.php b/apps/theming/tests/Themes/AccessibleThemeTestCase.php index 5f13e2259aa..36d3a667f31 100644 --- a/apps/theming/tests/Themes/AccessibleThemeTestCase.php +++ b/apps/theming/tests/Themes/AccessibleThemeTestCase.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Themes/DarkHighContrastThemeTest.php b/apps/theming/tests/Themes/DarkHighContrastThemeTest.php index 30bbc5f110d..b6d9fac5a13 100644 --- a/apps/theming/tests/Themes/DarkHighContrastThemeTest.php +++ b/apps/theming/tests/Themes/DarkHighContrastThemeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Themes/DarkThemeTest.php b/apps/theming/tests/Themes/DarkThemeTest.php index 16a289053ae..7513edbd5b3 100644 --- a/apps/theming/tests/Themes/DarkThemeTest.php +++ b/apps/theming/tests/Themes/DarkThemeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Themes/DefaultThemeTest.php b/apps/theming/tests/Themes/DefaultThemeTest.php index d11237e774c..ae615dfb357 100644 --- a/apps/theming/tests/Themes/DefaultThemeTest.php +++ b/apps/theming/tests/Themes/DefaultThemeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Themes/DyslexiaFontTest.php b/apps/theming/tests/Themes/DyslexiaFontTest.php index 99b6f8cfc8e..a84d24fb766 100644 --- a/apps/theming/tests/Themes/DyslexiaFontTest.php +++ b/apps/theming/tests/Themes/DyslexiaFontTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/Themes/HighContrastThemeTest.php b/apps/theming/tests/Themes/HighContrastThemeTest.php index 47c4b3bb374..167dce666f1 100644 --- a/apps/theming/tests/Themes/HighContrastThemeTest.php +++ b/apps/theming/tests/Themes/HighContrastThemeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index 8edbcbc53c1..da3efe0c0ee 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/theming/tests/UtilTest.php b/apps/theming/tests/UtilTest.php index d9085e523f0..03d4746d842 100644 --- a/apps/theming/tests/UtilTest.php +++ b/apps/theming/tests/UtilTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -103,22 +104,22 @@ class UtilTest extends TestCase { } public function testElementColorDefaultBlack() { - $elementColor = $this->util->elementColor("#000000"); + $elementColor = $this->util->elementColor('#000000'); $this->assertEquals('#4d4d4d', $elementColor); } public function testElementColorDefaultWhite() { - $elementColor = $this->util->elementColor("#ffffff"); + $elementColor = $this->util->elementColor('#ffffff'); $this->assertEquals('#b3b3b3', $elementColor); } public function testElementColorBlackOnDarkBackground() { - $elementColor = $this->util->elementColor("#000000", false); + $elementColor = $this->util->elementColor('#000000', false); $this->assertEquals('#4d4d4d', $elementColor); } public function testElementColorBlackOnBrightBackground() { - $elementColor = $this->util->elementColor("#000000", true); + $elementColor = $this->util->elementColor('#000000', true); $this->assertEquals('#000000', $elementColor); } @@ -206,8 +207,8 @@ class UtilTest extends TestCase { } public function testColorizeSvg() { - $input = "#0082c9 #0082C9 #000000 #FFFFFF"; - $expected = "#AAAAAA #AAAAAA #000000 #FFFFFF"; + $input = '#0082c9 #0082C9 #000000 #FFFFFF'; + $expected = '#AAAAAA #AAAAAA #000000 #FFFFFF'; $result = $this->util->colorizeSvg($input, '#AAAAAA'); $this->assertEquals($expected, $result); } diff --git a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170926101419.php b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170926101419.php index d8ac73def1e..d19fda49182 100644 --- a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170926101419.php +++ b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170926101419.php @@ -17,7 +17,7 @@ class Version1002Date20170926101419 extends BigIntMigration { /** * @return array Returns an array with the following structure - * ['table1' => ['column1', 'column2'], ...] + * ['table1' => ['column1', 'column2'], ...] * @since 13.0.0 */ protected function getColumnsByTable() { diff --git a/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php b/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php index cab2033e94e..6704c2245d1 100644 --- a/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php +++ b/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php @@ -88,7 +88,7 @@ class BackupCodeStorage { $total = count($codes); $used = 0; array_walk($codes, function (BackupCode $code) use (&$used) { - if ((int)$code->getUsed() === 1) { + if ((int) $code->getUsed() === 1) { $used++; } }); @@ -108,7 +108,7 @@ class BackupCodeStorage { $dbCodes = $this->mapper->getBackupCodes($user); foreach ($dbCodes as $dbCode) { - if ((int)$dbCode->getUsed() === 0 && $this->hasher->verify($code, $dbCode->getCode())) { + if ((int) $dbCode->getUsed() === 0 && $this->hasher->verify($code, $dbCode->getCode())) { $dbCode->setUsed(1); $this->mapper->update($dbCode); return true; diff --git a/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/RememberBackupCodesJobTest.php b/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/RememberBackupCodesJobTest.php index b8a44d64a74..8b2714227cd 100644 --- a/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/RememberBackupCodesJobTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/RememberBackupCodesJobTest.php @@ -21,10 +21,10 @@ use Test\TestCase; class RememberBackupCodesJobTest extends TestCase { - /** @var IRegistry|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IRegistry|\PHPUnit\Framework\MockObject\MockObject */ private $registry; - /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */ private $userManager; /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */ diff --git a/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php b/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php index f64f5735d77..ffeb5fd1e15 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php @@ -40,7 +40,7 @@ class BackupCodesProviderTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->appName = "twofactor_backupcodes"; + $this->appName = 'twofactor_backupcodes'; $this->storage = $this->createMock(BackupCodeStorage::class); $this->l10n = $this->createMock(IL10N::class); $this->appManager = $this->createMock(AppManager::class); diff --git a/apps/updatenotification/templates/empty.php b/apps/updatenotification/templates/empty.php index 47473ebab9d..6e020c591ed 100644 --- a/apps/updatenotification/templates/empty.php +++ b/apps/updatenotification/templates/empty.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/ajax/clearMappings.php b/apps/user_ldap/ajax/clearMappings.php index 0616281b415..4c871c2a6f7 100644 --- a/apps/user_ldap/ajax/clearMappings.php +++ b/apps/user_ldap/ajax/clearMappings.php @@ -13,7 +13,7 @@ use OCA\User_LDAP\Mapping\UserMapping; \OC_JSON::checkAppEnabled('user_ldap'); \OC_JSON::callCheck(); -$subject = (string)$_POST['ldap_clear_mapping']; +$subject = (string) $_POST['ldap_clear_mapping']; $mapping = null; try { if ($subject === 'user') { diff --git a/apps/user_ldap/ajax/deleteConfiguration.php b/apps/user_ldap/ajax/deleteConfiguration.php index b8e9a09dc1c..5a464d0cf13 100644 --- a/apps/user_ldap/ajax/deleteConfiguration.php +++ b/apps/user_ldap/ajax/deleteConfiguration.php @@ -10,7 +10,7 @@ \OC_JSON::checkAppEnabled('user_ldap'); \OC_JSON::callCheck(); -$prefix = (string)$_POST['ldap_serverconfig_chooser']; +$prefix = (string) $_POST['ldap_serverconfig_chooser']; $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()); if ($helper->deleteServerConfiguration($prefix)) { \OC_JSON::success(); diff --git a/apps/user_ldap/ajax/getConfiguration.php b/apps/user_ldap/ajax/getConfiguration.php index 31372e89c20..3527884f663 100644 --- a/apps/user_ldap/ajax/getConfiguration.php +++ b/apps/user_ldap/ajax/getConfiguration.php @@ -10,7 +10,7 @@ \OC_JSON::checkAppEnabled('user_ldap'); \OC_JSON::callCheck(); -$prefix = (string)$_POST['ldap_serverconfig_chooser']; +$prefix = (string) $_POST['ldap_serverconfig_chooser']; $ldapWrapper = new OCA\User_LDAP\LDAP(); $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix); $configuration = $connection->getConfiguration(); diff --git a/apps/user_ldap/ajax/getNewServerConfigPrefix.php b/apps/user_ldap/ajax/getNewServerConfigPrefix.php index 8064ce92833..96d82cd48a9 100644 --- a/apps/user_ldap/ajax/getNewServerConfigPrefix.php +++ b/apps/user_ldap/ajax/getNewServerConfigPrefix.php @@ -14,7 +14,7 @@ $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig(), \OC::$server->get $serverConnections = $helper->getServerConfigurationPrefixes(); sort($serverConnections); $lk = array_pop($serverConnections); -$ln = (int)str_replace('s', '', $lk); +$ln = (int) str_replace('s', '', $lk); $nk = 's'.str_pad($ln + 1, 2, '0', STR_PAD_LEFT); $resultData = ['configPrefix' => $nk]; diff --git a/apps/user_ldap/ajax/setConfiguration.php b/apps/user_ldap/ajax/setConfiguration.php index afa3b551899..7bd2e3d3de0 100644 --- a/apps/user_ldap/ajax/setConfiguration.php +++ b/apps/user_ldap/ajax/setConfiguration.php @@ -10,7 +10,7 @@ \OC_JSON::checkAppEnabled('user_ldap'); \OC_JSON::callCheck(); -$prefix = (string)$_POST['ldap_serverconfig_chooser']; +$prefix = (string) $_POST['ldap_serverconfig_chooser']; // Checkboxes are not submitted, when they are unchecked. Set them manually. // only legacy checkboxes (Advanced and Expert tab) need to be handled here, diff --git a/apps/user_ldap/ajax/wizard.php b/apps/user_ldap/ajax/wizard.php index aa617fb3fc1..5d616a2415f 100644 --- a/apps/user_ldap/ajax/wizard.php +++ b/apps/user_ldap/ajax/wizard.php @@ -15,19 +15,19 @@ $l = \OCP\Util::getL10N('user_ldap'); if (!isset($_POST['action'])) { \OC_JSON::error(['message' => $l->t('No action specified')]); } -$action = (string)$_POST['action']; +$action = (string) $_POST['action']; if (!isset($_POST['ldap_serverconfig_chooser'])) { \OC_JSON::error(['message' => $l->t('No configuration specified')]); } -$prefix = (string)$_POST['ldap_serverconfig_chooser']; +$prefix = (string) $_POST['ldap_serverconfig_chooser']; $ldapWrapper = new \OCA\User_LDAP\LDAP(); $configuration = new \OCA\User_LDAP\Configuration($prefix); $con = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix, null); $con->setConfiguration($configuration->getConfiguration()); -$con->ldapConfigurationActive = (string)true; +$con->ldapConfigurationActive = (string) true; $con->setIgnoreValidation(true); $factory = \OC::$server->get(\OCA\User_LDAP\AccessFactory::class); diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index 267351dcaea..9d74d07aeee 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -171,10 +171,10 @@ class Access extends LDAPUtility { * * @param string $dn the record in question * @param string $attr the attribute that shall be retrieved - * if empty, just check the record's existence + * if empty, just check the record's existence * @param string $filter * @return array|false an array of values on success or an empty - * array if $attr is empty, false otherwise + * array if $attr is empty, false otherwise * @throws ServerNotAvailableException */ public function readAttribute(string $dn, string $attr, string $filter = 'objectClass=*') { @@ -308,8 +308,8 @@ class Access extends LDAPUtility { public function extractRangeData(array $result, string $attribute): array { $keys = array_keys($result); foreach ($keys as $key) { - if ($key !== $attribute && str_starts_with((string)$key, $attribute)) { - $queryData = explode(';', (string)$key); + if ($key !== $attribute && str_starts_with((string) $key, $attribute)) { + $queryData = explode(';', (string) $key); if (isset($queryData[1]) && str_starts_with($queryData[1], 'range=')) { $high = substr($queryData[1], 1 + strpos($queryData[1], '-')); return [ @@ -334,7 +334,7 @@ class Access extends LDAPUtility { * @throws \Exception */ public function setPassword($userDN, $password) { - if ((int)$this->connection->turnOnPasswordChange !== 1) { + if ((int) $this->connection->turnOnPasswordChange !== 1) { throw new \Exception('LDAP password changes are disabled.'); } $cr = $this->connection->getConnectionResource(); @@ -343,7 +343,7 @@ class Access extends LDAPUtility { return @$this->invokeLDAPMethod('exopPasswd', $userDN, '', $password) || @$this->invokeLDAPMethod('modReplace', $userDN, $password); } catch (ConstraintViolationException $e) { - throw new HintException('Password change rejected.', \OCP\Util::getL10N('user_ldap')->t('Password change rejected. Hint: %s', $e->getMessage()), (int)$e->getCode()); + throw new HintException('Password change rejected.', \OCP\Util::getL10N('user_ldap')->t('Password change rejected. Hint: %s', $e->getMessage()), (int) $e->getCode()); } } @@ -810,15 +810,15 @@ class Access extends LDAPUtility { * "Developers" */ private function _createAltInternalOwnCloudNameForGroups(string $name) { - $usedNames = $this->getGroupMapper()->getNamesBySearch($name, "", '_%'); + $usedNames = $this->getGroupMapper()->getNamesBySearch($name, '', '_%'); if (count($usedNames) === 0) { $lastNo = 1; //will become name_2 } else { natsort($usedNames); $lastName = array_pop($usedNames); - $lastNo = (int)substr($lastName, strrpos($lastName, '_') + 1); + $lastNo = (int) substr($lastName, strrpos($lastName, '_') + 1); } - $altName = $name . '_' . (string)($lastNo + 1); + $altName = $name . '_' . (string) ($lastNo + 1); unset($usedNames); $attempts = 1; @@ -920,7 +920,7 @@ class Access extends LDAPUtility { * @throws \Exception */ public function batchApplyUserAttributes(array $ldapRecords): void { - $displayNameAttribute = strtolower((string)$this->connection->ldapUserDisplayName); + $displayNameAttribute = strtolower((string) $this->connection->ldapUserDisplayName); foreach ($ldapRecords as $userRecord) { if (!isset($userRecord[$displayNameAttribute])) { // displayName is obligatory @@ -947,7 +947,7 @@ class Access extends LDAPUtility { * @return array[] */ public function fetchListOfGroups(string $filter, array $attr, ?int $limit = null, ?int $offset = null): array { - $cacheKey = 'fetchListOfGroups_' . $filter . '_' . implode('-', $attr) . '_' . (string)$limit . '_' . (string)$offset; + $cacheKey = 'fetchListOfGroups_' . $filter . '_' . implode('-', $attr) . '_' . (string) $limit . '_' . (string) $offset; $listOfGroups = $this->connection->getFromCache($cacheKey); if (!is_null($listOfGroups)) { return $listOfGroups; @@ -1008,7 +1008,7 @@ class Access extends LDAPUtility { $result = false; foreach ($this->connection->ldapBaseUsers as $base) { $count = $this->count($filter, [$base], $attr, $limit ?? 0, $offset ?? 0); - $result = is_int($count) ? (int)$result + $count : $result; + $result = is_int($count) ? (int) $result + $count : $result; } return $result; } @@ -1039,7 +1039,7 @@ class Access extends LDAPUtility { $result = false; foreach ($this->connection->ldapBaseGroups as $base) { $count = $this->count($filter, [$base], $attr, $limit ?? 0, $offset ?? 0); - $result = is_int($count) ? (int)$result + $count : $result; + $result = is_int($count) ? (int) $result + $count : $result; } return $result; } @@ -1054,7 +1054,7 @@ class Access extends LDAPUtility { $result = false; foreach ($this->connection->ldapBase as $base) { $count = $this->count('objectclass=*', [$base], ['dn'], $limit ?? 0, $offset ?? 0); - $result = is_int($count) ? (int)$result + $count : $result; + $result = is_int($count) ? (int) $result + $count : $result; } return $result; } @@ -1116,7 +1116,7 @@ class Access extends LDAPUtility { * @param int|null $limit optional, maximum results to be counted * @param int|null $offset optional, a starting point * @return array|false array with the search result as first value and pagedSearchOK as - * second | false if not successful + * second | false if not successful * @throws ServerNotAvailableException */ private function executeSearch( @@ -1131,7 +1131,7 @@ class Access extends LDAPUtility { //check whether paged search should be attempted try { - [$pagedSearchOK, $pageSize, $cookie] = $this->initPagedSearch($filter, $base, $attr, (int)$pageSize, (int)$offset); + [$pagedSearchOK, $pageSize, $cookie] = $this->initPagedSearch($filter, $base, $attr, (int) $pageSize, (int) $offset); } catch (NoMoreResults $e) { // beyond last results page return false; @@ -1155,7 +1155,7 @@ class Access extends LDAPUtility { * @param int $limit maximum results to be counted * @param bool $pagedSearchOK whether a paged search has been executed * @param bool $skipHandling required for paged search when cookies to - * prior results need to be gained + * prior results need to be gained * @return bool cookie validity, true if we have more pages, false otherwise. * @throws ServerNotAvailableException */ @@ -1184,7 +1184,7 @@ class Access extends LDAPUtility { $this->pagedSearchedSuccessful = true; } } else { - if ((int)$this->connection->ldapPagingSize !== 0) { + if ((int) $this->connection->ldapPagingSize !== 0) { $this->logger->debug( 'Paged search was not available', ['app' => 'user_ldap'] @@ -1205,11 +1205,11 @@ class Access extends LDAPUtility { * @param string $filter the LDAP filter for the search * @param array $bases an array containing the LDAP subtree(s) that shall be searched * @param ?string[] $attr optional, array, one or more attributes that shall be - * retrieved. Results will according to the order in the array. + * retrieved. Results will according to the order in the array. * @param int $limit maximum results to be counted, 0 means no limit * @param int $offset a starting point, defaults to 0 * @param bool $skipHandling indicates whether the pages search operation is - * completed + * completed * @return int|false Integer or false if the search could not be initialized * @throws ServerNotAvailableException */ @@ -1226,7 +1226,7 @@ class Access extends LDAPUtility { 'filter' => $filter ]); - $limitPerPage = (int)$this->connection->ldapPagingSize; + $limitPerPage = (int) $this->connection->ldapPagingSize; if ($limit < $limitPerPage && $limit > 0) { $limitPerPage = $limit; } @@ -1268,7 +1268,7 @@ class Access extends LDAPUtility { * @throws ServerNotAvailableException */ private function countEntriesInSearchResults($sr): int { - return (int)$this->invokeLDAPMethod('countEntries', $sr); + return (int) $this->invokeLDAPMethod('countEntries', $sr); } /** @@ -1286,7 +1286,7 @@ class Access extends LDAPUtility { ?int $offset = null, bool $skipHandling = false ): array { - $limitPerPage = (int)$this->connection->ldapPagingSize; + $limitPerPage = (int) $this->connection->ldapPagingSize; if (!is_null($limit) && $limit < $limitPerPage && $limit > 0) { $limitPerPage = $limit; } @@ -1455,7 +1455,7 @@ class Access extends LDAPUtility { * * @param string[] $filters the filters to connect * @return string the combined filter - * Combines Filter arguments with OR + * Combines Filter arguments with OR */ public function combineFilterWithOr($filters) { return $this->combineFilter($filters, '|'); @@ -1510,7 +1510,7 @@ class Access extends LDAPUtility { * * @param string $search the search term * @param string[]|null|'' $searchAttributes needs to have at least two attributes, - * otherwise it does not make sense :) + * otherwise it does not make sense :) * @return string the final filter part to use in LDAP searches * @throws DomainException */ @@ -1538,7 +1538,7 @@ class Access extends LDAPUtility { * @param string $search the search term * @param string[]|null|'' $searchAttributes * @param string $fallbackAttribute a fallback attribute in case the user - * did not define search attributes. Typically the display name attribute. + * did not define search attributes. Typically the display name attribute. * @return string the final filter part to use in LDAP searches */ private function getFilterPartForSearch(string $search, $searchAttributes, string $fallbackAttribute): string { @@ -2009,7 +2009,7 @@ class Access extends LDAPUtility { // no cookie known from a potential previous search. We need // to start from 0 to come to the desired page. cookie value // of '0' is valid, because 389ds - $defaultPageSize = (int)$this->connection->ldapPagingSize; + $defaultPageSize = (int) $this->connection->ldapPagingSize; if ($offset < $defaultPageSize) { /* Make a search with offset as page size and dismiss the result, to init the cookie */ $this->search($filter, $base, $attr, $offset, 0, true); @@ -2043,7 +2043,7 @@ class Access extends LDAPUtility { $this->abandonPagedSearch(); // in case someone set it to 0 … use 500, otherwise no results will // be returned. - $pageSize = (int)$this->connection->ldapPagingSize > 0 ? (int)$this->connection->ldapPagingSize : 500; + $pageSize = (int) $this->connection->ldapPagingSize > 0 ? (int) $this->connection->ldapPagingSize : 500; return [true, $pageSize, $this->lastCookie]; } diff --git a/apps/user_ldap/lib/AccessFactory.php b/apps/user_ldap/lib/AccessFactory.php index 28f88e3c4e9..9b006a2f1b3 100644 --- a/apps/user_ldap/lib/AccessFactory.php +++ b/apps/user_ldap/lib/AccessFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/AppInfo/Application.php b/apps/user_ldap/lib/AppInfo/Application.php index 400315442bb..a4c6452885c 100644 --- a/apps/user_ldap/lib/AppInfo/Application.php +++ b/apps/user_ldap/lib/AppInfo/Application.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/Command/PromoteGroup.php b/apps/user_ldap/lib/Command/PromoteGroup.php index bb5362e4700..5a8c4b0b9b1 100644 --- a/apps/user_ldap/lib/Command/PromoteGroup.php +++ b/apps/user_ldap/lib/Command/PromoteGroup.php @@ -83,7 +83,7 @@ class PromoteGroup extends Command { } protected function execute(InputInterface $input, OutputInterface $output): int { - $groupInput = (string)$input->getArgument('group'); + $groupInput = (string) $input->getArgument('group'); $group = $this->groupManager->get($groupInput); if ($group instanceof IGroup && $this->backend->groupExists($group->getGID())) { diff --git a/apps/user_ldap/lib/Command/ResetGroup.php b/apps/user_ldap/lib/Command/ResetGroup.php index 89d3f31f69d..5833ca980f2 100644 --- a/apps/user_ldap/lib/Command/ResetGroup.php +++ b/apps/user_ldap/lib/Command/ResetGroup.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/Command/ResetUser.php b/apps/user_ldap/lib/Command/ResetUser.php index 58dfbf68519..1409806e4ac 100644 --- a/apps/user_ldap/lib/Command/ResetUser.php +++ b/apps/user_ldap/lib/Command/ResetUser.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/Command/Search.php b/apps/user_ldap/lib/Command/Search.php index 4886e0c7638..e55b96f0853 100644 --- a/apps/user_ldap/lib/Command/Search.php +++ b/apps/user_ldap/lib/Command/Search.php @@ -85,8 +85,8 @@ class Search extends Command { $configPrefixes = $helper->getServerConfigurationPrefixes(true); $ldapWrapper = new LDAP(); - $offset = (int)$input->getOption('offset'); - $limit = (int)$input->getOption('limit'); + $offset = (int) $input->getOption('offset'); + $limit = (int) $input->getOption('limit'); $this->validateOffsetAndLimit($offset, $limit); if ($input->getOption('group')) { diff --git a/apps/user_ldap/lib/Command/SetConfig.php b/apps/user_ldap/lib/Command/SetConfig.php index 66a79d8c439..3a2bc4437e3 100644 --- a/apps/user_ldap/lib/Command/SetConfig.php +++ b/apps/user_ldap/lib/Command/SetConfig.php @@ -44,7 +44,7 @@ class SetConfig extends Command { $availableConfigs = $helper->getServerConfigurationPrefixes(); $configID = $input->getArgument('configID'); if (!in_array($configID, $availableConfigs)) { - $output->writeln("Invalid configID"); + $output->writeln('Invalid configID'); return self::FAILURE; } diff --git a/apps/user_ldap/lib/Command/ShowConfig.php b/apps/user_ldap/lib/Command/ShowConfig.php index 933d1129d42..fa021192ac4 100644 --- a/apps/user_ldap/lib/Command/ShowConfig.php +++ b/apps/user_ldap/lib/Command/ShowConfig.php @@ -54,7 +54,7 @@ class ShowConfig extends Base { if (!is_null($configID)) { $configIDs[] = $configID; if (!in_array($configIDs[0], $availableConfigs)) { - $output->writeln("Invalid configID"); + $output->writeln('Invalid configID'); return self::FAILURE; } } else { diff --git a/apps/user_ldap/lib/Command/ShowRemnants.php b/apps/user_ldap/lib/Command/ShowRemnants.php index d255aac1368..77832774364 100644 --- a/apps/user_ldap/lib/Command/ShowRemnants.php +++ b/apps/user_ldap/lib/Command/ShowRemnants.php @@ -62,8 +62,8 @@ class ShowRemnants extends Command { 'displayName' => $user->getDisplayName(), 'uid' => $user->getUID(), 'dn' => $user->getDN(), - 'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool)$input->getOption('short-date')), - 'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool)$input->getOption('short-date')), + 'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool) $input->getOption('short-date')), + 'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool) $input->getOption('short-date')), 'homePath' => $user->getHomePath(), 'sharer' => $user->getHasActiveShares() ? 'Y' : 'N', ]; diff --git a/apps/user_ldap/lib/Command/TestUserSettings.php b/apps/user_ldap/lib/Command/TestUserSettings.php index 88524eded02..b811b4a055a 100644 --- a/apps/user_ldap/lib/Command/TestUserSettings.php +++ b/apps/user_ldap/lib/Command/TestUserSettings.php @@ -190,12 +190,12 @@ class TestUserSettings extends Command { $groups = $groupLdapInstance->getUserGroups($uid); $output->writeln('All known groups: <info>' . json_encode($groups) . '</info>'); - $memberOfUsed = ((int)$access->connection->hasMemberOfFilterSupport === 1 - && (int)$access->connection->useMemberOfToDetectMembership === 1); + $memberOfUsed = ((int) $access->connection->hasMemberOfFilterSupport === 1 + && (int) $access->connection->useMemberOfToDetectMembership === 1); $output->writeln('MemberOf usage: <info>' . ($memberOfUsed ? 'on' : 'off') . '</info> (' . $access->connection->hasMemberOfFilterSupport . ',' . $access->connection->useMemberOfToDetectMembership . ')'); - $gid = (string)$input->getOption('group'); + $gid = (string) $input->getOption('group'); if ($gid === '') { return self::SUCCESS; } diff --git a/apps/user_ldap/lib/Command/UpdateUUID.php b/apps/user_ldap/lib/Command/UpdateUUID.php index acf4acbe7d5..93dcc37bada 100644 --- a/apps/user_ldap/lib/Command/UpdateUUID.php +++ b/apps/user_ldap/lib/Command/UpdateUUID.php @@ -266,7 +266,7 @@ class UpdateUUID extends Command { protected function handleMappingBasedUpdates(bool $invalidatedOnly): \Generator { $limit = 1000; - /** @var AbstractMapping $mapping*/ + /** @var AbstractMapping $mapping */ foreach ([$this->userMapping, $this->groupMapping] as $mapping) { $offset = 0; do { diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php index 5505844ec86..50fdae7a9b6 100644 --- a/apps/user_ldap/lib/Configuration.php +++ b/apps/user_ldap/lib/Configuration.php @@ -216,7 +216,7 @@ class Configuration { * from configuration. It does not save the configuration! To do so, you * must call saveConfiguration afterwards. * @param array $config array that holds the config parameters in an associated - * array + * array * @param array &$applied optional; array where the set fields will be given to */ public function setConfiguration(array $config, ?array &$applied = null): void { @@ -370,7 +370,7 @@ class Configuration { $this->saveValue($cta[$key], $value); } if ($changed) { - $this->saveValue('_lastChange', (string)time()); + $this->saveValue('_lastChange', (string) time()); } $this->unsavedChanges = []; } @@ -484,7 +484,7 @@ class Configuration { /** * @return array an associative array with the default values. Keys are correspond - * to config-value entries in the database table + * to config-value entries in the database table */ public function getDefaults(): array { return [ diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index c36229f59e5..6b102031e97 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -112,7 +112,7 @@ class Connection extends LDAPUtility { */ protected $cache = null; - /** @var Configuration settings handler **/ + /** @var Configuration settings handler * */ protected $configuration; /** @@ -214,7 +214,7 @@ class Connection extends LDAPUtility { * @param bool $state */ public function setIgnoreValidation($state) { - $this->ignoreValidation = (bool)$state; + $this->ignoreValidation = (bool) $state; } /** @@ -313,7 +313,7 @@ class Connection extends LDAPUtility { /** * Caches the general LDAP configuration. * @param bool $force optional. true, if the re-read should be forced. defaults - * to false. + * to false. */ private function readConfiguration(bool $force = false): void { if ((!$this->configured || $force) && !is_null($this->configID)) { @@ -397,8 +397,7 @@ class Connection extends LDAPUtility { } foreach (['ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute', - 'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute'] - as $expertSetting => $effectiveSetting) { + 'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute'] as $expertSetting => $effectiveSetting) { $uuidOverride = $this->configuration->$expertSetting; if (!empty($uuidOverride)) { $this->configuration->$effectiveSetting = $uuidOverride; @@ -417,7 +416,7 @@ class Connection extends LDAPUtility { } } - $backupPort = (int)$this->configuration->ldapBackupPort; + $backupPort = (int) $this->configuration->ldapBackupPort; if ($backupPort <= 0) { $this->configuration->ldapBackupPort = $this->configuration->ldapPort; } @@ -432,9 +431,9 @@ class Connection extends LDAPUtility { } } - if ((stripos((string)$this->configuration->ldapHost, 'ldaps://') === 0) + if ((stripos((string) $this->configuration->ldapHost, 'ldaps://') === 0) && $this->configuration->ldapTLS) { - $this->configuration->ldapTLS = (string)false; + $this->configuration->ldapTLS = (string) false; $this->logger->info( 'LDAPS (already using secure connection) and TLS do not work together. Switched off TLS.', ['app' => 'user_ldap'] @@ -513,7 +512,7 @@ class Connection extends LDAPUtility { $configurationOK = false; } - if (mb_strpos((string)$this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8') + if (mb_strpos((string) $this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8') === false) { $this->logger->warning( $errorStr.'login filter does not contain %uid place holder.', diff --git a/apps/user_ldap/lib/ConnectionFactory.php b/apps/user_ldap/lib/ConnectionFactory.php index 1e86699c427..89aae74cc2e 100644 --- a/apps/user_ldap/lib/ConnectionFactory.php +++ b/apps/user_ldap/lib/ConnectionFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/Controller/ConfigAPIController.php b/apps/user_ldap/lib/Controller/ConfigAPIController.php index 978aa005559..db60854cacc 100644 --- a/apps/user_ldap/lib/Controller/ConfigAPIController.php +++ b/apps/user_ldap/lib/Controller/ConfigAPIController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/Controller/RenewPasswordController.php b/apps/user_ldap/lib/Controller/RenewPasswordController.php index 574e85b4fde..4b3f3fc10d1 100644 --- a/apps/user_ldap/lib/Controller/RenewPasswordController.php +++ b/apps/user_ldap/lib/Controller/RenewPasswordController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -127,7 +128,7 @@ class RenewPasswordController extends Controller { try { if (!is_null($newPassword) && \OC_User::setPassword($user, $newPassword)) { $this->session->set('loginMessages', [ - [], [$this->l10n->t("Please login with the new password")] + [], [$this->l10n->t('Please login with the new password')] ]); $this->config->setUserValue($user, 'user_ldap', 'needsPasswordReset', 'false'); return new RedirectResponse($this->urlGenerator->linkToRoute('core.login.showLoginForm', $args)); diff --git a/apps/user_ldap/lib/Exceptions/AttributeNotSet.php b/apps/user_ldap/lib/Exceptions/AttributeNotSet.php index 35df63518b4..4d6053eda66 100644 --- a/apps/user_ldap/lib/Exceptions/AttributeNotSet.php +++ b/apps/user_ldap/lib/Exceptions/AttributeNotSet.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/Exceptions/ConstraintViolationException.php b/apps/user_ldap/lib/Exceptions/ConstraintViolationException.php index f468abd2282..d0d384c31de 100644 --- a/apps/user_ldap/lib/Exceptions/ConstraintViolationException.php +++ b/apps/user_ldap/lib/Exceptions/ConstraintViolationException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/Exceptions/NotOnLDAP.php b/apps/user_ldap/lib/Exceptions/NotOnLDAP.php index 8f3d8fc3499..cd74e918829 100644 --- a/apps/user_ldap/lib/Exceptions/NotOnLDAP.php +++ b/apps/user_ldap/lib/Exceptions/NotOnLDAP.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/GroupPluginManager.php b/apps/user_ldap/lib/GroupPluginManager.php index 16fdcc5228c..82389343359 100644 --- a/apps/user_ldap/lib/GroupPluginManager.php +++ b/apps/user_ldap/lib/GroupPluginManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -39,9 +40,9 @@ class GroupPluginManager { $this->respondToActions |= $respondToActions; foreach ($this->which as $action => $v) { - if ((bool)($respondToActions & $action)) { + if ((bool) ($respondToActions & $action)) { $this->which[$action] = $plugin; - \OCP\Server::get(LoggerInterface::class)->debug("Registered action ".$action." to plugin ".get_class($plugin), ['app' => 'user_ldap']); + \OCP\Server::get(LoggerInterface::class)->debug('Registered action '.$action.' to plugin '.get_class($plugin), ['app' => 'user_ldap']); } } } diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index c1424164d97..f70e70aa5aa 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -60,7 +60,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis $this->cachedNestedGroups = new CappedMemoryCache(); $this->groupPluginManager = $groupPluginManager; $this->logger = Server::get(LoggerInterface::class); - $this->ldapGroupMemberAssocAttr = strtolower((string)$gAssoc); + $this->ldapGroupMemberAssocAttr = strtolower((string) $gAssoc); $this->config = $config; $this->ncUserManager = $ncUserManager; } @@ -80,7 +80,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis $cacheKey = 'inGroup' . $uid . ':' . $gid; $inGroup = $this->access->connection->getFromCache($cacheKey); if (!is_null($inGroup)) { - return (bool)$inGroup; + return (bool) $inGroup; } $userDN = $this->access->username2dn($uid); @@ -180,7 +180,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis * @throws ServerNotAvailableException */ public function getDynamicGroupMembers(string $dnGroup): array { - $dynamicGroupMemberURL = strtolower((string)$this->access->connection->ldapDynamicGroupMemberURL); + $dynamicGroupMemberURL = strtolower((string) $this->access->connection->ldapDynamicGroupMemberURL); if (empty($dynamicGroupMemberURL)) { return []; @@ -270,7 +270,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis $allMembers = []; $members = $this->access->readAttribute($dnGroup, $this->access->connection->ldapGroupMemberAssocAttr); if (is_array($members)) { - if ((int)$this->access->connection->ldapNestedGroups === 1) { + if ((int) $this->access->connection->ldapNestedGroups === 1) { while ($recordDn = array_shift($members)) { $nestedMembers = $this->_groupMembers($recordDn, $seen, $recursive); if (!empty($nestedMembers)) { @@ -328,7 +328,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis $allGroups = []; $groups = $this->access->readAttribute($dn, 'memberOf'); if (is_array($groups)) { - if ((int)$this->access->connection->ldapNestedGroups === 1) { + if ((int) $this->access->connection->ldapNestedGroups === 1) { while ($recordDn = array_shift($groups)) { $nestedParents = $this->_getGroupDNsFromMemberOf($recordDn, $seen); $groups = array_merge($groups, $nestedParents); @@ -608,7 +608,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis try { $filter = $this->prepareFilterForUsersInPrimaryGroup($groupDN, $search); $users = $this->access->countUsers($filter, ['dn'], $limit, $offset); - return (int)$users; + return (int) $users; } catch (ServerNotAvailableException $e) { throw $e; } catch (Exception $e) { @@ -734,8 +734,8 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis // if possible, read out membership via memberOf. It's far faster than // performing a search, which still is a fallback later. // memberof doesn't support memberuid, so skip it here. - if ((int)$this->access->connection->hasMemberOfFilterSupport === 1 - && (int)$this->access->connection->useMemberOfToDetectMembership === 1 + if ((int) $this->access->connection->hasMemberOfFilterSupport === 1 + && (int) $this->access->connection->useMemberOfToDetectMembership === 1 && $this->ldapGroupMemberAssocAttr !== 'memberuid' && $this->ldapGroupMemberAssocAttr !== 'zimbramailforwardingaddress') { $groupDNs = $this->_getGroupDNsFromMemberOf($userDN); @@ -831,7 +831,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis $filter .= '@*'; } - $nesting = (int)$this->access->connection->ldapNestedGroups; + $nesting = (int) $this->access->connection->ldapNestedGroups; if ($nesting === 0) { $filter = $this->access->combineFilterWithAnd([$filter, $this->access->connection->ldapGroupFilter]); } @@ -1140,7 +1140,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis if (!$ignoreCache) { $groupExists = $this->access->connection->getFromCache($cacheKey); if (!is_null($groupExists)) { - return (bool)$groupExists; + return (bool) $groupExists; } } @@ -1203,7 +1203,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis * compared with GroupInterface::CREATE_GROUP etc. */ public function implementsActions($actions): bool { - return (bool)((GroupInterface::COUNT_USERS | + return (bool) ((GroupInterface::COUNT_USERS | GroupInterface::DELETE_GROUP | GroupInterface::IS_ADMIN | $this->groupPluginManager->getImplementedActions()) & $actions); @@ -1258,7 +1258,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis if ($ret = $this->groupPluginManager->deleteGroup($gid)) { // Delete group in nextcloud internal db $this->access->getGroupMapper()->unmap($gid); - $this->access->connection->writeToCache("groupExists" . $gid, false); + $this->access->connection->writeToCache('groupExists' . $gid, false); } return $ret; } @@ -1272,7 +1272,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis if (!$this->groupExists($gid)) { // The group does not exist in the LDAP, remove the mapping $this->access->getGroupMapper()->unmap($gid); - $this->access->connection->writeToCache("groupExists" . $gid, false); + $this->access->connection->writeToCache('groupExists' . $gid, false); return true; } diff --git a/apps/user_ldap/lib/Group_Proxy.php b/apps/user_ldap/lib/Group_Proxy.php index ceaa5c2fb5a..769c985fe7c 100644 --- a/apps/user_ldap/lib/Group_Proxy.php +++ b/apps/user_ldap/lib/Group_Proxy.php @@ -236,7 +236,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet */ public function getGroupsDetails(array $gids): array { if (!($this instanceof IGroupDetailsBackend || $this->implementsActions(GroupInterface::GROUP_DETAILS))) { - throw new \Exception("Should not have been called"); + throw new \Exception('Should not have been called'); } $groupData = []; diff --git a/apps/user_ldap/lib/Handler/ExtStorageConfigHandler.php b/apps/user_ldap/lib/Handler/ExtStorageConfigHandler.php index d4a8f332362..8b63d54aa66 100644 --- a/apps/user_ldap/lib/Handler/ExtStorageConfigHandler.php +++ b/apps/user_ldap/lib/Handler/ExtStorageConfigHandler.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/Helper.php b/apps/user_ldap/lib/Helper.php index c9d0cd1773d..1bfa626e389 100644 --- a/apps/user_ldap/lib/Helper.php +++ b/apps/user_ldap/lib/Helper.php @@ -29,7 +29,7 @@ class Helper { * returns prefixes for each saved LDAP/AD server configuration. * * @param bool $activeConfigurations optional, whether only active configuration shall be - * retrieved, defaults to false + * retrieved, defaults to false * @return array with a list of the available prefixes * * Configuration prefixes are used to set up configurations for n LDAP or @@ -101,8 +101,8 @@ class Helper { sort($serverConnections); $lastKey = array_pop($serverConnections); - $lastNumber = (int)str_replace('s', '', $lastKey); - return 's' . str_pad((string)($lastNumber + 1), 2, '0', STR_PAD_LEFT); + $lastNumber = (int) str_replace('s', '', $lastKey); + return 's' . str_pad((string) ($lastNumber + 1), 2, '0', STR_PAD_LEFT); } private function getServersConfig(string $value): array { @@ -133,7 +133,7 @@ class Helper { $query = $this->connection->getQueryBuilder(); $query->delete('appconfig') ->where($query->expr()->eq('appid', $query->createNamedParameter('user_ldap'))) - ->andWhere($query->expr()->like('configkey', $query->createNamedParameter((string)$prefix . '%'))) + ->andWhere($query->expr()->like('configkey', $query->createNamedParameter((string) $prefix . '%'))) ->andWhere($query->expr()->notIn('configkey', $query->createNamedParameter([ 'enabled', 'installed_version', diff --git a/apps/user_ldap/lib/IGroupLDAP.php b/apps/user_ldap/lib/IGroupLDAP.php index 764e0c88e64..667eb421004 100644 --- a/apps/user_ldap/lib/IGroupLDAP.php +++ b/apps/user_ldap/lib/IGroupLDAP.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/ILDAPGroupPlugin.php b/apps/user_ldap/lib/ILDAPGroupPlugin.php index d601e3a6548..261b9383dc1 100644 --- a/apps/user_ldap/lib/ILDAPGroupPlugin.php +++ b/apps/user_ldap/lib/ILDAPGroupPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/ILDAPUserPlugin.php b/apps/user_ldap/lib/ILDAPUserPlugin.php index 4638a1a49da..037c8ff7587 100644 --- a/apps/user_ldap/lib/ILDAPUserPlugin.php +++ b/apps/user_ldap/lib/ILDAPUserPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/IUserLDAP.php b/apps/user_ldap/lib/IUserLDAP.php index 6fcd68c0c01..f07b9b06e05 100644 --- a/apps/user_ldap/lib/IUserLDAP.php +++ b/apps/user_ldap/lib/IUserLDAP.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/Jobs/CleanUp.php b/apps/user_ldap/lib/Jobs/CleanUp.php index 1f2bf8dcb7e..489662181c6 100644 --- a/apps/user_ldap/lib/Jobs/CleanUp.php +++ b/apps/user_ldap/lib/Jobs/CleanUp.php @@ -54,8 +54,8 @@ class CleanUp extends TimedJob { ) { parent::__construct($timeFactory); $minutes = \OC::$server->getConfig()->getSystemValue( - 'ldapUserCleanupInterval', (string)$this->defaultIntervalMin); - $this->setInterval((int)$minutes * 60); + 'ldapUserCleanupInterval', (string) $this->defaultIntervalMin); + $this->setInterval((int) $minutes * 60); $this->userBackend = $userBackend; $this->dui = $dui; } @@ -145,8 +145,8 @@ class CleanUp extends TimedJob { * checks whether clean up is enabled by configuration */ private function isCleanUpEnabled(): bool { - return (bool)$this->ocConfig->getSystemValue( - 'ldapUserCleanupInterval', (string)$this->defaultIntervalMin); + return (bool) $this->ocConfig->getSystemValue( + 'ldapUserCleanupInterval', (string) $this->defaultIntervalMin); } /** @@ -177,7 +177,7 @@ class CleanUp extends TimedJob { * gets the offset to fetch users from the mappings table */ private function getOffset(): int { - return (int)$this->ocConfig->getAppValue('user_ldap', 'cleanUpJobOffset', '0'); + return (int) $this->ocConfig->getAppValue('user_ldap', 'cleanUpJobOffset', '0'); } /** @@ -187,7 +187,7 @@ class CleanUp extends TimedJob { public function setOffset(bool $reset = false): void { $newOffset = $reset ? 0 : $this->getOffset() + $this->getChunkSize(); - $this->ocConfig->setAppValue('user_ldap', 'cleanUpJobOffset', (string)$newOffset); + $this->ocConfig->setAppValue('user_ldap', 'cleanUpJobOffset', (string) $newOffset); } /** @@ -195,7 +195,7 @@ class CleanUp extends TimedJob { */ public function getChunkSize(): int { if ($this->limit === null) { - $this->limit = (int)$this->ocConfig->getAppValue('user_ldap', 'cleanUpJobChunkSize', '50'); + $this->limit = (int) $this->ocConfig->getAppValue('user_ldap', 'cleanUpJobChunkSize', '50'); } return $this->limit; } diff --git a/apps/user_ldap/lib/Jobs/Sync.php b/apps/user_ldap/lib/Jobs/Sync.php index f0122733b62..1fb28c12ef2 100644 --- a/apps/user_ldap/lib/Jobs/Sync.php +++ b/apps/user_ldap/lib/Jobs/Sync.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,23 +25,23 @@ use Psr\Log\LoggerInterface; class Sync extends TimedJob { public const MAX_INTERVAL = 12 * 60 * 60; // 12h public const MIN_INTERVAL = 30 * 60; // 30min - /** @var Helper */ + /** @var Helper */ protected $ldapHelper; - /** @var LDAP */ + /** @var LDAP */ protected $ldap; /** @var UserMapping */ protected $mapper; - /** @var IConfig */ + /** @var IConfig */ protected $config; - /** @var IAvatarManager */ + /** @var IAvatarManager */ protected $avatarManager; - /** @var IDBConnection */ + /** @var IDBConnection */ protected $dbc; - /** @var IUserManager */ + /** @var IUserManager */ protected $ncUserManager; - /** @var LoggerInterface */ + /** @var LoggerInterface */ protected $logger; - /** @var IManager */ + /** @var IManager */ protected $notificationManager; /** @var ConnectionFactory */ protected $connectionFactory; @@ -50,10 +51,10 @@ class Sync extends TimedJob { public function __construct(ITimeFactory $time) { parent::__construct($time); $this->setInterval( - (int)\OC::$server->getConfig()->getAppValue( + (int) \OC::$server->getConfig()->getAppValue( 'user_ldap', 'background_sync_interval', - (string)self::MIN_INTERVAL + (string) self::MIN_INTERVAL ) ); } @@ -74,7 +75,7 @@ class Sync extends TimedJob { $interval = floor(24 * 60 * 60 / $runsPerDay); $interval = min(max($interval, self::MIN_INTERVAL), self::MAX_INTERVAL); - $this->config->setAppValue('user_ldap', 'background_sync_interval', (string)$interval); + $this->config->setAppValue('user_ldap', 'background_sync_interval', (string) $interval); } /** @@ -91,7 +92,7 @@ class Sync extends TimedJob { $pagingSize = $this->config->getAppValue('user_ldap', $configKey, $minPagingSize); $minPagingSize = $minPagingSize === null ? $pagingSize : min($minPagingSize, $pagingSize); } - return (int)$minPagingSize; + return (int) $minPagingSize; } /** @@ -101,7 +102,7 @@ class Sync extends TimedJob { $this->setArgument($argument); $isBackgroundJobModeAjax = $this->config - ->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'ajax'; + ->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'ajax'; if ($isBackgroundJobModeAjax) { return; } @@ -150,15 +151,15 @@ class Sync extends TimedJob { $results = $access->fetchListOfUsers( $filter, $access->userManager->getAttributes(), - (int)$connection->ldapPagingSize, + (int) $connection->ldapPagingSize, $cycleData['offset'], true ); - if ((int)$connection->ldapPagingSize === 0) { + if ((int) $connection->ldapPagingSize === 0) { return false; } - return count($results) >= (int)$connection->ldapPagingSize; + return count($results) >= (int) $connection->ldapPagingSize; } /** @@ -175,7 +176,7 @@ class Sync extends TimedJob { $cycleData = [ 'prefix' => $this->config->getAppValue('user_ldap', 'background_sync_prefix', null), - 'offset' => (int)$this->config->getAppValue('user_ldap', 'background_sync_offset', '0'), + 'offset' => (int) $this->config->getAppValue('user_ldap', 'background_sync_offset', '0'), ]; if ( @@ -232,7 +233,7 @@ class Sync extends TimedJob { * @return bool */ public function qualifiesToRun($cycleData) { - $lastChange = (int)$this->config->getAppValue('user_ldap', $cycleData['prefix'] . '_lastChange', '0'); + $lastChange = (int) $this->config->getAppValue('user_ldap', $cycleData['prefix'] . '_lastChange', '0'); if ((time() - $lastChange) > 60 * 30) { return true; } @@ -246,7 +247,7 @@ class Sync extends TimedJob { */ protected function increaseOffset($cycleData) { $ldapConfig = new Configuration($cycleData['prefix']); - $cycleData['offset'] += (int)$ldapConfig->ldapPagingSize; + $cycleData['offset'] += (int) $ldapConfig->ldapPagingSize; $this->setCycle($cycleData); } diff --git a/apps/user_ldap/lib/Jobs/UpdateGroups.php b/apps/user_ldap/lib/Jobs/UpdateGroups.php index 9e72bcd8432..9a50dcf5710 100644 --- a/apps/user_ldap/lib/Jobs/UpdateGroups.php +++ b/apps/user_ldap/lib/Jobs/UpdateGroups.php @@ -24,7 +24,7 @@ class UpdateGroups extends TimedJob { ITimeFactory $timeFactory, ) { parent::__construct($timeFactory); - $this->interval = (int)$config->getAppValue('user_ldap', 'bgjRefreshInterval', '3600'); + $this->interval = (int) $config->getAppValue('user_ldap', 'bgjRefreshInterval', '3600'); } /** diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php index c29b8857e51..dcf2e6f62e1 100644 --- a/apps/user_ldap/lib/LDAP.php +++ b/apps/user_ldap/lib/LDAP.php @@ -293,7 +293,7 @@ class LDAP implements ILDAPWrapper { private function preFunctionCall(string $functionName, array $args): void { $this->curArgs = $args; - if(strcasecmp($functionName, 'ldap_bind') === 0 || strcasecmp($functionName, 'ldap_exop_passwd') === 0) { + if (strcasecmp($functionName, 'ldap_bind') === 0 || strcasecmp($functionName, 'ldap_exop_passwd') === 0) { // The arguments are not key value pairs // \OCA\User_LDAP\LDAP::bind passes 3 arguments, the 3rd being the pw // Remove it via direct array access for now, although a better solution could be found mebbe? @@ -312,8 +312,8 @@ class LDAP implements ILDAPWrapper { if ($this->isResource($item)) { return '(resource)'; } - if (isset($item[0]['value']['cookie']) && $item[0]['value']['cookie'] !== "") { - $item[0]['value']['cookie'] = "*opaque cookie*"; + if (isset($item[0]['value']['cookie']) && $item[0]['value']['cookie'] !== '') { + $item[0]['value']['cookie'] = '*opaque cookie*'; } return $item; }, $this->curArgs); diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index 79d23b8d618..74c4aa0dd37 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -259,7 +259,7 @@ abstract class AbstractMapping { * * @return string[] */ - public function getNamesBySearch(string $search, string $prefixMatch = "", string $postfixMatch = ""): array { + public function getNamesBySearch(string $search, string $prefixMatch = '', string $postfixMatch = ''): array { $statement = $this->dbc->prepare(' SELECT `owncloud_name` FROM `' . $this->getTableName() . '` @@ -352,11 +352,11 @@ abstract class AbstractMapping { try { $result = $this->dbc->insertIfNotExist($this->getTableName(), $row); - if ((bool)$result === true) { + if ((bool) $result === true) { $this->cache[$fdn] = $name; } // insertIfNotExist returns values as int - return (bool)$result; + return (bool) $result; } catch (\Exception $e) { return false; } @@ -406,7 +406,7 @@ abstract class AbstractMapping { * @param callable $preCallback * @param callable $postCallback * @return bool true on success, false when at least one row was not - * deleted + * deleted */ public function clearCb(callable $preCallback, callable $postCallback): bool { $picker = $this->dbc->getQueryBuilder(); @@ -437,7 +437,7 @@ abstract class AbstractMapping { $res = $query->execute(); $count = $res->fetchOne(); $res->closeCursor(); - return (int)$count; + return (int) $count; } public function countInvalidated(): int { @@ -448,6 +448,6 @@ abstract class AbstractMapping { $res = $query->execute(); $count = $res->fetchOne(); $res->closeCursor(); - return (int)$count; + return (int) $count; } } diff --git a/apps/user_ldap/lib/Migration/UUIDFix.php b/apps/user_ldap/lib/Migration/UUIDFix.php index 309910cdf0c..e853f3bba66 100644 --- a/apps/user_ldap/lib/Migration/UUIDFix.php +++ b/apps/user_ldap/lib/Migration/UUIDFix.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/Migration/UUIDFixGroup.php b/apps/user_ldap/lib/Migration/UUIDFixGroup.php index 4d039a72ebc..3924c91e7ba 100644 --- a/apps/user_ldap/lib/Migration/UUIDFixGroup.php +++ b/apps/user_ldap/lib/Migration/UUIDFixGroup.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/Migration/UUIDFixInsert.php b/apps/user_ldap/lib/Migration/UUIDFixInsert.php index 52c52190654..32649deee8e 100644 --- a/apps/user_ldap/lib/Migration/UUIDFixInsert.php +++ b/apps/user_ldap/lib/Migration/UUIDFixInsert.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -72,7 +73,7 @@ class UUIDFixInsert implements IRepairStep { $offset += $batchSize; } catch (\InvalidArgumentException $e) { if (str_contains($e->getMessage(), 'Background job arguments can\'t exceed 4000')) { - $batchSize = (int)floor(count($records) * 0.8); + $batchSize = (int) floor(count($records) * 0.8); $retry = true; } } diff --git a/apps/user_ldap/lib/Migration/UUIDFixUser.php b/apps/user_ldap/lib/Migration/UUIDFixUser.php index 0c292a2c2ae..71c3f638095 100644 --- a/apps/user_ldap/lib/Migration/UUIDFixUser.php +++ b/apps/user_ldap/lib/Migration/UUIDFixUser.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/Notification/Notifier.php b/apps/user_ldap/lib/Notification/Notifier.php index ca0fa6f0335..10a3efdcd2c 100644 --- a/apps/user_ldap/lib/Notification/Notifier.php +++ b/apps/user_ldap/lib/Notification/Notifier.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/lib/PagedResults/TLinkId.php b/apps/user_ldap/lib/PagedResults/TLinkId.php index 46d392995e0..7e10ee2936e 100644 --- a/apps/user_ldap/lib/PagedResults/TLinkId.php +++ b/apps/user_ldap/lib/PagedResults/TLinkId.php @@ -13,12 +13,12 @@ trait TLinkId { if (is_object($link)) { return spl_object_id($link); } elseif (is_resource($link)) { - return (int)$link; + return (int) $link; } elseif (is_array($link) && isset($link[0])) { if (is_object($link[0])) { return spl_object_id($link[0]); } elseif (is_resource($link[0])) { - return (int)$link[0]; + return (int) $link[0]; } } throw new \RuntimeException('No resource provided'); diff --git a/apps/user_ldap/lib/Settings/Admin.php b/apps/user_ldap/lib/Settings/Admin.php index a1de0a65362..c108980c40a 100644 --- a/apps/user_ldap/lib/Settings/Admin.php +++ b/apps/user_ldap/lib/Settings/Admin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -70,8 +71,8 @@ class Admin implements IDelegatedSettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/user_ldap/lib/Settings/Section.php b/apps/user_ldap/lib/Settings/Section.php index 2c8871db9ce..0b9ef86ef93 100644 --- a/apps/user_ldap/lib/Settings/Section.php +++ b/apps/user_ldap/lib/Settings/Section.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -46,8 +47,8 @@ class Section implements IIconSection { /** * @return int whether the form should be rather on the top or bottom of - * the settings navigation. The sections are arranged in ascending order of - * the priority values. It is required to return a value between 0 and 99. + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. * * E.g.: 70 */ diff --git a/apps/user_ldap/lib/User/DeletedUsersIndex.php b/apps/user_ldap/lib/User/DeletedUsersIndex.php index 4b5bb26fa96..684048c3489 100644 --- a/apps/user_ldap/lib/User/DeletedUsersIndex.php +++ b/apps/user_ldap/lib/User/DeletedUsersIndex.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only @@ -82,7 +83,7 @@ class DeletedUsersIndex { return; } $this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1'); - $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time()); + $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string) time()); $this->deletedUsers = null; } diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php index ead8e96f15c..127c8e95d2b 100644 --- a/apps/user_ldap/lib/User/Manager.php +++ b/apps/user_ldap/lib/User/Manager.php @@ -120,7 +120,7 @@ class Manager { * email, displayname, or others. * * @param bool $minimal - optional, set to true to skip attributes with big - * payload + * payload * @return string[] */ public function getAttributes($minimal = false) { @@ -144,7 +144,7 @@ class Manager { $this->access->getConnection()->ldapAttributeBirthDate, ]; - $homeRule = (string)$this->access->getConnection()->homeFolderNamingRule; + $homeRule = (string) $this->access->getConnection()->homeFolderNamingRule; if (str_starts_with($homeRule, 'attr:')) { $attributes[] = substr($homeRule, strlen('attr:')); } @@ -160,7 +160,7 @@ class Manager { $attributes = array_reduce($attributes, function ($list, $attribute) { - $attribute = strtolower(trim((string)$attribute)); + $attribute = strtolower(trim((string) $attribute)); if (!empty($attribute) && !in_array($attribute, $list)) { $list[] = $attribute; } @@ -181,7 +181,7 @@ class Manager { public function isDeletedUser($id) { $isDeleted = $this->ocConfig->getUserValue( $id, 'user_ldap', 'isDeleted', 0); - return (int)$isDeleted === 1; + return (int) $isDeleted === 1; } /** diff --git a/apps/user_ldap/lib/User/OfflineUser.php b/apps/user_ldap/lib/User/OfflineUser.php index 24f11a5a1f9..af8f9e03183 100644 --- a/apps/user_ldap/lib/User/OfflineUser.php +++ b/apps/user_ldap/lib/User/OfflineUser.php @@ -176,7 +176,7 @@ class OfflineUser { if ($this->lastLogin === null) { $this->fetchDetails(); } - return (int)$this->lastLogin; + return (int) $this->lastLogin; } /** @@ -187,14 +187,14 @@ class OfflineUser { if ($this->foundDeleted === null) { $this->fetchDetails(); } - return (int)$this->foundDeleted; + return (int) $this->foundDeleted; } public function getExtStorageHome(): string { if ($this->extStorageHome === null) { $this->fetchDetails(); } - return (string)$this->extStorageHome; + return (string) $this->extStorageHome; } /** diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index 53e2e2a983d..09a072aa2ca 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -136,7 +136,7 @@ class User { return; } $this->config->setUserValue($this->getUsername(), 'user_ldap', 'isDeleted', '1'); - $this->config->setUserValue($this->getUsername(), 'user_ldap', 'foundDeleted', (string)time()); + $this->config->setUserValue($this->getUsername(), 'user_ldap', 'foundDeleted', (string) time()); } /** @@ -159,11 +159,11 @@ class User { $displayName = $displayName2 = ''; $attr = strtolower($this->connection->ldapUserDisplayName); if (isset($ldapEntry[$attr])) { - $displayName = (string)$ldapEntry[$attr][0]; + $displayName = (string) $ldapEntry[$attr][0]; } $attr = strtolower($this->connection->ldapUserDisplayName2); if (isset($ldapEntry[$attr])) { - $displayName2 = (string)$ldapEntry[$attr][0]; + $displayName2 = (string) $ldapEntry[$attr][0]; } if ($displayName !== '') { $this->composeAndStoreDisplayName($displayName, $displayName2); @@ -229,12 +229,12 @@ class User { $attr = strtolower($this->connection->ldapAttributePhone); if (!empty($attr)) { // attribute configured $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_PHONE] - = $ldapEntry[$attr][0] ?? ""; + = $ldapEntry[$attr][0] ?? ''; } //User Profile Field - website $attr = strtolower($this->connection->ldapAttributeWebsite); if (isset($ldapEntry[$attr])) { - $cutPosition = strpos($ldapEntry[$attr][0], " "); + $cutPosition = strpos($ldapEntry[$attr][0], ' '); if ($cutPosition) { // drop appended label $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_WEBSITE] @@ -244,7 +244,7 @@ class User { = $ldapEntry[$attr][0]; } } elseif (!empty($attr)) { // configured, but not defined - $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_WEBSITE] = ""; + $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_WEBSITE] = ''; } //User Profile Field - Address $attr = strtolower($this->connection->ldapAttributeAddress); @@ -252,43 +252,43 @@ class User { if (str_contains($ldapEntry[$attr][0], '$')) { // basic format conversion from postalAddress syntax to commata delimited $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ADDRESS] - = str_replace('$', ", ", $ldapEntry[$attr][0]); + = str_replace('$', ', ', $ldapEntry[$attr][0]); } else { $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ADDRESS] = $ldapEntry[$attr][0]; } } elseif (!empty($attr)) { // configured, but not defined - $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ADDRESS] = ""; + $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ADDRESS] = ''; } //User Profile Field - Twitter $attr = strtolower($this->connection->ldapAttributeTwitter); if (!empty($attr)) { $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_TWITTER] - = $ldapEntry[$attr][0] ?? ""; + = $ldapEntry[$attr][0] ?? ''; } //User Profile Field - fediverse $attr = strtolower($this->connection->ldapAttributeFediverse); if (!empty($attr)) { $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_FEDIVERSE] - = $ldapEntry[$attr][0] ?? ""; + = $ldapEntry[$attr][0] ?? ''; } //User Profile Field - organisation $attr = strtolower($this->connection->ldapAttributeOrganisation); if (!empty($attr)) { $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ORGANISATION] - = $ldapEntry[$attr][0] ?? ""; + = $ldapEntry[$attr][0] ?? ''; } //User Profile Field - role $attr = strtolower($this->connection->ldapAttributeRole); if (!empty($attr)) { $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ROLE] - = $ldapEntry[$attr][0] ?? ""; + = $ldapEntry[$attr][0] ?? ''; } //User Profile Field - headline $attr = strtolower($this->connection->ldapAttributeHeadline); if (!empty($attr)) { $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_HEADLINE] - = $ldapEntry[$attr][0] ?? ""; + = $ldapEntry[$attr][0] ?? ''; } //User Profile Field - biography $attr = strtolower($this->connection->ldapAttributeBiography); @@ -302,7 +302,7 @@ class User { = $ldapEntry[$attr][0]; } } elseif (!empty($attr)) { // configured, but not defined - $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY] = ""; + $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY] = ''; } //User Profile Field - birthday $attr = strtolower($this->connection->ldapAttributeBirthDate); @@ -311,7 +311,7 @@ class User { try { $birthdate = $this->birthdateParser->parseBirthdate($value); $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIRTHDATE] - = $birthdate->format("Y-m-d"); + = $birthdate->format('Y-m-d'); } catch (InvalidArgumentException $e) { // Invalid date -> just skip the property $this->logger->info("Failed to parse user's birthdate from LDAP: $value", [ @@ -330,11 +330,11 @@ class User { $this->updateProfile($profileValues); $this->logger->info("updated profile uid=$username", ['app' => 'user_ldap']); } else { - $this->logger->debug("profile data from LDAP unchanged", ['app' => 'user_ldap', 'uid' => $username]); + $this->logger->debug('profile data from LDAP unchanged', ['app' => 'user_ldap', 'uid' => $username]); } unset($attr); } elseif ($profileCached !== null) { // message delayed, to declutter log - $this->logger->debug("skipping profile check, while cached data exist", ['app' => 'user_ldap', 'uid' => $username]); + $this->logger->debug('skipping profile check, while cached data exist', ['app' => 'user_ldap', 'uid' => $username]); } //Avatar @@ -377,7 +377,7 @@ class User { * @throws \Exception */ public function getHomePath($valueFromLDAP = null) { - $path = (string)$valueFromLDAP; + $path = (string) $valueFromLDAP; $attr = null; if (is_null($valueFromLDAP) @@ -483,7 +483,7 @@ class User { * @return string the effective display name */ public function composeAndStoreDisplayName($displayName, $displayName2 = '') { - $displayName2 = (string)$displayName2; + $displayName2 = (string) $displayName2; if ($displayName2 !== '') { $displayName .= ' (' . $displayName2 . ')'; } @@ -532,20 +532,20 @@ class User { if ($this->wasRefreshed('email')) { return; } - $email = (string)$valueFromLDAP; + $email = (string) $valueFromLDAP; if (is_null($valueFromLDAP)) { $emailAttribute = $this->connection->ldapEmailAttribute; if ($emailAttribute !== '') { $aEmail = $this->access->readAttribute($this->dn, $emailAttribute); if (is_array($aEmail) && (count($aEmail) > 0)) { - $email = (string)$aEmail[0]; + $email = (string) $aEmail[0]; } } } if ($email !== '') { $user = $this->userManager->get($this->uid); if (!is_null($user)) { - $currentEmail = (string)$user->getSystemEMailAddress(); + $currentEmail = (string) $user->getSystemEMailAddress(); if ($currentEmail !== $email) { $user->setEMailAddress($email); } @@ -570,7 +570,7 @@ class User { * * fetches the quota from LDAP and stores it as Nextcloud user value * @param ?string $valueFromLDAP the quota attribute's value can be passed, - * to save the readAttribute request + * to save the readAttribute request * @return void */ public function updateQuota($valueFromLDAP = null) { @@ -804,7 +804,7 @@ class User { */ public function handlePasswordExpiry($params) { $ppolicyDN = $this->connection->ldapDefaultPPolicyDN; - if (empty($ppolicyDN) || ((int)$this->connection->turnOnPasswordChange !== 1)) { + if (empty($ppolicyDN) || ((int) $this->connection->turnOnPasswordChange !== 1)) { return;//password expiry handling disabled } $uid = $params['uid']; @@ -838,7 +838,7 @@ class User { //handle grace login if (!empty($pwdGraceUseTime)) { //was this a grace login? if (!empty($pwdGraceAuthNLimit) - && count($pwdGraceUseTime) < (int)$pwdGraceAuthNLimit[0]) { //at least one more grace login available? + && count($pwdGraceUseTime) < (int) $pwdGraceAuthNLimit[0]) { //at least one more grace login available? $this->config->setUserValue($uid, 'user_ldap', 'needsPasswordReset', 'true'); header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute( 'user_ldap.renewPassword.showRenewPasswordForm', ['user' => $uid])); @@ -859,8 +859,8 @@ class User { if (!empty($pwdChangedTime)) { if (!empty($pwdMaxAge) && !empty($pwdExpireWarning)) { - $pwdMaxAgeInt = (int)$pwdMaxAge[0]; - $pwdExpireWarningInt = (int)$pwdExpireWarning[0]; + $pwdMaxAgeInt = (int) $pwdMaxAge[0]; + $pwdExpireWarningInt = (int) $pwdExpireWarning[0]; if ($pwdMaxAgeInt > 0 && $pwdExpireWarningInt > 0) { $pwdChangedTimeDt = \DateTime::createFromFormat('YmdHisZ', $pwdChangedTime[0]); $pwdChangedTimeDt->add(new \DateInterval('PT'.$pwdMaxAgeInt.'S')); diff --git a/apps/user_ldap/lib/UserPluginManager.php b/apps/user_ldap/lib/UserPluginManager.php index 70e477946b8..ae167398ea3 100644 --- a/apps/user_ldap/lib/UserPluginManager.php +++ b/apps/user_ldap/lib/UserPluginManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -41,14 +42,14 @@ class UserPluginManager { $this->respondToActions |= $respondToActions; foreach ($this->which as $action => $v) { - if (is_int($action) && (bool)($respondToActions & $action)) { + if (is_int($action) && (bool) ($respondToActions & $action)) { $this->which[$action] = $plugin; - \OCP\Server::get(LoggerInterface::class)->debug("Registered action ".$action." to plugin ".get_class($plugin), ['app' => 'user_ldap']); + \OCP\Server::get(LoggerInterface::class)->debug('Registered action '.$action.' to plugin '.get_class($plugin), ['app' => 'user_ldap']); } } if (method_exists($plugin, 'deleteUser')) { $this->which['deleteUser'] = $plugin; - \OCP\Server::get(LoggerInterface::class)->debug("Registered action deleteUser to plugin ".get_class($plugin), ['app' => 'user_ldap']); + \OCP\Server::get(LoggerInterface::class)->debug('Registered action deleteUser to plugin '.get_class($plugin), ['app' => 'user_ldap']); } } diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index e55dca03d25..ffae802b6ea 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -194,7 +194,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I if ($user->getUsername() !== false && $this->access->setPassword($user->getDN(), $password)) { $ldapDefaultPPolicyDN = $this->access->connection->ldapDefaultPPolicyDN; $turnOnPasswordChange = $this->access->connection->turnOnPasswordChange; - if (!empty($ldapDefaultPPolicyDN) && ((int)$turnOnPasswordChange === 1)) { + if (!empty($ldapDefaultPPolicyDN) && ((int) $turnOnPasswordChange === 1)) { //remove last password expiry warning if any $notification = $this->notificationManager->createNotification(); $notification->setApp('user_ldap') @@ -261,7 +261,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * checks whether a user is still available on LDAP * * @param string|\OCA\User_LDAP\User\User $user either the Nextcloud user - * name or an instance of that user + * name or an instance of that user * @throws \Exception * @throws \OC\ServerNotAvailableException */ @@ -277,7 +277,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I if (!$ignoreCache) { $userExists = $this->access->connection->getFromCache($cacheKey); if (!is_null($userExists)) { - return (bool)$userExists; + return (bool) $userExists; } } @@ -322,7 +322,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I public function userExists($uid) { $userExists = $this->access->connection->getFromCache('userExists'.$uid); if (!is_null($userExists)) { - return (bool)$userExists; + return (bool) $userExists; } $userExists = $this->access->userManager->exists($uid); @@ -465,7 +465,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I $this->access->connection->writeToCache($cacheKey, $displayName); } if ($user instanceof OfflineUser) { - /** @var OfflineUser $user*/ + /** @var OfflineUser $user */ $displayName = $user->getDisplayName(); } return $displayName; @@ -521,12 +521,12 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * compared with \OC\User\Backend::CREATE_USER etc. */ public function implementsActions($actions) { - return (bool)((Backend::CHECK_PASSWORD + return (bool) ((Backend::CHECK_PASSWORD | Backend::GET_HOME | Backend::GET_DISPLAYNAME | (($this->access->connection->ldapUserAvatarRule !== 'none') ? Backend::PROVIDE_AVATAR : 0) | Backend::COUNT_USERS - | (((int)$this->access->connection->turnOnPasswordChange === 1)? Backend::SET_PASSWORD :0) + | (((int) $this->access->connection->turnOnPasswordChange === 1)? Backend::SET_PASSWORD :0) | $this->userPluginManager->getImplementedActions()) & $actions); } @@ -622,7 +622,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I ); } } else { - throw new \UnexpectedValueException("LDAP Plugin: Method createUser changed to return the user DN instead of boolean."); + throw new \UnexpectedValueException('LDAP Plugin: Method createUser changed to return the user DN instead of boolean.'); } } return (bool) $dn; @@ -631,7 +631,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I } public function isUserEnabled(string $uid, callable $queryDatabaseValue): bool { - if ($this->deletedUsersIndex->isUserMarked($uid) && ((int)$this->access->connection->markRemnantsAsDisabled === 1)) { + if ($this->deletedUsersIndex->isUserMarked($uid) && ((int) $this->access->connection->markRemnantsAsDisabled === 1)) { return false; } else { return $queryDatabaseValue(); diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php index 320dfdb68cf..9572fb03e32 100644 --- a/apps/user_ldap/lib/User_Proxy.php +++ b/apps/user_ldap/lib/User_Proxy.php @@ -204,7 +204,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP * check if a user exists on LDAP * * @param string|\OCA\User_LDAP\User\User $user either the Nextcloud user - * name or an instance of that user + * name or an instance of that user */ public function userExistsOnLDAP($user, bool $ignoreCache = false): bool { $id = ($user instanceof User) ? $user->getUsername() : $user; @@ -353,7 +353,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP foreach ($this->backends as $backend) { $backendUsers = $backend->countUsers(); if ($backendUsers !== false) { - $users = (int)$users + $backendUsers; + $users = (int) $users + $backendUsers; } } return $users; @@ -413,7 +413,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP } public function getDisabledUserList(?int $limit = null, int $offset = 0, string $search = ''): array { - if ((int)$this->getAccess(array_key_first($this->backends) ?? '')->connection->markRemnantsAsDisabled !== 1) { + if ((int) $this->getAccess(array_key_first($this->backends) ?? '')->connection->markRemnantsAsDisabled !== 1) { return []; } $disabledUsers = $this->deletedUsersIndex->getUsers(); diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php index 3720b509068..f8d35aa7998 100644 --- a/apps/user_ldap/lib/Wizard.php +++ b/apps/user_ldap/lib/Wizard.php @@ -86,7 +86,7 @@ class Wizard extends LDAPUtility { throw new \Exception('Internal error: Invalid object type', 500); } - return (int)$result; + return (int) $result; } /** @@ -198,7 +198,7 @@ class Wizard extends LDAPUtility { if ($attr !== '' && $attr !== 'displayName') { // most likely not the default value with upper case N, // verify it still produces a result - $count = (int)$this->countUsersWithAttribute($attr, true); + $count = (int) $this->countUsersWithAttribute($attr, true); if ($count > 0) { //no change, but we sent it back to make sure the user interface //is still correct, even if the ajax call was cancelled meanwhile @@ -210,7 +210,7 @@ class Wizard extends LDAPUtility { // first attribute that has at least one result wins $displayNameAttrs = ['displayname', 'cn']; foreach ($displayNameAttrs as $attr) { - $count = (int)$this->countUsersWithAttribute($attr, true); + $count = (int) $this->countUsersWithAttribute($attr, true); if ($count > 0) { $this->applyFind('ldap_display_name', $attr); @@ -238,7 +238,7 @@ class Wizard extends LDAPUtility { $attr = $this->configuration->ldapEmailAttribute; if ($attr !== '') { - $count = (int)$this->countUsersWithAttribute($attr, true); + $count = (int) $this->countUsersWithAttribute($attr, true); if ($count > 0) { return false; } @@ -382,7 +382,7 @@ class Wizard extends LDAPUtility { $this->fetchGroups($dbKey, $confKey); if ($testMemberOf) { - $this->configuration->hasMemberOfFilterSupport = (string)$this->testMemberOf(); + $this->configuration->hasMemberOfFilterSupport = (string) $this->testMemberOf(); $this->result->markChange(); if (!$this->configuration->hasMemberOfFilterSupport) { throw new \Exception('memberOf is not supported by the server'); @@ -668,8 +668,8 @@ class Wizard extends LDAPUtility { if ($settingsFound === true) { $config = [ - 'ldapPort' => (string)$p, - 'ldapTLS' => (string)$t, + 'ldapPort' => (string) $p, + 'ldapTLS' => (string) $t, ]; $this->configuration->setConfiguration($config); $this->logger->debug( @@ -757,7 +757,7 @@ class Wizard extends LDAPUtility { $port = $hostInfo['port']; $host = str_replace(':'.$port, '', $host); $this->applyFind('ldap_host', $host); - $this->applyFind('ldap_port', (string)$port); + $this->applyFind('ldap_port', (string) $port); } } @@ -858,8 +858,8 @@ class Wizard extends LDAPUtility { /** * creates an LDAP Filter from given configuration * @param int $filterType int, for which use case the filter shall be created - * can be any of self::LFILTER_USER_LIST, self::LFILTER_LOGIN or - * self::LFILTER_GROUP_LIST + * can be any of self::LFILTER_USER_LIST, self::LFILTER_LOGIN or + * self::LFILTER_GROUP_LIST * @throws \Exception */ private function composeLdapFilter(int $filterType): string { @@ -1024,7 +1024,7 @@ class Wizard extends LDAPUtility { private function connectAndBind(int $port, bool $tls): bool { //connect, does not really trigger any server communication $host = $this->configuration->ldapHost; - $hostInfo = parse_url((string)$host); + $hostInfo = parse_url((string) $host); if (!is_string($host) || !$hostInfo) { throw new \Exception(self::$l->t('Invalid Host')); } @@ -1032,7 +1032,7 @@ class Wizard extends LDAPUtility { 'Wiz: Attempting to connect', ['app' => 'user_ldap'] ); - $cr = $this->ldap->connect($host, (string)$port); + $cr = $this->ldap->connect($host, (string) $port); if (!$this->ldap->isResource($cr)) { throw new \Exception(self::$l->t('Invalid Host')); } @@ -1069,7 +1069,7 @@ class Wizard extends LDAPUtility { if ($login === true) { $this->logger->debug( - 'Wiz: Bind successful to Port '. $port . ' TLS ' . (int)$tls, + 'Wiz: Bind successful to Port '. $port . ' TLS ' . (int) $tls, ['app' => 'user_ldap'] ); return true; @@ -1114,9 +1114,9 @@ class Wizard extends LDAPUtility { * @param string[] $filters array, the filters that shall be used in the search * @param string $attr the attribute of which a list of values shall be returned * @param int $dnReadLimit the amount of how many DNs should be analyzed. - * The lower, the faster + * The lower, the faster * @param string $maxF string. if not null, this variable will have the filter that - * yields most result entries + * yields most result entries * @return array|false an array with the values on success, false otherwise */ public function cumulativeSearchOnAttribute(array $filters, string $attr, int $dnReadLimit = 3, ?string &$maxF = null) { @@ -1190,9 +1190,9 @@ class Wizard extends LDAPUtility { * @param string $attr the attribute to look for * @param string $dbkey the dbkey of the setting the feature is connected to * @param string $confkey the confkey counterpart for the $dbkey as used in the - * Configuration class + * Configuration class * @param bool $po whether the objectClass with most result entries - * shall be pre-selected via the result + * shall be pre-selected via the result * @return array list of found items. * @throws \Exception */ @@ -1244,7 +1244,7 @@ class Wizard extends LDAPUtility { * @param string $attribute the attribute values to look for * @param array &$known new values will be appended here * @return int state on of the class constants LRESULT_PROCESSED_OK, - * LRESULT_PROCESSED_INVALID or LRESULT_PROCESSED_SKIP + * LRESULT_PROCESSED_INVALID or LRESULT_PROCESSED_SKIP */ private function getAttributeValuesFromEntry(array $result, string $attribute, array &$known): int { if (!isset($result['count']) @@ -1328,7 +1328,7 @@ class Wizard extends LDAPUtility { //636 ← LDAPS / SSL //7xxx ← UCS. need to be checked first, because both ports may be open $host = $this->configuration->ldapHost; - $port = (int)$this->configuration->ldapPort; + $port = (int) $this->configuration->ldapPort; $portSettings = []; //In case the port is already provided, we will check this first diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php index ff2eda99abf..62d5a7e8d07 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -51,7 +52,7 @@ class AccessTest extends TestCase { private $userManager; /** @var Helper|\PHPUnit\Framework\MockObject\MockObject */ private $helper; - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ private $config; /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */ private $ncUserManager; diff --git a/apps/user_ldap/tests/ConnectionTest.php b/apps/user_ldap/tests/ConnectionTest.php index 1054448198b..dfa3cf6beda 100644 --- a/apps/user_ldap/tests/ConnectionTest.php +++ b/apps/user_ldap/tests/ConnectionTest.php @@ -18,10 +18,10 @@ use OCA\User_LDAP\ILDAPWrapper; * @package OCA\User_LDAP\Tests */ class ConnectionTest extends \Test\TestCase { - /** @var \OCA\User_LDAP\ILDAPWrapper|\PHPUnit\Framework\MockObject\MockObject */ + /** @var \OCA\User_LDAP\ILDAPWrapper|\PHPUnit\Framework\MockObject\MockObject */ protected $ldap; - /** @var Connection */ + /** @var Connection */ protected $connection; protected function setUp(): void { diff --git a/apps/user_ldap/tests/GroupLDAPPluginTest.php b/apps/user_ldap/tests/GroupLDAPPluginTest.php index 24cfb5d51e9..c2890eb14a0 100644 --- a/apps/user_ldap/tests/GroupLDAPPluginTest.php +++ b/apps/user_ldap/tests/GroupLDAPPluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php index 06d64b99a4f..d454e9f80d4 100644 --- a/apps/user_ldap/tests/Group_LDAPTest.php +++ b/apps/user_ldap/tests/Group_LDAPTest.php @@ -969,7 +969,7 @@ class Group_LDAPTest extends TestCase { case 'ldapDynamicGroupMemberURL': return ''; case 'ldapNestedGroups': - return (int)$nestedGroups; + return (int) $nestedGroups; case 'ldapGroupMemberAssocAttr': return 'member'; case 'ldapGroupFilter': diff --git a/apps/user_ldap/tests/HelperTest.php b/apps/user_ldap/tests/HelperTest.php index bbb3956f918..97775a763d4 100644 --- a/apps/user_ldap/tests/HelperTest.php +++ b/apps/user_ldap/tests/HelperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php index ef84beb8f56..fd24fe8a891 100644 --- a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php +++ b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php @@ -20,10 +20,10 @@ use OCP\Share\IManager; use Psr\Log\LoggerInterface; abstract class AbstractIntegrationTest { - /** @var LDAP */ + /** @var LDAP */ protected $ldap; - /** @var Connection */ + /** @var Connection */ protected $connection; /** @var Access */ @@ -35,7 +35,7 @@ abstract class AbstractIntegrationTest { /** @var Helper */ protected $helper; - /** @var string */ + /** @var string */ protected $base; /** @var string[] */ diff --git a/apps/user_ldap/tests/Integration/Bootstrap.php b/apps/user_ldap/tests/Integration/Bootstrap.php index 872e06139ff..4ca5268ef17 100644 --- a/apps/user_ldap/tests/Integration/Bootstrap.php +++ b/apps/user_ldap/tests/Integration/Bootstrap.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php index 7dc2aa00065..f42c6d4bccd 100644 --- a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php +++ b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php @@ -21,28 +21,28 @@ use OCA\User_LDAP\LDAP; * */ class ExceptionOnLostConnection { - /** @var string */ + /** @var string */ private $toxiProxyHost; - /** @var string */ + /** @var string */ private $toxiProxyName; - /** @var string */ + /** @var string */ private $ldapBase; - /** @var string|null */ + /** @var string|null */ private $ldapBindDN; - /** @var string|null */ + /** @var string|null */ private $ldapBindPwd; - /** @var string */ + /** @var string */ private $ldapHost; - /** @var \OCA\User_LDAP\LDAP */ + /** @var \OCA\User_LDAP\LDAP */ private $ldap; - /** @var bool */ + /** @var bool */ private $originalProxyState; /** @@ -117,10 +117,10 @@ class ExceptionOnLostConnection { try { $this->ldap->search($cr, $this->ldapBase, 'objectClass=*', ['dn'], true, 5); } catch (ServerNotAvailableException $e) { - print("Test PASSED" . PHP_EOL); + print('Test PASSED' . PHP_EOL); exit(0); } - print("Test FAILED" . PHP_EOL); + print('Test FAILED' . PHP_EOL); exit(1); } diff --git a/apps/user_ldap/tests/Integration/Lib/IntegrationTestAttributeDetection.php b/apps/user_ldap/tests/Integration/Lib/IntegrationTestAttributeDetection.php index 27d08861723..7969b70747c 100644 --- a/apps/user_ldap/tests/Integration/Lib/IntegrationTestAttributeDetection.php +++ b/apps/user_ldap/tests/Integration/Lib/IntegrationTestAttributeDetection.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/Integration/Lib/IntegrationTestFetchUsersByLoginName.php b/apps/user_ldap/tests/Integration/Lib/IntegrationTestFetchUsersByLoginName.php index 2a8ff26865d..fe7a3d2226a 100644 --- a/apps/user_ldap/tests/Integration/Lib/IntegrationTestFetchUsersByLoginName.php +++ b/apps/user_ldap/tests/Integration/Lib/IntegrationTestFetchUsersByLoginName.php @@ -17,7 +17,7 @@ use Psr\Log\LoggerInterface; require_once __DIR__ . '/../Bootstrap.php'; class IntegrationTestFetchUsersByLoginName extends AbstractIntegrationTest { - /** @var UserMapping */ + /** @var UserMapping */ protected $mapping; /** @var User_LDAP */ diff --git a/apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php b/apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php index 56095a2da8b..e7b68735f6e 100644 --- a/apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php +++ b/apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php @@ -17,7 +17,7 @@ use Psr\Log\LoggerInterface; require_once __DIR__ . '/../Bootstrap.php'; class IntegrationTestPaging extends AbstractIntegrationTest { - /** @var UserMapping */ + /** @var UserMapping */ protected $mapping; /** @var User_LDAP */ diff --git a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php index df7dfe6b099..082c8ee46d4 100644 --- a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php +++ b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php @@ -22,7 +22,7 @@ use Psr\Log\LoggerInterface; require_once __DIR__ . '/../../Bootstrap.php'; class IntegrationTestUserAvatar extends AbstractIntegrationTest { - /** @var UserMapping */ + /** @var UserMapping */ protected $mapping; /** diff --git a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php index a1fc56dc47d..ed637155e5a 100644 --- a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php +++ b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php @@ -18,7 +18,7 @@ use Psr\Log\LoggerInterface; require_once __DIR__ . '/../../Bootstrap.php'; class IntegrationTestUserCleanUp extends AbstractIntegrationTest { - /** @var UserMapping */ + /** @var UserMapping */ protected $mapping; /** diff --git a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserDisplayName.php b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserDisplayName.php index 846d9d803f4..e8f94dac419 100644 --- a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserDisplayName.php +++ b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserDisplayName.php @@ -17,7 +17,7 @@ use Psr\Log\LoggerInterface; require_once __DIR__ . '/../../Bootstrap.php'; class IntegrationTestUserDisplayName extends AbstractIntegrationTest { - /** @var UserMapping */ + /** @var UserMapping */ protected $mapping; /** diff --git a/apps/user_ldap/tests/Jobs/SyncTest.php b/apps/user_ldap/tests/Jobs/SyncTest.php index 850e1ed42a4..33f2b43f41e 100644 --- a/apps/user_ldap/tests/Jobs/SyncTest.php +++ b/apps/user_ldap/tests/Jobs/SyncTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -23,27 +24,27 @@ use OCP\Notification\IManager; use Test\TestCase; class SyncTest extends TestCase { - /** @var array */ + /** @var array */ protected $arguments; - /** @var Helper|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Helper|\PHPUnit\Framework\MockObject\MockObject */ protected $helper; - /** @var LDAP|\PHPUnit\Framework\MockObject\MockObject */ + /** @var LDAP|\PHPUnit\Framework\MockObject\MockObject */ protected $ldapWrapper; - /** @var Manager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Manager|\PHPUnit\Framework\MockObject\MockObject */ protected $userManager; - /** @var UserMapping|\PHPUnit\Framework\MockObject\MockObject */ + /** @var UserMapping|\PHPUnit\Framework\MockObject\MockObject */ protected $mapper; - /** @var Sync */ + /** @var Sync */ protected $sync; - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ protected $config; - /** @var IAvatarManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IAvatarManager|\PHPUnit\Framework\MockObject\MockObject */ protected $avatarManager; - /** @var IDBConnection|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IDBConnection|\PHPUnit\Framework\MockObject\MockObject */ protected $dbc; - /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */ protected $ncUserManager; - /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ protected $notificationManager; /** @var ConnectionFactory|\PHPUnit\Framework\MockObject\MockObject */ protected $connectionFactory; diff --git a/apps/user_ldap/tests/LDAPGroupPluginDummy.php b/apps/user_ldap/tests/LDAPGroupPluginDummy.php index 0d47fbbd290..782136362f4 100644 --- a/apps/user_ldap/tests/LDAPGroupPluginDummy.php +++ b/apps/user_ldap/tests/LDAPGroupPluginDummy.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/LDAPProviderTest.php b/apps/user_ldap/tests/LDAPProviderTest.php index b4d189033d0..f5045b82d66 100644 --- a/apps/user_ldap/tests/LDAPProviderTest.php +++ b/apps/user_ldap/tests/LDAPProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -32,9 +33,9 @@ class LDAPProviderTest extends \Test\TestCase { private function getServerMock(IUserLDAP $userBackend, IGroupLDAP $groupBackend) { $server = $this->getMockBuilder('OC\Server') - ->setMethods(['getUserManager', 'getBackends', 'getGroupManager']) - ->setConstructorArgs(['', new \OC\Config(\OC::$configDir)]) - ->getMock(); + ->setMethods(['getUserManager', 'getBackends', 'getGroupManager']) + ->setConstructorArgs(['', new \OC\Config(\OC::$configDir)]) + ->getMock(); $server->expects($this->any()) ->method('getUserManager') ->willReturn($this->getUserManagerMock($userBackend)); @@ -94,9 +95,9 @@ class LDAPProviderTest extends \Test\TestCase { $this->expectExceptionMessage('User id not found in LDAP'); $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods(['userExists']) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods(['userExists']) + ->disableOriginalConstructor() + ->getMock(); $userBackend->expects($this->any())->method('userExists')->willReturn(false); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); @@ -107,9 +108,9 @@ class LDAPProviderTest extends \Test\TestCase { public function testGetUserDN() { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods(['userExists', 'getLDAPAccess', 'username2dn']) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods(['userExists', 'getLDAPAccess', 'username2dn']) + ->disableOriginalConstructor() + ->getMock(); $userBackend->expects($this->once()) ->method('userExists') ->willReturn(true); @@ -179,9 +180,9 @@ class LDAPProviderTest extends \Test\TestCase { public function testGetUserName() { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods(['dn2UserName']) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods(['dn2UserName']) + ->disableOriginalConstructor() + ->getMock(); $userBackend->expects($this->any()) ->method('dn2UserName') ->willReturn('existing_user'); @@ -195,9 +196,9 @@ class LDAPProviderTest extends \Test\TestCase { public function testDNasBaseParameter() { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods([]) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods([]) + ->disableOriginalConstructor() + ->getMock(); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); @@ -211,9 +212,9 @@ class LDAPProviderTest extends \Test\TestCase { public function testSanitizeDN() { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods([]) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods([]) + ->disableOriginalConstructor() + ->getMock(); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); @@ -231,9 +232,9 @@ class LDAPProviderTest extends \Test\TestCase { $this->expectExceptionMessage('User id not found in LDAP'); $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods(['userExists']) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods(['userExists']) + ->disableOriginalConstructor() + ->getMock(); $userBackend->expects($this->any())->method('userExists')->willReturn(false); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); @@ -244,9 +245,9 @@ class LDAPProviderTest extends \Test\TestCase { public function testGetLDAPConnection() { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods(['userExists', 'getNewLDAPConnection']) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods(['userExists', 'getNewLDAPConnection']) + ->disableOriginalConstructor() + ->getMock(); $userBackend->expects($this->any()) ->method('userExists') ->willReturn(true); @@ -314,9 +315,9 @@ class LDAPProviderTest extends \Test\TestCase { $this->expectExceptionMessage('User id not found in LDAP'); $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods(['userExists']) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods(['userExists']) + ->disableOriginalConstructor() + ->getMock(); $userBackend->expects($this->any())->method('userExists')->willReturn(false); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); @@ -355,9 +356,9 @@ class LDAPProviderTest extends \Test\TestCase { ->willReturn($dn); $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods(['userExists', 'getLDAPAccess', 'getConnection', 'getConfiguration']) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods(['userExists', 'getLDAPAccess', 'getConnection', 'getConfiguration']) + ->disableOriginalConstructor() + ->getMock(); $userBackend->expects($this->atLeastOnce()) ->method('userExists') ->willReturn(true); @@ -377,9 +378,9 @@ class LDAPProviderTest extends \Test\TestCase { $this->expectExceptionMessage('User id not found in LDAP'); $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods(['userExists']) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods(['userExists']) + ->disableOriginalConstructor() + ->getMock(); $userBackend->expects($this->any())->method('userExists')->willReturn(false); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); @@ -411,9 +412,9 @@ class LDAPProviderTest extends \Test\TestCase { ->willReturn($connection); $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods(['userExists', 'getLDAPAccess', 'getConnection', 'getConfiguration']) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods(['userExists', 'getLDAPAccess', 'getConnection', 'getConfiguration']) + ->disableOriginalConstructor() + ->getMock(); $userBackend->expects($this->any()) ->method('userExists') ->willReturn(true); @@ -433,9 +434,9 @@ class LDAPProviderTest extends \Test\TestCase { $this->expectExceptionMessage('User id not found in LDAP'); $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods(['userExists']) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods(['userExists']) + ->disableOriginalConstructor() + ->getMock(); $userBackend->expects($this->any())->method('userExists')->willReturn(false); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); @@ -446,9 +447,9 @@ class LDAPProviderTest extends \Test\TestCase { public function testClearCache() { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods(['userExists', 'getLDAPAccess', 'getConnection', 'clearCache']) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods(['userExists', 'getLDAPAccess', 'getConnection', 'clearCache']) + ->disableOriginalConstructor() + ->getMock(); $userBackend->expects($this->once()) ->method('userExists') ->willReturn(true); @@ -513,9 +514,9 @@ class LDAPProviderTest extends \Test\TestCase { public function testDnExists() { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods(['dn2UserName']) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods(['dn2UserName']) + ->disableOriginalConstructor() + ->getMock(); $userBackend->expects($this->any()) ->method('dn2UserName') ->willReturn('existing_user'); @@ -528,9 +529,9 @@ class LDAPProviderTest extends \Test\TestCase { public function testFlagRecord() { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods([]) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods([]) + ->disableOriginalConstructor() + ->getMock(); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); @@ -541,9 +542,9 @@ class LDAPProviderTest extends \Test\TestCase { public function testUnflagRecord() { $userBackend = $this->getMockBuilder('OCA\User_LDAP\User_LDAP') - ->setMethods([]) - ->disableOriginalConstructor() - ->getMock(); + ->setMethods([]) + ->disableOriginalConstructor() + ->getMock(); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); diff --git a/apps/user_ldap/tests/LDAPTest.php b/apps/user_ldap/tests/LDAPTest.php index 51ed0c2b462..5c760e6b646 100644 --- a/apps/user_ldap/tests/LDAPTest.php +++ b/apps/user_ldap/tests/LDAPTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/LDAPUserPluginDummy.php b/apps/user_ldap/tests/LDAPUserPluginDummy.php index f6edf3df63b..9c664406d9c 100644 --- a/apps/user_ldap/tests/LDAPUserPluginDummy.php +++ b/apps/user_ldap/tests/LDAPUserPluginDummy.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/Mapping/AbstractMappingTest.php b/apps/user_ldap/tests/Mapping/AbstractMappingTest.php index 7de3825a323..478e5ea0395 100644 --- a/apps/user_ldap/tests/Mapping/AbstractMappingTest.php +++ b/apps/user_ldap/tests/Mapping/AbstractMappingTest.php @@ -67,7 +67,7 @@ abstract class AbstractMappingTest extends \Test\TestCase { * test objects. Preparing environment means that all mappings are cleared * first and then filled with test entries. * @return array 0 = \OCA\User_LDAP\Mapping\AbstractMapping, 1 = array of - * users or groups + * users or groups */ private function initTest() { $dbc = \OC::$server->getDatabaseConnection(); diff --git a/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php b/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php index 9d433cf4937..2d4aeebe22e 100644 --- a/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php +++ b/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php b/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php index ab8fe03d6d2..5042873d568 100644 --- a/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php +++ b/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php b/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php index e3ce332577d..2040227a3a2 100644 --- a/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php +++ b/apps/user_ldap/tests/Migration/UUIDFixInsertTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -14,19 +15,19 @@ use OCP\Migration\IOutput; use Test\TestCase; class UUIDFixInsertTest extends TestCase { - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ protected $config; - /** @var UserMapping|\PHPUnit\Framework\MockObject\MockObject */ + /** @var UserMapping|\PHPUnit\Framework\MockObject\MockObject */ protected $userMapper; - /** @var GroupMapping|\PHPUnit\Framework\MockObject\MockObject */ + /** @var GroupMapping|\PHPUnit\Framework\MockObject\MockObject */ protected $groupMapper; - /** @var IJobList|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IJobList|\PHPUnit\Framework\MockObject\MockObject */ protected $jobList; - /** @var UUIDFixInsert */ + /** @var UUIDFixInsert */ protected $job; protected function setUp(): void { diff --git a/apps/user_ldap/tests/Migration/UUIDFixUserTest.php b/apps/user_ldap/tests/Migration/UUIDFixUserTest.php index dfa1898450f..b619e9832e6 100644 --- a/apps/user_ldap/tests/Migration/UUIDFixUserTest.php +++ b/apps/user_ldap/tests/Migration/UUIDFixUserTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/Service/UpdateGroupsServiceTest.php b/apps/user_ldap/tests/Service/UpdateGroupsServiceTest.php index 38556ec312f..b80d761b5c6 100644 --- a/apps/user_ldap/tests/Service/UpdateGroupsServiceTest.php +++ b/apps/user_ldap/tests/Service/UpdateGroupsServiceTest.php @@ -26,17 +26,17 @@ use Psr\Log\LoggerInterface; use Test\TestCase; class UpdateGroupsServiceTest extends TestCase { - /** @var Group_Proxy|MockObject */ + /** @var Group_Proxy|MockObject */ protected $groupBackend; - /** @var IEventDispatcher|MockObject */ + /** @var IEventDispatcher|MockObject */ protected $dispatcher; - /** @var IGroupManager|MockObject */ + /** @var IGroupManager|MockObject */ protected $groupManager; /** @var IUserManager|MockObject */ protected $userManager; /** @var LoggerInterface|MockObject */ protected $logger; - /** @var GroupMembershipMapper|MockObject */ + /** @var GroupMembershipMapper|MockObject */ protected $groupMembershipMapper; /** @var IConfig|MockObject */ protected $config; diff --git a/apps/user_ldap/tests/Settings/AdminTest.php b/apps/user_ldap/tests/Settings/AdminTest.php index 7906a07c3e9..adc83441f5a 100644 --- a/apps/user_ldap/tests/Settings/AdminTest.php +++ b/apps/user_ldap/tests/Settings/AdminTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/Settings/SectionTest.php b/apps/user_ldap/tests/Settings/SectionTest.php index 5fe5476f1c3..6539035cc61 100644 --- a/apps/user_ldap/tests/Settings/SectionTest.php +++ b/apps/user_ldap/tests/Settings/SectionTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php index 32fa5bc38bf..f25a762d5eb 100644 --- a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php +++ b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index ec5cf03f402..1d4aeb619b6 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -29,9 +29,9 @@ use Psr\Log\LoggerInterface; * @package OCA\User_LDAP\Tests\User */ class UserTest extends \Test\TestCase { - /** @var Access|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Access|\PHPUnit\Framework\MockObject\MockObject */ protected $access; - /** @var Connection|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Connection|\PHPUnit\Framework\MockObject\MockObject */ protected $connection; /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ protected $config; diff --git a/apps/user_ldap/tests/UserLDAPPluginTest.php b/apps/user_ldap/tests/UserLDAPPluginTest.php index 1e3cd6afbf8..76c0495ea95 100644 --- a/apps/user_ldap/tests/UserLDAPPluginTest.php +++ b/apps/user_ldap/tests/UserLDAPPluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 8e3a914d929..37ae52980a0 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -38,7 +38,7 @@ class User_LDAPTest extends TestCase { protected $backend; /** @var Access|MockObject */ protected $access; - /** @var OfflineUser|MockObject */ + /** @var OfflineUser|MockObject */ protected $offlineUser; /** @var INotificationManager|MockObject */ protected $notificationManager; @@ -84,25 +84,25 @@ class User_LDAPTest extends TestCase { private function prepareMockForUserExists() { $this->access->expects($this->any()) - ->method('username2dn') - ->willReturnCallback(function ($uid) { - switch ($uid) { - case 'gunslinger': - return 'dnOfRoland,dc=test'; - break; - case 'formerUser': - return 'dnOfFormerUser,dc=test'; - break; - case 'newyorker': - return 'dnOfNewYorker,dc=test'; - break; - case 'ladyofshadows': - return 'dnOfLadyOfShadows,dc=test'; - break; - default: - return false; - } - }); + ->method('username2dn') + ->willReturnCallback(function ($uid) { + switch ($uid) { + case 'gunslinger': + return 'dnOfRoland,dc=test'; + break; + case 'formerUser': + return 'dnOfFormerUser,dc=test'; + break; + case 'newyorker': + return 'dnOfNewYorker,dc=test'; + break; + case 'ladyofshadows': + return 'dnOfLadyOfShadows,dc=test'; + break; + default: + return false; + } + }); $this->access->method('fetchUsersByLoginName') ->willReturn([]); @@ -115,22 +115,22 @@ class User_LDAPTest extends TestCase { */ private function prepareAccessForCheckPassword($noDisplayName = false) { $this->connection->expects($this->any()) - ->method('__get') - ->willReturnCallback(function ($name) { - if ($name === 'ldapLoginFilter') { - return '%uid'; - } - return null; - }); + ->method('__get') + ->willReturnCallback(function ($name) { + if ($name === 'ldapLoginFilter') { + return '%uid'; + } + return null; + }); $this->access->expects($this->any()) - ->method('fetchListOfUsers') - ->willReturnCallback(function ($filter) { - if ($filter === 'roland') { - return [['dn' => ['dnOfRoland,dc=test']]]; - } - return []; - }); + ->method('fetchListOfUsers') + ->willReturnCallback(function ($filter) { + if ($filter === 'roland') { + return [['dn' => ['dnOfRoland,dc=test']]]; + } + return []; + }); $this->access->expects($this->any()) ->method('fetchUsersByLoginName') ->willReturnCallback(function ($uid) { @@ -145,21 +145,21 @@ class User_LDAPTest extends TestCase { $retVal = false; } $this->access->expects($this->any()) - ->method('dn2username') - ->with($this->equalTo('dnOfRoland,dc=test')) - ->willReturn($retVal); + ->method('dn2username') + ->with($this->equalTo('dnOfRoland,dc=test')) + ->willReturn($retVal); $this->access->expects($this->any()) - ->method('stringResemblesDN') - ->with($this->equalTo('dnOfRoland,dc=test')) - ->willReturn(true); + ->method('stringResemblesDN') + ->with($this->equalTo('dnOfRoland,dc=test')) + ->willReturn(true); $this->access->expects($this->any()) - ->method('areCredentialsValid') - ->willReturnCallback(function ($dn, $pwd) { - if ($pwd === 'dt19') { - return true; - } - return false; - }); + ->method('areCredentialsValid') + ->willReturnCallback(function ($dn, $pwd) { + if ($pwd === 'dt19') { + return true; + } + return false; + }); $this->userManager->expects($this->any()) ->method('getAttributes') @@ -288,9 +288,9 @@ class User_LDAPTest extends TestCase { ->willReturn(ldap_connect('ldap://example.com')); $this->deletedUsersIndex->expects($this->once()) - ->method('isUserMarked') - ->with($uid) - ->willReturn(true); + ->method('isUserMarked') + ->with($uid) + ->willReturn(true); $offlineUser = $this->createMock(OfflineUser::class); $offlineUser->expects($this->once()) @@ -322,9 +322,9 @@ class User_LDAPTest extends TestCase { ->willReturn(true); $this->deletedUsersIndex->expects($this->once()) - ->method('isUserMarked') - ->with('uid') - ->willReturn(true); + ->method('isUserMarked') + ->with('uid') + ->willReturn(true); $mapper = $this->createMock(UserMapping::class); $mapper->expects($this->once()) @@ -347,42 +347,42 @@ class User_LDAPTest extends TestCase { */ private function prepareAccessForGetUsers() { $this->access->expects($this->once()) - ->method('escapeFilterPart') - ->willReturnCallback(function ($search) { - return $search; - }); + ->method('escapeFilterPart') + ->willReturnCallback(function ($search) { + return $search; + }); $this->access->expects($this->any()) - ->method('getFilterPartForUserSearch') - ->willReturnCallback(function ($search) { - return $search; - }); + ->method('getFilterPartForUserSearch') + ->willReturnCallback(function ($search) { + return $search; + }); $this->access->expects($this->any()) - ->method('combineFilterWithAnd') - ->willReturnCallback(function ($param) { - return $param[2]; - }); + ->method('combineFilterWithAnd') + ->willReturnCallback(function ($param) { + return $param[2]; + }); $this->access->expects($this->any()) - ->method('fetchListOfUsers') - ->willReturnCallback(function ($search, $a, $l, $o) { - $users = ['gunslinger', 'newyorker', 'ladyofshadows']; - if (empty($search)) { - $result = $users; - } else { - $result = []; - foreach ($users as $user) { - if (stripos($user, $search) !== false) { - $result[] = $user; - } - } - } - if (!is_null($l) || !is_null($o)) { - $result = array_slice($result, $o, $l); - } - return $result; - }); + ->method('fetchListOfUsers') + ->willReturnCallback(function ($search, $a, $l, $o) { + $users = ['gunslinger', 'newyorker', 'ladyofshadows']; + if (empty($search)) { + $result = $users; + } else { + $result = []; + foreach ($users as $user) { + if (stripos($user, $search) !== false) { + $result[] = $user; + } + } + } + if (!is_null($l) || !is_null($o)) { + $result = array_slice($result, $o, $l); + } + return $result; + }); $this->access->expects($this->any()) - ->method('nextcloudUserNames') - ->willReturnArgument(0); + ->method('nextcloudUserNames') + ->willReturnArgument(0); $this->access->method('fetchUsersByLoginName') ->willReturn([]); @@ -753,23 +753,23 @@ class User_LDAPTest extends TestCase { $this->prepareMockForUserExists(); $this->connection->expects($this->any()) - ->method('__get') - ->willReturnCallback(function ($name) { - if ($name === 'homeFolderNamingRule') { - return 'attr:testAttribute'; - } - return null; - }); + ->method('__get') + ->willReturnCallback(function ($name) { + if ($name === 'homeFolderNamingRule') { + return 'attr:testAttribute'; + } + return null; + }); $this->access->expects($this->any()) - ->method('readAttribute') - ->willReturn([]); + ->method('readAttribute') + ->willReturn([]); $userMapper = $this->createMock(UserMapping::class); $this->access->expects($this->any()) - ->method('getUserMapper') - ->willReturn($userMapper); + ->method('getUserMapper') + ->willReturn($userMapper); $offlineUser = $this->createMock(OfflineUser::class); $offlineUser->expects($this->atLeastOnce()) @@ -822,20 +822,20 @@ class User_LDAPTest extends TestCase { }); $this->access->expects($this->any()) - ->method('readAttribute') - ->willReturnCallback(function ($dn, $attr) { - switch ($dn) { - case 'dnOfRoland,dc=test': - if ($attr === 'displayname') { - return ['Roland Deschain']; - } - return []; - break; - - default: - return false; - } - }); + ->method('readAttribute') + ->willReturnCallback(function ($dn, $attr) { + switch ($dn) { + case 'dnOfRoland,dc=test': + if ($attr === 'displayname') { + return ['Roland Deschain']; + } + return []; + break; + + default: + return false; + } + }); $this->access->method('fetchUsersByLoginName') ->willReturn([]); } @@ -1022,8 +1022,8 @@ class User_LDAPTest extends TestCase { public function testCountUsers() { $this->access->expects($this->once()) - ->method('countUsers') - ->willReturn(5); + ->method('countUsers') + ->willReturn(5); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); @@ -1033,8 +1033,8 @@ class User_LDAPTest extends TestCase { public function testCountUsersFailing() { $this->access->expects($this->once()) - ->method('countUsers') - ->willReturn(false); + ->method('countUsers') + ->willReturn(false); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); @@ -1179,33 +1179,33 @@ class User_LDAPTest extends TestCase { */ private function prepareAccessForSetPassword($enablePasswordChange = true) { $this->connection->expects($this->any()) - ->method('__get') - ->willReturnCallback(function ($name) use (&$enablePasswordChange) { - if ($name === 'ldapLoginFilter') { - return '%uid'; - } - if ($name === 'turnOnPasswordChange') { - return $enablePasswordChange?1:0; - } - return null; - }); + ->method('__get') + ->willReturnCallback(function ($name) use (&$enablePasswordChange) { + if ($name === 'ldapLoginFilter') { + return '%uid'; + } + if ($name === 'turnOnPasswordChange') { + return $enablePasswordChange?1:0; + } + return null; + }); $this->connection->expects($this->any()) - ->method('getFromCache') - ->willReturnCallback(function ($uid) { - if ($uid === 'userExists'.'roland') { - return true; - } - return null; - }); + ->method('getFromCache') + ->willReturnCallback(function ($uid) { + if ($uid === 'userExists'.'roland') { + return true; + } + return null; + }); $this->access->expects($this->any()) - ->method('fetchListOfUsers') - ->willReturnCallback(function ($filter) { - if ($filter === 'roland') { - return [['dn' => ['dnOfRoland,dc=test']]]; - } - return []; - }); + ->method('fetchListOfUsers') + ->willReturnCallback(function ($filter) { + if ($filter === 'roland') { + return [['dn' => ['dnOfRoland,dc=test']]]; + } + return []; + }); $this->access->expects($this->any()) ->method('fetchUsersByLoginName') ->willReturnCallback(function ($uid) { @@ -1215,21 +1215,21 @@ class User_LDAPTest extends TestCase { return []; }); $this->access->expects($this->any()) - ->method('dn2username') - ->with($this->equalTo('dnOfRoland,dc=test')) - ->willReturn('roland'); + ->method('dn2username') + ->with($this->equalTo('dnOfRoland,dc=test')) + ->willReturn('roland'); $this->access->expects($this->any()) - ->method('stringResemblesDN') - ->with($this->equalTo('dnOfRoland,dc=test')) - ->willReturn(true); + ->method('stringResemblesDN') + ->with($this->equalTo('dnOfRoland,dc=test')) + ->willReturn(true); $this->access->expects($this->any()) - ->method('setPassword') - ->willReturnCallback(function ($uid, $password) { - if (strlen($password) <= 5) { - throw new HintException('Password fails quality checking policy', '', 19); - } - return true; - }); + ->method('setPassword') + ->willReturnCallback(function ($uid, $password) { + if (strlen($password) <= 5) { + throw new HintException('Password fails quality checking policy', '', 19); + } + return true; + }); } @@ -1330,7 +1330,7 @@ class User_LDAPTest extends TestCase { /** @dataProvider avatarDataProvider */ public function testCanChangeAvatar($imageData, $expected) { - $isValidImage = str_starts_with((string)$imageData, 'valid'); + $isValidImage = str_starts_with((string) $imageData, 'valid'); $user = $this->createMock(User::class); $user->expects($this->once()) diff --git a/apps/user_ldap/tests/User_ProxyTest.php b/apps/user_ldap/tests/User_ProxyTest.php index 5af7fef3f00..fd3b78b03eb 100644 --- a/apps/user_ldap/tests/User_ProxyTest.php +++ b/apps/user_ldap/tests/User_ProxyTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php index d3cf6ffb0ae..f294500d0b3 100644 --- a/apps/user_ldap/tests/WizardTest.php +++ b/apps/user_ldap/tests/WizardTest.php @@ -368,7 +368,7 @@ class WizardTest extends TestCase { $ldap->expects($this->any()) ->method('isResource') ->willReturnCallback(function ($res) { - return (bool)$res; + return (bool) $res; }); $ldap->expects($this->any()) diff --git a/apps/user_status/lib/Connector/UserStatus.php b/apps/user_status/lib/Connector/UserStatus.php index 7fbfd62f223..6ff9d66c7c1 100644 --- a/apps/user_status/lib/Connector/UserStatus.php +++ b/apps/user_status/lib/Connector/UserStatus.php @@ -43,7 +43,7 @@ class UserStatus implements IUserStatus { $this->status = IUserStatus::OFFLINE; } if ($status->getClearAt() !== null) { - $this->clearAt = DateTimeImmutable::createFromFormat('U', (string)$status->getClearAt()); + $this->clearAt = DateTimeImmutable::createFromFormat('U', (string) $status->getClearAt()); } } diff --git a/apps/user_status/lib/Controller/HeartbeatController.php b/apps/user_status/lib/Controller/HeartbeatController.php index 65fdda75eec..4f3882f0bf0 100644 --- a/apps/user_status/lib/Controller/HeartbeatController.php +++ b/apps/user_status/lib/Controller/HeartbeatController.php @@ -59,9 +59,9 @@ class HeartbeatController extends OCSController { * @param string $status Only online, away * * @return DataResponse<Http::STATUS_OK, UserStatusPrivate, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NO_CONTENT, array<empty>, array{}> - * 200: Status successfully updated - * 204: User has no status to keep alive - * 400: Invalid status to update + * 200: Status successfully updated + * 204: User has no status to keep alive + * 400: Invalid status to update */ #[NoAdminRequired] #[ApiRoute(verb: 'PUT', url: '/api/v1/heartbeat')] diff --git a/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php b/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php index 7fe08e9719b..23dec452928 100644 --- a/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php +++ b/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php @@ -37,7 +37,7 @@ class OutOfOfficeStatusListener implements IEventListener { * @inheritDoc */ public function handle(Event $event): void { - if($event instanceof OutOfOfficeClearedEvent) { + if ($event instanceof OutOfOfficeClearedEvent) { $this->manager->revertUserStatus($event->getData()->getUser()->getUID(), IUserStatus::MESSAGE_OUT_OF_OFFICE, IUserStatus::DND); $this->jobsList->scheduleAfter(UserStatusAutomation::class, $this->time->getTime(), ['userId' => $event->getData()->getUser()->getUID()]); return; diff --git a/apps/user_status/lib/Listener/UserLiveStatusListener.php b/apps/user_status/lib/Listener/UserLiveStatusListener.php index fa4ff8e4aba..ea8d995b8a3 100644 --- a/apps/user_status/lib/Listener/UserLiveStatusListener.php +++ b/apps/user_status/lib/Listener/UserLiveStatusListener.php @@ -72,7 +72,7 @@ class UserLiveStatusListener implements IEventListener { } // Don't overwrite the "away" calendar status if it's set - if($userStatus->getMessageId() === IUserStatus::MESSAGE_CALENDAR_BUSY) { + if ($userStatus->getMessageId() === IUserStatus::MESSAGE_CALENDAR_BUSY) { $event->setUserStatus(new ConnectorUserStatus($userStatus)); return; } diff --git a/apps/user_status/lib/Service/StatusService.php b/apps/user_status/lib/Service/StatusService.php index 2a761a0f304..9adc13e4dbf 100644 --- a/apps/user_status/lib/Service/StatusService.php +++ b/apps/user_status/lib/Service/StatusService.php @@ -499,10 +499,10 @@ class StatusService { return; } // If there is a custom message, don't overwrite it - if(empty($status->getCustomMessage())) { + if (empty($status->getCustomMessage())) { $status->setCustomMessage($predefinedMessage['message']); } - if(empty($status->getCustomIcon())) { + if (empty($status->getCustomIcon())) { $status->setCustomIcon($predefinedMessage['icon']); } } diff --git a/apps/user_status/tests/Unit/Service/StatusServiceTest.php b/apps/user_status/tests/Unit/Service/StatusServiceTest.php index 710b3081b17..801d0cea0fc 100644 --- a/apps/user_status/tests/Unit/Service/StatusServiceTest.php +++ b/apps/user_status/tests/Unit/Service/StatusServiceTest.php @@ -47,10 +47,10 @@ class StatusServiceTest extends TestCase { /** @var IConfig|MockObject */ private $config; - /** @var IUserManager|MockObject */ + /** @var IUserManager|MockObject */ private $userManager; - /** @var LoggerInterface|MockObject */ + /** @var LoggerInterface|MockObject */ private $logger; private StatusService $service; diff --git a/apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php b/apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php index f7c111f41e8..efc9401f44f 100644 --- a/apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php +++ b/apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php @@ -56,14 +56,14 @@ class WebhookCall extends QueuedJob { } $webhookUri = $webhookListener->getUri(); $exAppId = $webhookListener->getAppId(); - if ($exAppId !== null && str_starts_with($webhookUri, "/")) { + if ($exAppId !== null && str_starts_with($webhookUri, '/')) { // ExApp is awaiting a direct request to itself using AppAPI if (!$this->appManager->isInstalled('app_api')) { throw new RuntimeException('AppAPI is disabled or not installed.'); } try { $appApiFunctions = \OCP\Server::get(\OCA\AppAPI\PublicFunctions::class); - } catch (ContainerExceptionInterface | NotFoundExceptionInterface) { + } catch (ContainerExceptionInterface|NotFoundExceptionInterface) { throw new RuntimeException('Could not get AppAPI public functions.'); } $exApp = $appApiFunctions->getExApp($exAppId); diff --git a/apps/webhook_listeners/lib/Db/WebhookListener.php b/apps/webhook_listeners/lib/Db/WebhookListener.php index 2e194261d64..fd592fda169 100644 --- a/apps/webhook_listeners/lib/Db/WebhookListener.php +++ b/apps/webhook_listeners/lib/Db/WebhookListener.php @@ -62,7 +62,7 @@ class WebhookListener extends Entity implements \JsonSerializable { /** * @var ?string - * If not empty, id of the user that needs to be connected for the webhook to trigger + * If not empty, id of the user that needs to be connected for the webhook to trigger * @psalm-suppress PropertyNotSetInConstructor */ protected $userIdFilter; diff --git a/apps/webhook_listeners/lib/Service/PHPMongoQuery.php b/apps/webhook_listeners/lib/Service/PHPMongoQuery.php index e8e52615008..435ec3f6922 100644 --- a/apps/webhook_listeners/lib/Service/PHPMongoQuery.php +++ b/apps/webhook_listeners/lib/Service/PHPMongoQuery.php @@ -19,23 +19,23 @@ abstract class PHPMongoQuery { /** * Execute a mongo query on a set of documents and return the documents that pass the query * - * @param array $query A boolean value or an array defining a query - * @param array $documents The document to query - * @param array $options Any options: - * 'debug' - boolean - debug mode, verbose logging - * 'logger' - \Psr\LoggerInterface - A logger instance that implements {@link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#3-psrlogloggerinterface PSR-3} - * 'unknownOperatorCallback' - a callback to be called if an operator can't be found. The function definition is function($operator, $operatorValue, $field, $document). return true or false. + * @param array $query A boolean value or an array defining a query + * @param array $documents The document to query + * @param array $options Any options: + * 'debug' - boolean - debug mode, verbose logging + * 'logger' - \Psr\LoggerInterface - A logger instance that implements {@link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#3-psrlogloggerinterface PSR-3} + * 'unknownOperatorCallback' - a callback to be called if an operator can't be found. The function definition is function($operator, $operatorValue, $field, $document). return true or false. * @throws Exception */ public static function find(array $query, array $documents, array $options = []): array { - if(empty($documents) || empty($query)) { + if (empty($documents) || empty($query)) { return []; } $ret = []; $options['_shouldLog'] = !empty($options['logger']) && $options['logger'] instanceof \Psr\Log\LoggerInterface; $options['_debug'] = !empty($options['debug']); foreach ($documents as $doc) { - if(static::_executeQuery($query, $doc, $options)) { + if (static::_executeQuery($query, $doc, $options)) { $ret[] = $doc; } } @@ -45,23 +45,23 @@ abstract class PHPMongoQuery { /** * Execute a Mongo query on a document * - * @param mixed $query A boolean value or an array defining a query - * @param array $document The document to query - * @param array $options Any options: - * 'debug' - boolean - debug mode, verbose logging - * 'logger' - \Psr\LoggerInterface - A logger instance that implements {@link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#3-psrlogloggerinterface PSR-3} - * 'unknownOperatorCallback' - a callback to be called if an operator can't be found. The function definition is function($operator, $operatorValue, $field, $document). return true or false. + * @param mixed $query A boolean value or an array defining a query + * @param array $document The document to query + * @param array $options Any options: + * 'debug' - boolean - debug mode, verbose logging + * 'logger' - \Psr\LoggerInterface - A logger instance that implements {@link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#3-psrlogloggerinterface PSR-3} + * 'unknownOperatorCallback' - a callback to be called if an operator can't be found. The function definition is function($operator, $operatorValue, $field, $document). return true or false. * @throws Exception */ public static function executeQuery($query, array &$document, array $options = []): bool { $options['_shouldLog'] = !empty($options['logger']) && $options['logger'] instanceof \Psr\Log\LoggerInterface; $options['_debug'] = !empty($options['debug']); - if($options['_debug'] && $options['_shouldLog']) { + if ($options['_debug'] && $options['_shouldLog']) { $options['logger']->debug('executeQuery called', ['query' => $query, 'document' => $document, 'options' => $options]); } - if(!is_array($query)) { - return (bool)$query; + if (!is_array($query)) { + return (bool) $query; } return self::_executeQuery($query, $document, $options); @@ -75,10 +75,10 @@ abstract class PHPMongoQuery { * @throws Exception */ private static function _executeQuery(array $query, array &$document, array $options = [], string $logicalOperator = '$and'): bool { - if($logicalOperator !== '$and' && (!count($query) || !isset($query[0]))) { + if ($logicalOperator !== '$and' && (!count($query) || !isset($query[0]))) { throw new Exception($logicalOperator.' requires nonempty array'); } - if($options['_debug'] && $options['_shouldLog']) { + if ($options['_debug'] && $options['_shouldLog']) { $options['logger']->debug('_executeQuery called', ['query' => $query, 'document' => $document, 'logicalOperator' => $logicalOperator]); } @@ -87,19 +87,19 @@ abstract class PHPMongoQuery { // to detect an array of key->vals that have numeric IDs vs an array of queries (where keys were not specified) $queryIsIndexedArray = !empty($query) && array_is_list($query); - foreach($query as $k => $q) { + foreach ($query as $k => $q) { $pass = true; - if(is_string($k) && substr($k, 0, 1) === '$') { + if (is_string($k) && substr($k, 0, 1) === '$') { // key is an operator at this level, except $not, which can be at any level - if($k === '$not') { + if ($k === '$not') { $pass = !self::_executeQuery($q, $document, $options); } else { $pass = self::_executeQuery($q, $document, $options, $k); } - } elseif($logicalOperator === '$and') { // special case for $and - if($queryIsIndexedArray) { // $q is an array of query objects + } elseif ($logicalOperator === '$and') { // special case for $and + if ($queryIsIndexedArray) { // $q is an array of query objects $pass = self::_executeQuery($q, $document, $options); - } elseif(is_array($q)) { // query is array, run all queries on field. All queries must match. e.g { 'age': { $gt: 24, $lt: 52 } } + } elseif (is_array($q)) { // query is array, run all queries on field. All queries must match. e.g { 'age': { $gt: 24, $lt: 52 } } $pass = self::_executeQueryOnElement($q, $k, $document, $options); } else { // key value means equality @@ -108,30 +108,30 @@ abstract class PHPMongoQuery { } else { // $q is array of query objects e.g '$or' => [{'fullName' => 'Nick'}] $pass = self::_executeQuery($q, $document, $options, '$and'); } - switch($logicalOperator) { + switch ($logicalOperator) { case '$and': // if any fail, query fails - if(!$pass) { + if (!$pass) { return false; } break; case '$or': // if one succeeds, query succeeds - if($pass) { + if ($pass) { return true; } break; case '$nor': // if one succeeds, query fails - if($pass) { + if ($pass) { return false; } break; default: - if($options['_shouldLog']) { + if ($options['_shouldLog']) { $options['logger']->warning('_executeQuery could not find logical operator', ['query' => $query, 'document' => $document, 'logicalOperator' => $logicalOperator]); } return false; } } - switch($logicalOperator) { + switch ($logicalOperator) { case '$and': // all succeeded, query succeeds return true; case '$or': // all failed, query fails @@ -139,7 +139,7 @@ abstract class PHPMongoQuery { case '$nor': // all failed, query succeeded return true; default: - if($options['_shouldLog']) { + if ($options['_shouldLog']) { $options['logger']->warning('_executeQuery could not find logical operator', ['query' => $query, 'document' => $document, 'logicalOperator' => $logicalOperator]); } return false; @@ -152,12 +152,12 @@ abstract class PHPMongoQuery { * @throws Exception */ private static function _executeQueryOnElement(array $query, string $element, array &$document, array $options = []): bool { - if($options['_debug'] && $options['_shouldLog']) { + if ($options['_debug'] && $options['_shouldLog']) { $options['logger']->debug('_executeQueryOnElement called', ['query' => $query, 'element' => $element, 'document' => $document]); } // iterate through query operators - foreach($query as $op => $opVal) { - if(!self::_executeOperatorOnElement($op, $opVal, $element, $document, $options)) { + foreach ($query as $op => $opVal) { + if (!self::_executeOperatorOnElement($op, $opVal, $element, $document, $options)) { return false; } } @@ -176,11 +176,11 @@ abstract class PHPMongoQuery { if (is_array($v) && is_array($operatorValue)) { return $v == $operatorValue; } - if(is_array($v)) { + if (is_array($v)) { return in_array($operatorValue, $v); } - if(is_string($operatorValue) && preg_match('/^\/(.*?)\/([a-z]*)$/i', $operatorValue, $matches)) { - return (bool)preg_match('/'.$matches[1].'/'.$matches[2], $v); + if (is_string($operatorValue) && preg_match('/^\/(.*?)\/([a-z]*)$/i', $operatorValue, $matches)) { + return (bool) preg_match('/'.$matches[1].'/'.$matches[2], $v); } return $operatorValue === $v; } @@ -188,42 +188,42 @@ abstract class PHPMongoQuery { /** * Execute a Mongo Operator on an element * - * @param string $operator The operator to perform - * @param mixed $operatorValue The value to provide the operator - * @param string $element The target element. Can be an object path eg price.shoes - * @param array $document The document in which to find the element - * @param array $options Options - * @throws Exception Exceptions on invalid operators, invalid unknown operator callback, and invalid operator values + * @param string $operator The operator to perform + * @param mixed $operatorValue The value to provide the operator + * @param string $element The target element. Can be an object path eg price.shoes + * @param array $document The document in which to find the element + * @param array $options Options + * @throws Exception Exceptions on invalid operators, invalid unknown operator callback, and invalid operator values */ private static function _executeOperatorOnElement(string $operator, $operatorValue, string $element, array &$document, array $options = []): bool { - if($options['_debug'] && $options['_shouldLog']) { + if ($options['_debug'] && $options['_shouldLog']) { $options['logger']->debug('_executeOperatorOnElement called', ['operator' => $operator, 'operatorValue' => $operatorValue, 'element' => $element, 'document' => $document]); } - if($operator === '$not') { + if ($operator === '$not') { return !self::_executeQueryOnElement($operatorValue, $element, $document, $options); } $elementSpecifier = explode('.', $element); $v = & $document; $exists = true; - foreach($elementSpecifier as $index => $es) { - if(empty($v)) { + foreach ($elementSpecifier as $index => $es) { + if (empty($v)) { $exists = false; break; } - if(isset($v[0])) { + if (isset($v[0])) { // value from document is an array, so we need to iterate through array and test the query on all elements of the array // if any elements match, then return true $newSpecifier = implode('.', array_slice($elementSpecifier, $index)); - foreach($v as $item) { - if(self::_executeOperatorOnElement($operator, $operatorValue, $newSpecifier, $item, $options)) { + foreach ($v as $item) { + if (self::_executeOperatorOnElement($operator, $operatorValue, $newSpecifier, $item, $options)) { return true; } } return false; } - if(isset($v[$es])) { + if (isset($v[$es])) { $v = & $v[$es]; } else { $exists = false; @@ -231,40 +231,40 @@ abstract class PHPMongoQuery { } } - switch($operator) { + switch ($operator) { case '$all': - if(!$exists) { + if (!$exists) { return false; } - if(!is_array($operatorValue)) { + if (!is_array($operatorValue)) { throw new Exception('$all requires array'); } - if(count($operatorValue) === 0) { + if (count($operatorValue) === 0) { return false; } - if(!is_array($v)) { - if(count($operatorValue) === 1) { + if (!is_array($v)) { + if (count($operatorValue) === 1) { return $v === $operatorValue[0]; } return false; } return count(array_intersect($v, $operatorValue)) === count($operatorValue); case '$e': - if(!$exists) { + if (!$exists) { return false; } return self::_isEqual($v, $operatorValue); case '$in': - if(!$exists) { + if (!$exists) { return false; } - if(!is_array($operatorValue)) { + if (!is_array($operatorValue)) { throw new Exception('$in requires array'); } - if(count($operatorValue) === 0) { + if (count($operatorValue) === 0) { return false; } - if(is_array($v)) { + if (is_array($v)) { return count(array_intersect($v, $operatorValue)) > 0; } return in_array($v, $operatorValue); @@ -274,43 +274,43 @@ abstract class PHPMongoQuery { case '$gte': return $exists && $v >= $operatorValue; case '$ne': return (!$exists && $operatorValue !== null) || ($exists && !self::_isEqual($v, $operatorValue)); case '$nin': - if(!$exists) { + if (!$exists) { return true; } - if(!is_array($operatorValue)) { + if (!is_array($operatorValue)) { throw new Exception('$nin requires array'); } - if(count($operatorValue) === 0) { + if (count($operatorValue) === 0) { return true; } - if(is_array($v)) { + if (is_array($v)) { return count(array_intersect($v, $operatorValue)) === 0; } return !in_array($v, $operatorValue); case '$exists': return ($operatorValue && $exists) || (!$operatorValue && !$exists); case '$mod': - if(!$exists) { + if (!$exists) { return false; } - if(!is_array($operatorValue)) { + if (!is_array($operatorValue)) { throw new Exception('$mod requires array'); } - if(count($operatorValue) !== 2) { + if (count($operatorValue) !== 2) { throw new Exception('$mod requires two parameters in array: divisor and remainder'); } return $v % $operatorValue[0] === $operatorValue[1]; default: - if(empty($options['unknownOperatorCallback']) || !is_callable($options['unknownOperatorCallback'])) { + if (empty($options['unknownOperatorCallback']) || !is_callable($options['unknownOperatorCallback'])) { throw new Exception('Operator '.$operator.' is unknown'); } $res = call_user_func($options['unknownOperatorCallback'], $operator, $operatorValue, $element, $document); - if($res === null) { + if ($res === null) { throw new Exception('Operator '.$operator.' is unknown'); } - if(!is_bool($res)) { + if (!is_bool($res)) { throw new Exception('Return value of unknownOperatorCallback must be boolean, actual value '.$res); } return $res; @@ -322,15 +322,15 @@ abstract class PHPMongoQuery { * Get the fields this query depends on * * @param array query The query to analyse - * @return array An array of fields this query depends on + * @return array An array of fields this query depends on */ public static function getDependentFields(array $query) { $fields = []; - foreach($query as $k => $v) { - if(is_array($v)) { + foreach ($query as $k => $v) { + if (is_array($v)) { $fields = array_merge($fields, static::getDependentFields($v)); } - if(is_int($k) || $k[0] === '$') { + if (is_int($k) || $k[0] === '$') { continue; } $fields[] = $k; diff --git a/apps/webhook_listeners/lib/Settings/Admin.php b/apps/webhook_listeners/lib/Settings/Admin.php index 5ef7656ca3e..64ed53426f9 100644 --- a/apps/webhook_listeners/lib/Settings/Admin.php +++ b/apps/webhook_listeners/lib/Settings/Admin.php @@ -43,8 +43,8 @@ class Admin implements IDelegatedSettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/workflowengine/appinfo/routes.php b/apps/workflowengine/appinfo/routes.php index ffafd0b91a8..48e5ed2ef4e 100644 --- a/apps/workflowengine/appinfo/routes.php +++ b/apps/workflowengine/appinfo/routes.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/lib/AppInfo/Application.php b/apps/workflowengine/lib/AppInfo/Application.php index c416db466fe..9fa0b978df1 100644 --- a/apps/workflowengine/lib/AppInfo/Application.php +++ b/apps/workflowengine/lib/AppInfo/Application.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/lib/BackgroundJobs/Rotate.php b/apps/workflowengine/lib/BackgroundJobs/Rotate.php index fd3c76c524e..5ff64716113 100644 --- a/apps/workflowengine/lib/BackgroundJobs/Rotate.php +++ b/apps/workflowengine/lib/BackgroundJobs/Rotate.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -21,7 +22,7 @@ class Rotate extends TimedJob { protected function run($argument) { $config = \OC::$server->getConfig(); $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/flow.log'; - $this->filePath = trim((string)$config->getAppValue(Application::APP_ID, 'logfile', $default)); + $this->filePath = trim((string) $config->getAppValue(Application::APP_ID, 'logfile', $default)); if ($this->filePath === '') { // disabled, nothing to do diff --git a/apps/workflowengine/lib/Check/AbstractStringCheck.php b/apps/workflowengine/lib/Check/AbstractStringCheck.php index 1c544c8c000..f630526be55 100644 --- a/apps/workflowengine/lib/Check/AbstractStringCheck.php +++ b/apps/workflowengine/lib/Check/AbstractStringCheck.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/lib/Check/FileMimeType.php b/apps/workflowengine/lib/Check/FileMimeType.php index c1e448376c9..1e03e26707f 100644 --- a/apps/workflowengine/lib/Check/FileMimeType.php +++ b/apps/workflowengine/lib/Check/FileMimeType.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/lib/Check/FileSize.php b/apps/workflowengine/lib/Check/FileSize.php index 51d7d38a7af..9fcac0c9856 100644 --- a/apps/workflowengine/lib/Check/FileSize.php +++ b/apps/workflowengine/lib/Check/FileSize.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/lib/Check/FileSystemTags.php b/apps/workflowengine/lib/Check/FileSystemTags.php index ca81eb828dc..311aeaf7591 100644 --- a/apps/workflowengine/lib/Check/FileSystemTags.php +++ b/apps/workflowengine/lib/Check/FileSystemTags.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/lib/Check/RequestRemoteAddress.php b/apps/workflowengine/lib/Check/RequestRemoteAddress.php index 909b26c74d6..3b6c86e71bf 100644 --- a/apps/workflowengine/lib/Check/RequestRemoteAddress.php +++ b/apps/workflowengine/lib/Check/RequestRemoteAddress.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/lib/Check/RequestTime.php b/apps/workflowengine/lib/Check/RequestTime.php index 3bb1dba9d93..0fec42dc1e4 100644 --- a/apps/workflowengine/lib/Check/RequestTime.php +++ b/apps/workflowengine/lib/Check/RequestTime.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -89,12 +90,12 @@ class RequestTime implements ICheck { } $values = json_decode($value, true); - $time1 = \DateTime::createFromFormat('H:i e', (string)$values[0]); + $time1 = \DateTime::createFromFormat('H:i e', (string) $values[0]); if ($time1 === false) { throw new \UnexpectedValueException($this->l->t('The given start time is invalid'), 3); } - $time2 = \DateTime::createFromFormat('H:i e', (string)$values[1]); + $time2 = \DateTime::createFromFormat('H:i e', (string) $values[1]); if ($time2 === false) { throw new \UnexpectedValueException($this->l->t('The given end time is invalid'), 4); } diff --git a/apps/workflowengine/lib/Check/RequestURL.php b/apps/workflowengine/lib/Check/RequestURL.php index 43123bddbe9..355ae33a0cb 100644 --- a/apps/workflowengine/lib/Check/RequestURL.php +++ b/apps/workflowengine/lib/Check/RequestURL.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/lib/Check/RequestUserAgent.php b/apps/workflowengine/lib/Check/RequestUserAgent.php index 2ae630394fb..7a33bfa6a07 100644 --- a/apps/workflowengine/lib/Check/RequestUserAgent.php +++ b/apps/workflowengine/lib/Check/RequestUserAgent.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/lib/Check/UserGroupMembership.php b/apps/workflowengine/lib/Check/UserGroupMembership.php index 1c2e535b346..dbba74aaa52 100644 --- a/apps/workflowengine/lib/Check/UserGroupMembership.php +++ b/apps/workflowengine/lib/Check/UserGroupMembership.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/lib/Controller/RequestTimeController.php b/apps/workflowengine/lib/Controller/RequestTimeController.php index 1aca5d92d2d..4b34f16ce0a 100644 --- a/apps/workflowengine/lib/Controller/RequestTimeController.php +++ b/apps/workflowengine/lib/Controller/RequestTimeController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/lib/Entity/File.php b/apps/workflowengine/lib/Entity/File.php index 25cefcd9314..27cf927487c 100644 --- a/apps/workflowengine/lib/Entity/File.php +++ b/apps/workflowengine/lib/Entity/File.php @@ -166,7 +166,7 @@ class File implements IEntity, IDisplayText, IUrl, IIcon, IContextPortation { if (!$this->event instanceof MapperEvent || $this->event->getObjectType() !== 'files') { throw new NotFoundException(); } - $nodes = $this->root->getById((int)$this->event->getObjectId()); + $nodes = $this->root->getById((int) $this->event->getObjectId()); if (is_array($nodes) && isset($nodes[0])) { $this->node = $nodes[0]; return $this->node; diff --git a/apps/workflowengine/lib/Helper/ScopeContext.php b/apps/workflowengine/lib/Helper/ScopeContext.php index 05379f5ff43..6b80a052577 100644 --- a/apps/workflowengine/lib/Helper/ScopeContext.php +++ b/apps/workflowengine/lib/Helper/ScopeContext.php @@ -32,10 +32,10 @@ class ScopeContext { private function evaluateScopeId(?string $scopeId = null): string { if ($this->scope === IManager::SCOPE_USER - && trim((string)$scopeId) === '') { + && trim((string) $scopeId) === '') { throw new \InvalidArgumentException('user scope requires a user id'); } - return trim((string)$scopeId); + return trim((string) $scopeId); } /** diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php index 8cd52f4cd64..a25d717b715 100644 --- a/apps/workflowengine/lib/Manager.php +++ b/apps/workflowengine/lib/Manager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -317,7 +318,7 @@ class Manager implements IManager { $operations = []; while (($opId = $result->fetchOne()) !== false) { - $operations[] = (int)$opId; + $operations[] = (int) $opId; } $this->operationsByScope[$scopeContext->getHash()] = $operations; $result->closeCursor(); @@ -391,12 +392,12 @@ class Manager implements IManager { $query = $this->connection->getQueryBuilder(); try { $this->connection->beginTransaction(); - $result = (bool)$query->delete('flow_operations') + $result = (bool) $query->delete('flow_operations') ->where($query->expr()->eq('id', $query->createNamedParameter($id))) ->execute(); if ($result) { $qb = $this->connection->getQueryBuilder(); - $result &= (bool)$qb->delete('flow_operations_scope') + $result &= (bool) $qb->delete('flow_operations_scope') ->where($qb->expr()->eq('operation_id', $qb->createNamedParameter($id))) ->execute(); } @@ -478,7 +479,7 @@ class Manager implements IManager { throw new \UnexpectedValueException($this->l->t('At least one check needs to be provided')); } - if (strlen((string)$operation) > IManager::MAX_OPERATION_VALUE_BYTES) { + if (strlen((string) $operation) > IManager::MAX_OPERATION_VALUE_BYTES) { throw new \UnexpectedValueException($this->l->t('The provided operation data is too long')); } @@ -506,7 +507,7 @@ class Manager implements IManager { throw new \UnexpectedValueException($this->l->t('Check %s is not allowed with this entity', [$class])); } - if (strlen((string)$check['value']) > IManager::MAX_CHECK_VALUE_BYTES) { + if (strlen((string) $check['value']) > IManager::MAX_CHECK_VALUE_BYTES) { throw new \UnexpectedValueException($this->l->t('The provided check value is too long')); } diff --git a/apps/workflowengine/lib/Service/Logger.php b/apps/workflowengine/lib/Service/Logger.php index 13ac36659e5..001cd92d299 100644 --- a/apps/workflowengine/lib/Service/Logger.php +++ b/apps/workflowengine/lib/Service/Logger.php @@ -29,7 +29,7 @@ class Logger { protected function initLogger(): void { $default = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/flow.log'; - $logFile = trim((string)$this->config->getAppValue(Application::APP_ID, 'logfile', $default)); + $logFile = trim((string) $this->config->getAppValue(Application::APP_ID, 'logfile', $default)); if ($logFile !== '') { $this->flowLogger = $this->logFactory->getCustomPsrLogger($logFile); } diff --git a/apps/workflowengine/lib/Settings/ASettings.php b/apps/workflowengine/lib/Settings/ASettings.php index 1cf03376e9f..390682a2f06 100644 --- a/apps/workflowengine/lib/Settings/ASettings.php +++ b/apps/workflowengine/lib/Settings/ASettings.php @@ -110,8 +110,8 @@ abstract class ASettings implements ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 */ diff --git a/apps/workflowengine/lib/Settings/Section.php b/apps/workflowengine/lib/Settings/Section.php index 1e23eee64ee..9b675cdc15d 100644 --- a/apps/workflowengine/lib/Settings/Section.php +++ b/apps/workflowengine/lib/Settings/Section.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php index e5182bea483..8767b1a56b6 100644 --- a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php +++ b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php b/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php index 7c46a33a477..2f7c17157ca 100644 --- a/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php +++ b/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/tests/Check/RequestTimeTest.php b/apps/workflowengine/tests/Check/RequestTimeTest.php index 3c261fe2de3..a622dbad5da 100644 --- a/apps/workflowengine/tests/Check/RequestTimeTest.php +++ b/apps/workflowengine/tests/Check/RequestTimeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/tests/Check/RequestUserAgentTest.php b/apps/workflowengine/tests/Check/RequestUserAgentTest.php index f110d6ea049..b51104e0c75 100644 --- a/apps/workflowengine/tests/Check/RequestUserAgentTest.php +++ b/apps/workflowengine/tests/Check/RequestUserAgentTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/tests/ManagerTest.php b/apps/workflowengine/tests/ManagerTest.php index d0c04ba1e09..c45bbeabb6d 100644 --- a/apps/workflowengine/tests/ManagerTest.php +++ b/apps/workflowengine/tests/ManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -58,7 +59,7 @@ class ManagerTest extends TestCase { protected $dispatcher; /** @var MockObject|IConfig */ protected $config; - /** @var MockObject|ICacheFactory */ + /** @var MockObject|ICacheFactory */ protected $cacheFactory; protected function setUp(): void { diff --git a/build/gen-coverage-badge.php b/build/gen-coverage-badge.php index 1c19d381626..dea769da1d6 100644 --- a/build/gen-coverage-badge.php +++ b/build/gen-coverage-badge.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -6,7 +7,7 @@ */ if (!isset($argv[1])) { - echo "Clover file is missing" . PHP_EOL; + echo 'Clover file is missing' . PHP_EOL; exit; } @@ -28,7 +29,7 @@ try { echo $c1 . PHP_EOL; echo $c2 . PHP_EOL; - $percent = (int)($c2 * 100); + $percent = (int) ($c2 * 100); $color = 'red'; if ($percent >= 50) { $color = 'yellow'; @@ -40,6 +41,6 @@ try { file_put_contents('coverage.svg', $content); } catch (Exception $ex) { echo $ex->getMessage() . PHP_EOL; - $content = file_get_contents("https://img.shields.io/badge/coverage-ERROR-red.svg"); + $content = file_get_contents('https://img.shields.io/badge/coverage-ERROR-red.svg'); file_put_contents('coverage.svg', $content); } diff --git a/build/integration/features/bootstrap/AppConfiguration.php b/build/integration/features/bootstrap/AppConfiguration.php index 5f39c58ffeb..e8580ed537b 100644 --- a/build/integration/features/bootstrap/AppConfiguration.php +++ b/build/integration/features/bootstrap/AppConfiguration.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/build/integration/features/bootstrap/Auth.php b/build/integration/features/bootstrap/Auth.php index e620af4d530..d95aca8ea35 100644 --- a/build/integration/features/bootstrap/Auth.php +++ b/build/integration/features/bootstrap/Auth.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/build/integration/features/bootstrap/Avatar.php b/build/integration/features/bootstrap/Avatar.php index f05d0372687..c7d70ff1507 100644 --- a/build/integration/features/bootstrap/Avatar.php +++ b/build/integration/features/bootstrap/Avatar.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -9,7 +10,7 @@ use PHPUnit\Framework\Assert; require __DIR__ . '/../../vendor/autoload.php'; trait Avatar { - /** @var string **/ + /** @var string * */ private $lastAvatar; /** @AfterScenario **/ diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 4c39c75be22..5c7e6e0a595 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -74,7 +75,7 @@ trait BasicStructure { * @param string $version */ public function usingApiVersion($version) { - $this->apiVersion = (int)$version; + $this->apiVersion = (int) $version; } /** @@ -120,7 +121,7 @@ trait BasicStructure { * @return string */ public function getOCSResponse($response) { - $body = simplexml_load_string((string)$response->getBody()); + $body = simplexml_load_string((string) $response->getBody()); if ($body === false) { throw new \RuntimeException('Could not parse OCS response, body is not valid XML'); } @@ -419,14 +420,14 @@ trait BasicStructure { } public function createFileSpecificSize($name, $size) { - $file = fopen("work/" . "$name", 'w'); + $file = fopen('work/' . "$name", 'w'); fseek($file, $size - 1, SEEK_CUR); fwrite($file, 'a'); // write a dummy char at SIZE position fclose($file); } public function createFileWithText($name, $text) { - $file = fopen("work/" . "$name", 'w'); + $file = fopen('work/' . "$name", 'w'); fwrite($file, $text); fclose($file); } @@ -454,7 +455,7 @@ trait BasicStructure { * @param int $seconds */ public function sleepForSeconds($seconds) { - sleep((int)$seconds); + sleep((int) $seconds); } /** @@ -462,19 +463,19 @@ trait BasicStructure { */ public static function addFilesToSkeleton() { for ($i = 0; $i < 5; $i++) { - file_put_contents("../../core/skeleton/" . "textfile" . "$i" . ".txt", "Nextcloud test text file\n"); + file_put_contents('../../core/skeleton/' . 'textfile' . "$i" . '.txt', "Nextcloud test text file\n"); } - if (!file_exists("../../core/skeleton/FOLDER")) { - mkdir("../../core/skeleton/FOLDER", 0777, true); + if (!file_exists('../../core/skeleton/FOLDER')) { + mkdir('../../core/skeleton/FOLDER', 0777, true); } - if (!file_exists("../../core/skeleton/PARENT")) { - mkdir("../../core/skeleton/PARENT", 0777, true); + if (!file_exists('../../core/skeleton/PARENT')) { + mkdir('../../core/skeleton/PARENT', 0777, true); } - file_put_contents("../../core/skeleton/PARENT/" . "parent.txt", "Nextcloud test text file\n"); - if (!file_exists("../../core/skeleton/PARENT/CHILD")) { - mkdir("../../core/skeleton/PARENT/CHILD", 0777, true); + file_put_contents('../../core/skeleton/PARENT/' . 'parent.txt', "Nextcloud test text file\n"); + if (!file_exists('../../core/skeleton/PARENT/CHILD')) { + mkdir('../../core/skeleton/PARENT/CHILD', 0777, true); } - file_put_contents("../../core/skeleton/PARENT/CHILD/" . "child.txt", "Nextcloud test text file\n"); + file_put_contents('../../core/skeleton/PARENT/CHILD/' . 'child.txt', "Nextcloud test text file\n"); } /** @@ -482,18 +483,18 @@ trait BasicStructure { */ public static function removeFilesFromSkeleton() { for ($i = 0; $i < 5; $i++) { - self::removeFile("../../core/skeleton/", "textfile" . "$i" . ".txt"); + self::removeFile('../../core/skeleton/', 'textfile' . "$i" . '.txt'); } - if (is_dir("../../core/skeleton/FOLDER")) { - rmdir("../../core/skeleton/FOLDER"); + if (is_dir('../../core/skeleton/FOLDER')) { + rmdir('../../core/skeleton/FOLDER'); } - self::removeFile("../../core/skeleton/PARENT/CHILD/", "child.txt"); - if (is_dir("../../core/skeleton/PARENT/CHILD")) { - rmdir("../../core/skeleton/PARENT/CHILD"); + self::removeFile('../../core/skeleton/PARENT/CHILD/', 'child.txt'); + if (is_dir('../../core/skeleton/PARENT/CHILD')) { + rmdir('../../core/skeleton/PARENT/CHILD'); } - self::removeFile("../../core/skeleton/PARENT/", "parent.txt"); - if (is_dir("../../core/skeleton/PARENT")) { - rmdir("../../core/skeleton/PARENT"); + self::removeFile('../../core/skeleton/PARENT/', 'parent.txt'); + if (is_dir('../../core/skeleton/PARENT')) { + rmdir('../../core/skeleton/PARENT'); } } @@ -501,7 +502,7 @@ trait BasicStructure { * @BeforeScenario @local_storage */ public static function removeFilesFromLocalStorageBefore() { - $dir = "./work/local_storage/"; + $dir = './work/local_storage/'; $di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS); $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST); foreach ($ri as $file) { @@ -513,7 +514,7 @@ trait BasicStructure { * @AfterScenario @local_storage */ public static function removeFilesFromLocalStorageAfter() { - $dir = "./work/local_storage/"; + $dir = './work/local_storage/'; $di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS); $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST); foreach ($ri as $file) { diff --git a/build/integration/features/bootstrap/CalDavContext.php b/build/integration/features/bootstrap/CalDavContext.php index a9db5c89d4d..9e6b139f374 100644 --- a/build/integration/features/bootstrap/CalDavContext.php +++ b/build/integration/features/bootstrap/CalDavContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -11,7 +12,7 @@ use GuzzleHttp\Exception\GuzzleException; use Psr\Http\Message\ResponseInterface; class CalDavContext implements \Behat\Behat\Context\Context { - /** @var string */ + /** @var string */ private $baseUrl; /** @var Client */ private $client; @@ -204,11 +205,11 @@ class CalDavContext implements \Behat\Behat\Context\Context { * @throws \Exception */ public function theCaldavHttpStatusCodeShouldBe($code) { - if ((int)$code !== $this->response->getStatusCode()) { + if ((int) $code !== $this->response->getStatusCode()) { throw new \Exception( sprintf( 'Expected %s got %s', - (int)$code, + (int) $code, $this->response->getStatusCode() ) ); @@ -317,7 +318,7 @@ class CalDavContext implements \Behat\Behat\Context\Context { $jsonEncoded = json_encode($this->responseXml); $arrayElement = json_decode($jsonEncoded, true); $actual = count($arrayElement['value']) - 1; - if ($actual !== (int)$amount) { + if ($actual !== (int) $amount) { throw new InvalidArgumentException( sprintf( 'Expected %s got %s', diff --git a/build/integration/features/bootstrap/CapabilitiesContext.php b/build/integration/features/bootstrap/CapabilitiesContext.php index 8e98d9fb720..b6bc9d8f823 100644 --- a/build/integration/features/bootstrap/CapabilitiesContext.php +++ b/build/integration/features/bootstrap/CapabilitiesContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -32,11 +33,11 @@ class CapabilitiesContext implements Context, SnippetAcceptingContext { for ($i = 0; $i < count($path_to_element); $i++) { $answeredValue = $answeredValue->{$path_to_element[$i]}; } - $answeredValue = (string)$answeredValue; + $answeredValue = (string) $answeredValue; Assert::assertEquals( - $row['value'] === "EMPTY" ? '' : $row['value'], + $row['value'] === 'EMPTY' ? '' : $row['value'], $answeredValue, - "Failed field " . $row['capability'] . " " . $row['path_to_element'] + 'Failed field ' . $row['capability'] . ' ' . $row['path_to_element'] ); } } diff --git a/build/integration/features/bootstrap/CardDavContext.php b/build/integration/features/bootstrap/CardDavContext.php index d5694ec619b..dfc97eadcb5 100644 --- a/build/integration/features/bootstrap/CardDavContext.php +++ b/build/integration/features/bootstrap/CardDavContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -11,7 +12,7 @@ use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Message\ResponseInterface; class CardDavContext implements \Behat\Behat\Context\Context { - /** @var string */ + /** @var string */ private $baseUrl; /** @var Client */ private $client; @@ -84,11 +85,11 @@ class CardDavContext implements \Behat\Behat\Context\Context { $this->response = $e->getResponse(); } - if ((int)$statusCode !== $this->response->getStatusCode()) { + if ((int) $statusCode !== $this->response->getStatusCode()) { throw new \Exception( sprintf( 'Expected %s got %s', - (int)$statusCode, + (int) $statusCode, $this->response->getStatusCode() ) ); @@ -137,11 +138,11 @@ class CardDavContext implements \Behat\Behat\Context\Context { ] ); - if ($this->response->getStatusCode() !== (int)$statusCode) { + if ($this->response->getStatusCode() !== (int) $statusCode) { throw new \Exception( sprintf( 'Expected %s got %s', - (int)$statusCode, + (int) $statusCode, $this->response->getStatusCode() ) ); @@ -336,11 +337,11 @@ class CardDavContext implements \Behat\Behat\Context\Context { * @throws \Exception */ public function theCarddavHttpStatusCodeShouldBe($code) { - if ((int)$code !== $this->response->getStatusCode()) { + if ((int) $code !== $this->response->getStatusCode()) { throw new \Exception( sprintf( 'Expected %s got %s', - (int)$code, + (int) $code, $this->response->getStatusCode() ) ); diff --git a/build/integration/features/bootstrap/ChecksumsContext.php b/build/integration/features/bootstrap/ChecksumsContext.php index 7909d077d7c..8f035f634a2 100644 --- a/build/integration/features/bootstrap/ChecksumsContext.php +++ b/build/integration/features/bootstrap/ChecksumsContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -10,7 +11,7 @@ use GuzzleHttp\Client; use GuzzleHttp\Message\ResponseInterface; class ChecksumsContext implements \Behat\Behat\Context\Context { - /** @var string */ + /** @var string */ private $baseUrl; /** @var Client */ private $client; @@ -86,7 +87,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context { * @throws \Exception */ public function theWebdavResponseShouldHaveAStatusCode($statusCode) { - if ((int)$statusCode !== $this->response->getStatusCode()) { + if ((int) $statusCode !== $this->response->getStatusCode()) { throw new \Exception("Expected $statusCode, got ".$this->response->getStatusCode()); } } @@ -208,7 +209,7 @@ class ChecksumsContext implements \Behat\Behat\Context\Context { */ public function theOcChecksumHeaderShouldNotBeThere() { if ($this->response->hasHeader('OC-Checksum')) { - throw new \Exception("Expected no checksum header but got ".$this->response->getHeader('OC-Checksum')[0]); + throw new \Exception('Expected no checksum header but got '.$this->response->getHeader('OC-Checksum')[0]); } } } diff --git a/build/integration/features/bootstrap/CollaborationContext.php b/build/integration/features/bootstrap/CollaborationContext.php index 854abe98b2f..27fa1795c5d 100644 --- a/build/integration/features/bootstrap/CollaborationContext.php +++ b/build/integration/features/bootstrap/CollaborationContext.php @@ -71,7 +71,7 @@ class CollaborationContext implements Context { try { $destination = '/users/admin/myaddressbook'; $data = '<x0:mkcol xmlns:x0="DAV:"><x0:set><x0:prop><x0:resourcetype><x0:collection/><x4:addressbook xmlns:x4="urn:ietf:params:xml:ns:carddav"/></x0:resourcetype><x0:displayname>myaddressbook</x0:displayname></x0:prop></x0:set></x0:mkcol>'; - $this->response = $this->makeDavRequest($this->currentUser, "MKCOL", $destination, ['Content-Type' => 'application/xml'], $data, "addressbooks"); + $this->response = $this->makeDavRequest($this->currentUser, 'MKCOL', $destination, ['Content-Type' => 'application/xml'], $data, 'addressbooks'); } catch (\GuzzleHttp\Exception\ServerException $e) { // 5xx responses cause a server exception $this->response = $e->getResponse(); @@ -93,7 +93,7 @@ EMAIL;TYPE=HOME:user@example.com REV;VALUE=DATE-AND-OR-TIME:20211130T140111Z END:VCARD EOF; - $this->response = $this->makeDavRequest($this->currentUser, "PUT", $destination, [], $data, "addressbooks"); + $this->response = $this->makeDavRequest($this->currentUser, 'PUT', $destination, [], $data, 'addressbooks'); } catch (\GuzzleHttp\Exception\ServerException $e) { // 5xx responses cause a server exception $this->response = $e->getResponse(); diff --git a/build/integration/features/bootstrap/CommandLine.php b/build/integration/features/bootstrap/CommandLine.php index 84b3dfd447f..118da8a82cf 100644 --- a/build/integration/features/bootstrap/CommandLine.php +++ b/build/integration/features/bootstrap/CommandLine.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -99,7 +100,7 @@ trait CommandLine { * @Then /^the command failed with exit code ([0-9]+)$/ */ public function theCommandFailedWithExitCode($exitCode) { - if ($this->lastCode !== (int)$exitCode) { + if ($this->lastCode !== (int) $exitCode) { throw new \Exception('The command was expected to fail with exit code ' . $exitCode . ' but got ' . $this->lastCode); } } diff --git a/build/integration/features/bootstrap/CommandLineContext.php b/build/integration/features/bootstrap/CommandLineContext.php index 5ea8d12a970..b46d566e328 100644 --- a/build/integration/features/bootstrap/CommandLineContext.php +++ b/build/integration/features/bootstrap/CommandLineContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/build/integration/features/bootstrap/CommentsContext.php b/build/integration/features/bootstrap/CommentsContext.php index 22dc5348077..beae7f7bc61 100644 --- a/build/integration/features/bootstrap/CommentsContext.php +++ b/build/integration/features/bootstrap/CommentsContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -100,7 +101,7 @@ class CommentsContext implements \Behat\Behat\Context\Context { $response = file_get_contents($url, false, $context); preg_match_all('/\<oc:fileid\>(.*)\<\/oc:fileid\>/', $response, $matches); - return (int)$matches[1][0]; + return (int) $matches[1][0]; } /** @@ -113,7 +114,7 @@ class CommentsContext implements \Behat\Behat\Context\Context { */ public function postsACommentWithContentOnTheFileNamedItShouldReturn($user, $content, $fileName, $statusCode) { $fileId = $this->getFileIdForPath($fileName); - $this->fileId = (int)$fileId; + $this->fileId = (int) $fileId; $url = $this->baseUrl . '/remote.php/dav/comments/files/' . $fileId . '/'; $client = new \GuzzleHttp\Client(); @@ -135,8 +136,8 @@ class CommentsContext implements \Behat\Behat\Context\Context { $res = $e->getResponse(); } - if ($res->getStatusCode() !== (int)$statusCode) { - throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ")"); + if ($res->getStatusCode() !== (int) $statusCode) { + throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ')'); } } @@ -177,8 +178,8 @@ class CommentsContext implements \Behat\Behat\Context\Context { $res = $e->getResponse(); } - if ($res->getStatusCode() !== (int)$statusCode) { - throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ")"); + if ($res->getStatusCode() !== (int) $statusCode) { + throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ')'); } if ($res->getStatusCode() === 207) { @@ -235,8 +236,8 @@ class CommentsContext implements \Behat\Behat\Context\Context { $res = $e->getResponse(); } - if ($res->getStatusCode() !== (int)$statusCode) { - throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ")"); + if ($res->getStatusCode() !== (int) $statusCode) { + throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ')'); } } @@ -272,8 +273,8 @@ class CommentsContext implements \Behat\Behat\Context\Context { if ($this->response !== null) { $count = count($this->response); } - if ($count !== (int)$number) { - throw new \Exception("Found more comments than $number (" . $count . ")"); + if ($count !== (int) $number) { + throw new \Exception("Found more comments than $number (" . $count . ')'); } } @@ -302,8 +303,8 @@ class CommentsContext implements \Behat\Behat\Context\Context { $res = $e->getResponse(); } - if ($res->getStatusCode() !== (int)$statusCode) { - throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ")"); + if ($res->getStatusCode() !== (int) $statusCode) { + throw new \Exception("Response status code was not $statusCode (" . $res->getStatusCode() . ')'); } } } diff --git a/build/integration/features/bootstrap/ContactsMenu.php b/build/integration/features/bootstrap/ContactsMenu.php index 4fc3c03c5e9..f6bf6b9422b 100644 --- a/build/integration/features/bootstrap/ContactsMenu.php +++ b/build/integration/features/bootstrap/ContactsMenu.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build/integration/features/bootstrap/DavFeatureContext.php b/build/integration/features/bootstrap/DavFeatureContext.php index acca52ccafc..ec6085cff98 100644 --- a/build/integration/features/bootstrap/DavFeatureContext.php +++ b/build/integration/features/bootstrap/DavFeatureContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build/integration/features/bootstrap/Download.php b/build/integration/features/bootstrap/Download.php index 92f65933854..cf8b4c1b144 100644 --- a/build/integration/features/bootstrap/Download.php +++ b/build/integration/features/bootstrap/Download.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -8,7 +9,7 @@ use PHPUnit\Framework\Assert; require __DIR__ . '/../../vendor/autoload.php'; trait Download { - /** @var string **/ + /** @var string * */ private $downloadedFile; /** @AfterScenario **/ @@ -21,7 +22,7 @@ trait Download { */ public function userDownloadsZipFileForEntriesInFolder($user, $entries, $folder) { $this->asAn($user); - $this->sendingToDirectUrl('GET', "/index.php/apps/files/ajax/download.php?dir=" . $folder . "&files=[" . $entries . "]"); + $this->sendingToDirectUrl('GET', '/index.php/apps/files/ajax/download.php?dir=' . $folder . '&files=[' . $entries . ']'); $this->theHTTPStatusCodeShouldBe('200'); $this->getDownloadedFile(); @@ -45,7 +46,7 @@ trait Download { // printed in case of error. Assert::assertTrue( strpos($this->downloadedFile, "\x50\x4B\x06\x06") === false, - "File contains the zip64 end of central dir signature" + 'File contains the zip64 end of central dir signature' ); } @@ -57,7 +58,7 @@ trait Download { // printed in case of error. Assert::assertTrue( strpos($this->downloadedFile, "\x50\x4B\x06\x06") !== false, - "File does not contain the zip64 end of central dir signature" + 'File does not contain the zip64 end of central dir signature' ); } @@ -77,7 +78,7 @@ trait Download { // in case of error and to be able to get the extra field length. Assert::assertEquals( 1, preg_match($fileHeaderRegExp, $this->downloadedFile, $matches), - "Local header for file did not appear once in zip file" + 'Local header for file did not appear once in zip file' ); $extraFieldLength = unpack('vextraFieldLength', $matches[1])['extraFieldLength']; @@ -97,7 +98,7 @@ trait Download { // in case of error. Assert::assertEquals( 1, preg_match($fileHeaderAndContentRegExp, $this->downloadedFile), - "Local header and contents for file did not appear once in zip file" + 'Local header and contents for file did not appear once in zip file' ); } @@ -117,7 +118,7 @@ trait Download { // in case of error. Assert::assertEquals( 1, preg_match($folderHeaderRegExp, $this->downloadedFile), - "Local header for folder did not appear once in zip file" + 'Local header for folder did not appear once in zip file' ); } diff --git a/build/integration/features/bootstrap/ExternalStorage.php b/build/integration/features/bootstrap/ExternalStorage.php index b1e4c92810b..8fe2653a026 100644 --- a/build/integration/features/bootstrap/ExternalStorage.php +++ b/build/integration/features/bootstrap/ExternalStorage.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build/integration/features/bootstrap/FakeSMTPHelper.php b/build/integration/features/bootstrap/FakeSMTPHelper.php index 2d90494b82c..6e7ed0aa575 100644 --- a/build/integration/features/bootstrap/FakeSMTPHelper.php +++ b/build/integration/features/bootstrap/FakeSMTPHelper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php index c91c5e7cfa3..ab37556f931 100644 --- a/build/integration/features/bootstrap/FeatureContext.php +++ b/build/integration/features/bootstrap/FeatureContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/build/integration/features/bootstrap/FederationContext.php b/build/integration/features/bootstrap/FederationContext.php index 03a03ef2fd6..c868cac7f5b 100644 --- a/build/integration/features/bootstrap/FederationContext.php +++ b/build/integration/features/bootstrap/FederationContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -64,7 +65,7 @@ class FederationContext implements Context, SnippetAcceptingContext { * @param string $shareeServer "LOCAL" or "REMOTE" */ public function federateSharing($sharerUser, $sharerServer, $sharerPath, $shareeUser, $shareeServer) { - if ($shareeServer == "REMOTE") { + if ($shareeServer == 'REMOTE') { $shareWith = "$shareeUser@" . substr($this->remoteBaseUrl, 0, -4); } else { $shareWith = "$shareeUser@" . substr($this->localBaseUrl, 0, -4); @@ -85,7 +86,7 @@ class FederationContext implements Context, SnippetAcceptingContext { * @param string $shareeServer "LOCAL" or "REMOTE" */ public function federateGroupSharing($sharerUser, $sharerServer, $sharerPath, $shareeGroup, $shareeServer) { - if ($shareeServer == "REMOTE") { + if ($shareeServer == 'REMOTE') { $shareWith = "$shareeGroup@" . substr($this->remoteBaseUrl, 0, -4); } else { $shareWith = "$shareeGroup@" . substr($this->localBaseUrl, 0, -4); @@ -134,7 +135,7 @@ class FederationContext implements Context, SnippetAcceptingContext { public function acceptLastPendingShare($user, $server) { $previous = $this->usingServer($server); $this->asAn($user); - $this->sendingToWith('GET', "/apps/files_sharing/api/v1/remote_shares/pending", null); + $this->sendingToWith('GET', '/apps/files_sharing/api/v1/remote_shares/pending', null); $this->theHTTPStatusCodeShouldBe('200'); $this->theOCSStatusCodeShouldBe('100'); $share_id = simplexml_load_string($this->response->getBody())->data[0]->element[0]->id; @@ -152,7 +153,7 @@ class FederationContext implements Context, SnippetAcceptingContext { */ public function deleteLastAcceptedRemoteShare($user) { $this->asAn($user); - $this->sendingToWith('DELETE', "/apps/files_sharing/api/v1/remote_shares/" . $this->lastAcceptedRemoteShareId, null); + $this->sendingToWith('DELETE', '/apps/files_sharing/api/v1/remote_shares/' . $this->lastAcceptedRemoteShareId, null); } /** diff --git a/build/integration/features/bootstrap/FilesDropContext.php b/build/integration/features/bootstrap/FilesDropContext.php index e70c9c72d40..96351ad6fc3 100644 --- a/build/integration/features/bootstrap/FilesDropContext.php +++ b/build/integration/features/bootstrap/FilesDropContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build/integration/features/bootstrap/LDAPContext.php b/build/integration/features/bootstrap/LDAPContext.php index f0181b36c71..6f6fe86b605 100644 --- a/build/integration/features/bootstrap/LDAPContext.php +++ b/build/integration/features/bootstrap/LDAPContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -137,7 +138,7 @@ class LDAPContext implements Context { $listReturnedElements = simplexml_load_string($this->response->getBody())->data[0]->$type[0]->element; $extractedIDsArray = json_decode(json_encode($listReturnedElements), 1); foreach ($expectations->getRows() as $expectation) { - if ((int)$expectation[1] === 1) { + if ((int) $expectation[1] === 1) { Assert::assertContains($expectation[0], $extractedIDsArray); } else { Assert::assertNotContains($expectation[0], $extractedIDsArray); @@ -170,7 +171,7 @@ class LDAPContext implements Context { $uidsFound++; } } - Assert::assertSame((int)$expectedCount, $uidsFound); + Assert::assertSame((int) $expectedCount, $uidsFound); } /** @@ -178,11 +179,11 @@ class LDAPContext implements Context { */ public function theRecordFieldsShouldMatch(TableNode $expectations) { foreach ($expectations->getRowsHash() as $k => $v) { - $value = (string)simplexml_load_string($this->response->getBody())->data[0]->$k; + $value = (string) simplexml_load_string($this->response->getBody())->data[0]->$k; Assert::assertEquals($v, $value, "got $value"); } - $backend = (string)simplexml_load_string($this->response->getBody())->data[0]->backend; + $backend = (string) simplexml_load_string($this->response->getBody())->data[0]->backend; Assert::assertEquals('LDAP', $backend); } diff --git a/build/integration/features/bootstrap/Mail.php b/build/integration/features/bootstrap/Mail.php index 5e5a75fdc26..d48ed6399c5 100644 --- a/build/integration/features/bootstrap/Mail.php +++ b/build/integration/features/bootstrap/Mail.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -20,7 +21,7 @@ trait Mail { return; } - exec("kill " . $this->fakeSmtpServerPid); + exec('kill ' . $this->fakeSmtpServerPid); $this->invokingTheCommand('config:system:delete mail_smtpport'); } @@ -33,6 +34,6 @@ trait Mail { // FakeSMTP uses 2525 instead. $this->invokingTheCommand('config:system:set mail_smtpport --value=2525 --type integer'); - $this->fakeSmtpServerPid = exec("php features/bootstrap/FakeSMTPHelper.php >/dev/null 2>&1 & echo $!"); + $this->fakeSmtpServerPid = exec('php features/bootstrap/FakeSMTPHelper.php >/dev/null 2>&1 & echo $!'); } } diff --git a/build/integration/features/bootstrap/MetadataContext.php b/build/integration/features/bootstrap/MetadataContext.php index 893c08a5467..32042590c86 100644 --- a/build/integration/features/bootstrap/MetadataContext.php +++ b/build/integration/features/bootstrap/MetadataContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index 2fb1c807cc5..774a42a4e00 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -34,7 +35,7 @@ trait Provisioning { $this->userExists($user); } catch (\GuzzleHttp\Exception\ClientException $ex) { $previous_user = $this->currentUser; - $this->currentUser = "admin"; + $this->currentUser = 'admin'; $this->creatingTheUser($user); $this->currentUser = $previous_user; } @@ -51,7 +52,7 @@ trait Provisioning { $this->userExists($user); } catch (\GuzzleHttp\Exception\ClientException $ex) { $previous_user = $this->currentUser; - $this->currentUser = "admin"; + $this->currentUser = 'admin'; $this->creatingTheUser($user, $displayname); $this->currentUser = $previous_user; } @@ -72,7 +73,7 @@ trait Provisioning { return; } $previous_user = $this->currentUser; - $this->currentUser = "admin"; + $this->currentUser = 'admin'; $this->deletingTheUser($user); $this->currentUser = $previous_user; try { @@ -250,7 +251,7 @@ trait Provisioning { public function createUser($user) { $previous_user = $this->currentUser; - $this->currentUser = "admin"; + $this->currentUser = 'admin'; $this->creatingTheUser($user); $this->userExists($user); $this->currentUser = $previous_user; @@ -258,7 +259,7 @@ trait Provisioning { public function deleteUser($user) { $previous_user = $this->currentUser; - $this->currentUser = "admin"; + $this->currentUser = 'admin'; $this->deletingTheUser($user); $this->userDoesNotExist($user); $this->currentUser = $previous_user; @@ -266,7 +267,7 @@ trait Provisioning { public function createGroup($group) { $previous_user = $this->currentUser; - $this->currentUser = "admin"; + $this->currentUser = 'admin'; $this->creatingTheGroup($group); $this->groupExists($group); $this->currentUser = $previous_user; @@ -274,7 +275,7 @@ trait Provisioning { public function deleteGroup($group) { $previous_user = $this->currentUser; - $this->currentUser = "admin"; + $this->currentUser = 'admin'; $this->deletingTheGroup($group); $this->groupDoesNotExist($group); $this->currentUser = $previous_user; @@ -343,7 +344,7 @@ trait Provisioning { */ public function assureUserBelongsToGroup($user, $group) { $previous_user = $this->currentUser; - $this->currentUser = "admin"; + $this->currentUser = 'admin'; if (!$this->userBelongsToGroup($user, $group)) { $this->addingUserToGroup($user, $group); @@ -522,7 +523,7 @@ trait Provisioning { $this->groupExists($group); } catch (\GuzzleHttp\Exception\ClientException $ex) { $previous_user = $this->currentUser; - $this->currentUser = "admin"; + $this->currentUser = 'admin'; $this->creatingTheGroup($group); $this->currentUser = $previous_user; } @@ -543,7 +544,7 @@ trait Provisioning { return; } $previous_user = $this->currentUser; - $this->currentUser = "admin"; + $this->currentUser = 'admin'; $this->deletingTheGroup($group); $this->currentUser = $previous_user; try { @@ -775,7 +776,7 @@ trait Provisioning { * @param string $app */ public function appIsDisabled($app) { - $fullUrl = $this->baseUrl . "v2.php/cloud/apps?filter=disabled"; + $fullUrl = $this->baseUrl . 'v2.php/cloud/apps?filter=disabled'; $client = new Client(); $options = []; if ($this->currentUser === 'admin') { @@ -796,7 +797,7 @@ trait Provisioning { * @param string $app */ public function appIsEnabled($app) { - $fullUrl = $this->baseUrl . "v2.php/cloud/apps?filter=enabled"; + $fullUrl = $this->baseUrl . 'v2.php/cloud/apps?filter=enabled'; $client = new Client(); $options = []; if ($this->currentUser === 'admin') { @@ -820,7 +821,7 @@ trait Provisioning { * @param string $app */ public function appIsNotEnabled($app) { - $fullUrl = $this->baseUrl . "v2.php/cloud/apps?filter=enabled"; + $fullUrl = $this->baseUrl . 'v2.php/cloud/apps?filter=enabled'; $client = new Client(); $options = []; if ($this->currentUser === 'admin') { @@ -873,7 +874,7 @@ trait Provisioning { $this->response = $client->get($fullUrl, $options); // boolean to string is integer - Assert::assertEquals("1", simplexml_load_string($this->response->getBody())->data[0]->enabled); + Assert::assertEquals('1', simplexml_load_string($this->response->getBody())->data[0]->enabled); } /** @@ -888,7 +889,7 @@ trait Provisioning { ]); // method used from BasicStructure trait - $this->sendingToWith("PUT", "/cloud/users/" . $user, $body); + $this->sendingToWith('PUT', '/cloud/users/' . $user, $body); } /** diff --git a/build/integration/features/bootstrap/RateLimitingContext.php b/build/integration/features/bootstrap/RateLimitingContext.php index ca198dc5514..15c8c5c8379 100644 --- a/build/integration/features/bootstrap/RateLimitingContext.php +++ b/build/integration/features/bootstrap/RateLimitingContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build/integration/features/bootstrap/RemoteContext.php b/build/integration/features/bootstrap/RemoteContext.php index b1605e4da25..6102f686ea7 100644 --- a/build/integration/features/bootstrap/RemoteContext.php +++ b/build/integration/features/bootstrap/RemoteContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -41,7 +42,7 @@ class RemoteContext implements Context { * @param string $remoteServer "NON_EXISTING" or "REMOTE" */ public function selectRemoteInstance($remoteServer) { - if ($remoteServer == "REMOTE") { + if ($remoteServer == 'REMOTE') { $baseUri = $this->remoteUrl; } else { $baseUri = 'nonexistingnextcloudserver.local'; diff --git a/build/integration/features/bootstrap/Search.php b/build/integration/features/bootstrap/Search.php index 47259be769c..49a4fe92822 100644 --- a/build/integration/features/bootstrap/Search.php +++ b/build/integration/features/bootstrap/Search.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build/integration/features/bootstrap/SetupContext.php b/build/integration/features/bootstrap/SetupContext.php index 96cb00d8601..aa131cec597 100644 --- a/build/integration/features/bootstrap/SetupContext.php +++ b/build/integration/features/bootstrap/SetupContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build/integration/features/bootstrap/ShareesContext.php b/build/integration/features/bootstrap/ShareesContext.php index e152a749bfa..37e0e63e547 100644 --- a/build/integration/features/bootstrap/ShareesContext.php +++ b/build/integration/features/bootstrap/ShareesContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 4d57bbfa670..ea74096ca3b 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -66,7 +67,7 @@ trait Sharing { } try { - $this->response = $client->request("POST", $fullUrl, $options); + $this->response = $client->request('POST', $fullUrl, $options); } catch (\GuzzleHttp\Exception\ClientException $ex) { $this->response = $ex->getResponse(); } @@ -102,7 +103,7 @@ trait Sharing { public function acceptingLastShare() { $share_id = $this->lastShareData->data[0]->id; $url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/pending/$share_id"; - $this->sendingToWith("POST", $url, null); + $this->sendingToWith('POST', $url, null); $this->theHTTPStatusCodeShouldBe('200'); } @@ -122,7 +123,7 @@ trait Sharing { $share_id = $this->lastShareData->data[0]->id; $url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/pending/$share_id"; - $this->sendingToWith("POST", $url, null); + $this->sendingToWith('POST', $url, null); $this->currentUser = $previousUser; @@ -138,7 +139,7 @@ trait Sharing { } else { $url = $this->lastShareData->data->url; } - $fullUrl = $url . "/download"; + $fullUrl = $url . '/download'; $this->checkDownload($fullUrl, null, 'text/plain'); } @@ -152,7 +153,7 @@ trait Sharing { $token = $this->lastShareData->data->token; } - $fullUrl = substr($this->baseUrl, 0, -4) . "index.php/s/" . $token . "/download"; + $fullUrl = substr($this->baseUrl, 0, -4) . 'index.php/s/' . $token . '/download'; $this->checkDownload($fullUrl, null, 'text/plain'); } @@ -207,9 +208,9 @@ trait Sharing { } else { $options['auth'] = [$this->currentUser, $this->regularUser]; } - $date = date('Y-m-d', strtotime("+3 days")); + $date = date('Y-m-d', strtotime('+3 days')); $options['form_params'] = ['expireDate' => $date]; - $this->response = $this->response = $client->request("PUT", $fullUrl, $options); + $this->response = $this->response = $client->request('PUT', $fullUrl, $options); Assert::assertEquals(200, $this->response->getStatusCode()); } @@ -242,7 +243,7 @@ trait Sharing { } try { - $this->response = $client->request("PUT", $fullUrl, $options); + $this->response = $client->request('PUT', $fullUrl, $options); } catch (\GuzzleHttp\Exception\ClientException $ex) { $this->response = $ex->getResponse(); } @@ -296,7 +297,7 @@ trait Sharing { $options['form_params'] = $body; try { - $this->response = $client->request("POST", $fullUrl, $options); + $this->response = $client->request('POST', $fullUrl, $options); $this->lastShareData = simplexml_load_string($this->response->getBody()); } catch (\GuzzleHttp\Exception\ClientException $ex) { $this->response = $ex->getResponse(); @@ -306,20 +307,20 @@ trait Sharing { public function isFieldInResponse($field, $contentExpected) { $data = simplexml_load_string($this->response->getBody())->data[0]; - if ((string)$field == 'expiration') { - if(!empty($contentExpected)) { - $contentExpected = date('Y-m-d', strtotime($contentExpected)) . " 00:00:00"; + if ((string) $field == 'expiration') { + if (!empty($contentExpected)) { + $contentExpected = date('Y-m-d', strtotime($contentExpected)) . ' 00:00:00'; } } if (count($data->element) > 0) { foreach ($data as $element) { - if ($contentExpected == "A_TOKEN") { - return (strlen((string)$element->$field) == 15); - } elseif ($contentExpected == "A_NUMBER") { - return is_numeric((string)$element->$field); - } elseif ($contentExpected == "AN_URL") { - return $this->isExpectedUrl((string)$element->$field, "index.php/s/"); - } elseif ((string)$element->$field == $contentExpected) { + if ($contentExpected == 'A_TOKEN') { + return (strlen((string) $element->$field) == 15); + } elseif ($contentExpected == 'A_NUMBER') { + return is_numeric((string) $element->$field); + } elseif ($contentExpected == 'AN_URL') { + return $this->isExpectedUrl((string) $element->$field, 'index.php/s/'); + } elseif ((string) $element->$field == $contentExpected) { return true; } else { print($element->$field); @@ -328,12 +329,12 @@ trait Sharing { return false; } else { - if ($contentExpected == "A_TOKEN") { - return (strlen((string)$data->$field) == 15); - } elseif ($contentExpected == "A_NUMBER") { - return is_numeric((string)$data->$field); - } elseif ($contentExpected == "AN_URL") { - return $this->isExpectedUrl((string)$data->$field, "index.php/s/"); + if ($contentExpected == 'A_TOKEN') { + return (strlen((string) $data->$field) == 15); + } elseif ($contentExpected == 'A_NUMBER') { + return is_numeric((string) $data->$field); + } elseif ($contentExpected == 'AN_URL') { + return $this->isExpectedUrl((string) $data->$field, 'index.php/s/'); } elseif ($contentExpected == $data->$field) { return true; } @@ -459,7 +460,7 @@ trait Sharing { public function deletingLastShare() { $share_id = $this->lastShareData->data[0]->id; $url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; - $this->sendingToWith("DELETE", $url, null); + $this->sendingToWith('DELETE', $url, null); } /** @@ -468,7 +469,7 @@ trait Sharing { public function gettingInfoOfLastShare() { $share_id = $this->lastShareData->data[0]->id; $url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; - $this->sendingToWith("GET", $url, null); + $this->sendingToWith('GET', $url, null); } /** @@ -500,13 +501,13 @@ trait Sharing { $fd = $body->getRowsHash(); foreach ($fd as $field => $value) { - if (substr($field, 0, 10) === "share_with") { - $value = str_replace("REMOTE", substr($this->remoteBaseUrl, 0, -5), $value); - $value = str_replace("LOCAL", substr($this->localBaseUrl, 0, -5), $value); + if (substr($field, 0, 10) === 'share_with') { + $value = str_replace('REMOTE', substr($this->remoteBaseUrl, 0, -5), $value); + $value = str_replace('LOCAL', substr($this->localBaseUrl, 0, -5), $value); } - if (substr($field, 0, 6) === "remote") { - $value = str_replace("REMOTE", substr($this->remoteBaseUrl, 0, -4), $value); - $value = str_replace("LOCAL", substr($this->localBaseUrl, 0, -4), $value); + if (substr($field, 0, 6) === 'remote') { + $value = str_replace('REMOTE', substr($this->remoteBaseUrl, 0, -4), $value); + $value = str_replace('LOCAL', substr($this->localBaseUrl, 0, -4), $value); } if (!$this->isFieldInResponse($field, $value)) { Assert::fail("$field" . " doesn't have value " . "$value"); @@ -607,19 +608,19 @@ trait Sharing { } if ($field === 'expiration' && !empty($contentExpected)) { - $contentExpected = date('Y-m-d', strtotime($contentExpected)) . " 00:00:00"; + $contentExpected = date('Y-m-d', strtotime($contentExpected)) . ' 00:00:00'; } if ($contentExpected === 'A_NUMBER') { - Assert::assertTrue(is_numeric((string)$returnedShare->$field), "Field '$field' is not a number: " . $returnedShare->$field); + Assert::assertTrue(is_numeric((string) $returnedShare->$field), "Field '$field' is not a number: " . $returnedShare->$field); } elseif ($contentExpected === 'A_TOKEN') { // A token is composed by 15 characters from // ISecureRandom::CHAR_HUMAN_READABLE. - Assert::assertRegExp('/^[abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789]{15}$/', (string)$returnedShare->$field, "Field '$field' is not a token"); + Assert::assertRegExp('/^[abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789]{15}$/', (string) $returnedShare->$field, "Field '$field' is not a token"); } elseif (strpos($contentExpected, 'REGEXP ') === 0) { - Assert::assertRegExp(substr($contentExpected, strlen('REGEXP ')), (string)$returnedShare->$field, "Field '$field' does not match"); + Assert::assertRegExp(substr($contentExpected, strlen('REGEXP ')), (string) $returnedShare->$field, "Field '$field' does not match"); } else { - Assert::assertEquals($contentExpected, (string)$returnedShare->$field, "Field '$field' does not match"); + Assert::assertEquals($contentExpected, (string) $returnedShare->$field, "Field '$field' does not match"); } } diff --git a/build/integration/features/bootstrap/SharingContext.php b/build/integration/features/bootstrap/SharingContext.php index d2f1a2446ae..04a9fde6c25 100644 --- a/build/integration/features/bootstrap/SharingContext.php +++ b/build/integration/features/bootstrap/SharingContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build/integration/features/bootstrap/TagsContext.php b/build/integration/features/bootstrap/TagsContext.php index 3a2c0e41744..bb492170c71 100644 --- a/build/integration/features/bootstrap/TagsContext.php +++ b/build/integration/features/bootstrap/TagsContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -161,7 +162,7 @@ class TagsContext implements \Behat\Behat\Context\Context { * @throws \Exception */ public function theResponseShouldHaveAStatusCode($statusCode) { - if ((int)$statusCode !== $this->response->getStatusCode()) { + if ((int) $statusCode !== $this->response->getStatusCode()) { throw new \Exception("Expected $statusCode, got " . $this->response->getStatusCode()); } } @@ -245,7 +246,7 @@ class TagsContext implements \Behat\Behat\Context\Context { if (count($table->getRows()) !== count($tags)) { throw new \Exception( sprintf( - "Expected %s tags, got %s.", + 'Expected %s tags, got %s.', count($table->getRows()), count($tags) ) @@ -311,7 +312,7 @@ class TagsContext implements \Behat\Behat\Context\Context { * @throws \Exception */ public function tagsShouldExistFor($count, $user) { - if ((int)$count !== count($this->requestTagsForUser($user))) { + if ((int) $count !== count($this->requestTagsForUser($user))) { throw new \Exception("Expected $count tags, got " . count($this->requestTagsForUser($user))); } } @@ -368,7 +369,7 @@ class TagsContext implements \Behat\Behat\Context\Context { break; } } - return (int)$tagId; + return (int) $tagId; } /** @@ -492,7 +493,7 @@ class TagsContext implements \Behat\Behat\Context\Context { ]); $response = file_get_contents($url, false, $context); preg_match_all('/\<oc:fileid\>(.*?)\<\/oc:fileid\>/', $response, $matches); - return (int)$matches[1][0]; + return (int) $matches[1][0]; } /** diff --git a/build/integration/features/bootstrap/TalkContext.php b/build/integration/features/bootstrap/TalkContext.php index fe248e1af7c..6f351c30ccf 100644 --- a/build/integration/features/bootstrap/TalkContext.php +++ b/build/integration/features/bootstrap/TalkContext.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/build/integration/features/bootstrap/Trashbin.php b/build/integration/features/bootstrap/Trashbin.php index 1b1be71bace..dfcc23289a7 100644 --- a/build/integration/features/bootstrap/Trashbin.php +++ b/build/integration/features/bootstrap/Trashbin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2017 ownCloud GmbH @@ -97,7 +98,7 @@ trait Trashbin { foreach ($elementsSimplified as $expectedElement) { $expectedElement = ltrim($expectedElement, '/'); if (array_search($expectedElement, $trashContent) === false) { - Assert::fail("$expectedElement" . " is not in trash listing"); + Assert::fail("$expectedElement" . ' is not in trash listing'); } } } diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 93a44f7c4b6..0533ab330a8 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -17,7 +18,7 @@ require __DIR__ . '/../../vendor/autoload.php'; trait WebDav { use Sharing; - private string $davPath = "remote.php/webdav"; + private string $davPath = 'remote.php/webdav'; private bool $usingOldDavPath = true; private ?array $storedETAG = null; // map with user as key and another map as value, which has path as key and etag as value private ?int $storedFileID = null; @@ -40,7 +41,7 @@ trait WebDav { * @Given /^using old dav path$/ */ public function usingOldDavPath() { - $this->davPath = "remote.php/webdav"; + $this->davPath = 'remote.php/webdav'; $this->usingOldDavPath = true; } @@ -48,7 +49,7 @@ trait WebDav { * @Given /^using new dav path$/ */ public function usingNewDavPath() { - $this->davPath = "remote.php/dav"; + $this->davPath = 'remote.php/dav'; $this->usingOldDavPath = false; } @@ -56,7 +57,7 @@ trait WebDav { * @Given /^using new public dav path$/ */ public function usingNewPublicDavPath() { - $this->davPath = "public.php/dav"; + $this->davPath = 'public.php/dav'; $this->usingOldDavPath = false; } @@ -68,10 +69,10 @@ trait WebDav { } } - public function makeDavRequest($user, $method, $path, $headers, $body = null, $type = "files") { - if ($type === "files") { + public function makeDavRequest($user, $method, $path, $headers, $body = null, $type = 'files') { + if ($type === 'files') { $fullUrl = substr($this->baseUrl, 0, -4) . $this->getDavFilesPath($user) . "$path"; - } elseif ($type === "uploads") { + } elseif ($type === 'uploads') { $fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath . "$path"; } else { $fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath . '/' . $type . "$path"; @@ -98,7 +99,7 @@ trait WebDav { public function userMovedFile($user, $entry, $fileSource, $fileDestination) { $fullUrl = substr($this->baseUrl, 0, -4) . $this->getDavFilesPath($user); $headers['Destination'] = $fullUrl . $fileDestination; - $this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers); + $this->response = $this->makeDavRequest($user, 'MOVE', $fileSource, $headers); Assert::assertEquals(201, $this->response->getStatusCode()); } @@ -112,7 +113,7 @@ trait WebDav { $fullUrl = substr($this->baseUrl, 0, -4) . $this->getDavFilesPath($user); $headers['Destination'] = $fullUrl . $fileDestination; try { - $this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers); + $this->response = $this->makeDavRequest($user, 'MOVE', $fileSource, $headers); } catch (\GuzzleHttp\Exception\ClientException $e) { $this->response = $e->getResponse(); } @@ -142,7 +143,7 @@ trait WebDav { */ public function downloadFileWithRange($fileSource, $range) { $headers['Range'] = $range; - $this->response = $this->makeDavRequest($this->currentUser, "GET", $fileSource, $headers); + $this->response = $this->makeDavRequest($this->currentUser, 'GET', $fileSource, $headers); } /** @@ -159,7 +160,7 @@ trait WebDav { 'Range' => $range ]; - $this->response = $client->request("GET", $fullUrl, $options); + $this->response = $client->request('GET', $fullUrl, $options); } /** @@ -177,7 +178,7 @@ trait WebDav { ] ]; - $this->response = $client->request("GET", $fullUrl, $options); + $this->response = $client->request('GET', $fullUrl, $options); } /** @@ -185,7 +186,7 @@ trait WebDav { * @param string $content */ public function downloadedContentShouldBe($content) { - Assert::assertEquals($content, (string)$this->response->getBody()); + Assert::assertEquals($content, (string) $this->response->getBody()); } /** @@ -392,7 +393,7 @@ trait WebDav { public function theResponseShouldContainAShareTypesPropertyWith($table) { $keys = $this->response; if (!array_key_exists('{http://owncloud.org/ns}share-types', $keys)) { - throw new \Exception("Cannot find property \"{http://owncloud.org/ns}share-types\""); + throw new \Exception('Cannot find property "{http://owncloud.org/ns}share-types"'); } $foundTypes = []; @@ -557,11 +558,11 @@ trait WebDav { </d:searchrequest>'; try { - $this->response = $this->makeDavRequest($user, "SEARCH", '', [ + $this->response = $this->makeDavRequest($user, 'SEARCH', '', [ 'Content-Type' => 'text/xml' ], $body, ''); - var_dump((string)$this->response->getBody()); + var_dump((string) $this->response->getBody()); } catch (\GuzzleHttp\Exception\ServerException $e) { // 5xx responses cause a server exception $this->response = $e->getResponse(); @@ -632,9 +633,9 @@ trait WebDav { $elementRows = $expectedElements->getRows(); $elementsSimplified = $this->simplifyArray($elementRows); foreach ($elementsSimplified as $expectedElement) { - $webdavPath = "/" . $this->getDavFilesPath($user) . $expectedElement; + $webdavPath = '/' . $this->getDavFilesPath($user) . $expectedElement; if (!array_key_exists($webdavPath, $elementList)) { - Assert::fail("$webdavPath" . " is not in propfind answer"); + Assert::fail("$webdavPath" . ' is not in propfind answer'); } } } @@ -649,7 +650,7 @@ trait WebDav { public function userUploadsAFileTo($user, $source, $destination) { $file = \GuzzleHttp\Psr7\Utils::streamFor(fopen($source, 'r')); try { - $this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file); + $this->response = $this->makeDavRequest($user, 'PUT', $destination, [], $file); } catch (\GuzzleHttp\Exception\ServerException $e) { // 5xx responses cause a server exception $this->response = $e->getResponse(); @@ -666,11 +667,11 @@ trait WebDav { * @param string $destination */ public function userAddsAFileTo($user, $bytes, $destination) { - $filename = "filespecificSize.txt"; + $filename = 'filespecificSize.txt'; $this->createFileSpecificSize($filename, $bytes); Assert::assertEquals(1, file_exists("work/$filename")); $this->userUploadsAFileTo($user, "work/$filename", $destination); - $this->removeFile("work/", $filename); + $this->removeFile('work/', $filename); $expectedElements = new \Behat\Gherkin\Node\TableNode([["$destination"]]); $this->checkElementList($user, $expectedElements); } @@ -681,7 +682,7 @@ trait WebDav { public function userUploadsAFileWithContentTo($user, $content, $destination) { $file = \GuzzleHttp\Psr7\Utils::streamFor($content); try { - $this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file); + $this->response = $this->makeDavRequest($user, 'PUT', $destination, [], $file); } catch (\GuzzleHttp\Exception\ServerException $e) { // 5xx responses cause a server exception $this->response = $e->getResponse(); @@ -717,7 +718,7 @@ trait WebDav { public function userCreatedAFolder($user, $destination) { try { $destination = '/' . ltrim($destination, '/'); - $this->response = $this->makeDavRequest($user, "MKCOL", $destination, []); + $this->response = $this->makeDavRequest($user, 'MKCOL', $destination, []); } catch (\GuzzleHttp\Exception\ServerException $e) { // 5xx responses cause a server exception $this->response = $e->getResponse(); @@ -738,28 +739,28 @@ trait WebDav { * @param string $content3 */ public function userUploadsBulkedFiles($user, $name1, $content1, $name2, $content2, $name3, $content3) { - $boundary = "boundary_azertyuiop"; + $boundary = 'boundary_azertyuiop'; - $body = ""; + $body = ''; $body .= '--'.$boundary."\r\n"; - $body .= "X-File-Path: ".$name1."\r\n"; + $body .= 'X-File-Path: '.$name1."\r\n"; $body .= "X-File-MD5: f6a6263167c92de8644ac998b3c4e4d1\r\n"; $body .= "X-OC-Mtime: 1111111111\r\n"; - $body .= "Content-Length: ".strlen($content1)."\r\n"; + $body .= 'Content-Length: '.strlen($content1)."\r\n"; $body .= "\r\n"; $body .= $content1."\r\n"; $body .= '--'.$boundary."\r\n"; - $body .= "X-File-Path: ".$name2."\r\n"; + $body .= 'X-File-Path: '.$name2."\r\n"; $body .= "X-File-MD5: 87c7d4068be07d390a1fffd21bf1e944\r\n"; $body .= "X-OC-Mtime: 2222222222\r\n"; - $body .= "Content-Length: ".strlen($content2)."\r\n"; + $body .= 'Content-Length: '.strlen($content2)."\r\n"; $body .= "\r\n"; $body .= $content2."\r\n"; $body .= '--'.$boundary."\r\n"; - $body .= "X-File-Path: ".$name3."\r\n"; + $body .= 'X-File-Path: '.$name3."\r\n"; $body .= "X-File-MD5: e86a1cf0678099986a901c79086f5617\r\n"; $body .= "X-File-Mtime: 3333333333\r\n"; - $body .= "Content-Length: ".strlen($content3)."\r\n"; + $body .= 'Content-Length: '.strlen($content3)."\r\n"; $body .= "\r\n"; $body .= $content3."\r\n"; $body .= '--'.$boundary."--\r\n"; @@ -773,12 +774,12 @@ trait WebDav { 'auth' => [$user, $this->regularUser], 'headers' => [ 'Content-Type' => 'multipart/related; boundary='.$boundary, - 'Content-Length' => (string)strlen($body), + 'Content-Length' => (string) strlen($body), ], 'body' => $body ]; - return $client->request("POST", substr($this->baseUrl, 0, -4) . "remote.php/dav/bulk", $options); + return $client->request('POST', substr($this->baseUrl, 0, -4) . 'remote.php/dav/bulk', $options); } /** @@ -787,7 +788,7 @@ trait WebDav { public function userCreatesANewChunkingUploadWithId($user, $id) { $this->parts = []; $destination = '/uploads/' . $user . '/' . $id; - $this->makeDavRequest($user, 'MKCOL', $destination, [], null, "uploads"); + $this->makeDavRequest($user, 'MKCOL', $destination, [], null, 'uploads'); } /** @@ -796,7 +797,7 @@ trait WebDav { public function userUploadsNewChunkFileOfWithToId($user, $num, $data, $id) { $data = \GuzzleHttp\Psr7\Utils::streamFor($data); $destination = '/uploads/' . $user . '/' . $id . '/' . $num; - $this->makeDavRequest($user, 'PUT', $destination, [], $data, "uploads"); + $this->makeDavRequest($user, 'PUT', $destination, [], $data, 'uploads'); } /** @@ -807,7 +808,7 @@ trait WebDav { $destination = substr($this->baseUrl, 0, -4) . $this->getDavFilesPath($user) . $dest; $this->makeDavRequest($user, 'MOVE', $source, [ 'Destination' => $destination - ], null, "uploads"); + ], null, 'uploads'); } /** @@ -821,7 +822,7 @@ trait WebDav { $this->response = $this->makeDavRequest($user, 'MOVE', $source, [ 'Destination' => $destination, 'OC-Total-Length' => $size - ], null, "uploads"); + ], null, 'uploads'); } catch (\GuzzleHttp\Exception\BadResponseException $ex) { $this->response = $ex->getResponse(); } @@ -837,7 +838,7 @@ trait WebDav { $destination = '/uploads/' . $user . '/' . $this->getUploadId($id); $this->response = $this->makeDavRequest($user, 'MKCOL', $destination, [ 'Destination' => $this->s3MultipartDestination, - ], null, "uploads"); + ], null, 'uploads'); } /** @@ -848,7 +849,7 @@ trait WebDav { $destination = '/uploads/' . $user . '/' . $this->getUploadId($id) . '/' . $num; $this->response = $this->makeDavRequest($user, 'PUT', $destination, [ 'Destination' => $this->s3MultipartDestination - ], $data, "uploads"); + ], $data, 'uploads'); } /** @@ -859,7 +860,7 @@ trait WebDav { try { $this->response = $this->makeDavRequest($user, 'MOVE', $source, [ 'Destination' => $this->s3MultipartDestination, - ], null, "uploads"); + ], null, 'uploads'); } catch (\GuzzleHttp\Exception\ServerException $e) { // 5xx responses cause a server exception $this->response = $e->getResponse(); @@ -878,7 +879,7 @@ trait WebDav { } private function newUploadId() { - $this->uploadId = (string)time(); + $this->uploadId = (string) time(); } /** @@ -1030,9 +1031,9 @@ trait WebDav { $elementRows = $expectedElements->getRows(); $elementsSimplified = $this->simplifyArray($elementRows); foreach ($elementsSimplified as $expectedElement) { - $webdavPath = "/" . $this->getDavFilesPath($user) . $expectedElement; + $webdavPath = '/' . $this->getDavFilesPath($user) . $expectedElement; if (!array_key_exists($webdavPath, $elementList)) { - Assert::fail("$webdavPath" . " is not in report answer"); + Assert::fail("$webdavPath" . ' is not in report answer'); } } } @@ -1047,12 +1048,12 @@ trait WebDav { $elementList = $this->listFolder($user, $folder, 1); $elementListKeys = array_keys($elementList); array_shift($elementListKeys); - $davPrefix = "/" . $this->getDavFilesPath($user); + $davPrefix = '/' . $this->getDavFilesPath($user); foreach ($elementListKeys as $element) { if (substr($element, 0, strlen($davPrefix)) == $davPrefix) { $element = substr($element, strlen($davPrefix)); } - $this->userDeletesFile($user, "element", $element); + $this->userDeletesFile($user, 'element', $element); } } @@ -1063,9 +1064,9 @@ trait WebDav { * @return int */ private function getFileIdForPath($user, $path) { - $propertiesTable = new \Behat\Gherkin\Node\TableNode([["{http://owncloud.org/ns}fileid"]]); + $propertiesTable = new \Behat\Gherkin\Node\TableNode([['{http://owncloud.org/ns}fileid']]); $this->asGetsPropertiesOfFolderWith($user, 'file', $path, $propertiesTable); - return (int)$this->response['{http://owncloud.org/ns}fileid']; + return (int) $this->response['{http://owncloud.org/ns}fileid']; } /** @@ -1092,8 +1093,8 @@ trait WebDav { */ public function userCreatesAFileLocallyWithChunks($arg1, $chunks) { $this->parts = []; - for ($i = 1;$i <= (int)$chunks;$i++) { - $randomletter = substr(str_shuffle("abcdefghijklmnopqrstuvwxyz"), 0, 1); + for ($i = 1;$i <= (int) $chunks;$i++) { + $randomletter = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz'), 0, 1); file_put_contents('/tmp/part-upload-' . $i, str_repeat($randomletter, 5 * 1024 * 1024)); $this->parts[] = '/tmp/part-upload-' . $i; } @@ -1103,8 +1104,8 @@ trait WebDav { * @Given user :user creates the chunk :id with a size of :size MB */ public function userCreatesAChunk($user, $id, $size) { - $randomletter = substr(str_shuffle("abcdefghijklmnopqrstuvwxyz"), 0, 1); - file_put_contents('/tmp/part-upload-' . $id, str_repeat($randomletter, (int)$size * 1024 * 1024)); + $randomletter = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz'), 0, 1); + file_put_contents('/tmp/part-upload-' . $id, str_repeat($randomletter, (int) $size * 1024 * 1024)); $this->parts[] = '/tmp/part-upload-' . $id; } @@ -1117,14 +1118,14 @@ trait WebDav { foreach ($this->parts as $part) { $content .= file_get_contents($part); } - Assert::assertEquals($content, (string)$this->response->getBody()); + Assert::assertEquals($content, (string) $this->response->getBody()); } /** * @Then /^the S3 multipart upload was successful with status "([^"]*)"$/ */ public function theSmultipartUploadWasSuccessful($status) { - Assert::assertEquals((int)$status, $this->response->getStatusCode()); + Assert::assertEquals((int) $status, $this->response->getStatusCode()); } /** @@ -1161,7 +1162,7 @@ trait WebDav { */ private function convertResponseToDavEntries(): array { $client = $this->getSabreClient($this->currentUser); - $parsedResponse = $client->parseMultiStatus((string)$this->response->getBody()); + $parsedResponse = $client->parseMultiStatus((string) $this->response->getBody()); $results = []; foreach ($parsedResponse as $href => $statusList) { diff --git a/build/license.php b/build/license.php index 31b288f36eb..97516ee7632 100644 --- a/build/license.php +++ b/build/license.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -57,7 +58,7 @@ EOD; * */ EOD; - $this->licenseTextLegacy = str_replace('@YEAR@', date("Y"), $this->licenseTextLegacy); + $this->licenseTextLegacy = str_replace('@YEAR@', date('Y'), $this->licenseTextLegacy); } /** @@ -109,7 +110,7 @@ EOD; public function writeAuthorsFile() { ksort($this->authors); - $template = "Nextcloud is written by: + $template = 'Nextcloud is written by: @AUTHORS@ With help from many libraries and frameworks including: @@ -117,9 +118,9 @@ With help from many libraries and frameworks including: SabreDAV jQuery … -"; +'; $authors = implode(PHP_EOL, array_map(function ($author) { - return " - ".$author; + return ' - '.$author; }, $this->authors)); $template = str_replace('@AUTHORS@', $authors, $template); file_put_contents(__DIR__.'/../AUTHORS', $template); @@ -153,9 +154,9 @@ With help from many libraries and frameworks including: if ($isPhp) { if ($isStrict) { - $source = "<?php" . PHP_EOL . PHP_EOL . 'declare(strict_types=1);' . PHP_EOL . PHP_EOL . $license . PHP_EOL . $source; + $source = '<?php' . PHP_EOL . PHP_EOL . 'declare(strict_types=1);' . PHP_EOL . PHP_EOL . $license . PHP_EOL . $source; } else { - $source = "<?php" . PHP_EOL . $license . PHP_EOL . $source; + $source = '<?php' . PHP_EOL . $license . PHP_EOL . $source; } } else { $source = $license . PHP_EOL . PHP_EOL . $source; @@ -266,7 +267,7 @@ With help from many libraries and frameworks including: $copyrightNotice = []; if (trim($licenseHeaderCopyrightAtLines !== '')) { $copyrightNotice = array_map(function ($line) use ($lineByLine) { - return $lineByLine[(int)$line - 1]; + return $lineByLine[(int) $line - 1]; }, explode(PHP_EOL, $licenseHeaderCopyrightAtLines)); } @@ -298,7 +299,7 @@ With help from many libraries and frameworks including: $timestampChanges = explode(PHP_EOL, $out); $timestampChanges = array_slice($timestampChanges, 0, count($timestampChanges) - 1); foreach ($timestampChanges as $timestamp) { - if ((int)$timestamp < $deadlineTimestamp) { + if ((int) $timestamp < $deadlineTimestamp) { return; } } @@ -310,8 +311,8 @@ With help from many libraries and frameworks including: private function printFilesToCheck() { if (!empty($this->checkFiles)) { print "\n"; - print "For following files all lines changed since the Nextcloud fork." . PHP_EOL; - print "Please check if these files can be moved over to AGPLv3 or later" . PHP_EOL; + print 'For following files all lines changed since the Nextcloud fork.' . PHP_EOL; + print 'Please check if these files can be moved over to AGPLv3 or later' . PHP_EOL; print "\n"; foreach ($this->checkFiles as $file) { print $file . PHP_EOL; diff --git a/build/signed-off-checker.php b/build/signed-off-checker.php index 750d4757b07..e99f9147ba5 100644 --- a/build/signed-off-checker.php +++ b/build/signed-off-checker.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -103,7 +104,7 @@ if ($notSignedCommits !== []) { echo("Some commits were not signed off!\n"); echo("Missing signatures on:\n"); foreach ($notSignedCommits as $commit) { - echo("- " . $commit . "\n"); + echo('- ' . $commit . "\n"); } echo("Build has failed\n"); exit(1); diff --git a/console.php b/console.php index 4e1acb00c97..4fcb3d6c7a3 100644 --- a/console.php +++ b/console.php @@ -20,7 +20,7 @@ use Symfony\Component\Console\Output\ConsoleOutput; define('OC_CONSOLE', 1); function exceptionHandler($exception) { - echo "An unhandled exception has been thrown:" . PHP_EOL; + echo 'An unhandled exception has been thrown:' . PHP_EOL; echo $exception; exit(1); } @@ -33,7 +33,7 @@ try { } if (!OC::$CLI) { - echo "This script can be run from the command line only" . PHP_EOL; + echo 'This script can be run from the command line only' . PHP_EOL; exit(1); } @@ -41,16 +41,16 @@ try { set_exception_handler('exceptionHandler'); if (!function_exists('posix_getuid')) { - echo "The posix extensions are required - see https://www.php.net/manual/en/book.posix.php" . PHP_EOL; + echo 'The posix extensions are required - see https://www.php.net/manual/en/book.posix.php' . PHP_EOL; exit(1); } $user = posix_getuid(); $configUser = fileowner(OC::$configDir . 'config.php'); if ($user !== $configUser) { - echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; - echo "Current user id: " . $user . PHP_EOL; - echo "Owner id of config.php: " . $configUser . PHP_EOL; + echo 'Console has to be executed with the user that owns the file config/config.php' . PHP_EOL; + echo 'Current user id: ' . $user . PHP_EOL; + echo 'Owner id of config.php: ' . $configUser . PHP_EOL; echo "Try adding 'sudo -u #" . $configUser . "' to the beginning of the command (without the single quotes)" . PHP_EOL; echo "If running with 'docker exec' try adding the option '-u " . $configUser . "' to the docker command (without the single quotes)" . PHP_EOL; exit(1); @@ -58,16 +58,16 @@ try { $oldWorkingDir = getcwd(); if ($oldWorkingDir === false) { - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; + echo 'This script can be run from the Nextcloud root directory only.' . PHP_EOL; echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; } elseif ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { - echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; + echo 'This script can be run from the Nextcloud root directory only.' . PHP_EOL; echo "Can't change to Nextcloud root directory." . PHP_EOL; exit(1); } if (!(function_exists('pcntl_signal') && function_exists('pcntl_signal_dispatch')) && !in_array('--no-warnings', $argv)) { - echo "The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php" . PHP_EOL; + echo 'The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php' . PHP_EOL; echo "Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini." . PHP_EOL; } diff --git a/core/Application.php b/core/Application.php index 34e798a22bf..02dc1ced3a2 100644 --- a/core/Application.php +++ b/core/Application.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php b/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php index c6cf833342f..231caa683af 100644 --- a/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php +++ b/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php @@ -61,13 +61,13 @@ class BackgroundCleanupUpdaterBackupsJob extends QueuedJob { ksort($dirList); // drop the newest 3 directories $dirList = array_slice($dirList, 0, -3); - $this->log->info("List of all directories that will be deleted: " . json_encode($dirList)); + $this->log->info('List of all directories that will be deleted: ' . json_encode($dirList)); foreach ($dirList as $dir) { $this->log->info("Removing $dir ..."); \OC_Helper::rmdirr($dir); } - $this->log->info("Cleanup finished"); + $this->log->info('Cleanup finished'); } else { $this->log->info("Could not find updater directory $backupFolderPath - cleanup step not needed"); } diff --git a/core/BackgroundJobs/GenerateMetadataJob.php b/core/BackgroundJobs/GenerateMetadataJob.php index f2137374834..e775717092a 100644 --- a/core/BackgroundJobs/GenerateMetadataJob.php +++ b/core/BackgroundJobs/GenerateMetadataJob.php @@ -98,7 +98,7 @@ class GenerateMetadataJob extends TimedJob { $nodeSize = $node->getSize(); $nodeLimit = $this->config->getSystemValueInt('metadata_max_filesize', self::DEFAULT_MAX_FILESIZE); if ($nodeSize > $nodeLimit * 1000000) { - $this->logger->debug("Skipping generating metadata for fileid " . $node->getId() . " as its size exceeds configured 'metadata_max_filesize'."); + $this->logger->debug('Skipping generating metadata for fileid ' . $node->getId() . " as its size exceeds configured 'metadata_max_filesize'."); continue; } @@ -111,7 +111,7 @@ class GenerateMetadataJob extends TimedJob { IFilesMetadataManager::PROCESS_LIVE | IFilesMetadataManager::PROCESS_BACKGROUND ); } catch (\Throwable $ex) { - $this->logger->warning("Error while generating metadata for fileid " . $node->getId(), ['exception' => $ex]); + $this->logger->warning('Error while generating metadata for fileid ' . $node->getId(), ['exception' => $ex]); } } } diff --git a/core/Command/App/Disable.php b/core/Command/App/Disable.php index e1f9c2a4d72..477528c9cf2 100644 --- a/core/Command/App/Disable.php +++ b/core/Command/App/Disable.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only diff --git a/core/Command/App/GetPath.php b/core/Command/App/GetPath.php index 5eedcbe4182..442af2f3570 100644 --- a/core/Command/App/GetPath.php +++ b/core/Command/App/GetPath.php @@ -40,7 +40,7 @@ class GetPath extends Base { /** * Executes the current command. * - * @param InputInterface $input An InputInterface instance + * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * @return int 0 if everything went fine, or an error code */ diff --git a/core/Command/App/ListApps.php b/core/Command/App/ListApps.php index 6512c9e064c..30ea5dcf5c3 100644 --- a/core/Command/App/ListApps.php +++ b/core/Command/App/ListApps.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php index 36422b4727c..b4018c94b79 100644 --- a/core/Command/App/Update.php +++ b/core/Command/App/Update.php @@ -71,7 +71,7 @@ class Update extends Command { } elseif ($input->getOption('all') || $input->getOption('showonly')) { $apps = \OC_App::getAllApps(); } else { - $output->writeln("<error>Please specify an app to update or \"--all\" to update all updatable apps\"</error>"); + $output->writeln('<error>Please specify an app to update or "--all" to update all updatable apps"</error>'); return 1; } diff --git a/core/Command/Background/JobBase.php b/core/Command/Background/JobBase.php index 756e0ad7b80..f4d88fca77b 100644 --- a/core/Command/Background/JobBase.php +++ b/core/Command/Background/JobBase.php @@ -67,7 +67,7 @@ abstract class JobBase extends \OC\Core\Command\Base { $interval = $intervalProperty->getValue($job); $nextRun = new \DateTime(); - $nextRun->setTimestamp((int)$row['last_run'] + $interval); + $nextRun->setTimestamp((int) $row['last_run'] + $interval); if ($nextRun > new \DateTime()) { $output->writeln('Next execution: <comment>' . $nextRun->format(\DateTimeInterface::ATOM) . '</comment>'); diff --git a/core/Command/Background/ListCommand.php b/core/Command/Background/ListCommand.php index c84931c81e4..49a6dfdfbd5 100644 --- a/core/Command/Background/ListCommand.php +++ b/core/Command/Background/ListCommand.php @@ -49,11 +49,11 @@ class ListCommand extends Base { } protected function execute(InputInterface $input, OutputInterface $output): int { - $limit = (int)$input->getOption('limit'); - $jobsInfo = $this->formatJobs($this->jobList->getJobsIterator($input->getOption('class'), $limit, (int)$input->getOption('offset'))); + $limit = (int) $input->getOption('limit'); + $jobsInfo = $this->formatJobs($this->jobList->getJobsIterator($input->getOption('class'), $limit, (int) $input->getOption('offset'))); $this->writeTableInOutputFormat($input, $output, $jobsInfo); if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN && count($jobsInfo) >= $limit) { - $output->writeln("\n<comment>Output is currently limited to " . $limit . " jobs. Specify `-l, --limit[=LIMIT]` to override.</comment>"); + $output->writeln("\n<comment>Output is currently limited to " . $limit . ' jobs. Specify `-l, --limit[=LIMIT]` to override.</comment>'); } return 0; } diff --git a/core/Command/Config/App/GetConfig.php b/core/Command/Config/App/GetConfig.php index 74a230ff5fc..b68476a2e91 100644 --- a/core/Command/Config/App/GetConfig.php +++ b/core/Command/Config/App/GetConfig.php @@ -49,7 +49,7 @@ class GetConfig extends Base { /** * Executes the current command. * - * @param InputInterface $input An InputInterface instance + * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * @return int 0 if everything went fine, or an error code */ diff --git a/core/Command/Config/App/SetConfig.php b/core/Command/Config/App/SetConfig.php index dc836d56cc4..92d94f61f5d 100644 --- a/core/Command/Config/App/SetConfig.php +++ b/core/Command/Config/App/SetConfig.php @@ -160,7 +160,7 @@ class SetConfig extends Base { $sensitive = $sensitive ?? false; } - $value = (string)$input->getOption('value'); + $value = (string) $input->getOption('value'); switch ($type) { case IAppConfig::VALUE_MIXED: @@ -175,14 +175,14 @@ class SetConfig extends Base { if ($value !== ((string) ((int) $value))) { throw new AppConfigIncorrectTypeException('Value is not an integer'); } - $updated = $this->appConfig->setValueInt($appName, $configName, (int)$value, $lazy, $sensitive); + $updated = $this->appConfig->setValueInt($appName, $configName, (int) $value, $lazy, $sensitive); break; case IAppConfig::VALUE_FLOAT: if ($value !== ((string) ((float) $value))) { throw new AppConfigIncorrectTypeException('Value is not a float'); } - $updated = $this->appConfig->setValueFloat($appName, $configName, (float)$value, $lazy, $sensitive); + $updated = $this->appConfig->setValueFloat($appName, $configName, (float) $value, $lazy, $sensitive); break; case IAppConfig::VALUE_BOOL: @@ -237,7 +237,7 @@ class SetConfig extends Base { $output->writeln(''); $output->writeln('<comment>This might break thing, affect performance on your instance or its security!</comment>'); - $result = (strtolower((string)$helper->ask( + $result = (strtolower((string) $helper->ask( $input, $output, new Question('<comment>Confirm this action by typing \'yes\'</comment>: '))) === 'yes'); diff --git a/core/Command/Config/System/Base.php b/core/Command/Config/System/Base.php index ce39cd4c95b..088d902b4fd 100644 --- a/core/Command/Config/System/Base.php +++ b/core/Command/Config/System/Base.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/Config/System/GetConfig.php b/core/Command/Config/System/GetConfig.php index c9c40da34f5..c0a9623a84e 100644 --- a/core/Command/Config/System/GetConfig.php +++ b/core/Command/Config/System/GetConfig.php @@ -43,7 +43,7 @@ class GetConfig extends Base { /** * Executes the current command. * - * @param InputInterface $input An InputInterface instance + * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * @return int 0 if everything went fine, or an error code */ diff --git a/core/Command/Config/System/SetConfig.php b/core/Command/Config/System/SetConfig.php index ac132dbac89..693bc9bb12b 100644 --- a/core/Command/Config/System/SetConfig.php +++ b/core/Command/Config/System/SetConfig.php @@ -104,8 +104,8 @@ class SetConfig extends Base { throw new \InvalidArgumentException('Non-numeric value specified'); } return [ - 'value' => (double) $value, - 'readable-value' => 'double ' . (double) $value, + 'value' => (float) $value, + 'readable-value' => 'double ' . (float) $value, ]; case 'boolean': diff --git a/core/Command/Db/AddMissingColumns.php b/core/Command/Db/AddMissingColumns.php index 198a55979c7..33b4b24a6cb 100644 --- a/core/Command/Db/AddMissingColumns.php +++ b/core/Command/Db/AddMissingColumns.php @@ -37,7 +37,7 @@ class AddMissingColumns extends Command { $this ->setName('db:add-missing-columns') ->setDescription('Add missing optional columns to the database tables') - ->addOption('dry-run', null, InputOption::VALUE_NONE, "Output the SQL queries instead of running them."); + ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Output the SQL queries instead of running them.'); } protected function execute(InputInterface $input, OutputInterface $output): int { diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 4d0624ba8a7..eec0aedce11 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -37,7 +37,7 @@ class AddMissingIndices extends Command { $this ->setName('db:add-missing-indices') ->setDescription('Add missing indices to the database tables') - ->addOption('dry-run', null, InputOption::VALUE_NONE, "Output the SQL queries instead of running them."); + ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Output the SQL queries instead of running them.'); } protected function execute(InputInterface $input, OutputInterface $output): int { diff --git a/core/Command/Db/AddMissingPrimaryKeys.php b/core/Command/Db/AddMissingPrimaryKeys.php index 073ce7538cc..1eb11c894fa 100644 --- a/core/Command/Db/AddMissingPrimaryKeys.php +++ b/core/Command/Db/AddMissingPrimaryKeys.php @@ -37,7 +37,7 @@ class AddMissingPrimaryKeys extends Command { $this ->setName('db:add-missing-primary-keys') ->setDescription('Add missing primary keys to the database tables') - ->addOption('dry-run', null, InputOption::VALUE_NONE, "Output the SQL queries instead of running them."); + ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Output the SQL queries instead of running them.'); } protected function execute(InputInterface $input, OutputInterface $output): int { diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php index f5028aacaef..0d96d139701 100644 --- a/core/Command/Db/ConvertFilecacheBigInt.php +++ b/core/Command/Db/ConvertFilecacheBigInt.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/Db/ConvertMysqlToMB4.php b/core/Command/Db/ConvertMysqlToMB4.php index 618e15de3f4..926e56c4300 100644 --- a/core/Command/Db/ConvertMysqlToMB4.php +++ b/core/Command/Db/ConvertMysqlToMB4.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 ownCloud GmbH * SPDX-License-Identifier: AGPL-3.0-only @@ -34,14 +35,14 @@ class ConvertMysqlToMB4 extends Command { protected function execute(InputInterface $input, OutputInterface $output): int { if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_MYSQL) { - $output->writeln("This command is only valid for MySQL/MariaDB databases."); + $output->writeln('This command is only valid for MySQL/MariaDB databases.'); return 1; } $tools = new MySqlTools(); if (!$tools->supports4ByteCharset($this->connection)) { $url = $this->urlGenerator->linkToDocs('admin-mysql-utf8mb4'); - $output->writeln("The database is not properly setup to use the charset utf8mb4."); + $output->writeln('The database is not properly setup to use the charset utf8mb4.'); $output->writeln("For more information please read the documentation at $url"); return 1; } diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index c7b886ca0d3..f3a73d83eb7 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -267,7 +267,7 @@ class ConvertType extends Command implements CompletionAwareInterface { return; } - $chunkSize = (int)$input->getOption('chunk-size'); + $chunkSize = (int) $input->getOption('chunk-size'); $query = $fromDB->getQueryBuilder(); $query->automaticTablePrefix(false); diff --git a/core/Command/Db/Migrations/ExecuteCommand.php b/core/Command/Db/Migrations/ExecuteCommand.php index cb6edd7c78c..a89072c1ad1 100644 --- a/core/Command/Db/Migrations/ExecuteCommand.php +++ b/core/Command/Db/Migrations/ExecuteCommand.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2017 ownCloud GmbH diff --git a/core/Command/Db/Migrations/GenerateCommand.php b/core/Command/Db/Migrations/GenerateCommand.php index 186a45c36fb..3b3053cde2e 100644 --- a/core/Command/Db/Migrations/GenerateCommand.php +++ b/core/Command/Db/Migrations/GenerateCommand.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2017 ownCloud GmbH @@ -113,7 +114,7 @@ class {{classname}} extends SimpleMigrationStep { if ($fullVersion) { [$major, $minor] = explode('.', $fullVersion); - $shouldVersion = (string) ((int)$major * 1000 + (int)$minor); + $shouldVersion = (string) ((int) $major * 1000 + (int) $minor); if ($version !== $shouldVersion) { $output->writeln('<comment>Unexpected migration version for current version: ' . $fullVersion . '</comment>'); $output->writeln('<comment> - Pattern: XYYY </comment>'); diff --git a/core/Command/Db/Migrations/PreviewCommand.php b/core/Command/Db/Migrations/PreviewCommand.php index 5a0e766ee6d..f5b850fff76 100644 --- a/core/Command/Db/Migrations/PreviewCommand.php +++ b/core/Command/Db/Migrations/PreviewCommand.php @@ -94,13 +94,13 @@ class PreviewCommand extends Command { )->addRow(new TableSeparator()); /** @var MigrationAttribute[] $attributes */ - foreach($data as $migration => $attributes) { + foreach ($data as $migration => $attributes) { $attributesStr = []; if (empty($attributes)) { $attributesStr[] = '<comment>(metadata not set)</comment>'; } - foreach($attributes as $attribute) { - $definition = '<info>' . $attribute->definition() . "</info>"; + foreach ($attributes as $attribute) { + $definition = '<info>' . $attribute->definition() . '</info>'; $definition .= empty($attribute->getDescription()) ? '' : "\n " . $attribute->getDescription(); $definition .= empty($attribute->getNotes()) ? '' : "\n <comment>" . implode("</comment>\n <comment>", $attribute->getNotes()) . '</comment>'; $attributesStr[] = $definition; diff --git a/core/Command/Db/SchemaEncoder.php b/core/Command/Db/SchemaEncoder.php index d36a34e8583..beae3a81264 100644 --- a/core/Command/Db/SchemaEncoder.php +++ b/core/Command/Db/SchemaEncoder.php @@ -90,7 +90,7 @@ class SchemaEncoder { if ($platform instanceof PostgreSqlPlatform) { $name = $table->getName() . '_pkey'; } elseif ($platform instanceof AbstractMySQLPlatform) { - $name = "PRIMARY"; + $name = 'PRIMARY'; } else { $name = $index->getName(); } diff --git a/core/Command/Encryption/ChangeKeyStorageRoot.php b/core/Command/Encryption/ChangeKeyStorageRoot.php index a4431b36f2f..76cde1b8e77 100644 --- a/core/Command/Encryption/ChangeKeyStorageRoot.php +++ b/core/Command/Encryption/ChangeKeyStorageRoot.php @@ -79,10 +79,10 @@ class ChangeKeyStorageRoot extends Command { * @throws \Exception */ protected function moveAllKeys($oldRoot, $newRoot, OutputInterface $output) { - $output->writeln("Start to move keys:"); + $output->writeln('Start to move keys:'); if ($this->rootView->is_dir($oldRoot) === false) { - $output->writeln("No old keys found: Nothing needs to be moved"); + $output->writeln('No old keys found: Nothing needs to be moved'); return false; } diff --git a/core/Command/Encryption/DecryptAll.php b/core/Command/Encryption/DecryptAll.php index 1de14debdec..92e2ba787e2 100644 --- a/core/Command/Encryption/DecryptAll.php +++ b/core/Command/Encryption/DecryptAll.php @@ -81,10 +81,10 @@ class DecryptAll extends Command { $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); if ($isMaintenanceModeEnabled) { - $output->writeln("Maintenance mode must be disabled when starting decryption,"); - $output->writeln("in order to load the relevant encryption modules correctly."); - $output->writeln("Your instance will automatically be put to maintenance mode"); - $output->writeln("during the actual decryption of the files."); + $output->writeln('Maintenance mode must be disabled when starting decryption,'); + $output->writeln('in order to load the relevant encryption modules correctly.'); + $output->writeln('Your instance will automatically be put to maintenance mode'); + $output->writeln('during the actual decryption of the files.'); return 1; } diff --git a/core/Command/Encryption/EncryptAll.php b/core/Command/Encryption/EncryptAll.php index 868c240e26d..88aaf68ba03 100644 --- a/core/Command/Encryption/EncryptAll.php +++ b/core/Command/Encryption/EncryptAll.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -32,7 +33,7 @@ class EncryptAll extends Command { * Set maintenance mode and disable the trashbin app */ protected function forceMaintenanceAndTrashbin(): void { - $this->wasTrashbinEnabled = (bool)$this->appManager->isEnabledForUser('files_trashbin'); + $this->wasTrashbinEnabled = (bool) $this->appManager->isEnabledForUser('files_trashbin'); $this->wasMaintenanceModeEnabled = $this->config->getSystemValueBool('maintenance'); $this->config->setSystemValue('maintenance', true); $this->appManager->disableApp('files_trashbin'); diff --git a/core/Command/Encryption/ListModules.php b/core/Command/Encryption/ListModules.php index a5cd403d3a7..b1f35b05bc9 100644 --- a/core/Command/Encryption/ListModules.php +++ b/core/Command/Encryption/ListModules.php @@ -33,8 +33,8 @@ class ListModules extends Base { protected function execute(InputInterface $input, OutputInterface $output): int { $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); if ($isMaintenanceModeEnabled) { - $output->writeln("Maintenance mode must be disabled when listing modules"); - $output->writeln("in order to list the relevant encryption modules correctly."); + $output->writeln('Maintenance mode must be disabled when listing modules'); + $output->writeln('in order to list the relevant encryption modules correctly.'); return 1; } diff --git a/core/Command/Encryption/MigrateKeyStorage.php b/core/Command/Encryption/MigrateKeyStorage.php index 486a6149622..ddd17eaa0b7 100644 --- a/core/Command/Encryption/MigrateKeyStorage.php +++ b/core/Command/Encryption/MigrateKeyStorage.php @@ -40,9 +40,9 @@ class MigrateKeyStorage extends Command { protected function execute(InputInterface $input, OutputInterface $output): int { $root = $this->util->getKeyStorageRoot(); - $output->writeln("Updating key storage format"); + $output->writeln('Updating key storage format'); $this->updateKeys($root, $output); - $output->writeln("Key storage format successfully updated"); + $output->writeln('Key storage format successfully updated'); return 0; } @@ -56,7 +56,7 @@ class MigrateKeyStorage extends Command { * @throws \Exception */ protected function updateKeys(string $root, OutputInterface $output): bool { - $output->writeln("Start to update the keys:"); + $output->writeln('Start to update the keys:'); $this->updateSystemKeys($root); $this->updateUsersKeys($root, $output); diff --git a/core/Command/Encryption/SetDefaultModule.php b/core/Command/Encryption/SetDefaultModule.php index 789138fac95..d10872afd38 100644 --- a/core/Command/Encryption/SetDefaultModule.php +++ b/core/Command/Encryption/SetDefaultModule.php @@ -39,8 +39,8 @@ class SetDefaultModule extends Command { protected function execute(InputInterface $input, OutputInterface $output): int { $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); if ($isMaintenanceModeEnabled) { - $output->writeln("Maintenance mode must be disabled when setting default module,"); - $output->writeln("in order to load the relevant encryption modules correctly."); + $output->writeln('Maintenance mode must be disabled when setting default module,'); + $output->writeln('in order to load the relevant encryption modules correctly.'); return 1; } diff --git a/core/Command/FilesMetadata/Get.php b/core/Command/FilesMetadata/Get.php index eec01661e94..5c84279733a 100644 --- a/core/Command/FilesMetadata/Get.php +++ b/core/Command/FilesMetadata/Get.php @@ -31,35 +31,35 @@ class Get extends Command { protected function configure(): void { $this->setName('metadata:get') - ->setDescription('get stored metadata about a file, by its id') - ->addArgument( - 'fileId', - InputArgument::REQUIRED, - 'id of the file document' - ) - ->addArgument( - 'userId', - InputArgument::OPTIONAL, - 'file owner' - ) - ->addOption( - 'as-array', - '', - InputOption::VALUE_NONE, - 'display metadata as a simple key=>value array' - ) - ->addOption( - 'refresh', - '', - InputOption::VALUE_NONE, - 'refresh metadata' - ) - ->addOption( - 'reset', - '', - InputOption::VALUE_NONE, - 'refresh metadata from scratch' - ); + ->setDescription('get stored metadata about a file, by its id') + ->addArgument( + 'fileId', + InputArgument::REQUIRED, + 'id of the file document' + ) + ->addArgument( + 'userId', + InputArgument::OPTIONAL, + 'file owner' + ) + ->addOption( + 'as-array', + '', + InputOption::VALUE_NONE, + 'display metadata as a simple key=>value array' + ) + ->addOption( + 'refresh', + '', + InputOption::VALUE_NONE, + 'refresh metadata' + ) + ->addOption( + 'reset', + '', + InputOption::VALUE_NONE, + 'refresh metadata from scratch' + ); } /** @@ -69,7 +69,7 @@ class Get extends Command { * @throws NotFoundException */ protected function execute(InputInterface $input, OutputInterface $output): int { - $fileId = (int)$input->getArgument('fileId'); + $fileId = (int) $input->getArgument('fileId'); if ($input->getOption('reset')) { $this->filesMetadataManager->deleteMetadata($fileId); diff --git a/core/Command/Group/Add.php b/core/Command/Group/Add.php index 26d44c7ea83..12d06823c18 100644 --- a/core/Command/Group/Add.php +++ b/core/Command/Group/Add.php @@ -54,7 +54,7 @@ class Add extends Base { } $output->writeln('Created group "' . $group->getGID() . '"'); - $displayName = trim((string)$input->getOption('display-name')); + $displayName = trim((string) $input->getOption('display-name')); if ($displayName !== '') { $group->setDisplayName($displayName); } diff --git a/core/Command/Group/AddUser.php b/core/Command/Group/AddUser.php index 1f144b13893..999113390af 100644 --- a/core/Command/Group/AddUser.php +++ b/core/Command/Group/AddUser.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/Group/ListCommand.php b/core/Command/Group/ListCommand.php index 13161ec0eaa..b0183a6931a 100644 --- a/core/Command/Group/ListCommand.php +++ b/core/Command/Group/ListCommand.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -50,8 +51,8 @@ class ListCommand extends Base { } protected function execute(InputInterface $input, OutputInterface $output): int { - $groups = $this->groupManager->search('', (int)$input->getOption('limit'), (int)$input->getOption('offset')); - $this->writeArrayInOutputFormat($input, $output, $this->formatGroups($groups, (bool)$input->getOption('info'))); + $groups = $this->groupManager->search('', (int) $input->getOption('limit'), (int) $input->getOption('offset')); + $this->writeArrayInOutputFormat($input, $output, $this->formatGroups($groups, (bool) $input->getOption('info'))); return 0; } @@ -62,7 +63,7 @@ class ListCommand extends Base { public function usersForGroup(IGroup $group) { $users = array_keys($group->getUsers()); return array_map(function ($userId) { - return (string)$userId; + return (string) $userId; }, $users); } diff --git a/core/Command/Group/RemoveUser.php b/core/Command/Group/RemoveUser.php index 7c58f9ac4c4..952fc6e7712 100644 --- a/core/Command/Group/RemoveUser.php +++ b/core/Command/Group/RemoveUser.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/Info/File.php b/core/Command/Info/File.php index 5aca892547b..2b1daef2470 100644 --- a/core/Command/Info/File.php +++ b/core/Command/Info/File.php @@ -35,7 +35,7 @@ class File extends Command { private FileUtils $fileUtils, private \OC\Encryption\Util $encryptionUtil ) { - $this->l10n = $l10nFactory->get("core"); + $this->l10n = $l10nFactory->get('core'); parent::__construct(); $this->rootView = new View(); } @@ -44,9 +44,9 @@ class File extends Command { $this ->setName('info:file') ->setDescription('get information for a file') - ->addArgument('file', InputArgument::REQUIRED, "File id or path") - ->addOption('children', 'c', InputOption::VALUE_NONE, "List children of folders") - ->addOption('storage-tree', null, InputOption::VALUE_NONE, "Show storage and cache wrapping tree"); + ->addArgument('file', InputArgument::REQUIRED, 'File id or path') + ->addOption('children', 'c', InputOption::VALUE_NONE, 'List children of folders') + ->addOption('storage-tree', null, InputOption::VALUE_NONE, 'Show storage and cache wrapping tree'); } public function execute(InputInterface $input, OutputInterface $output): int { @@ -59,17 +59,17 @@ class File extends Command { } $output->writeln($node->getName()); - $output->writeln(" fileid: " . $node->getId()); - $output->writeln(" mimetype: " . $node->getMimetype()); - $output->writeln(" modified: " . (string)$this->l10n->l("datetime", $node->getMTime())); + $output->writeln(' fileid: ' . $node->getId()); + $output->writeln(' mimetype: ' . $node->getMimetype()); + $output->writeln(' modified: ' . (string) $this->l10n->l('datetime', $node->getMTime())); if ($node instanceof OCPFile && $node->isEncrypted()) { $output->writeln(' ' . 'server-side encrypted: yes'); $keyPath = $this->encryptionUtil->getFileKeyDir('', $node->getPath()); if ($this->rootView->file_exists($keyPath)) { - $output->writeln(" encryption key at: " . $keyPath); + $output->writeln(' encryption key at: ' . $keyPath); } else { - $output->writeln(" <error>encryption key not found</error> should be located at: " . $keyPath); + $output->writeln(' <error>encryption key not found</error> should be located at: ' . $keyPath); } } @@ -77,38 +77,38 @@ class File extends Command { $output->writeln(' ' . 'end-to-end encrypted: yes'); } - $output->writeln(" size: " . Util::humanFileSize($node->getSize())); - $output->writeln(" etag: " . $node->getEtag()); + $output->writeln(' size: ' . Util::humanFileSize($node->getSize())); + $output->writeln(' etag: ' . $node->getEtag()); if ($node instanceof Folder) { $children = $node->getDirectoryListing(); $childSize = array_sum(array_map(function (Node $node) { return $node->getSize(); }, $children)); if ($childSize != $node->getSize()) { - $output->writeln(" <error>warning: folder has a size of " . Util::humanFileSize($node->getSize()) ." but it's children sum up to " . Util::humanFileSize($childSize) . "</error>."); - $output->writeln(" Run <info>occ files:scan --path " . $node->getPath() . "</info> to attempt to resolve this."); + $output->writeln(' <error>warning: folder has a size of ' . Util::humanFileSize($node->getSize()) ." but it's children sum up to " . Util::humanFileSize($childSize) . '</error>.'); + $output->writeln(' Run <info>occ files:scan --path ' . $node->getPath() . '</info> to attempt to resolve this.'); } if ($showChildren) { - $output->writeln(" children: " . count($children) . ":"); + $output->writeln(' children: ' . count($children) . ':'); foreach ($children as $child) { - $output->writeln(" - " . $child->getName()); + $output->writeln(' - ' . $child->getName()); } } else { - $output->writeln(" children: " . count($children) . " (use <info>--children</info> option to list)"); + $output->writeln(' children: ' . count($children) . ' (use <info>--children</info> option to list)'); } } $this->outputStorageDetails($node->getMountPoint(), $node, $input, $output); $filesPerUser = $this->fileUtils->getFilesByUser($node); - $output->writeln(""); - $output->writeln("The following users have access to the file"); - $output->writeln(""); + $output->writeln(''); + $output->writeln('The following users have access to the file'); + $output->writeln(''); foreach ($filesPerUser as $user => $files) { $output->writeln("$user:"); foreach ($files as $userFile) { - $output->writeln(" " . $userFile->getPath() . ": " . $this->fileUtils->formatPermissions($userFile->getType(), $userFile->getPermissions())); + $output->writeln(' ' . $userFile->getPath() . ': ' . $this->fileUtils->formatPermissions($userFile->getType(), $userFile->getPermissions())); $mount = $userFile->getMountPoint(); - $output->writeln(" " . $this->fileUtils->formatMountType($mount)); + $output->writeln(' ' . $this->fileUtils->formatMountType($mount)); } } @@ -125,7 +125,7 @@ class File extends Command { return; } if (!$storage->instanceOfStorage(IHomeStorage::class)) { - $output->writeln(" mounted at: " . $mountPoint->getMountPoint()); + $output->writeln(' mounted at: ' . $mountPoint->getMountPoint()); } if ($storage->instanceOfStorage(ObjectStoreStorage::class)) { /** @var ObjectStoreStorage $storage */ @@ -133,9 +133,9 @@ class File extends Command { $parts = explode(':', $objectStoreId); /** @var string $bucket */ $bucket = array_pop($parts); - $output->writeln(" bucket: " . $bucket); + $output->writeln(' bucket: ' . $bucket); if ($node instanceof \OC\Files\Node\File) { - $output->writeln(" object id: " . $storage->getURN($node->getId())); + $output->writeln(' object id: ' . $storage->getURN($node->getId())); try { $fh = $node->fopen('r'); if (!$fh) { @@ -144,23 +144,23 @@ class File extends Command { $stat = fstat($fh); fclose($fh); if ($stat['size'] !== $node->getSize()) { - $output->writeln(" <error>warning: object had a size of " . $stat['size'] . " but cache entry has a size of " . $node->getSize() . "</error>. This should have been automatically repaired"); + $output->writeln(' <error>warning: object had a size of ' . $stat['size'] . ' but cache entry has a size of ' . $node->getSize() . '</error>. This should have been automatically repaired'); } } catch (\Exception $e) { - $output->writeln(" <error>warning: object not found in bucket</error>"); + $output->writeln(' <error>warning: object not found in bucket</error>'); } } } else { if (!$storage->file_exists($node->getInternalPath())) { - $output->writeln(" <error>warning: file not found in storage</error>"); + $output->writeln(' <error>warning: file not found in storage</error>'); } } if ($mountPoint instanceof ExternalMountPoint) { $storageConfig = $mountPoint->getStorageConfig(); - $output->writeln(" external storage id: " . $storageConfig->getId()); - $output->writeln(" external type: " . $storageConfig->getBackend()->getText()); + $output->writeln(' external storage id: ' . $storageConfig->getId()); + $output->writeln(' external type: ' . $storageConfig->getBackend()->getText()); } elseif ($mountPoint instanceof GroupMountPoint) { - $output->writeln(" groupfolder id: " . $mountPoint->getFolderId()); + $output->writeln(' groupfolder id: ' . $mountPoint->getFolderId()); } if ($input->getOption('storage-tree')) { $storageTmp = $storage; @@ -169,7 +169,7 @@ class File extends Command { $storageTmp = $storageTmp->getWrapperStorage(); $storageClass .= "\n\t".'> '.get_class($storageTmp).' (cache:'.get_class($storageTmp->getCache()).')'; } - $output->writeln(" storage wrapping: " . $storageClass); + $output->writeln(' storage wrapping: ' . $storageClass); } } diff --git a/core/Command/Info/FileUtils.php b/core/Command/Info/FileUtils.php index 6c490d31c3d..6b38c5a2ed1 100644 --- a/core/Command/Info/FileUtils.php +++ b/core/Command/Info/FileUtils.php @@ -66,13 +66,13 @@ class FileUtils { */ public function getNode(string $fileInput): ?Node { if (is_numeric($fileInput)) { - $mounts = $this->userMountCache->getMountsForFileId((int)$fileInput); + $mounts = $this->userMountCache->getMountsForFileId((int) $fileInput); if (!$mounts) { return null; } $mount = reset($mounts); $userFolder = $this->rootFolder->getUserFolder($mount->getUser()->getUID()); - return $userFolder->getFirstNodeById((int)$fileInput); + return $userFolder->getFirstNodeById((int) $fileInput); } else { try { return $this->rootFolder->get($fileInput); @@ -84,18 +84,18 @@ class FileUtils { public function formatPermissions(string $type, int $permissions): string { if ($permissions == Constants::PERMISSION_ALL || ($type === 'file' && $permissions == (Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE))) { - return "full permissions"; + return 'full permissions'; } $perms = []; - $allPerms = [Constants::PERMISSION_READ => "read", Constants::PERMISSION_UPDATE => "update", Constants::PERMISSION_CREATE => "create", Constants::PERMISSION_DELETE => "delete", Constants::PERMISSION_SHARE => "share"]; + $allPerms = [Constants::PERMISSION_READ => 'read', Constants::PERMISSION_UPDATE => 'update', Constants::PERMISSION_CREATE => 'create', Constants::PERMISSION_DELETE => 'delete', Constants::PERMISSION_SHARE => 'share']; foreach ($allPerms as $perm => $name) { if (($permissions & $perm) === $perm) { $perms[] = $name; } } - return implode(", ", $perms); + return implode(', ', $perms); } /** @@ -105,29 +105,29 @@ class FileUtils { public function formatMountType(IMountPoint $mountPoint): string { $storage = $mountPoint->getStorage(); if ($storage && $storage->instanceOfStorage(IHomeStorage::class)) { - return "home storage"; + return 'home storage'; } elseif ($mountPoint instanceof SharedMount) { $share = $mountPoint->getShare(); $shares = $mountPoint->getGroupedShares(); $sharedBy = array_map(function (IShare $share) { $shareType = $this->formatShareType($share); if ($shareType) { - return $share->getSharedBy() . " (via " . $shareType . " " . $share->getSharedWith() . ")"; + return $share->getSharedBy() . ' (via ' . $shareType . ' ' . $share->getSharedWith() . ')'; } else { return $share->getSharedBy(); } }, $shares); - $description = "shared by " . implode(', ', $sharedBy); + $description = 'shared by ' . implode(', ', $sharedBy); if ($share->getSharedBy() !== $share->getShareOwner()) { - $description .= " owned by " . $share->getShareOwner(); + $description .= ' owned by ' . $share->getShareOwner(); } return $description; } elseif ($mountPoint instanceof GroupMountPoint) { - return "groupfolder " . $mountPoint->getFolderId(); + return 'groupfolder ' . $mountPoint->getFolderId(); } elseif ($mountPoint instanceof ExternalMountPoint) { - return "external storage " . $mountPoint->getStorageConfig()->getId(); + return 'external storage ' . $mountPoint->getStorageConfig()->getId(); } elseif ($mountPoint instanceof CircleMount) { - return "circle"; + return 'circle'; } return get_class($mountPoint); } @@ -135,17 +135,17 @@ class FileUtils { public function formatShareType(IShare $share): ?string { switch ($share->getShareType()) { case IShare::TYPE_GROUP: - return "group"; + return 'group'; case IShare::TYPE_CIRCLE: - return "circle"; + return 'circle'; case IShare::TYPE_DECK: - return "deck"; + return 'deck'; case IShare::TYPE_ROOM: - return "room"; + return 'room'; case IShare::TYPE_USER: return null; default: - return "Unknown (" . $share->getShareType() . ")"; + return 'Unknown (' . $share->getShareType() . ')'; } } @@ -197,7 +197,7 @@ class FileUtils { $count += 1; /** @var Node $child */ - $output->writeln("$prefix- " . $child->getName() . ": <info>" . Util::humanFileSize($child->getSize()) . "</info>"); + $output->writeln("$prefix- " . $child->getName() . ': <info>' . Util::humanFileSize($child->getSize()) . '</info>'); if ($child instanceof Folder) { $recurseSizeLimits = $sizeLimits; if (!$all) { @@ -212,7 +212,7 @@ class FileUtils { } sort($recurseSizeLimits); } - $recurseCount = $this->outputLargeFilesTree($output, $child, $prefix . " ", $recurseSizeLimits, $all); + $recurseCount = $this->outputLargeFilesTree($output, $child, $prefix . ' ', $recurseSizeLimits, $all); $sizeLimits = array_slice($sizeLimits, $recurseCount); $count += $recurseCount; } diff --git a/core/Command/Info/Space.php b/core/Command/Info/Space.php index 645deae04b2..b041f2af99f 100644 --- a/core/Command/Info/Space.php +++ b/core/Command/Info/Space.php @@ -27,21 +27,21 @@ class Space extends Command { $this ->setName('info:file:space') ->setDescription('Summarize space usage of specified folder') - ->addArgument('file', InputArgument::REQUIRED, "File id or path") - ->addOption('count', 'c', InputOption::VALUE_REQUIRED, "Number of items to display", 25) - ->addOption('all', 'a', InputOption::VALUE_NONE, "Display all items"); + ->addArgument('file', InputArgument::REQUIRED, 'File id or path') + ->addOption('count', 'c', InputOption::VALUE_REQUIRED, 'Number of items to display', 25) + ->addOption('all', 'a', InputOption::VALUE_NONE, 'Display all items'); } public function execute(InputInterface $input, OutputInterface $output): int { $fileInput = $input->getArgument('file'); - $count = (int)$input->getOption('count'); + $count = (int) $input->getOption('count'); $all = $input->getOption('all'); $node = $this->fileUtils->getNode($fileInput); if (!$node) { $output->writeln("<error>file $fileInput not found</error>"); return 1; } - $output->writeln($node->getName() . ": <info>" . Util::humanFileSize($node->getSize()) . "</info>"); + $output->writeln($node->getName() . ': <info>' . Util::humanFileSize($node->getSize()) . '</info>'); if ($node instanceof Folder) { $limits = $all ? [] : array_fill(0, $count - 1, 0); $this->fileUtils->outputLargeFilesTree($output, $node, '', $limits, $all); diff --git a/core/Command/Integrity/CheckApp.php b/core/Command/Integrity/CheckApp.php index d24b80a4764..5830cb459e7 100644 --- a/core/Command/Integrity/CheckApp.php +++ b/core/Command/Integrity/CheckApp.php @@ -43,7 +43,7 @@ class CheckApp extends Base { */ protected function execute(InputInterface $input, OutputInterface $output): int { $appid = $input->getArgument('appid'); - $path = (string)$input->getOption('path'); + $path = (string) $input->getOption('path'); $result = $this->checker->verifyAppSignature($appid, $path, true); $this->writeArrayInOutputFormat($input, $output, $result); if (count($result) > 0) { diff --git a/core/Command/Maintenance/Install.php b/core/Command/Maintenance/Install.php index a4aa67bd780..514adc4f4fa 100644 --- a/core/Command/Maintenance/Install.php +++ b/core/Command/Maintenance/Install.php @@ -46,7 +46,7 @@ class Install extends Command { ->addOption('admin-user', null, InputOption::VALUE_REQUIRED, 'Login of the admin account', 'admin') ->addOption('admin-pass', null, InputOption::VALUE_REQUIRED, 'Password of the admin account') ->addOption('admin-email', null, InputOption::VALUE_OPTIONAL, 'E-Mail of the admin account') - ->addOption('data-dir', null, InputOption::VALUE_REQUIRED, 'Path to data directory', \OC::$SERVERROOT."/data"); + ->addOption('data-dir', null, InputOption::VALUE_REQUIRED, 'Path to data directory', \OC::$SERVERROOT.'/data'); } protected function execute(InputInterface $input, OutputInterface $output): int { @@ -59,7 +59,7 @@ class Install extends Command { // ignore the OS X setup warning if (count($errors) !== 1 || - (string)$errors[0]['error'] !== 'Mac OS X is not supported and Nextcloud will not work properly on this platform. Use it at your own risk!') { + (string) $errors[0]['error'] !== 'Mac OS X is not supported and Nextcloud will not work properly on this platform. Use it at your own risk!') { return 1; } } @@ -85,7 +85,7 @@ class Install extends Command { if ($setupHelper->shouldRemoveCanInstallFile()) { $output->writeln('<warn>Could not remove CAN_INSTALL from the config folder. Please remove this file manually.</warn>'); } - $output->writeln("Nextcloud was successfully installed"); + $output->writeln('Nextcloud was successfully installed'); return 0; } @@ -99,7 +99,7 @@ class Install extends Command { $db = strtolower($input->getOption('database')); if (!in_array($db, $supportedDatabases)) { - throw new InvalidArgumentException("Database <$db> is not supported. " . implode(", ", $supportedDatabases) . " are supported."); + throw new InvalidArgumentException("Database <$db> is not supported. " . implode(', ', $supportedDatabases) . ' are supported.'); } $dbUser = $input->getOption('database-user'); @@ -126,10 +126,10 @@ class Install extends Command { if ($db !== 'sqlite') { if (is_null($dbUser)) { - throw new InvalidArgumentException("Database account not provided."); + throw new InvalidArgumentException('Database account not provided.'); } if (is_null($dbName)) { - throw new InvalidArgumentException("Database name not provided."); + throw new InvalidArgumentException('Database name not provided.'); } if (is_null($dbPass)) { /** @var QuestionHelper $helper */ diff --git a/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php b/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php index 7e54af61748..1aa4ad55e06 100644 --- a/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php +++ b/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php @@ -21,7 +21,7 @@ class GenerateMimetypeFileBuilder { // Single digit extensions will be treated as integers // Let's make sure they are strings // https://github.com/nextcloud/server/issues/42902 - $key = (string)$key; + $key = (string) $key; return !($key === '' || $key[0] === '_'); }, ARRAY_FILTER_USE_KEY); diff --git a/core/Command/Maintenance/Mimetype/UpdateDB.php b/core/Command/Maintenance/Mimetype/UpdateDB.php index 97677b9d5f4..3d2b33f3b08 100644 --- a/core/Command/Maintenance/Mimetype/UpdateDB.php +++ b/core/Command/Maintenance/Mimetype/UpdateDB.php @@ -48,7 +48,7 @@ class UpdateDB extends Command { // Single digit extensions will be treated as integers // Let's make sure they are strings // https://github.com/nextcloud/server/issues/42902 - $ext = (string)$ext; + $ext = (string) $ext; if ($ext[0] === '_') { // comment continue; diff --git a/core/Command/Maintenance/RepairShareOwnership.php b/core/Command/Maintenance/RepairShareOwnership.php index 6ae235ab3e9..91c9e05c596 100644 --- a/core/Command/Maintenance/RepairShareOwnership.php +++ b/core/Command/Maintenance/RepairShareOwnership.php @@ -34,7 +34,7 @@ class RepairShareOwnership extends Command { ->setName('maintenance:repair-share-owner') ->setDescription('repair invalid share-owner entries in the database') ->addOption('no-confirm', 'y', InputOption::VALUE_NONE, "Don't ask for confirmation before repairing the shares") - ->addArgument('user', InputArgument::OPTIONAL, "User to fix incoming shares for, if omitted all users will be fixed"); + ->addArgument('user', InputArgument::OPTIONAL, 'User to fix incoming shares for, if omitted all users will be fixed'); } protected function execute(InputInterface $input, OutputInterface $output): int { @@ -52,13 +52,13 @@ class RepairShareOwnership extends Command { } if ($shares) { - $output->writeln(""); - $output->writeln("Found " . count($shares) . " shares with invalid share owner"); + $output->writeln(''); + $output->writeln('Found ' . count($shares) . ' shares with invalid share owner'); foreach ($shares as $share) { /** @var array{shareId: int, fileTarget: string, initiator: string, receiver: string, owner: string, mountOwner: string} $share */ $output->writeln(" - share {$share['shareId']} from \"{$share['initiator']}\" to \"{$share['receiver']}\" at \"{$share['fileTarget']}\", owned by \"{$share['owner']}\", that should be owned by \"{$share['mountOwner']}\""); } - $output->writeln(""); + $output->writeln(''); if (!$noConfirm) { /** @var QuestionHelper $helper */ @@ -69,10 +69,10 @@ class RepairShareOwnership extends Command { return 0; } } - $output->writeln("Repairing " . count($shares) . " shares"); + $output->writeln('Repairing ' . count($shares) . ' shares'); $this->repairShares($shares); } else { - $output->writeln("Found no shares with invalid share owner"); + $output->writeln('Found no shares with invalid share owner'); } return 0; diff --git a/core/Command/Maintenance/UpdateTheme.php b/core/Command/Maintenance/UpdateTheme.php index f819b9c8e58..3fbcb546cca 100644 --- a/core/Command/Maintenance/UpdateTheme.php +++ b/core/Command/Maintenance/UpdateTheme.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/Preview/Generate.php b/core/Command/Preview/Generate.php index 0a36217405a..5e893d563dd 100644 --- a/core/Command/Preview/Generate.php +++ b/core/Command/Preview/Generate.php @@ -33,15 +33,15 @@ class Generate extends Command { $this ->setName('preview:generate') ->setDescription('generate a preview for a file') - ->addArgument("file", InputArgument::REQUIRED, "path or fileid of the file to generate the preview for") - ->addOption("size", "s", InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, "size to generate the preview for in pixels, defaults to 64x64", ["64x64"]) - ->addOption("crop", "c", InputOption::VALUE_NONE, "crop the previews instead of maintaining aspect ratio") - ->addOption("mode", "m", InputOption::VALUE_REQUIRED, "mode for generating uncropped previews, 'cover' or 'fill'", IPreview::MODE_FILL); + ->addArgument('file', InputArgument::REQUIRED, 'path or fileid of the file to generate the preview for') + ->addOption('size', 's', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'size to generate the preview for in pixels, defaults to 64x64', ['64x64']) + ->addOption('crop', 'c', InputOption::VALUE_NONE, 'crop the previews instead of maintaining aspect ratio') + ->addOption('mode', 'm', InputOption::VALUE_REQUIRED, "mode for generating uncropped previews, 'cover' or 'fill'", IPreview::MODE_FILL); } protected function execute(InputInterface $input, OutputInterface $output): int { - $fileInput = $input->getArgument("file"); - $sizes = $input->getOption("size"); + $fileInput = $input->getArgument('file'); + $sizes = $input->getOption('size'); $sizes = array_map(function (string $size) use ($output) { if (str_contains($size, 'x')) { $sizeParts = explode('x', $size, 2); @@ -53,18 +53,18 @@ class Generate extends Command { return null; } - return array_map("intval", $sizeParts); + return array_map('intval', $sizeParts); }, $sizes); if (in_array(null, $sizes)) { return 1; } - $mode = $input->getOption("mode"); + $mode = $input->getOption('mode'); if ($mode !== IPreview::MODE_FILL && $mode !== IPreview::MODE_COVER) { $output->writeln("<error>Invalid mode $mode</error>"); return 1; } - $crop = $input->getOption("crop"); + $crop = $input->getOption('crop'); $file = $this->getFile($fileInput); if (!$file) { $output->writeln("<error>File $fileInput not found</error>"); @@ -76,7 +76,7 @@ class Generate extends Command { } if (!$this->previewManager->isAvailable($file)) { - $output->writeln("<error>No preview generator available for file of type" . $file->getMimetype() . "</error>"); + $output->writeln('<error>No preview generator available for file of type' . $file->getMimetype() . '</error>'); return 1; } @@ -91,22 +91,22 @@ class Generate extends Command { $this->previewManager->generatePreviews($file, $specifications); if (count($specifications) > 1) { - $output->writeln("generated <info>" . count($specifications) . "</info> previews"); + $output->writeln('generated <info>' . count($specifications) . '</info> previews'); } else { - $output->writeln("preview generated"); + $output->writeln('preview generated'); } return 0; } private function getFile(string $fileInput): ?Node { if (is_numeric($fileInput)) { - $mounts = $this->userMountCache->getMountsForFileId((int)$fileInput); + $mounts = $this->userMountCache->getMountsForFileId((int) $fileInput); if (!$mounts) { return null; } $mount = $mounts[0]; $userFolder = $this->rootFolder->getUserFolder($mount->getUser()->getUID()); - return $userFolder->getFirstNodeById((int)$fileInput); + return $userFolder->getFirstNodeById((int) $fileInput); } else { try { return $this->rootFolder->get($fileInput); diff --git a/core/Command/Preview/Repair.php b/core/Command/Preview/Repair.php index a6564209163..2e082ee6b4a 100644 --- a/core/Command/Preview/Repair.php +++ b/core/Command/Preview/Repair.php @@ -39,7 +39,7 @@ class Repair extends Command { IniGetWrapper $phpIni, private ILockingProvider $lockingProvider, ) { - $this->memoryLimit = (int)$phpIni->getBytes('memory_limit'); + $this->memoryLimit = (int) $phpIni->getBytes('memory_limit'); $this->memoryTreshold = $this->memoryLimit - 25 * 1024 * 1024; parent::__construct(); @@ -60,11 +60,11 @@ class Repair extends Command { $thresholdInMiB = round($this->memoryTreshold / 1024 / 1024, 1); $output->writeln("Memory limit is $limitInMiB MiB"); $output->writeln("Memory threshold is $thresholdInMiB MiB"); - $output->writeln(""); + $output->writeln(''); $memoryCheckEnabled = true; } else { - $output->writeln("No memory limit in place - disabled memory check. Set a PHP memory limit to automatically stop the execution of this migration script once memory consumption is close to this limit."); - $output->writeln(""); + $output->writeln('No memory limit in place - disabled memory check. Set a PHP memory limit to automatically stop the execution of this migration script once memory consumption is close to this limit.'); + $output->writeln(''); $memoryCheckEnabled = false; } @@ -73,16 +73,16 @@ class Repair extends Command { if ($dryMode) { - $output->writeln("INFO: The migration is run in dry mode and will not modify anything."); - $output->writeln(""); + $output->writeln('INFO: The migration is run in dry mode and will not modify anything.'); + $output->writeln(''); } elseif ($deleteMode) { - $output->writeln("WARN: The migration will _DELETE_ old previews."); - $output->writeln(""); + $output->writeln('WARN: The migration will _DELETE_ old previews.'); + $output->writeln(''); } $instanceId = $this->config->getSystemValueString('instanceid'); - $output->writeln("This will migrate all previews from the old preview location to the new one."); + $output->writeln('This will migrate all previews from the old preview location to the new one.'); $output->writeln(''); $output->writeln('Fetching previews that need to be migrated …'); @@ -123,13 +123,13 @@ class Repair extends Command { } if ($total === 0) { - $output->writeln("All previews are already migrated."); + $output->writeln('All previews are already migrated.'); return 0; } $output->writeln("A total of $total preview files need to be migrated."); - $output->writeln(""); - $output->writeln("The migration will always migrate all previews of a single file in a batch. After each batch the process can be canceled by pressing CTRL-C. This will finish the current batch and then stop the migration. This migration can then just be started and it will continue."); + $output->writeln(''); + $output->writeln('The migration will always migrate all previews of a single file in a batch. After each batch the process can be canceled by pressing CTRL-C. This will finish the current batch and then stop the migration. This migration can then just be started and it will continue.'); if ($input->getOption('batch')) { $output->writeln('Batch mode active: migration is started right away.'); @@ -146,12 +146,12 @@ class Repair extends Command { // register the SIGINT listener late in here to be able to exit in the early process of this command pcntl_signal(SIGINT, [$this, 'sigIntHandler']); - $output->writeln(""); - $output->writeln(""); + $output->writeln(''); + $output->writeln(''); $section1 = $output->section(); $section2 = $output->section(); $progressBar = new ProgressBar($section2, $total); - $progressBar->setFormat("%current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% Used Memory: %memory:6s%"); + $progressBar->setFormat('%current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% Used Memory: %memory:6s%'); $time = (new \DateTime())->format('H:i:s'); $progressBar->setMessage("$time Starting …"); $progressBar->maxSecondsBetweenRedraws(0.2); @@ -193,10 +193,10 @@ class Repair extends Command { $memoryUsage = memory_get_usage(); if ($memoryCheckEnabled && $memoryUsage > $this->memoryTreshold) { - $section1->writeln(""); - $section1->writeln(""); - $section1->writeln(""); - $section1->writeln(" Stopped process 25 MB before reaching the memory limit to avoid a hard crash."); + $section1->writeln(''); + $section1->writeln(''); + $section1->writeln(''); + $section1->writeln(' Stopped process 25 MB before reaching the memory limit to avoid a hard crash.'); $time = (new \DateTime())->format('H:i:s'); $section1->writeln("$time Reached memory limit and stopped to avoid hard crash."); return 1; @@ -207,7 +207,7 @@ class Repair extends Command { $section1->writeln(" Locking \"$lockName\" …", OutputInterface::VERBOSITY_VERBOSE); $this->lockingProvider->acquireLock($lockName, ILockingProvider::LOCK_EXCLUSIVE); } catch (LockedException $e) { - $section1->writeln(" Skipping because it is locked - another process seems to work on this …"); + $section1->writeln(' Skipping because it is locked - another process seems to work on this …'); continue; } @@ -275,14 +275,14 @@ class Repair extends Command { } $this->lockingProvider->releaseLock($lockName, ILockingProvider::LOCK_EXCLUSIVE); - $section1->writeln(" Unlocked", OutputInterface::VERBOSITY_VERBOSE); + $section1->writeln(' Unlocked', OutputInterface::VERBOSITY_VERBOSE); $section1->writeln(" Finished migrating previews of file with fileId $name …"); $progressBar->advance(); } $progressBar->finish(); - $output->writeln(""); + $output->writeln(''); return 0; } diff --git a/core/Command/Preview/ResetRenderedTexts.php b/core/Command/Preview/ResetRenderedTexts.php index 12f7d237d8f..86339b7e9aa 100644 --- a/core/Command/Preview/ResetRenderedTexts.php +++ b/core/Command/Preview/ResetRenderedTexts.php @@ -101,7 +101,7 @@ class ResetRenderedTexts extends Command { } try { - $preview = $this->previewFolder->getFolder((string)$previewFileId); + $preview = $this->previewFolder->getFolder((string) $previewFileId); $preview->delete(); } catch (NotFoundException $e) { // continue diff --git a/core/Command/SystemTag/Add.php b/core/Command/SystemTag/Add.php index 9d8f7ae05e4..64d378fc1eb 100644 --- a/core/Command/SystemTag/Add.php +++ b/core/Command/SystemTag/Add.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/SystemTag/Delete.php b/core/Command/SystemTag/Delete.php index 73b3dc8187a..f657f4473ab 100644 --- a/core/Command/SystemTag/Delete.php +++ b/core/Command/SystemTag/Delete.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/SystemTag/Edit.php b/core/Command/SystemTag/Edit.php index 7ac74cbc53a..d857a56edfb 100644 --- a/core/Command/SystemTag/Edit.php +++ b/core/Command/SystemTag/Edit.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/SystemTag/ListCommand.php b/core/Command/SystemTag/ListCommand.php index 836869f157d..2c6435d6faf 100644 --- a/core/Command/SystemTag/ListCommand.php +++ b/core/Command/SystemTag/ListCommand.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/TaskProcessing/ListCommand.php b/core/Command/TaskProcessing/ListCommand.php index 46f32e0bc53..6dd4c148a98 100644 --- a/core/Command/TaskProcessing/ListCommand.php +++ b/core/Command/TaskProcessing/ListCommand.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/TaskProcessing/Statistics.php b/core/Command/TaskProcessing/Statistics.php index a3dc9ee0254..67d897ae8dd 100644 --- a/core/Command/TaskProcessing/Statistics.php +++ b/core/Command/TaskProcessing/Statistics.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -159,31 +160,31 @@ class Statistics extends Base { if ($runningTimeCount > 0) { $stats['Max running time'] = $maxRunningTime; $averageRunningTime = $totalRunningTime / $runningTimeCount; - $stats['Average running time'] = (int)$averageRunningTime; + $stats['Average running time'] = (int) $averageRunningTime; $stats['Running time count'] = $runningTimeCount; } if ($queuingTimeCount > 0) { $stats['Max queuing time'] = $maxQueuingTime; $averageQueuingTime = $totalQueuingTime / $queuingTimeCount; - $stats['Average queuing time'] = (int)$averageQueuingTime; + $stats['Average queuing time'] = (int) $averageQueuingTime; $stats['Queuing time count'] = $queuingTimeCount; } if ($userWaitingTimeCount > 0) { $stats['Max user waiting time'] = $maxUserWaitingTime; $averageUserWaitingTime = $totalUserWaitingTime / $userWaitingTimeCount; - $stats['Average user waiting time'] = (int)$averageUserWaitingTime; + $stats['Average user waiting time'] = (int) $averageUserWaitingTime; $stats['User waiting time count'] = $userWaitingTimeCount; } if ($outputCount > 0) { $stats['Max output size (bytes)'] = $maxOutputSize; $averageOutputSize = $outputSum / $outputCount; - $stats['Average output size (bytes)'] = (int)$averageOutputSize; + $stats['Average output size (bytes)'] = (int) $averageOutputSize; $stats['Number of tasks with output'] = $outputCount; } if ($inputCount > 0) { $stats['Max input size (bytes)'] = $maxInputSize; $averageInputSize = $inputSum / $inputCount; - $stats['Average input size (bytes)'] = (int)$averageInputSize; + $stats['Average input size (bytes)'] = (int) $averageInputSize; $stats['Number of tasks with input'] = $inputCount; } diff --git a/core/Command/TwoFactorAuth/Base.php b/core/Command/TwoFactorAuth/Base.php index 70e33bfd23c..034ea36afca 100644 --- a/core/Command/TwoFactorAuth/Base.php +++ b/core/Command/TwoFactorAuth/Base.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/TwoFactorAuth/Disable.php b/core/Command/TwoFactorAuth/Disable.php index aeb3854fc60..c60c1245735 100644 --- a/core/Command/TwoFactorAuth/Disable.php +++ b/core/Command/TwoFactorAuth/Disable.php @@ -38,14 +38,14 @@ class Disable extends Base { $providerId = $input->getArgument('provider_id'); $user = $this->userManager->get($uid); if (is_null($user)) { - $output->writeln("<error>Invalid UID</error>"); + $output->writeln('<error>Invalid UID</error>'); return 1; } if ($this->manager->tryDisableProviderFor($providerId, $user)) { $output->writeln("Two-factor provider <options=bold>$providerId</> disabled for user <options=bold>$uid</>."); return 0; } else { - $output->writeln("<error>The provider does not support this operation.</error>"); + $output->writeln('<error>The provider does not support this operation.</error>'); return 2; } } diff --git a/core/Command/TwoFactorAuth/Enable.php b/core/Command/TwoFactorAuth/Enable.php index fac44d11374..215cb31397e 100644 --- a/core/Command/TwoFactorAuth/Enable.php +++ b/core/Command/TwoFactorAuth/Enable.php @@ -38,14 +38,14 @@ class Enable extends Base { $providerId = $input->getArgument('provider_id'); $user = $this->userManager->get($uid); if (is_null($user)) { - $output->writeln("<error>Invalid UID</error>"); + $output->writeln('<error>Invalid UID</error>'); return 1; } if ($this->manager->tryEnableProviderFor($providerId, $user)) { $output->writeln("Two-factor provider <options=bold>$providerId</> enabled for user <options=bold>$uid</>."); return 0; } else { - $output->writeln("<error>The provider does not support this operation.</error>"); + $output->writeln('<error>The provider does not support this operation.</error>'); return 2; } } diff --git a/core/Command/TwoFactorAuth/State.php b/core/Command/TwoFactorAuth/State.php index 19a859695c1..ab2e8f2aecf 100644 --- a/core/Command/TwoFactorAuth/State.php +++ b/core/Command/TwoFactorAuth/State.php @@ -37,7 +37,7 @@ class State extends Base { $uid = $input->getArgument('uid'); $user = $this->userManager->get($uid); if (is_null($user)) { - $output->writeln("<error>Invalid UID</error>"); + $output->writeln('<error>Invalid UID</error>'); return 1; } @@ -51,9 +51,9 @@ class State extends Base { $output->writeln("Two-factor authentication is not enabled for user $uid"); } - $output->writeln(""); - $this->printProviders("Enabled providers", $enabled, $output); - $this->printProviders("Disabled providers", $disabled, $output); + $output->writeln(''); + $this->printProviders('Enabled providers', $enabled, $output); + $this->printProviders('Disabled providers', $disabled, $output); return 0; } @@ -80,9 +80,9 @@ class State extends Base { return; } - $output->writeln($title . ":"); + $output->writeln($title . ':'); foreach ($providers as $provider) { - $output->writeln("- " . $provider); + $output->writeln('- ' . $provider); } } } diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php index adfda87ffbc..7b1526766f3 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -142,9 +142,9 @@ class Upgrade extends Command { $updater->listen('\OC\Updater', 'updateEnd', function ($success) use ($output, $self) { if ($success) { - $message = "<info>Update successful</info>"; + $message = '<info>Update successful</info>'; } else { - $message = "<error>Update failed</error>"; + $message = '<error>Update failed</error>'; } $output->writeln($message); }); @@ -175,16 +175,16 @@ class Upgrade extends Command { $output->writeln("<error>$message</error>"); }); $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($output) { - $output->writeln("<info>Setting log level to debug</info>"); + $output->writeln('<info>Setting log level to debug</info>'); }); $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($output) { - $output->writeln("<info>Resetting log level</info>"); + $output->writeln('<info>Resetting log level</info>'); }); $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($output) { - $output->writeln("<info>Starting code integrity check...</info>"); + $output->writeln('<info>Starting code integrity check...</info>'); }); $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($output) { - $output->writeln("<info>Finished code integrity check</info>"); + $output->writeln('<info>Finished code integrity check</info>'); }); $success = $updater->upgrade(); diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php index 60cf67e8df3..033d2bdc9a2 100644 --- a/core/Command/User/Add.php +++ b/core/Command/User/Add.php @@ -114,11 +114,11 @@ class Add extends Command { $confirm = $helper->ask($input, $output, $question); if ($password !== $confirm) { - $output->writeln("<error>Passwords did not match!</error>"); + $output->writeln('<error>Passwords did not match!</error>'); return 1; } } else { - $output->writeln("<error>Interactive input or --password-from-env or --generate-password is needed for setting a password!</error>"); + $output->writeln('<error>Interactive input or --password-from-env or --generate-password is needed for setting a password!</error>'); return 1; } diff --git a/core/Command/User/AuthTokens/Delete.php b/core/Command/User/AuthTokens/Delete.php index 65c0147aa24..d6563de711c 100644 --- a/core/Command/User/AuthTokens/Delete.php +++ b/core/Command/User/AuthTokens/Delete.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/User/AuthTokens/ListCommand.php b/core/Command/User/AuthTokens/ListCommand.php index 1ebd4a0f0b4..b36aa717505 100644 --- a/core/Command/User/AuthTokens/ListCommand.php +++ b/core/Command/User/AuthTokens/ListCommand.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/User/ClearGeneratedAvatarCacheCommand.php b/core/Command/User/ClearGeneratedAvatarCacheCommand.php index fc9d70709c8..515b3a913b7 100644 --- a/core/Command/User/ClearGeneratedAvatarCacheCommand.php +++ b/core/Command/User/ClearGeneratedAvatarCacheCommand.php @@ -27,9 +27,9 @@ class ClearGeneratedAvatarCacheCommand extends Base { } protected function execute(InputInterface $input, OutputInterface $output): int { - $output->writeln("Clearing avatar cache has started"); + $output->writeln('Clearing avatar cache has started'); $this->avatarManager->clearCachedAvatars(); - $output->writeln("Cleared avatar cache successfully"); + $output->writeln('Cleared avatar cache successfully'); return 0; } } diff --git a/core/Command/User/Info.php b/core/Command/User/Info.php index 55298f0164c..515a7a34474 100644 --- a/core/Command/User/Info.php +++ b/core/Command/User/Info.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -50,7 +51,7 @@ class Info extends Base { $data = [ 'user_id' => $user->getUID(), 'display_name' => $user->getDisplayName(), - 'email' => (string)$user->getSystemEMailAddress(), + 'email' => (string) $user->getSystemEMailAddress(), 'cloud_id' => $user->getCloudId(), 'enabled' => $user->isEnabled(), 'groups' => $groups, diff --git a/core/Command/User/LastSeen.php b/core/Command/User/LastSeen.php index 61a6c97ce72..dbb611a4fff 100644 --- a/core/Command/User/LastSeen.php +++ b/core/Command/User/LastSeen.php @@ -64,7 +64,7 @@ class LastSeen extends Base { } if (!$input->getOption('all')) { - $output->writeln("<error>Please specify a username, or \"--all\" to list all</error>"); + $output->writeln('<error>Please specify a username, or "--all" to list all</error>'); return 1; } diff --git a/core/Command/User/ListCommand.php b/core/Command/User/ListCommand.php index 3d592afd7ee..342619af728 100644 --- a/core/Command/User/ListCommand.php +++ b/core/Command/User/ListCommand.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -63,7 +64,7 @@ class ListCommand extends Base { $users = $this->userManager->searchDisplayName('', (int) $input->getOption('limit'), (int) $input->getOption('offset')); } - $this->writeArrayInOutputFormat($input, $output, $this->formatUsers($users, (bool)$input->getOption('info'))); + $this->writeArrayInOutputFormat($input, $output, $this->formatUsers($users, (bool) $input->getOption('info'))); return 0; } @@ -78,7 +79,7 @@ class ListCommand extends Base { $value = [ 'user_id' => $user->getUID(), 'display_name' => $user->getDisplayName(), - 'email' => (string)$user->getSystemEMailAddress(), + 'email' => (string) $user->getSystemEMailAddress(), 'cloud_id' => $user->getCloudId(), 'enabled' => $user->isEnabled(), 'groups' => $groups, diff --git a/core/Command/User/ResetPassword.php b/core/Command/User/ResetPassword.php index 3233424ff4c..2f18c3d473e 100644 --- a/core/Command/User/ResetPassword.php +++ b/core/Command/User/ResetPassword.php @@ -81,7 +81,7 @@ class ResetPassword extends Base { $password = $helper->ask($input, $output, $question); if ($password === null) { - $output->writeln("<error>Password cannot be empty!</error>"); + $output->writeln('<error>Password cannot be empty!</error>'); return 1; } @@ -90,11 +90,11 @@ class ResetPassword extends Base { $confirm = $helper->ask($input, $output, $question); if ($password !== $confirm) { - $output->writeln("<error>Passwords did not match!</error>"); + $output->writeln('<error>Passwords did not match!</error>'); return 1; } } else { - $output->writeln("<error>Interactive input or --password-from-env is needed for entering a new password!</error>"); + $output->writeln('<error>Interactive input or --password-from-env is needed for entering a new password!</error>'); return 1; } @@ -107,9 +107,9 @@ class ResetPassword extends Base { } if ($success) { - $output->writeln("<info>Successfully reset password for " . $username . "</info>"); + $output->writeln('<info>Successfully reset password for ' . $username . '</info>'); } else { - $output->writeln("<error>Error while resetting password!</error>"); + $output->writeln('<error>Error while resetting password!</error>'); return 1; } return 0; diff --git a/core/Command/User/SyncAccountDataCommand.php b/core/Command/User/SyncAccountDataCommand.php index 6a70f1239f6..87e55288d71 100644 --- a/core/Command/User/SyncAccountDataCommand.php +++ b/core/Command/User/SyncAccountDataCommand.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Command/User/Welcome.php b/core/Command/User/Welcome.php index ba1c88a26c5..7b20a0277ea 100644 --- a/core/Command/User/Welcome.php +++ b/core/Command/User/Welcome.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 FedericoHeichou <federicoheichou@gmail.com> * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 5d117f6ae7f..0e5a8b2e408 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -85,7 +85,7 @@ class AvatarController extends Controller { $response = new FileDisplayResponse( $avatarFile, Http::STATUS_OK, - ['Content-Type' => $avatarFile->getMimeType(), 'X-NC-IsCustomAvatar' => (int)$avatar->isCustomAvatar()] + ['Content-Type' => $avatarFile->getMimeType(), 'X-NC-IsCustomAvatar' => (int) $avatar->isCustomAvatar()] ); } catch (\Exception $e) { if ($guestFallback) { @@ -136,7 +136,7 @@ class AvatarController extends Controller { $response = new FileDisplayResponse( $avatarFile, Http::STATUS_OK, - ['Content-Type' => $avatarFile->getMimeType(), 'X-NC-IsCustomAvatar' => (int)$avatar->isCustomAvatar()] + ['Content-Type' => $avatarFile->getMimeType(), 'X-NC-IsCustomAvatar' => (int) $avatar->isCustomAvatar()] ); } catch (\Exception $e) { if ($guestFallback) { @@ -292,7 +292,7 @@ class AvatarController extends Controller { $tmpAvatar = $this->cache->get('tmpAvatar'); if (is_null($tmpAvatar)) { return new JSONResponse(['data' => [ - 'message' => $this->l10n->t("No temporary profile picture available, try again") + 'message' => $this->l10n->t('No temporary profile picture available, try again') ]], Http::STATUS_NOT_FOUND); } @@ -305,7 +305,7 @@ class AvatarController extends Controller { Http::STATUS_OK, ['Content-Type' => $image->mimeType()]); - $resp->setETag((string)crc32($image->data() ?? '')); + $resp->setETag((string) crc32($image->data() ?? '')); $resp->cacheFor(0); $resp->setLastModified(new \DateTime('now', new \DateTimeZone('GMT'))); return $resp; @@ -315,26 +315,26 @@ class AvatarController extends Controller { #[FrontpageRoute(verb: 'POST', url: '/avatar/cropped')] public function postCroppedAvatar(?array $crop = null): JSONResponse { if (is_null($crop)) { - return new JSONResponse(['data' => ['message' => $this->l10n->t("No crop data provided")]], + return new JSONResponse(['data' => ['message' => $this->l10n->t('No crop data provided')]], Http::STATUS_BAD_REQUEST); } if (!isset($crop['x'], $crop['y'], $crop['w'], $crop['h'])) { - return new JSONResponse(['data' => ['message' => $this->l10n->t("No valid crop data provided")]], + return new JSONResponse(['data' => ['message' => $this->l10n->t('No valid crop data provided')]], Http::STATUS_BAD_REQUEST); } $tmpAvatar = $this->cache->get('tmpAvatar'); if (is_null($tmpAvatar)) { return new JSONResponse(['data' => [ - 'message' => $this->l10n->t("No temporary profile picture available, try again") + 'message' => $this->l10n->t('No temporary profile picture available, try again') ]], Http::STATUS_BAD_REQUEST); } $image = new \OCP\Image(); $image->loadFromData($tmpAvatar); - $image->crop($crop['x'], $crop['y'], (int)round($crop['w']), (int)round($crop['h'])); + $image->crop($crop['x'], $crop['y'], (int) round($crop['w']), (int) round($crop['h'])); try { $avatar = $this->avatarManager->getAvatar($this->userId); $avatar->set($image); diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index fa4b4d83d00..1fad89a9a68 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -355,7 +356,7 @@ class ClientFlowLoginController extends Controller { $protocol = $this->request->getServerProtocol(); - if ($protocol !== "https") { + if ($protocol !== 'https') { $xForwardedProto = $this->request->getHeader('X-Forwarded-Proto'); $xForwardedSSL = $this->request->getHeader('X-Forwarded-Ssl'); if ($xForwardedProto === 'https' || $xForwardedSSL === 'on') { @@ -363,6 +364,6 @@ class ClientFlowLoginController extends Controller { } } - return $protocol . "://" . $this->request->getServerHost() . $serverPostfix; + return $protocol . '://' . $this->request->getServerHost() . $serverPostfix; } } diff --git a/core/Controller/ContactsMenuController.php b/core/Controller/ContactsMenuController.php index f4ded1ed42b..d90ee8a1c61 100644 --- a/core/Controller/ContactsMenuController.php +++ b/core/Controller/ContactsMenuController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Controller/GuestAvatarController.php b/core/Controller/GuestAvatarController.php index e87112726f2..240834c7a95 100644 --- a/core/Controller/GuestAvatarController.php +++ b/core/Controller/GuestAvatarController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -68,7 +69,7 @@ class GuestAvatarController extends Controller { $resp = new FileDisplayResponse( $avatarFile, $avatar->isCustomAvatar() ? Http::STATUS_OK : Http::STATUS_CREATED, - ['Content-Type' => $avatarFile->getMimeType(), 'X-NC-IsCustomAvatar' => (int)$avatar->isCustomAvatar()] + ['Content-Type' => $avatarFile->getMimeType(), 'X-NC-IsCustomAvatar' => (int) $avatar->isCustomAvatar()] ); } catch (\Exception $e) { $this->logger->error('error while creating guest avatar', [ diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index 2a5e5503952..b900ea6b5aa 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -94,7 +94,7 @@ class LostController extends Controller { ) { $response = new TemplateResponse( 'core', 'error', [ - "errors" => [["error" => $e->getMessage()]] + 'errors' => [['error' => $e->getMessage()]] ], TemplateResponse::RENDER_AS_GUEST ); @@ -131,7 +131,7 @@ class LostController extends Controller { $error = $e->getCode() === InvalidTokenException::TOKEN_EXPIRED ? $this->l10n->t('Could not reset password because the token is expired') : $this->l10n->t('Could not reset password because the token is invalid'); - throw new Exception($error, (int)$e->getCode(), $e); + throw new Exception($error, (int) $e->getCode(), $e); } } diff --git a/core/Controller/NavigationController.php b/core/Controller/NavigationController.php index 44c8ef0880b..a4c9faa5f8b 100644 --- a/core/Controller/NavigationController.php +++ b/core/Controller/NavigationController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Controller/OCJSController.php b/core/Controller/OCJSController.php index 3a0922c9344..d2e4e312437 100644 --- a/core/Controller/OCJSController.php +++ b/core/Controller/OCJSController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index 743a71622da..9628a53f8b1 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -57,9 +58,9 @@ class OCSController extends \OCP\AppFramework\OCSController { $result = []; [$major, $minor, $micro] = \OCP\Util::getVersion(); $result['version'] = [ - 'major' => (int)$major, - 'minor' => (int)$minor, - 'micro' => (int)$micro, + 'major' => (int) $major, + 'minor' => (int) $minor, + 'micro' => (int) $micro, 'string' => \OC_Util::getVersionString(), 'edition' => '', 'extendedSupport' => \OCP\Util::hasExtendedSupport() diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 26fc93a4cd3..2d459afbb15 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -530,7 +530,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { break; } } - $taskIdsToIgnore[] = (int)$task->getId(); + $taskIdsToIgnore[] = (int) $task->getId(); } /** @var CoreTaskProcessingTask $json */ diff --git a/core/Controller/TextProcessingApiController.php b/core/Controller/TextProcessingApiController.php index 40e569ee1d9..697dc530ae9 100644 --- a/core/Controller/TextProcessingApiController.php +++ b/core/Controller/TextProcessingApiController.php @@ -109,7 +109,7 @@ class TextProcessingApiController extends \OCP\AppFramework\OCSController { try { try { $this->textProcessingManager->runOrScheduleTask($task); - } catch(TaskFailureException) { + } catch (TaskFailureException) { // noop, because the task object has the failure status set already, we just return the task json } diff --git a/core/Controller/TextToImageApiController.php b/core/Controller/TextToImageApiController.php index 4a560d8b04d..05c764e874b 100644 --- a/core/Controller/TextToImageApiController.php +++ b/core/Controller/TextToImageApiController.php @@ -150,7 +150,7 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController { $task = $this->textToImageManager->getUserTask($id, $this->userId); try { $folder = $this->appData->getFolder('text2image'); - } catch(NotFoundException) { + } catch (NotFoundException) { $res = new DataResponse(['message' => $this->l->t('Image not found')], Http::STATUS_NOT_FOUND); $res->throttle(['action' => 'text2image']); return $res; diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php index 153e1e7559a..ef0f420fc82 100644 --- a/core/Controller/TwoFactorChallengeController.php +++ b/core/Controller/TwoFactorChallengeController.php @@ -123,7 +123,7 @@ class TwoFactorChallengeController extends Controller { if ($this->session->exists('two_factor_auth_error')) { $this->session->remove('two_factor_auth_error'); $error = true; - $errorMessage = $this->session->get("two_factor_auth_error_message"); + $errorMessage = $this->session->get('two_factor_auth_error_message'); $this->session->remove('two_factor_auth_error_message'); } $tmpl = $provider->getTemplate($user); diff --git a/core/Controller/WalledGardenController.php b/core/Controller/WalledGardenController.php index b55e90675a1..d0bc0665534 100644 --- a/core/Controller/WalledGardenController.php +++ b/core/Controller/WalledGardenController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Controller/WellKnownController.php b/core/Controller/WellKnownController.php index 89a648d6bef..9ce83686355 100644 --- a/core/Controller/WellKnownController.php +++ b/core/Controller/WellKnownController.php @@ -41,7 +41,7 @@ class WellKnownController extends Controller { ); if ($response === null) { - $httpResponse = new JSONResponse(["message" => "$service not supported"], Http::STATUS_NOT_FOUND); + $httpResponse = new JSONResponse(['message' => "$service not supported"], Http::STATUS_NOT_FOUND); } else { $httpResponse = $response->toHttpResponse(); } diff --git a/core/Controller/WhatsNewController.php b/core/Controller/WhatsNewController.php index 06b27b0d302..50655c540a0 100644 --- a/core/Controller/WhatsNewController.php +++ b/core/Controller/WhatsNewController.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -49,7 +50,7 @@ class WhatsNewController extends OCSController { public function get():DataResponse { $user = $this->userSession->getUser(); if ($user === null) { - throw new \RuntimeException("Acting user cannot be resolved"); + throw new \RuntimeException('Acting user cannot be resolved'); } $lastRead = $this->config->getUserValue($user->getUID(), 'core', 'whatsNewLastRead', 0); $currentVersion = $this->whatsNewService->normalizeVersion($this->config->getSystemValue('version')); @@ -96,7 +97,7 @@ class WhatsNewController extends OCSController { public function dismiss(string $version):DataResponse { $user = $this->userSession->getUser(); if ($user === null) { - throw new \RuntimeException("Acting user cannot be resolved"); + throw new \RuntimeException('Acting user cannot be resolved'); } $version = $this->whatsNewService->normalizeVersion($version); // checks whether it's a valid version, throws an Exception otherwise diff --git a/core/Listener/BeforeMessageLoggedEventListener.php b/core/Listener/BeforeMessageLoggedEventListener.php index ef771ca0a81..e04a766d69f 100644 --- a/core/Listener/BeforeMessageLoggedEventListener.php +++ b/core/Listener/BeforeMessageLoggedEventListener.php @@ -58,7 +58,7 @@ class BeforeMessageLoggedEventListener implements IEventListener { if ($arg === '--'.ReservedOptions::DEBUG_LOG) { unset($argv[$key]); } elseif (str_starts_with($arg, '--'.ReservedOptions::DEBUG_LOG_LEVEL.'=')) { - $level = (int)substr($arg, strlen('--'.ReservedOptions::DEBUG_LOG_LEVEL.'=')); + $level = (int) substr($arg, strlen('--'.ReservedOptions::DEBUG_LOG_LEVEL.'=')); unset($argv[$key]); } } diff --git a/core/Migrations/Version13000Date20170705121758.php b/core/Migrations/Version13000Date20170705121758.php index 7233cc0302e..17262cf0743 100644 --- a/core/Migrations/Version13000Date20170705121758.php +++ b/core/Migrations/Version13000Date20170705121758.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index fff993f7554..a4416924c93 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Migrations/Version13000Date20170814074715.php b/core/Migrations/Version13000Date20170814074715.php index 73de1af0e0a..6e7ca19fc3c 100644 --- a/core/Migrations/Version13000Date20170814074715.php +++ b/core/Migrations/Version13000Date20170814074715.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Migrations/Version13000Date20170919121250.php b/core/Migrations/Version13000Date20170919121250.php index ae6eff99bcd..b3e9541d605 100644 --- a/core/Migrations/Version13000Date20170919121250.php +++ b/core/Migrations/Version13000Date20170919121250.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Migrations/Version13000Date20170926101637.php b/core/Migrations/Version13000Date20170926101637.php index 4a270c5e1cb..aca772de313 100644 --- a/core/Migrations/Version13000Date20170926101637.php +++ b/core/Migrations/Version13000Date20170926101637.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -13,7 +14,7 @@ use OCP\Migration\BigIntMigration; class Version13000Date20170926101637 extends BigIntMigration { /** * @return array Returns an array with the following structure - * ['table1' => ['column1', 'column2'], ...] + * ['table1' => ['column1', 'column2'], ...] * @since 13.0.0 */ protected function getColumnsByTable() { diff --git a/core/Migrations/Version14000Date20180129121024.php b/core/Migrations/Version14000Date20180129121024.php index 6da5f2602e8..c16d95ed71b 100644 --- a/core/Migrations/Version14000Date20180129121024.php +++ b/core/Migrations/Version14000Date20180129121024.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Migrations/Version14000Date20180516101403.php b/core/Migrations/Version14000Date20180516101403.php index c024b1b93ab..a71673a9674 100644 --- a/core/Migrations/Version14000Date20180516101403.php +++ b/core/Migrations/Version14000Date20180516101403.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Migrations/Version14000Date20180626223656.php b/core/Migrations/Version14000Date20180626223656.php index 8c3e81303bc..25f7b019487 100644 --- a/core/Migrations/Version14000Date20180626223656.php +++ b/core/Migrations/Version14000Date20180626223656.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Migrations/Version14000Date20180712153140.php b/core/Migrations/Version14000Date20180712153140.php index d719b0f803c..421189b315d 100644 --- a/core/Migrations/Version14000Date20180712153140.php +++ b/core/Migrations/Version14000Date20180712153140.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/core/Migrations/Version23000Date20211213203940.php b/core/Migrations/Version23000Date20211213203940.php index 69f6257e812..f31f13a14d7 100644 --- a/core/Migrations/Version23000Date20211213203940.php +++ b/core/Migrations/Version23000Date20211213203940.php @@ -14,7 +14,7 @@ use OCP\Migration\BigIntMigration; class Version23000Date20211213203940 extends BigIntMigration { /** * @return array Returns an array with the following structure - * ['table1' => ['column1', 'column2'], ...] + * ['table1' => ['column1', 'column2'], ...] */ protected function getColumnsByTable() { return [ diff --git a/core/Migrations/Version25000Date20220515204012.php b/core/Migrations/Version25000Date20220515204012.php index 2ec96bc5175..7f7c6b6cee2 100644 --- a/core/Migrations/Version25000Date20220515204012.php +++ b/core/Migrations/Version25000Date20220515204012.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 ownCloud GmbH * SPDX-License-Identifier: AGPL-3.0-only diff --git a/core/Migrations/Version27000Date20220613163520.php b/core/Migrations/Version27000Date20220613163520.php index f3f6e374572..4a5601b6cd5 100644 --- a/core/Migrations/Version27000Date20220613163520.php +++ b/core/Migrations/Version27000Date20220613163520.php @@ -16,7 +16,7 @@ use OCP\Migration\SimpleMigrationStep; class Version27000Date20220613163520 extends SimpleMigrationStep { public function name(): string { - return "Add mountpoint path to mounts table unique index"; + return 'Add mountpoint path to mounts table unique index'; } public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { diff --git a/core/Migrations/Version28000Date20240828142927.php b/core/Migrations/Version28000Date20240828142927.php index e36c27add1c..999855a5feb 100644 --- a/core/Migrations/Version28000Date20240828142927.php +++ b/core/Migrations/Version28000Date20240828142927.php @@ -72,7 +72,7 @@ class Version28000Date20240828142927 extends SimpleMigrationStep { } else { $hash = hash('sha256', $jobRow['argument']); } - $insertQuery->setParameter('id', (string)$jobRow['id'], IQueryBuilder::PARAM_INT); + $insertQuery->setParameter('id', (string) $jobRow['id'], IQueryBuilder::PARAM_INT); $insertQuery->setParameter('argument_hash', $hash); $insertQuery->executeStatement(); } diff --git a/core/routes.php b/core/routes.php index 2234a4a5c17..611c1c6d7c3 100644 --- a/core/routes.php +++ b/core/routes.php @@ -8,7 +8,7 @@ declare(strict_types=1); * SPDX-License-Identifier: AGPL-3.0-only */ -/** @var $this OCP\Route\IRouter */ +/** @var OCP\Route\IRouter $this */ // Core ajax actions // Routing $this->create('core_ajax_update', '/core/ajax/update.php') diff --git a/core/strings.php b/core/strings.php index ed62ce167f6..3feab3af888 100644 --- a/core/strings.php +++ b/core/strings.php @@ -9,8 +9,8 @@ declare(strict_types=1); */ //some strings that are used in /lib but won't be translatable unless they are in /core too $l = \OCP\Util::getL10N('core'); -$l->t("Personal"); -$l->t("Accounts"); -$l->t("Apps"); -$l->t("Admin"); -$l->t("Help"); +$l->t('Personal'); +$l->t('Accounts'); +$l->t('Apps'); +$l->t('Admin'); +$l->t('Help'); diff --git a/core/templates/error.php b/core/templates/error.php index 82acb08f9ed..ac9bd34d558 100644 --- a/core/templates/error.php +++ b/core/templates/error.php @@ -8,7 +8,7 @@ <div class="guest-box"> <h2><?php p($l->t('Error')) ?></h2> <ul> - <?php foreach ($_["errors"] as $error):?> + <?php foreach ($_['errors'] as $error):?> <li> <p><?php p($error['error']) ?></p> <?php if (isset($error['hint']) && $error['hint']): ?> diff --git a/core/templates/print_exception.php b/core/templates/print_exception.php index 2def6d4e9d9..470dfe11cf2 100644 --- a/core/templates/print_exception.php +++ b/core/templates/print_exception.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2012-2015 ownCloud, Inc. diff --git a/core/templates/print_xml_exception.php b/core/templates/print_xml_exception.php index 94452d8ae9d..f903e8ced6c 100644 --- a/core/templates/print_xml_exception.php +++ b/core/templates/print_xml_exception.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2012-2015 ownCloud, Inc. diff --git a/core/templates/twofactorshowchallenge.php b/core/templates/twofactorshowchallenge.php index 42cc14e5f22..16f4390f177 100644 --- a/core/templates/twofactorshowchallenge.php +++ b/core/templates/twofactorshowchallenge.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ /** @var \OCP\IL10N $l */ -/** @var array $_*/ +/** @var array $_ */ /** @var boolean $error */ $error = $_['error']; /* @var $error_message string */ @@ -91,16 +91,16 @@ Options: // the cron job must be executed with the right user if (!function_exists('posix_getuid')) { - echo "The posix extensions are required - see https://www.php.net/manual/en/book.posix.php" . PHP_EOL; + echo 'The posix extensions are required - see https://www.php.net/manual/en/book.posix.php' . PHP_EOL; exit(1); } $user = posix_getuid(); $configUser = fileowner(OC::$configDir . 'config.php'); if ($user !== $configUser) { - echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; - echo "Current user id: " . $user . PHP_EOL; - echo "Owner id of config.php: " . $configUser . PHP_EOL; + echo 'Console has to be executed with the user that owns the file config/config.php' . PHP_EOL; + echo 'Current user id: ' . $user . PHP_EOL; + echo 'Owner id of config.php: ' . $configUser . PHP_EOL; exit(1); } diff --git a/lib/base.php b/lib/base.php index 284b4d71085..f9aaf887f2f 100644 --- a/lib/base.php +++ b/lib/base.php @@ -79,7 +79,7 @@ class OC { /** * @throws \RuntimeException when the 3rdparty directory is missing or - * the app path list is empty or contains an invalid path + * the app path list is empty or contains an invalid path */ public static function initPaths(): void { if (defined('PHPUNIT_CONFIG_DIR')) { @@ -93,7 +93,7 @@ class OC { } self::$config = new \OC\Config(self::$configDir); - OC::$SUBURI = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"] ?? ''), strlen(OC::$SERVERROOT))); + OC::$SUBURI = str_replace('\\', '/', substr(realpath($_SERVER['SCRIPT_FILENAME'] ?? ''), strlen(OC::$SERVERROOT))); /** * FIXME: The following lines are required because we can't yet instantiate * Server::get(\OCP\IRequest::class) since \OC::$server does not yet exist. @@ -582,7 +582,7 @@ class OC { } // calculate the root directories - OC::$SERVERROOT = str_replace("\\", '/', substr(__DIR__, 0, -4)); + OC::$SERVERROOT = str_replace('\\', '/', substr(__DIR__, 0, -4)); // register autoloader $loaderStart = microtime(true); @@ -700,8 +700,8 @@ class OC { echo $error['error'] . "\n"; echo $error['hint'] . "\n\n"; $staticErrors[] = [ - 'error' => (string)$error['error'], - 'hint' => (string)$error['hint'], + 'error' => (string) $error['error'], + 'hint' => (string) $error['hint'], ]; } @@ -717,7 +717,7 @@ class OC { } // User and Groups - if (!$systemConfig->getValue("installed", false)) { + if (!$systemConfig->getValue('installed', false)) { self::$server->getSession()->set('user_id', ''); } @@ -750,7 +750,7 @@ class OC { self::registerAppRestrictionsHooks(); // Make sure that the application class is not loaded before the database is setup - if ($systemConfig->getValue("installed", false)) { + if ($systemConfig->getValue('installed', false)) { OC_App::loadApp('settings'); /* Build core application to make sure that listeners are registered */ Server::get(\OC\Core\Application::class); diff --git a/lib/private/Accounts/Hooks.php b/lib/private/Accounts/Hooks.php index 0235879e8e7..b0abf52e87a 100644 --- a/lib/private/Accounts/Hooks.php +++ b/lib/private/Accounts/Hooks.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -43,7 +44,7 @@ class Hooks implements IEventListener { return; } - if (isset($property) && $property->getValue() !== (string)$newValue) { + if (isset($property) && $property->getValue() !== (string) $newValue) { $property->setValue($newValue); $this->accountManager->updateAccount($account); } diff --git a/lib/private/Activity/EventMerger.php b/lib/private/Activity/EventMerger.php index 504f9088f24..0e7d318103a 100644 --- a/lib/private/Activity/EventMerger.php +++ b/lib/private/Activity/EventMerger.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Activity/Manager.php b/lib/private/Activity/Manager.php index 8b60dc49ec9..d26df3b8234 100644 --- a/lib/private/Activity/Manager.php +++ b/lib/private/Activity/Manager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index d48de298fad..556a8ab3942 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -242,9 +243,9 @@ class AllConfig implements IConfig { $prevValue = $this->getUserValue($userId, $appName, $key, null); if ($prevValue !== null) { - if ($preCondition !== null && $prevValue !== (string)$preCondition) { + if ($preCondition !== null && $prevValue !== (string) $preCondition) { throw new PreConditionNotMetException(); - } elseif ($prevValue === (string)$value) { + } elseif ($prevValue === (string) $value) { return; } else { $qb = $this->connection->getQueryBuilder(); @@ -255,7 +256,7 @@ class AllConfig implements IConfig { ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key))); $qb->executeStatement(); - $this->userCache[$userId][$appName][$key] = (string)$value; + $this->userCache[$userId][$appName][$key] = (string) $value; return; } } @@ -280,7 +281,7 @@ class AllConfig implements IConfig { if (!isset($this->userCache[$userId][$appName])) { $this->userCache[$userId][$appName] = []; } - $this->userCache[$userId][$appName][$key] = (string)$value; + $this->userCache[$userId][$appName][$key] = (string) $value; } } @@ -382,9 +383,9 @@ class AllConfig implements IConfig { * @param ?string $userId the user ID to get the app configs from * @psalm-return array<string, array<string, string>> * @return array[] - 2 dimensional array with the following structure: - * [ $appId => - * [ $key => $value ] - * ] + * [ $appId => + * [ $key => $value ] + * ] */ public function getAllUserValues(?string $userId): array { if (isset($this->userCache[$userId])) { diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index e00a89a8f4a..75110ded7e5 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/App/AppStore/Bundles/Bundle.php b/lib/private/App/AppStore/Bundles/Bundle.php index 62f09b82f79..1443be81e92 100644 --- a/lib/private/App/AppStore/Bundles/Bundle.php +++ b/lib/private/App/AppStore/Bundles/Bundle.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/App/AppStore/Bundles/BundleFetcher.php b/lib/private/App/AppStore/Bundles/BundleFetcher.php index 01325699e2c..4ff53b0c70b 100644 --- a/lib/private/App/AppStore/Bundles/BundleFetcher.php +++ b/lib/private/App/AppStore/Bundles/BundleFetcher.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/App/AppStore/Bundles/EducationBundle.php b/lib/private/App/AppStore/Bundles/EducationBundle.php index 6770d4a7091..23681ec7416 100644 --- a/lib/private/App/AppStore/Bundles/EducationBundle.php +++ b/lib/private/App/AppStore/Bundles/EducationBundle.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/App/AppStore/Bundles/EnterpriseBundle.php b/lib/private/App/AppStore/Bundles/EnterpriseBundle.php index 88a9ec60a00..fc2d43e0388 100644 --- a/lib/private/App/AppStore/Bundles/EnterpriseBundle.php +++ b/lib/private/App/AppStore/Bundles/EnterpriseBundle.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/App/AppStore/Bundles/GroupwareBundle.php b/lib/private/App/AppStore/Bundles/GroupwareBundle.php index 7c7b74ff53d..93fa70268cd 100644 --- a/lib/private/App/AppStore/Bundles/GroupwareBundle.php +++ b/lib/private/App/AppStore/Bundles/GroupwareBundle.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/App/AppStore/Bundles/PublicSectorBundle.php b/lib/private/App/AppStore/Bundles/PublicSectorBundle.php index 158d525bdcc..106a6353029 100644 --- a/lib/private/App/AppStore/Bundles/PublicSectorBundle.php +++ b/lib/private/App/AppStore/Bundles/PublicSectorBundle.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/App/AppStore/Bundles/SocialSharingBundle.php b/lib/private/App/AppStore/Bundles/SocialSharingBundle.php index 7f925688ca3..40f0fb15977 100644 --- a/lib/private/App/AppStore/Bundles/SocialSharingBundle.php +++ b/lib/private/App/AppStore/Bundles/SocialSharingBundle.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php b/lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php index 1174c7d240b..fac120153ae 100644 --- a/lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppDiscoverFetcher.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -89,7 +90,7 @@ class AppDiscoverFetcher extends Fetcher { $jsonBlob = json_decode($file->getContent(), true); if (is_array($jsonBlob) && isset($jsonBlob['ETag'])) { - return (string)$jsonBlob['ETag']; + return (string) $jsonBlob['ETag']; } } catch (\Throwable $e) { // ignore diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php index e7ab2f9c377..c96de76ce65 100644 --- a/lib/private/App/AppStore/Fetcher/AppFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -126,7 +127,7 @@ class AppFetcher extends Fetcher { if (isset($versions[0])) { $highestVersion = $versions[0]; foreach ($releases as $release) { - if ((string)$release['version'] === (string)$highestVersion) { + if ((string) $release['version'] === (string) $highestVersion) { $response['data'][$dataKey]['releases'] = [$release]; break; } diff --git a/lib/private/App/AppStore/Fetcher/CategoryFetcher.php b/lib/private/App/AppStore/Fetcher/CategoryFetcher.php index d72f8fa7e24..d7857d41bee 100644 --- a/lib/private/App/AppStore/Fetcher/CategoryFetcher.php +++ b/lib/private/App/AppStore/Fetcher/CategoryFetcher.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php index edb96b55f0a..d4b62ac7c74 100644 --- a/lib/private/App/AppStore/Fetcher/Fetcher.php +++ b/lib/private/App/AppStore/Fetcher/Fetcher.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -55,7 +56,7 @@ abstract class Fetcher { */ protected function fetch($ETag, $content) { $appstoreenabled = $this->config->getSystemValueBool('appstoreenabled', true); - if ((int)$this->config->getAppValue('settings', 'appstore-fetcher-lastFailure', '0') > time() - self::RETRY_AFTER_FAILURE_SECONDS) { + if ((int) $this->config->getAppValue('settings', 'appstore-fetcher-lastFailure', '0') > time() - self::RETRY_AFTER_FAILURE_SECONDS) { return []; } @@ -86,7 +87,7 @@ abstract class Fetcher { try { $response = $client->get($this->getEndpoint(), $options); } catch (ConnectException $e) { - $this->config->setAppValue('settings', 'appstore-fetcher-lastFailure', (string)time()); + $this->config->setAppValue('settings', 'appstore-fetcher-lastFailure', (string) time()); $this->logger->error('Failed to connect to the app store', ['exception' => $e]); return []; } @@ -145,7 +146,7 @@ abstract class Fetcher { $invalidateAfterSeconds = self::INVALIDATE_AFTER_SECONDS_UNSTABLE; } - if ((int)$jsonBlob['timestamp'] > ($this->timeFactory->getTime() - $invalidateAfterSeconds)) { + if ((int) $jsonBlob['timestamp'] > ($this->timeFactory->getTime() - $invalidateAfterSeconds)) { return $jsonBlob['data']; } diff --git a/lib/private/App/AppStore/Version/Version.php b/lib/private/App/AppStore/Version/Version.php index b7e679d250a..2d169a291f1 100644 --- a/lib/private/App/AppStore/Version/Version.php +++ b/lib/private/App/AppStore/Version/Version.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/App/AppStore/Version/VersionParser.php b/lib/private/App/AppStore/Version/VersionParser.php index 59715c8d385..b7b039b9b12 100644 --- a/lib/private/App/AppStore/Version/VersionParser.php +++ b/lib/private/App/AppStore/Version/VersionParser.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -16,7 +17,7 @@ class VersionParser { * @return bool */ private function isValidVersionString($versionString) { - return (bool)preg_match('/^[0-9.]+$/', $versionString); + return (bool) preg_match('/^[0-9.]+$/', $versionString); } /** diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php index d963c74de79..54b700eb2c5 100644 --- a/lib/private/App/DependencyAnalyzer.php +++ b/lib/private/App/DependencyAnalyzer.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -66,7 +67,7 @@ class DependencyAnalyzer { * @param string $first * @param string $second * @return string[] first element is the first version, second element is the - * second version + * second version */ private function normalizeVersions($first, $second) { $first = explode('.', $first); @@ -371,6 +372,6 @@ class DependencyAnalyzer { if (isset($element['@value'])) { return $element['@value']; } - return (string)$element; + return (string) $element; } } diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php index c22db132c47..27d8d115a39 100644 --- a/lib/private/App/InfoParser.php +++ b/lib/private/App/InfoParser.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -226,7 +227,7 @@ class InfoParser { */ public function xmlToArray($xml) { if (!$xml->children()) { - return (string)$xml; + return (string) $xml; } $array = []; @@ -234,7 +235,7 @@ class InfoParser { $totalElement = count($xml->{$element}); if (!isset($array[$element])) { - $array[$element] = $totalElement > 1 ? [] : ""; + $array[$element] = $totalElement > 1 ? [] : ''; } /** @var \SimpleXMLElement $node */ // Has attributes @@ -243,7 +244,7 @@ class InfoParser { '@attributes' => [], ]; if (!count($node->children())) { - $value = (string)$node; + $value = (string) $node; if (!empty($value)) { $data['@value'] = $value; } @@ -251,7 +252,7 @@ class InfoParser { $data = array_merge($data, $this->xmlToArray($node)); } foreach ($attributes as $attr => $value) { - $data['@attributes'][$attr] = (string)$value; + $data['@attributes'][$attr] = (string) $value; } if ($totalElement > 1) { diff --git a/lib/private/App/Platform.php b/lib/private/App/Platform.php index c2c059220c8..80e4cefed64 100644 --- a/lib/private/App/Platform.php +++ b/lib/private/App/Platform.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/App/PlatformRepository.php b/lib/private/App/PlatformRepository.php index 6d9a9cd011a..faed8b07feb 100644 --- a/lib/private/App/PlatformRepository.php +++ b/lib/private/App/PlatformRepository.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index 53726efc0b4..645f65382b8 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -246,7 +246,7 @@ class AppConfig implements IAppConfig { $values = []; foreach (array_keys($cache) as $app) { if (isset($cache[$app][$key])) { - $values[$app] = $this->convertTypedValue($cache[$app][$key], $typedAs ?? $this->getValueType((string)$app, $key, $lazy)); + $values[$app] = $this->convertTypedValue($cache[$app][$key], $typedAs ?? $this->getValueType((string) $app, $key, $lazy)); } } @@ -341,7 +341,7 @@ class AppConfig implements IAppConfig { int $default = 0, bool $lazy = false ): int { - return (int)$this->getTypedValue($app, $key, (string)$default, $lazy, self::VALUE_INT); + return (int) $this->getTypedValue($app, $key, (string) $default, $lazy, self::VALUE_INT); } /** @@ -359,7 +359,7 @@ class AppConfig implements IAppConfig { * @see IAppConfig for explanation about lazy loading */ public function getValueFloat(string $app, string $key, float $default = 0, bool $lazy = false): float { - return (float)$this->getTypedValue($app, $key, (string)$default, $lazy, self::VALUE_FLOAT); + return (float) $this->getTypedValue($app, $key, (string) $default, $lazy, self::VALUE_FLOAT); } /** @@ -596,7 +596,7 @@ class AppConfig implements IAppConfig { return $this->setTypedValue( $app, $key, - (string)$value, + (string) $value, $lazy, self::VALUE_INT | ($sensitive ? self::VALUE_SENSITIVE : 0) ); @@ -626,7 +626,7 @@ class AppConfig implements IAppConfig { return $this->setTypedValue( $app, $key, - (string)$value, + (string) $value, $lazy, self::VALUE_FLOAT | ($sensitive ? self::VALUE_SENSITIVE : 0) ); @@ -748,11 +748,11 @@ class AppConfig implements IAppConfig { try { $insert = $this->connection->getQueryBuilder(); $insert->insert('appconfig') - ->setValue('appid', $insert->createNamedParameter($app)) - ->setValue('lazy', $insert->createNamedParameter(($lazy) ? 1 : 0, IQueryBuilder::PARAM_INT)) - ->setValue('type', $insert->createNamedParameter($type, IQueryBuilder::PARAM_INT)) - ->setValue('configkey', $insert->createNamedParameter($key)) - ->setValue('configvalue', $insert->createNamedParameter($value)); + ->setValue('appid', $insert->createNamedParameter($app)) + ->setValue('lazy', $insert->createNamedParameter(($lazy) ? 1 : 0, IQueryBuilder::PARAM_INT)) + ->setValue('type', $insert->createNamedParameter($type, IQueryBuilder::PARAM_INT)) + ->setValue('configkey', $insert->createNamedParameter($key)) + ->setValue('configvalue', $insert->createNamedParameter($value)); $insert->executeStatement(); $inserted = true; } catch (DBException $e) { @@ -807,11 +807,11 @@ class AppConfig implements IAppConfig { $update = $this->connection->getQueryBuilder(); $update->update('appconfig') - ->set('configvalue', $update->createNamedParameter($value)) - ->set('lazy', $update->createNamedParameter(($lazy) ? 1 : 0, IQueryBuilder::PARAM_INT)) - ->set('type', $update->createNamedParameter($type, IQueryBuilder::PARAM_INT)) - ->where($update->expr()->eq('appid', $update->createNamedParameter($app))) - ->andWhere($update->expr()->eq('configkey', $update->createNamedParameter($key))); + ->set('configvalue', $update->createNamedParameter($value)) + ->set('lazy', $update->createNamedParameter(($lazy) ? 1 : 0, IQueryBuilder::PARAM_INT)) + ->set('type', $update->createNamedParameter($type, IQueryBuilder::PARAM_INT)) + ->where($update->expr()->eq('appid', $update->createNamedParameter($app))) + ->andWhere($update->expr()->eq('configkey', $update->createNamedParameter($key))); $update->executeStatement(); } @@ -869,9 +869,9 @@ class AppConfig implements IAppConfig { $update = $this->connection->getQueryBuilder(); $update->update('appconfig') - ->set('type', $update->createNamedParameter($type, IQueryBuilder::PARAM_INT)) - ->where($update->expr()->eq('appid', $update->createNamedParameter($app))) - ->andWhere($update->expr()->eq('configkey', $update->createNamedParameter($key))); + ->set('type', $update->createNamedParameter($type, IQueryBuilder::PARAM_INT)) + ->where($update->expr()->eq('appid', $update->createNamedParameter($app))) + ->andWhere($update->expr()->eq('configkey', $update->createNamedParameter($key))); $update->executeStatement(); $this->valueTypes[$app][$key] = $type; @@ -927,10 +927,10 @@ class AppConfig implements IAppConfig { $update = $this->connection->getQueryBuilder(); $update->update('appconfig') - ->set('type', $update->createNamedParameter($type, IQueryBuilder::PARAM_INT)) - ->set('configvalue', $update->createNamedParameter($value)) - ->where($update->expr()->eq('appid', $update->createNamedParameter($app))) - ->andWhere($update->expr()->eq('configkey', $update->createNamedParameter($key))); + ->set('type', $update->createNamedParameter($type, IQueryBuilder::PARAM_INT)) + ->set('configvalue', $update->createNamedParameter($value)) + ->where($update->expr()->eq('appid', $update->createNamedParameter($app))) + ->andWhere($update->expr()->eq('configkey', $update->createNamedParameter($key))); $update->executeStatement(); $this->valueTypes[$app][$key] = $type; @@ -962,9 +962,9 @@ class AppConfig implements IAppConfig { $update = $this->connection->getQueryBuilder(); $update->update('appconfig') - ->set('lazy', $update->createNamedParameter($lazy ? 1 : 0, IQueryBuilder::PARAM_INT)) - ->where($update->expr()->eq('appid', $update->createNamedParameter($app))) - ->andWhere($update->expr()->eq('configkey', $update->createNamedParameter($key))); + ->set('lazy', $update->createNamedParameter($lazy ? 1 : 0, IQueryBuilder::PARAM_INT)) + ->where($update->expr()->eq('appid', $update->createNamedParameter($app))) + ->andWhere($update->expr()->eq('configkey', $update->createNamedParameter($key))); $update->executeStatement(); // At this point, it is a lot safer to clean cache @@ -999,7 +999,7 @@ class AppConfig implements IAppConfig { $typeString = $this->convertTypeToString($type); } catch (AppConfigIncorrectTypeException $e) { $this->logger->warning('type stored in database is not correct', ['exception' => $e, 'type' => $type]); - $typeString = (string)$type; + $typeString = (string) $type; } if (!isset($cache[$app][$key])) { @@ -1075,8 +1075,8 @@ class AppConfig implements IAppConfig { $this->assertParams($app, $key); $qb = $this->connection->getQueryBuilder(); $qb->delete('appconfig') - ->where($qb->expr()->eq('appid', $qb->createNamedParameter($app))) - ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key))); + ->where($qb->expr()->eq('appid', $qb->createNamedParameter($app))) + ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key))); $qb->executeStatement(); unset($this->lazyCache[$app][$key]); @@ -1094,7 +1094,7 @@ class AppConfig implements IAppConfig { $this->assertParams($app); $qb = $this->connection->getQueryBuilder(); $qb->delete('appconfig') - ->where($qb->expr()->eq('appid', $qb->createNamedParameter($app))); + ->where($qb->expr()->eq('appid', $qb->createNamedParameter($app))); $qb->executeStatement(); $this->clearCache(); @@ -1240,7 +1240,7 @@ class AppConfig implements IAppConfig { } else { $this->fastCache[$row['appid']][$row['configkey']] = $row['configvalue'] ?? ''; } - $this->valueTypes[$row['appid']][$row['configkey']] = (int)($row['type'] ?? 0); + $this->valueTypes[$row['appid']][$row['configkey']] = (int) ($row['type'] ?? 0); } $result->closeCursor(); $this->setAsLoaded($lazy); @@ -1328,7 +1328,7 @@ class AppConfig implements IAppConfig { * this solution would remove the loading of config values from disabled app * unless calling the method {@see loadConfigAll()} */ - return $this->setTypedValue($app, $key, (string)$value, false, self::VALUE_MIXED); + return $this->setTypedValue($app, $key, (string) $value, false, self::VALUE_MIXED); } @@ -1378,7 +1378,7 @@ class AppConfig implements IAppConfig { * @return array<string, string|int|float|bool|array> */ private function formatAppValues(string $app, array $values, ?bool $lazy = null): array { - foreach($values as $key => $value) { + foreach ($values as $key => $value) { try { $type = $this->getValueType($app, $key, $lazy); } catch (AppConfigUnknownKeyException $e) { @@ -1402,9 +1402,9 @@ class AppConfig implements IAppConfig { private function convertTypedValue(string $value, int $type): string|int|float|bool|array { switch ($type) { case self::VALUE_INT: - return (int)$value; + return (int) $value; case self::VALUE_FLOAT: - return (float)$value; + return (float) $value; case self::VALUE_BOOL: return in_array(strtolower($value), ['1', 'true', 'yes', 'on']); case self::VALUE_ARRAY: diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php index 9f9fb32dbcb..8a6478fb917 100644 --- a/lib/private/AppFramework/App.php +++ b/lib/private/AppFramework/App.php @@ -37,7 +37,7 @@ class App { * namespace tag or uppercasing the appid's first letter * @param string $appId the app id * @param string $topNamespace the namespace which should be prepended to - * the transformed app id, defaults to OCA\ + * the transformed app id, defaults to OCA\ * @return string the starting namespace for the app */ public static function buildAppNamespace(string $appId, string $topNamespace = 'OCA\\'): string { @@ -207,7 +207,7 @@ class App { */ $emptyResponse = false; if (preg_match('/^HTTP\/\d\.\d (\d{3}) .*$/', $httpHeaders, $matches)) { - $status = (int)$matches[1]; + $status = (int) $matches[1]; if ($status === Http::STATUS_NO_CONTENT || $status === Http::STATUS_NOT_MODIFIED) { $emptyResponse = true; } diff --git a/lib/private/AppFramework/Bootstrap/RegistrationContext.php b/lib/private/AppFramework/Bootstrap/RegistrationContext.php index f59d5b55706..d7a380f9e1d 100644 --- a/lib/private/AppFramework/Bootstrap/RegistrationContext.php +++ b/lib/private/AppFramework/Bootstrap/RegistrationContext.php @@ -538,10 +538,10 @@ class RegistrationContext { public function registerTalkBackend(string $appId, string $backend) { // Some safeguards for invalid registrations if ($appId !== 'spreed') { - throw new RuntimeException("Only the Talk app is allowed to register a Talk backend"); + throw new RuntimeException('Only the Talk app is allowed to register a Talk backend'); } if ($this->talkBackendRegistration !== null) { - throw new RuntimeException("There can only be one Talk backend"); + throw new RuntimeException('There can only be one Talk backend'); } $this->talkBackendRegistration = new ServiceRegistration($appId, $backend); diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index a33a385f21b..76cb2a98a3b 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php index bbb68972a41..b7952df8d19 100644 --- a/lib/private/AppFramework/Http/Dispatcher.php +++ b/lib/private/AppFramework/Http/Dispatcher.php @@ -55,9 +55,9 @@ class Dispatcher { /** * @param Http $protocol the http protocol with contains all status headers * @param MiddlewareDispatcher $middlewareDispatcher the dispatcher which - * runs the middleware + * runs the middleware * @param ControllerMethodReflector $reflector the reflector that is used to inject - * the arguments for the controller + * the arguments for the controller * @param IRequest $request the incoming request * @param IConfig $config * @param ConnectionAdapter $connection @@ -89,10 +89,10 @@ class Dispatcher { * Handles a request and calls the dispatcher on the controller * @param Controller $controller the controller which will be called * @param string $methodName the method name which will be called on - * the controller + * the controller * @return array $array[0] contains a string with the http main header, - * $array[1] contains headers in the form: $key => value, $array[2] contains - * the response output + * $array[1] contains headers in the form: $key => value, $array[2] contains + * the response output * @throws \Exception */ public function dispatch(Controller $controller, string $methodName): array { diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index c877304c929..6716c618b80 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -67,15 +67,15 @@ class Request implements \ArrayAccess, \Countable, IRequest { /** * @param array $vars An associative array with the following optional values: - * - array 'urlParams' the parameters which were matched from the URL - * - array 'get' the $_GET array - * - array|string 'post' the $_POST array or JSON string - * - array 'files' the $_FILES array - * - array 'server' the $_SERVER array - * - array 'env' the $_ENV array - * - array 'cookies' the $_COOKIE array - * - string 'method' the request method (GET, POST etc) - * - string|false 'requesttoken' the requesttoken or false when not available + * - array 'urlParams' the parameters which were matched from the URL + * - array 'get' the $_GET array + * - array|string 'post' the $_POST array or JSON string + * - array 'files' the $_FILES array + * - array 'server' the $_SERVER array + * - array 'env' the $_ENV array + * - array 'cookies' the $_COOKIE array + * - string 'method' the request method (GET, POST etc) + * - string|false 'requesttoken' the requesttoken or false when not available * @param IRequestId $requestId * @param IConfig $config * @param CsrfTokenManager|null $csrfTokenManager @@ -284,11 +284,11 @@ class Request implements \ArrayAccess, \Countable, IRequest { * In case of json requests the encoded json body is accessed * * @param string $key the key which you want to access in the URL Parameter - * placeholder, $_POST or $_GET array. - * The priority how they're returned is the following: - * 1. URL parameters - * 2. POST parameters - * 3. GET parameters + * placeholder, $_POST or $_GET array. + * The priority how they're returned is the following: + * 1. URL parameters + * 2. POST parameters + * 3. GET parameters * @param mixed $default If the key is not found, this value will be returned * @return mixed the content of the array */ @@ -825,7 +825,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { return $host; } - $trustedList = (array)$this->config->getSystemValue('trusted_domains', []); + $trustedList = (array) $this->config->getSystemValue('trusted_domains', []); if (count($trustedList) > 0) { return reset($trustedList); } @@ -837,7 +837,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * Returns the overwritehost setting from the config if set and * if the overwrite condition is met * @return string|null overwritehost value or null if not defined or the defined condition - * isn't met + * isn't met */ private function getOverwriteHost() { if ($this->config->getSystemValueString('overwritehost') !== '' && $this->isOverwriteCondition()) { diff --git a/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php b/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php index 2b5acc8b75f..c9b51f26f34 100644 --- a/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php +++ b/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php @@ -23,7 +23,7 @@ class MiddlewareDispatcher { /** * @var int counter which tells us what middleware was executed once an - * exception occurs + * exception occurs */ private int $middlewareCounter; @@ -84,10 +84,10 @@ class MiddlewareDispatcher { * * @param Controller $controller the controller that is being called * @param string $methodName the name of the method that will be called on - * the controller + * the controller * @param \Exception $exception the thrown exception * @return Response a Response object if the middleware can handle the - * exception + * exception * @throws \Exception the passed in exception if it can't handle it */ public function afterException(Controller $controller, string $methodName, \Exception $exception): Response { @@ -109,7 +109,7 @@ class MiddlewareDispatcher { * * @param Controller $controller the controller that is being called * @param string $methodName the name of the method that will be called on - * the controller + * the controller * @param Response $response the generated response from the controller * @return Response a Response object */ diff --git a/lib/private/AppFramework/Middleware/OCSMiddleware.php b/lib/private/AppFramework/Middleware/OCSMiddleware.php index 46612bf0d29..64f4b0054de 100644 --- a/lib/private/AppFramework/Middleware/OCSMiddleware.php +++ b/lib/private/AppFramework/Middleware/OCSMiddleware.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/AppFramework/Middleware/PublicShare/Exceptions/NeedAuthenticationException.php b/lib/private/AppFramework/Middleware/PublicShare/Exceptions/NeedAuthenticationException.php index c80d06c90ae..5df4009b094 100644 --- a/lib/private/AppFramework/Middleware/PublicShare/Exceptions/NeedAuthenticationException.php +++ b/lib/private/AppFramework/Middleware/PublicShare/Exceptions/NeedAuthenticationException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php b/lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php index 34291dfef10..950d490e5d5 100644 --- a/lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php +++ b/lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php b/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php index 6240be7852e..118b6313b06 100644 --- a/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php @@ -31,7 +31,7 @@ use ReflectionMethod; * https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS */ class CORSMiddleware extends Middleware { - /** @var IRequest */ + /** @var IRequest */ private $request; /** @var ControllerMethodReflector */ private $reflector; diff --git a/lib/private/AppFramework/Middleware/Security/Exceptions/AppNotEnabledException.php b/lib/private/AppFramework/Middleware/Security/Exceptions/AppNotEnabledException.php index 646a5240bfc..53fbaaf5ed2 100644 --- a/lib/private/AppFramework/Middleware/Security/Exceptions/AppNotEnabledException.php +++ b/lib/private/AppFramework/Middleware/Security/Exceptions/AppNotEnabledException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/AppFramework/Middleware/Security/Exceptions/LaxSameSiteCookieFailedException.php b/lib/private/AppFramework/Middleware/Security/Exceptions/LaxSameSiteCookieFailedException.php index 91f1dba874d..0380c6781aa 100644 --- a/lib/private/AppFramework/Middleware/Security/Exceptions/LaxSameSiteCookieFailedException.php +++ b/lib/private/AppFramework/Middleware/Security/Exceptions/LaxSameSiteCookieFailedException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/AppFramework/Middleware/Security/Exceptions/NotConfirmedException.php b/lib/private/AppFramework/Middleware/Security/Exceptions/NotConfirmedException.php index 7e950f2c976..ef94a484385 100644 --- a/lib/private/AppFramework/Middleware/Security/Exceptions/NotConfirmedException.php +++ b/lib/private/AppFramework/Middleware/Security/Exceptions/NotConfirmedException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php b/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php index 8dda2680699..1c98820c5bf 100644 --- a/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/PasswordConfirmationMiddleware.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/AppFramework/Middleware/Security/SameSiteCookieMiddleware.php b/lib/private/AppFramework/Middleware/Security/SameSiteCookieMiddleware.php index e0bb96f132b..a84d3c2af7b 100644 --- a/lib/private/AppFramework/Middleware/Security/SameSiteCookieMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/SameSiteCookieMiddleware.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/AppFramework/OCS/BaseResponse.php b/lib/private/AppFramework/OCS/BaseResponse.php index cc7f7845760..8478de9eb3e 100644 --- a/lib/private/AppFramework/OCS/BaseResponse.php +++ b/lib/private/AppFramework/OCS/BaseResponse.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -146,7 +147,7 @@ abstract class BaseResponse extends Response { } elseif ($v === null) { $writer->writeElement($k); } else { - $writer->writeElement($k, (string)$v); + $writer->writeElement($k, (string) $v); } } } diff --git a/lib/private/AppFramework/OCS/V1Response.php b/lib/private/AppFramework/OCS/V1Response.php index 131ca22ff24..94c0e53f55a 100644 --- a/lib/private/AppFramework/OCS/V1Response.php +++ b/lib/private/AppFramework/OCS/V1Response.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -58,8 +59,8 @@ class V1Response extends BaseResponse { 'status' => $this->getOCSStatus() === 100 ? 'ok' : 'failure', 'statuscode' => $this->getOCSStatus(), 'message' => $this->getOCSStatus() === 100 ? 'OK' : $this->statusMessage ?? '', - 'totalitems' => (string)($this->itemsCount ?? ''), - 'itemsperpage' => (string)($this->itemsPerPage ?? ''), + 'totalitems' => (string) ($this->itemsCount ?? ''), + 'itemsperpage' => (string) ($this->itemsPerPage ?? ''), ]; return $this->renderResult($meta); diff --git a/lib/private/AppFramework/OCS/V2Response.php b/lib/private/AppFramework/OCS/V2Response.php index 47cf0f60200..efc9348eb37 100644 --- a/lib/private/AppFramework/OCS/V2Response.php +++ b/lib/private/AppFramework/OCS/V2Response.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/AppFramework/Utility/ControllerMethodReflector.php b/lib/private/AppFramework/Utility/ControllerMethodReflector.php index 9c08f58b384..3a714c0ee0c 100644 --- a/lib/private/AppFramework/Utility/ControllerMethodReflector.php +++ b/lib/private/AppFramework/Utility/ControllerMethodReflector.php @@ -58,8 +58,8 @@ class ControllerMethodReflector implements IControllerMethodReflector { continue; } $this->ranges[$varName] = [ - 'min' => $matches['rangeMin'][$index] === 'min' ? PHP_INT_MIN : (int)$matches['rangeMin'][$index], - 'max' => $matches['rangeMax'][$index] === 'max' ? PHP_INT_MAX : (int)$matches['rangeMax'][$index], + 'min' => $matches['rangeMin'][$index] === 'min' ? PHP_INT_MIN : (int) $matches['rangeMin'][$index], + 'max' => $matches['rangeMax'][$index] === 'max' ? PHP_INT_MAX : (int) $matches['rangeMax'][$index], ]; } } @@ -82,9 +82,9 @@ class ControllerMethodReflector implements IControllerMethodReflector { /** * Inspects the PHPDoc parameters for types * @param string $parameter the parameter whose type comments should be - * parsed + * parsed * @return string|null type in the type parameters (@param int $something) - * would return int or null if not existing + * would return int or null if not existing */ public function getType(string $parameter) { if (array_key_exists($parameter, $this->types)) { diff --git a/lib/private/AppScriptDependency.php b/lib/private/AppScriptDependency.php index 380816f21ac..cc5ded0d011 100644 --- a/lib/private/AppScriptDependency.php +++ b/lib/private/AppScriptDependency.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/AppScriptSort.php b/lib/private/AppScriptSort.php index eda41e97445..134dad100dc 100644 --- a/lib/private/AppScriptSort.php +++ b/lib/private/AppScriptSort.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php b/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php index 5f55c4ecdd7..a619021d192 100644 --- a/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php +++ b/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php @@ -43,7 +43,7 @@ class UserDeletedFilesCleanupListener implements IEventListener { $userHome = $this->mountProviderCollection->getHomeMountForUser($user); $storage = $userHome->getStorage(); if (!$storage) { - throw new \Exception("Account has no home storage"); + throw new \Exception('Account has no home storage'); } // remove all wrappers, so we do the delete directly on the home storage bypassing any wrapper @@ -66,7 +66,7 @@ class UserDeletedFilesCleanupListener implements IEventListener { if ($cache instanceof Cache) { $cache->clear(); } else { - throw new \Exception("Home storage has invalid cache"); + throw new \Exception('Home storage has invalid cache'); } } } diff --git a/lib/private/Authentication/LoginCredentials/Credentials.php b/lib/private/Authentication/LoginCredentials/Credentials.php index 2d7ed3adfd0..3414034b33c 100644 --- a/lib/private/Authentication/LoginCredentials/Credentials.php +++ b/lib/private/Authentication/LoginCredentials/Credentials.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Authentication/LoginCredentials/Store.php b/lib/private/Authentication/LoginCredentials/Store.php index 67c5712715c..61834df9792 100644 --- a/lib/private/Authentication/LoginCredentials/Store.php +++ b/lib/private/Authentication/LoginCredentials/Store.php @@ -51,7 +51,7 @@ class Store implements IStore { */ public function authenticate(array $params) { if ($params['password'] !== null) { - $params['password'] = $this->crypto->encrypt((string)$params['password']); + $params['password'] = $this->crypto->encrypt((string) $params['password']); } $this->session->set('login_credentials', json_encode($params)); } diff --git a/lib/private/Authentication/Token/PublicKeyToken.php b/lib/private/Authentication/Token/PublicKeyToken.php index 961b7191d84..7e9fd188925 100644 --- a/lib/private/Authentication/Token/PublicKeyToken.php +++ b/lib/private/Authentication/Token/PublicKeyToken.php @@ -173,7 +173,7 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken { if (is_array($scope)) { parent::setScope(json_encode($scope)); } else { - parent::setScope((string)$scope); + parent::setScope((string) $scope); } } diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php index d3b1e7cffd7..74baf35a996 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php +++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php @@ -162,7 +162,7 @@ class PublicKeyTokenProvider implements IProvider { $this->rotate($token, $tokenId, $tokenId); } catch (DoesNotExistException) { $this->cacheInvalidHash($tokenHash); - throw new InvalidTokenException("Token does not exist: " . $ex->getMessage(), 0, $ex); + throw new InvalidTokenException('Token does not exist: ' . $ex->getMessage(), 0, $ex); } } @@ -213,7 +213,7 @@ class PublicKeyTokenProvider implements IProvider { } private function checkToken($token): void { - if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { + if ((int) $token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { throw new ExpiredTokenException($token); } @@ -232,7 +232,7 @@ class PublicKeyTokenProvider implements IProvider { $token = $this->getToken($oldSessionId); if (!($token instanceof PublicKeyToken)) { - throw new InvalidTokenException("Invalid token type"); + throw new InvalidTokenException('Invalid token type'); } $password = null; @@ -302,7 +302,7 @@ class PublicKeyTokenProvider implements IProvider { public function updateToken(OCPIToken $token) { if (!($token instanceof PublicKeyToken)) { - throw new InvalidTokenException("Invalid token type"); + throw new InvalidTokenException('Invalid token type'); } $this->mapper->update($token); $this->cacheToken($token); @@ -310,7 +310,7 @@ class PublicKeyTokenProvider implements IProvider { public function updateTokenActivity(OCPIToken $token) { if (!($token instanceof PublicKeyToken)) { - throw new InvalidTokenException("Invalid token type"); + throw new InvalidTokenException('Invalid token type'); } $activityInterval = $this->config->getSystemValueInt('token_auth_activity_update', 60); @@ -331,7 +331,7 @@ class PublicKeyTokenProvider implements IProvider { public function getPassword(OCPIToken $savedToken, string $tokenId): string { if (!($savedToken instanceof PublicKeyToken)) { - throw new InvalidTokenException("Invalid token type"); + throw new InvalidTokenException('Invalid token type'); } if ($savedToken->getPassword() === null) { @@ -347,7 +347,7 @@ class PublicKeyTokenProvider implements IProvider { public function setPassword(OCPIToken $token, string $tokenId, string $password) { if (!($token instanceof PublicKeyToken)) { - throw new InvalidTokenException("Invalid token type"); + throw new InvalidTokenException('Invalid token type'); } $this->atomic(function () use ($password, $token) { @@ -372,7 +372,7 @@ class PublicKeyTokenProvider implements IProvider { public function rotate(OCPIToken $token, string $oldTokenId, string $newTokenId): OCPIToken { if (!($token instanceof PublicKeyToken)) { - throw new InvalidTokenException("Invalid token type"); + throw new InvalidTokenException('Invalid token type'); } // Decrypt private key with oldTokenId @@ -405,7 +405,7 @@ class PublicKeyTokenProvider implements IProvider { } catch (\Exception $ex2) { // Delete the invalid token $this->invalidateToken($token); - throw new InvalidTokenException("Could not decrypt token password: " . $ex->getMessage(), 0, $ex2); + throw new InvalidTokenException('Could not decrypt token password: ' . $ex->getMessage(), 0, $ex2); } } } @@ -495,7 +495,7 @@ class PublicKeyTokenProvider implements IProvider { public function markPasswordInvalid(OCPIToken $token, string $tokenId) { if (!($token instanceof PublicKeyToken)) { - throw new InvalidTokenException("Invalid token type"); + throw new InvalidTokenException('Invalid token type'); } $token->setPasswordInvalid(true); diff --git a/lib/private/Authentication/Token/RemoteWipe.php b/lib/private/Authentication/Token/RemoteWipe.php index 43c2bd060d1..80ba330b66d 100644 --- a/lib/private/Authentication/Token/RemoteWipe.php +++ b/lib/private/Authentication/Token/RemoteWipe.php @@ -98,7 +98,7 @@ class RemoteWipe { $dbToken = $e->getToken(); - $this->logger->info("user " . $dbToken->getUID() . " started a remote wipe"); + $this->logger->info('user ' . $dbToken->getUID() . ' started a remote wipe'); $this->eventDispatcher->dispatch(RemoteWipeStarted::class, new RemoteWipeStarted($dbToken)); @@ -126,7 +126,7 @@ class RemoteWipe { $this->tokenProvider->invalidateToken($token); - $this->logger->info("user " . $dbToken->getUID() . " finished a remote wipe"); + $this->logger->info('user ' . $dbToken->getUID() . ' finished a remote wipe'); $this->eventDispatcher->dispatch(RemoteWipeFinished::class, new RemoteWipeFinished($dbToken)); return true; diff --git a/lib/private/Authentication/Token/TokenCleanupJob.php b/lib/private/Authentication/Token/TokenCleanupJob.php index 041d2e8a5e2..e6d1e69e9b4 100644 --- a/lib/private/Authentication/Token/TokenCleanupJob.php +++ b/lib/private/Authentication/Token/TokenCleanupJob.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only diff --git a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php index c84b7f1af20..87a3457a4a7 100644 --- a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php +++ b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php @@ -29,7 +29,7 @@ class ProviderUserAssignmentDao { * Get all assigned provider IDs for the given user ID * * @return array<string, bool> where the array key is the provider ID (string) and the - * value is the enabled state (bool) + * value is the enabled state (bool) */ public function getState(string $uid): array { $qb = $this->conn->getQueryBuilder(); @@ -40,7 +40,7 @@ class ProviderUserAssignmentDao { $result = $query->execute(); $providers = []; foreach ($result->fetchAll() as $row) { - $providers[(string)$row['provider_id']] = (int)$row['enabled'] === 1; + $providers[(string) $row['provider_id']] = (int) $row['enabled'] === 1; } $result->closeCursor(); @@ -93,8 +93,8 @@ class ProviderUserAssignmentDao { return array_values(array_map(function (array $row) { return [ - 'provider_id' => (string)$row['provider_id'], - 'uid' => (string)$row['uid'], + 'provider_id' => (string) $row['provider_id'], + 'uid' => (string) $row['uid'], 'enabled' => ((int) $row['enabled']) === 1, ]; }, $rows)); diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index 39d886132dd..6566e524cdf 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -193,7 +193,7 @@ class Manager { if (!empty($missing)) { // There was at least one provider missing - $this->logger->alert(count($missing) . " two-factor auth providers failed to load", ['app' => 'core']); + $this->logger->alert(count($missing) . ' two-factor auth providers failed to load', ['app' => 'core']); return true; } @@ -249,7 +249,7 @@ class Manager { $sessionId = $this->session->getId(); $token = $this->tokenProvider->getToken($sessionId); $tokenId = $token->getId(); - $this->config->deleteUserValue($user->getUID(), 'login_token_2fa', (string)$tokenId); + $this->config->deleteUserValue($user->getUID(), 'login_token_2fa', (string) $tokenId); $this->dispatcher->dispatchTyped(new TwoFactorProviderForUserEnabled($user, $provider)); $this->dispatcher->dispatchTyped(new TwoFactorProviderChallengePassed($user, $provider)); @@ -360,7 +360,7 @@ class Manager { $id = $this->session->getId(); $token = $this->tokenProvider->getToken($id); - $this->config->setUserValue($user->getUID(), 'login_token_2fa', (string) $token->getId(), (string)$this->timeFactory->getTime()); + $this->config->setUserValue($user->getUID(), 'login_token_2fa', (string) $token->getId(), (string) $this->timeFactory->getTime()); } public function clearTwoFactorPending(string $userId) { @@ -370,7 +370,7 @@ class Manager { $this->config->deleteUserValue($userId, 'login_token_2fa', $tokenId); try { - $this->tokenProvider->invalidateTokenById($userId, (int)$tokenId); + $this->tokenProvider->invalidateTokenById($userId, (int) $tokenId); } catch (DoesNotExistException $e) { } } diff --git a/lib/private/Avatar/Avatar.php b/lib/private/Avatar/Avatar.php index 1ad70001f13..6692d690a3f 100644 --- a/lib/private/Avatar/Avatar.php +++ b/lib/private/Avatar/Avatar.php @@ -88,8 +88,8 @@ abstract class Avatar implements IAvatar { $userDisplayName = $this->getDisplayName(); $fgRGB = $this->avatarBackgroundColor($userDisplayName); $bgRGB = $fgRGB->alphaBlending(0.1, $darkTheme ? new Color(0, 0, 0) : new Color(255, 255, 255)); - $fill = sprintf("%02x%02x%02x", $bgRGB->red(), $bgRGB->green(), $bgRGB->blue()); - $fgFill = sprintf("%02x%02x%02x", $fgRGB->red(), $fgRGB->green(), $fgRGB->blue()); + $fill = sprintf('%02x%02x%02x', $bgRGB->red(), $bgRGB->green(), $bgRGB->blue()); + $fgFill = sprintf('%02x%02x%02x', $fgRGB->red(), $fgRGB->green(), $fgRGB->blue()); $text = $this->getAvatarText(); $toReplace = ['{size}', '{fill}', '{fgFill}', '{letter}']; return str_replace($toReplace, [$size, $fill, $fgFill, $text], $this->svgTemplate); @@ -104,7 +104,7 @@ abstract class Avatar implements IAvatar { } $formats = Imagick::queryFormats(); // Avatar generation breaks if RSVG format is enabled. Fall back to gd in that case - if (in_array("RSVG", $formats, true)) { + if (in_array('RSVG', $formats, true)) { return null; } try { @@ -115,7 +115,7 @@ abstract class Avatar implements IAvatar { $avatar->readImageBlob($svg); $avatar->setImageFormat('png'); $image = new \OCP\Image(); - $image->loadFromData((string)$avatar); + $image->loadFromData((string) $avatar); return $image->data(); } catch (\Exception $e) { return null; @@ -155,7 +155,7 @@ abstract class Avatar implements IAvatar { $fontSize = $size * 0.4; [$x, $y] = $this->imageTTFCenter( - $im, $text, $font, (int)$fontSize + $im, $text, $font, (int) $fontSize ); imagettftext($im, $fontSize, 0, $x, $y, $textColor, $font, $text); diff --git a/lib/private/Avatar/AvatarManager.php b/lib/private/Avatar/AvatarManager.php index f8ce4d5b656..60a3d358bf4 100644 --- a/lib/private/Avatar/AvatarManager.php +++ b/lib/private/Avatar/AvatarManager.php @@ -115,7 +115,7 @@ class AvatarManager implements IAvatarManager { $folder->delete(); } catch (NotFoundException $e) { $this->logger->debug("No cache for the user $userId. Ignoring avatar deletion"); - } catch (NotPermittedException | StorageNotAvailableException $e) { + } catch (NotPermittedException|StorageNotAvailableException $e) { $this->logger->error("Unable to delete user avatars for $userId. gnoring avatar deletion"); } catch (NoUserException $e) { $this->logger->debug("Account $userId not found. Ignoring avatar deletion"); diff --git a/lib/private/Avatar/UserAvatar.php b/lib/private/Avatar/UserAvatar.php index c5a146a48b6..625d440fbb7 100644 --- a/lib/private/Avatar/UserAvatar.php +++ b/lib/private/Avatar/UserAvatar.php @@ -152,7 +152,7 @@ class UserAvatar extends Avatar { $avatars = $this->folder->getDirectoryListing(); $this->config->setUserValue($this->user->getUID(), 'avatar', 'version', - (string)((int)$this->config->getUserValue($this->user->getUID(), 'avatar', 'version', '0') + 1)); + (string) ((int) $this->config->getUserValue($this->user->getUID(), 'avatar', 'version', '0') + 1)); foreach ($avatars as $avatar) { $avatar->delete(); diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php index 9a675d91840..ddacba67fcc 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -317,7 +317,7 @@ class JobList implements IJobList { */ public function setLastJob(IJob $job): void { $this->unlockJob($job); - $this->config->setAppValue('backgroundjob', 'lastjob', (string)$job->getId()); + $this->config->setAppValue('backgroundjob', 'lastjob', (string) $job->getId()); } /** diff --git a/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php b/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php index e633c1645a5..16f63594f19 100644 --- a/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php +++ b/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php @@ -70,7 +70,7 @@ class GenerateBlurhashMetadata implements IEventListener { } $metadata->setString('blurhash', $this->generateBlurHash($image)) - ->setEtag('blurhash', $currentEtag); + ->setEtag('blurhash', $currentEtag); } /** diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php index aa1eeba9517..fa324273f5c 100644 --- a/lib/private/Calendar/Manager.php +++ b/lib/private/Calendar/Manager.php @@ -53,7 +53,7 @@ class Manager implements IManager { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options - optional parameters: - * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] + * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] * @param integer|null $limit - limit number of search results * @param integer|null $offset - offset for paging of search results * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs diff --git a/lib/private/Collaboration/AutoComplete/Manager.php b/lib/private/Collaboration/AutoComplete/Manager.php index d7298d9deef..149d2625db0 100644 --- a/lib/private/Collaboration/AutoComplete/Manager.php +++ b/lib/private/Collaboration/AutoComplete/Manager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -13,7 +14,7 @@ class Manager implements IManager { /** @var string[] */ protected array $sorters = []; - /** @var ISorter[] */ + /** @var ISorter[] */ protected array $sorterInstances = []; public function __construct( diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php index a7b84b72199..a59d5981825 100644 --- a/lib/private/Collaboration/Collaborators/GroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Collaboration/Collaborators/LookupPlugin.php b/lib/private/Collaboration/Collaborators/LookupPlugin.php index d026cfa80eb..b83235a35e1 100644 --- a/lib/private/Collaboration/Collaborators/LookupPlugin.php +++ b/lib/private/Collaboration/Collaborators/LookupPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index 278ba19aa5a..728eea1c733 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php b/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php index 89d5c4e4f79..f4c1793ea0a 100644 --- a/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php index 788ece70cb9..037c6f6cbea 100644 --- a/lib/private/Collaboration/Collaborators/RemotePlugin.php +++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Collaboration/Collaborators/Search.php b/lib/private/Collaboration/Collaborators/Search.php index 78b57b52400..32c70549a7b 100644 --- a/lib/private/Collaboration/Collaborators/Search.php +++ b/lib/private/Collaboration/Collaborators/Search.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Collaboration/Collaborators/SearchResult.php b/lib/private/Collaboration/Collaborators/SearchResult.php index 73c0fed41e0..c9c2f032f36 100644 --- a/lib/private/Collaboration/Collaborators/SearchResult.php +++ b/lib/private/Collaboration/Collaborators/SearchResult.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index b4cb77ad5b8..fb88ac41486 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -140,7 +141,7 @@ class UserPlugin implements ISearchPlugin { 'message' => $userStatus->getMessage(), 'icon' => $userStatus->getIcon(), 'clearAt' => $userStatus->getClearAt() - ? (int)$userStatus->getClearAt()->format('U') + ? (int) $userStatus->getClearAt()->format('U') : null, ]; } @@ -225,7 +226,7 @@ class UserPlugin implements ISearchPlugin { 'message' => $userStatus->getMessage(), 'icon' => $userStatus->getIcon(), 'clearAt' => $userStatus->getClearAt() - ? (int)$userStatus->getClearAt()->format('U') + ? (int) $userStatus->getClearAt()->format('U') : null, ]; } diff --git a/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php b/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php index e468ad4eb4c..5a71695754e 100644 --- a/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php +++ b/lib/private/Collaboration/Reference/File/FileReferenceEventListener.php @@ -40,13 +40,13 @@ class FileReferenceEventListener implements IEventListener { return; } - $this->manager->invalidateCache((string)$event->getNode()->getId()); + $this->manager->invalidateCache((string) $event->getNode()->getId()); } if ($event instanceof ShareDeletedEvent) { - $this->manager->invalidateCache((string)$event->getShare()->getNodeId()); + $this->manager->invalidateCache((string) $event->getShare()->getNodeId()); } if ($event instanceof ShareCreatedEvent) { - $this->manager->invalidateCache((string)$event->getShare()->getNodeId()); + $this->manager->invalidateCache((string) $event->getShare()->getNodeId()); } } } diff --git a/lib/private/Collaboration/Reference/File/FileReferenceProvider.php b/lib/private/Collaboration/Reference/File/FileReferenceProvider.php index 3cb174d9607..d22c7d96a43 100644 --- a/lib/private/Collaboration/Reference/File/FileReferenceProvider.php +++ b/lib/private/Collaboration/Reference/File/FileReferenceProvider.php @@ -52,15 +52,15 @@ class FileReferenceProvider extends ADiscoverableReferenceProvider { if (mb_strpos($referenceText, $start) === 0) { $parts = parse_url($referenceText); parse_str($parts['query'] ?? '', $query); - $fileId = isset($query['fileid']) ? (int)$query['fileid'] : $fileId; - $fileId = isset($query['openfile']) ? (int)$query['openfile'] : $fileId; + $fileId = isset($query['fileid']) ? (int) $query['fileid'] : $fileId; + $fileId = isset($query['openfile']) ? (int) $query['openfile'] : $fileId; } if (mb_strpos($referenceText, $startIndex) === 0) { $parts = parse_url($referenceText); parse_str($parts['query'] ?? '', $query); - $fileId = isset($query['fileid']) ? (int)$query['fileid'] : $fileId; - $fileId = isset($query['openfile']) ? (int)$query['openfile'] : $fileId; + $fileId = isset($query['fileid']) ? (int) $query['fileid'] : $fileId; + $fileId = isset($query['openfile']) ? (int) $query['openfile'] : $fileId; } if (mb_strpos($referenceText, $this->urlGenerator->getAbsoluteURL('/index.php/f/')) === 0) { @@ -71,7 +71,7 @@ class FileReferenceProvider extends ADiscoverableReferenceProvider { $fileId = str_replace($this->urlGenerator->getAbsoluteURL('/f/'), '', $referenceText); } - return $fileId !== null ? (int)$fileId : null; + return $fileId !== null ? (int) $fileId : null; } public function resolveReference(string $referenceText): ?IReference { @@ -136,7 +136,7 @@ class FileReferenceProvider extends ADiscoverableReferenceProvider { } public function getCachePrefix(string $referenceId): string { - return (string)$this->getFilesAppLinkId($referenceId); + return (string) $this->getFilesAppLinkId($referenceId); } public function getCacheKey(string $referenceId): ?string { diff --git a/lib/private/Collaboration/Resources/Manager.php b/lib/private/Collaboration/Resources/Manager.php index 6c9b77d41c5..93ac198a929 100644 --- a/lib/private/Collaboration/Resources/Manager.php +++ b/lib/private/Collaboration/Resources/Manager.php @@ -123,7 +123,7 @@ class Manager implements IManager { while ($row = $result->fetch()) { $foundResults++; $access = $row['access'] === null ? null : (bool) $row['access']; - $collection = new Collection($this, $this->connection, (int)$row['id'], (string)$row['name'], $user, $access); + $collection = new Collection($this, $this->connection, (int) $row['id'], (string) $row['name'], $user, $access); if ($collection->canAccess($user)) { $collections[] = $collection; } diff --git a/lib/private/Color.php b/lib/private/Color.php index e96d6fd23bd..d97c519e552 100644 --- a/lib/private/Color.php +++ b/lib/private/Color.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Command/CronBus.php b/lib/private/Command/CronBus.php index 1ff9bb7099a..a12520469a9 100644 --- a/lib/private/Command/CronBus.php +++ b/lib/private/Command/CronBus.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php index c240a541156..bbb113078fb 100644 --- a/lib/private/Comments/Comment.php +++ b/lib/private/Comments/Comment.php @@ -34,8 +34,8 @@ class Comment implements IComment { /** * Comment constructor. * - * @param array $data optional, array with keys according to column names from - * the comments database scheme + * @param array $data optional, array with keys according to column names from + * the comments database scheme */ public function __construct(?array $data = null) { if (is_array($data)) { diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index 21ff5322f23..d0320dea782 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -33,10 +33,10 @@ class Manager implements ICommentsManager { /** @var IComment[] */ protected array $commentsCache = []; - /** @var \Closure[] */ + /** @var \Closure[] */ protected array $eventHandlerClosures = []; - /** @var ICommentsEventHandler[] */ + /** @var ICommentsEventHandler[] */ protected array $eventHandlers = []; /** @var \Closure[] */ @@ -61,9 +61,9 @@ class Manager implements ICommentsManager { * @param array $data */ protected function normalizeDatabaseData(array $data): array { - $data['id'] = (string)$data['id']; - $data['parent_id'] = (string)$data['parent_id']; - $data['topmost_parent_id'] = (string)$data['topmost_parent_id']; + $data['id'] = (string) $data['id']; + $data['parent_id'] = (string) $data['parent_id']; + $data['topmost_parent_id'] = (string) $data['topmost_parent_id']; $data['creation_timestamp'] = new \DateTime($data['creation_timestamp']); if (!is_null($data['latest_child_timestamp'])) { $data['latest_child_timestamp'] = new \DateTime($data['latest_child_timestamp']); @@ -71,7 +71,7 @@ class Manager implements ICommentsManager { if (!is_null($data['expire_date'])) { $data['expire_date'] = new \DateTime($data['expire_date']); } - $data['children_count'] = (int)$data['children_count']; + $data['children_count'] = (int) $data['children_count']; $data['reference_id'] = $data['reference_id']; $data['meta_data'] = json_decode($data['meta_data'], true); if ($this->supportReactions()) { @@ -132,7 +132,7 @@ class Manager implements ICommentsManager { try { $comment->getCreationDateTime(); - } catch(\LogicException $e) { + } catch (\LogicException $e) { $comment->setCreationDateTime(new \DateTime()); } @@ -179,7 +179,7 @@ class Manager implements ICommentsManager { $resultStatement = $query->execute(); $data = $resultStatement->fetch(\PDO::FETCH_NUM); $resultStatement->closeCursor(); - $children = (int)$data[0]; + $children = (int) $data[0]; $comment = $this->get($id); $comment->setChildrenCount($children); @@ -213,7 +213,7 @@ class Manager implements ICommentsManager { if (empty($id)) { return; } - $this->commentsCache[(string)$id] = $comment; + $this->commentsCache[(string) $id] = $comment; } /** @@ -222,7 +222,7 @@ class Manager implements ICommentsManager { * @param mixed $id the comment's id */ protected function uncache($id): void { - $id = (string)$id; + $id = (string) $id; if (isset($this->commentsCache[$id])) { unset($this->commentsCache[$id]); } @@ -237,7 +237,7 @@ class Manager implements ICommentsManager { * @since 9.0.0 */ public function get($id): IComment { - if ((int)$id === 0) { + if ((int) $id === 0) { throw new \InvalidArgumentException('IDs must be translatable to a number in this implementation.'); } @@ -308,10 +308,10 @@ class Manager implements ICommentsManager { * @param string $objectType the object type, e.g. 'files' * @param string $objectId the id of the object * @param int $limit optional, number of maximum comments to be returned. if - * not specified, all comments are returned. + * not specified, all comments are returned. * @param int $offset optional, starting point * @param \DateTime $notOlderThan optional, timestamp of the oldest comments - * that may be returned + * that may be returned * @return list<IComment> * @since 9.0.0 */ @@ -362,7 +362,7 @@ class Manager implements ICommentsManager { * @param int $lastKnownCommentId the last known comment (will be used as offset) * @param string $sortDirection direction of the comments (`asc` or `desc`) * @param int $limit optional, number of maximum comments to be returned. if - * set to 0, all comments are returned. + * set to 0, all comments are returned. * @param bool $includeLastKnown * @return list<IComment> */ @@ -392,7 +392,7 @@ class Manager implements ICommentsManager { * @param int $lastKnownCommentId the last known comment (will be used as offset) * @param string $sortDirection direction of the comments (`asc` or `desc`) * @param int $limit optional, number of maximum comments to be returned. if - * set to 0, all comments are returned. + * set to 0, all comments are returned. * @param bool $includeLastKnown * @return list<IComment> */ @@ -608,7 +608,7 @@ class Manager implements ICommentsManager { * @param $objectType string the object type, e.g. 'files' * @param $objectId string the id of the object * @param \DateTime $notOlderThan optional, timestamp of the oldest comments - * that may be returned + * that may be returned * @param string $verb Limit the verb of the comment - Added in 14.0.0 * @return Int * @since 9.0.0 @@ -635,7 +635,7 @@ class Manager implements ICommentsManager { $resultStatement = $query->execute(); $data = $resultStatement->fetch(\PDO::FETCH_NUM); $resultStatement->closeCursor(); - return (int)$data[0]; + return (int) $data[0]; } /** @@ -1079,7 +1079,7 @@ class Manager implements ICommentsManager { $result = $this->update($comment); } - if ($result && !!$comment->getParentId()) { + if ($result && (bool) $comment->getParentId()) { $this->updateChildrenInformation( $comment->getParentId(), $comment->getCreationDateTime() @@ -1121,7 +1121,7 @@ class Manager implements ICommentsManager { ->execute(); if ($affectedRows > 0) { - $comment->setId((string)$qb->getLastInsertId()); + $comment->setId((string) $qb->getLastInsertId()); if ($comment->getVerb() === 'reaction') { $this->addReaction($comment); } @@ -1494,7 +1494,7 @@ class Manager implements ICommentsManager { if (!isset($this->displayNameResolvers[$type])) { throw new \OutOfBoundsException('No Displayname resolver for this type registered'); } - return (string)$this->displayNameResolvers[$type]($id); + return (string) $this->displayNameResolvers[$type]($id); } /** diff --git a/lib/private/Config.php b/lib/private/Config.php index 62b4aceaa12..063a40745d1 100644 --- a/lib/private/Config.php +++ b/lib/private/Config.php @@ -276,8 +276,8 @@ class Config { if (function_exists('disk_free_space')) { $df = disk_free_space($this->configDir); $size = strlen($content) + 10240; - if ($df !== false && $df < (float)$size) { - throw new \Exception($this->configDir . " does not have enough space for writing the config file! Not writing it back!"); + if ($df !== false && $df < (float) $size) { + throw new \Exception($this->configDir . ' does not have enough space for writing the config file! Not writing it back!'); } } diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php index 14baa528940..e992c8a9c96 100644 --- a/lib/private/Console/Application.php +++ b/lib/private/Console/Application.php @@ -94,7 +94,7 @@ class Application { try { $this->loadCommandsFromInfoXml($info['commands']); } catch (\Throwable $e) { - $output->writeln("<error>" . $e->getMessage() . "</error>"); + $output->writeln('<error>' . $e->getMessage() . '</error>'); $this->logger->error($e->getMessage(), [ 'exception' => $e, ]); @@ -116,13 +116,13 @@ class Application { } } elseif ($input->getArgument('command') !== '_completion' && $input->getArgument('command') !== 'maintenance:install') { $errorOutput = $output->getErrorOutput(); - $errorOutput->writeln("Nextcloud is not installed - only a limited number of commands are available"); + $errorOutput->writeln('Nextcloud is not installed - only a limited number of commands are available'); } } catch (NeedsUpdateException $e) { if ($input->getArgument('command') !== '_completion') { $errorOutput = $output->getErrorOutput(); - $errorOutput->writeln("Nextcloud or one of the apps require upgrade - only a limited number of commands are available"); - $errorOutput->writeln("You may use your browser or the occ upgrade command to do the upgrade"); + $errorOutput->writeln('Nextcloud or one of the apps require upgrade - only a limited number of commands are available'); + $errorOutput->writeln('You may use your browser or the occ upgrade command to do the upgrade'); } } @@ -130,11 +130,11 @@ class Application { $errors = \OC_Util::checkServer(\OC::$server->getSystemConfig()); if (!empty($errors)) { foreach ($errors as $error) { - $output->writeln((string)$error['error']); - $output->writeln((string)$error['hint']); + $output->writeln((string) $error['error']); + $output->writeln((string) $error['hint']); $output->writeln(''); } - throw new \Exception("Environment not properly prepared."); + throw new \Exception('Environment not properly prepared.'); } } } @@ -145,7 +145,7 @@ class Application { * * @param InputInterface $input The input implementation for reading inputs. * @param ConsoleOutputInterface $output The output implementation - * for writing outputs. + * for writing outputs. * @return void */ private function writeMaintenanceModeInfo(InputInterface $input, ConsoleOutputInterface $output): void { diff --git a/lib/private/Console/TimestampFormatter.php b/lib/private/Console/TimestampFormatter.php index 4d6705fafb9..e8d9eef6b16 100644 --- a/lib/private/Console/TimestampFormatter.php +++ b/lib/private/Console/TimestampFormatter.php @@ -81,7 +81,7 @@ class TimestampFormatter implements OutputFormatterInterface { * * @param string|null $message The message to style * @return string|null The styled message, prepended with a timestamp using the - * log timezone and dateformat, e.g. "2015-06-23T17:24:37+02:00" + * log timezone and dateformat, e.g. "2015-06-23T17:24:37+02:00" */ public function format(?string $message): ?string { if (!$this->formatter->isDecorated()) { diff --git a/lib/private/Contacts/ContactsMenu/ActionFactory.php b/lib/private/Contacts/ContactsMenu/ActionFactory.php index 71ebe575fdd..40037598d49 100644 --- a/lib/private/Contacts/ContactsMenu/ActionFactory.php +++ b/lib/private/Contacts/ContactsMenu/ActionFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php b/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php index 0d4cc9b9b01..cdaf9308bfc 100644 --- a/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php +++ b/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php index d7cdb5efebf..d15e6e35706 100644 --- a/lib/private/Contacts/ContactsMenu/ContactsStore.php +++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php @@ -348,7 +348,7 @@ class ContactsStore implements IContactsStore { $entry->setFullName($contact['FN']); } - $avatarPrefix = "VALUE=uri:"; + $avatarPrefix = 'VALUE=uri:'; if (!empty($contact['PHOTO']) && str_starts_with($contact['PHOTO'], $avatarPrefix)) { $entry->setAvatar(substr($contact['PHOTO'], strlen($avatarPrefix))); } diff --git a/lib/private/Contacts/ContactsMenu/Manager.php b/lib/private/Contacts/ContactsMenu/Manager.php index 65a2c4469ea..f8def45421b 100644 --- a/lib/private/Contacts/ContactsMenu/Manager.php +++ b/lib/private/Contacts/ContactsMenu/Manager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php b/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php index c852fc90b9e..266125f5ed5 100644 --- a/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php +++ b/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/ContactsManager.php b/lib/private/ContactsManager.php index f9550144e5d..87b341ac36b 100644 --- a/lib/private/ContactsManager.php +++ b/lib/private/ContactsManager.php @@ -20,14 +20,14 @@ class ContactsManager implements IManager { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options = array() to define the search behavior - * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array - * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']] - * - 'escape_like_param' - If set to false wildcards _ and % are not escaped - * - 'limit' - Set a numeric limit for the search results - * - 'offset' - Set the offset for the limited search results - * - 'enumeration' - (since 23.0.0) Whether user enumeration on system address book is allowed - * - 'fullmatch' - (since 23.0.0) Whether matching on full detail in system address book is allowed - * - 'strict_search' - (since 23.0.0) Whether the search pattern is full string or partial search + * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array + * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']] + * - 'escape_like_param' - If set to false wildcards _ and % are not escaped + * - 'limit' - Set a numeric limit for the search results + * - 'offset' - Set the offset for the limited search results + * - 'enumeration' - (since 23.0.0) Whether user enumeration on system address book is allowed + * - 'fullmatch' - (since 23.0.0) Whether matching on full detail in system address book is allowed + * - 'strict_search' - (since 23.0.0) Whether the search pattern is full string or partial search * @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, enumeration?: bool, fullmatch?: bool, strict_search?: bool} $options * @return array an array of contacts which are arrays of key-value-pairs */ diff --git a/lib/private/DB/Adapter.php b/lib/private/DB/Adapter.php index b5be14e5dc6..9c8bc5d9395 100644 --- a/lib/private/DB/Adapter.php +++ b/lib/private/DB/Adapter.php @@ -73,8 +73,8 @@ class Adapter { * @param string $table The table name (will replace *PREFIX* with the actual prefix) * @param array $input data that should be inserted into the table (column name => value) * @param array|null $compare List of values that should be checked for "if not exists" - * If this is null or an empty array, all keys of $input will be compared - * Please note: text fields (clob) must not be used in the compare array + * If this is null or an empty array, all keys of $input will be compared + * Please note: text fields (clob) must not be used in the compare array * @return int number of inserted rows * @throws Exception * @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371 diff --git a/lib/private/DB/AdapterPgSql.php b/lib/private/DB/AdapterPgSql.php index db48c81c2c5..ca4a87182a9 100644 --- a/lib/private/DB/AdapterPgSql.php +++ b/lib/private/DB/AdapterPgSql.php @@ -13,7 +13,7 @@ class AdapterPgSql extends Adapter { $result = $this->conn->executeQuery('SELECT lastval()'); $val = $result->fetchOne(); $result->free(); - return (int)$val; + return (int) $val; } public const UNIX_TIMESTAMP_REPLACEMENT = 'cast(extract(epoch from current_timestamp) as integer)'; diff --git a/lib/private/DB/AdapterSqlite.php b/lib/private/DB/AdapterSqlite.php index 24274cbcda6..0023ee15364 100644 --- a/lib/private/DB/AdapterSqlite.php +++ b/lib/private/DB/AdapterSqlite.php @@ -38,8 +38,8 @@ class AdapterSqlite extends Adapter { * @param string $table The table name (will replace *PREFIX* with the actual prefix) * @param array $input data that should be inserted into the table (column name => value) * @param array|null $compare List of values that should be checked for "if not exists" - * If this is null or an empty array, all keys of $input will be compared - * Please note: text fields (clob) must not be used in the compare array + * If this is null or an empty array, all keys of $input will be compared + * Please note: text fields (clob) must not be used in the compare array * @return int number of inserted rows * @throws \Doctrine\DBAL\Exception * @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371 diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index 26512403a6f..37c7c7613fa 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -362,10 +362,10 @@ class Connection extends PrimaryReadReplicaConnection { * If the query is parametrized, a prepared statement is used. * If an SQLLogger is configured, the execution is logged. * - * @param string $sql The SQL query to execute. - * @param array $params The parameters to bind to the query, if any. - * @param array $types The types the previous parameters are in. - * @param \Doctrine\DBAL\Cache\QueryCacheProfile|null $qcp The query cache profile, optional. + * @param string $sql The SQL query to execute. + * @param array $params The parameters to bind to the query, if any. + * @param array $types The types the previous parameters are in. + * @param \Doctrine\DBAL\Cache\QueryCacheProfile|null $qcp The query cache profile, optional. * * @return Result The executed statement. * @@ -442,9 +442,9 @@ class Connection extends PrimaryReadReplicaConnection { * * This method supports PDO binding types as well as DBAL mapping types. * - * @param string $sql The SQL query. - * @param array $params The query parameters. - * @param array $types The parameter types. + * @param string $sql The SQL query. + * @param array $params The query parameters. + * @param array $types The parameter types. * * @return int The number of affected rows. * @@ -459,7 +459,7 @@ class Connection extends PrimaryReadReplicaConnection { $this->queriesExecuted++; $this->logQueryToFile($sql); try { - return (int)parent::executeStatement($sql, $params, $types); + return (int) parent::executeStatement($sql, $params, $types); } catch (\Exception $e) { $this->logDatabaseException($e); throw $e; @@ -529,8 +529,8 @@ class Connection extends PrimaryReadReplicaConnection { * @param string $table The table name (will replace *PREFIX* with the actual prefix) * @param array $input data that should be inserted into the table (column name => value) * @param array|null $compare List of values that should be checked for "if not exists" - * If this is null or an empty array, all keys of $input will be compared - * Please note: text fields (clob) must not be used in the compare array + * If this is null or an empty array, all keys of $input will be compared + * Please note: text fields (clob) must not be used in the compare array * @return int number of inserted rows * @throws \Doctrine\DBAL\Exception * @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371 @@ -712,7 +712,7 @@ class Connection extends PrimaryReadReplicaConnection { $statement = $this->replaceTablePrefix($statement); $statement = $this->adapter->fixupStatement($statement); if ($this->logRequestId) { - return $statement . " /* reqid: " . $this->requestId . " */"; + return $statement . ' /* reqid: ' . $this->requestId . ' */'; } else { return $statement; } diff --git a/lib/private/DB/ConnectionFactory.php b/lib/private/DB/ConnectionFactory.php index 1061ed30bb8..da21ebc8e5a 100644 --- a/lib/private/DB/ConnectionFactory.php +++ b/lib/private/DB/ConnectionFactory.php @@ -133,7 +133,7 @@ class ConnectionFactory { if ($host === '') { $connectionParams['dbname'] = $dbName; // use dbname as easy connect name } else { - $connectionParams['dbname'] = '//' . $host . (!empty($port) ? ":{$port}" : "") . '/' . $dbName; + $connectionParams['dbname'] = '//' . $host . (!empty($port) ? ":{$port}" : '') . '/' . $dbName; } unset($connectionParams['host']); break; @@ -187,7 +187,7 @@ class ConnectionFactory { $name = $this->config->getValue($configPrefix . 'dbname', $this->config->getValue('dbname', self::DEFAULT_DBNAME)); if ($this->normalizeType($type) === 'sqlite3') { - $dataDir = $this->config->getValue("datadirectory", \OC::$SERVERROOT . '/data'); + $dataDir = $this->config->getValue('datadirectory', \OC::$SERVERROOT . '/data'); $connectionParams['path'] = $dataDir . '/' . $name . '.db'; } else { $host = $this->config->getValue($configPrefix . 'dbhost', $this->config->getValue('dbhost', '')); diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 8d65f836789..50ec624f3ab 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2017 ownCloud GmbH @@ -194,8 +195,8 @@ class MigrationService { preg_match('/(\d+)Date(\d+)/', basename($a), $matchA); preg_match('/(\d+)Date(\d+)/', basename($b), $matchB); if (!empty($matchA) && !empty($matchB)) { - $versionA = (int)$matchA[1]; - $versionB = (int)$matchB[1]; + $versionA = (int) $matchA[1]; + $versionB = (int) $matchB[1]; if ($versionA !== $versionB) { return ($versionA < $versionB) ? -1 : 1; } @@ -345,7 +346,7 @@ class MigrationService { return null; } - return (string)$versions[$offset + $delta]; + return (string) $versions[$offset + $delta]; } private function getCurrentVersion(): string { diff --git a/lib/private/DB/MySqlTools.php b/lib/private/DB/MySqlTools.php index cd6b812be61..05ebd059342 100644 --- a/lib/private/DB/MySqlTools.php +++ b/lib/private/DB/MySqlTools.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 ownCloud GmbH * SPDX-License-Identifier: AGPL-3.0-only diff --git a/lib/private/DB/PreparedStatement.php b/lib/private/DB/PreparedStatement.php index 5fdfa2b03e8..54561ed96cd 100644 --- a/lib/private/DB/PreparedStatement.php +++ b/lib/private/DB/PreparedStatement.php @@ -78,6 +78,6 @@ class PreparedStatement implements IPreparedStatement { return $this->result; } - throw new Exception("You have to execute the prepared statement before accessing the results"); + throw new Exception('You have to execute the prepared statement before accessing the results'); } } diff --git a/lib/private/DB/QueryBuilder/CompositeExpression.php b/lib/private/DB/QueryBuilder/CompositeExpression.php index 6edf385360c..a54e9b427ba 100644 --- a/lib/private/DB/QueryBuilder/CompositeExpression.php +++ b/lib/private/DB/QueryBuilder/CompositeExpression.php @@ -81,7 +81,7 @@ class CompositeExpression implements ICompositeExpression, \Countable { */ public function __toString(): string { if ($this->count() === 1) { - return (string)$this->parts[0]; + return (string) $this->parts[0]; } return '(' . implode(') ' . $this->type . ' (', $this->parts) . ')'; } diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php index b70e20e4d0d..b922c861630 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php @@ -57,7 +57,7 @@ class ExpressionBuilder implements IExpressionBuilder { * $expr->andX('u.type = ?', 'u.role = ?')); * * @param mixed ...$x Optional clause. Defaults = null, but requires - * at least one defined when converting to string. + * at least one defined when converting to string. * * @return \OCP\DB\QueryBuilder\ICompositeExpression */ @@ -78,7 +78,7 @@ class ExpressionBuilder implements IExpressionBuilder { * $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?')); * * @param mixed ...$x Optional clause. Defaults = null, but requires - * at least one defined when converting to string. + * at least one defined when converting to string. * * @return \OCP\DB\QueryBuilder\ICompositeExpression */ @@ -96,7 +96,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @param string $operator One of the IExpressionBuilder::* constants. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string */ @@ -119,7 +119,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @param mixed $x The left expression. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string */ @@ -141,7 +141,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @param mixed $x The left expression. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string */ @@ -163,7 +163,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @param mixed $x The left expression. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string */ @@ -185,7 +185,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @param mixed $x The left expression. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string */ @@ -207,7 +207,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @param mixed $x The left expression. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string */ @@ -229,7 +229,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @param mixed $x The left expression. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string */ @@ -269,7 +269,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by LIKE() comparison. * @param mixed $y Argument to be used in LIKE() comparison. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string */ @@ -285,7 +285,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @param string $x Field in string format to be inspected by ILIKE() comparison. * @param mixed $y Argument to be used in ILIKE() comparison. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 9.0.0 @@ -300,7 +300,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by NOT LIKE() comparison. * @param mixed $y Argument to be used in NOT LIKE() comparison. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string */ @@ -316,7 +316,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by IN() comparison. * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by IN() comparison. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string */ @@ -332,7 +332,7 @@ class ExpressionBuilder implements IExpressionBuilder { * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by NOT IN() comparison. * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by NOT IN() comparison. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string */ diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php index ac4698cdc76..4d1c280511c 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php index 2466493c1fa..48dc1da6330 100644 --- a/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php +++ b/lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php index a8dc4d8cf14..aad36ee5e7a 100644 --- a/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php +++ b/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/PgSqlFunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/PgSqlFunctionBuilder.php index ee430a6bd71..354a2b126d7 100644 --- a/lib/private/DB/QueryBuilder/FunctionBuilder/PgSqlFunctionBuilder.php +++ b/lib/private/DB/QueryBuilder/FunctionBuilder/PgSqlFunctionBuilder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php index 956b2123f2c..53aa530054b 100644 --- a/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php +++ b/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/DB/QueryBuilder/Partitioned/JoinCondition.php b/lib/private/DB/QueryBuilder/Partitioned/JoinCondition.php index a08858d1d6b..401a8ee0d5e 100644 --- a/lib/private/DB/QueryBuilder/Partitioned/JoinCondition.php +++ b/lib/private/DB/QueryBuilder/Partitioned/JoinCondition.php @@ -95,7 +95,7 @@ class JoinCondition { }, $condition->getParts())); } - $condition = (string)$condition; + $condition = (string) $condition; $isSubCondition = self::isExtraCondition($condition); if ($isSubCondition) { if (self::mentionsAlias($condition, $fromAlias)) { diff --git a/lib/private/DB/QueryBuilder/Partitioned/PartitionedQueryBuilder.php b/lib/private/DB/QueryBuilder/Partitioned/PartitionedQueryBuilder.php index ba1e5a80c0f..881e0b55a63 100644 --- a/lib/private/DB/QueryBuilder/Partitioned/PartitionedQueryBuilder.php +++ b/lib/private/DB/QueryBuilder/Partitioned/PartitionedQueryBuilder.php @@ -205,7 +205,7 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { } public function leftJoin($fromAlias, $join, $alias, $condition = null): self { - return $this->join($fromAlias, (string)$join, $alias, $condition, PartitionQuery::JOIN_MODE_LEFT); + return $this->join($fromAlias, (string) $join, $alias, $condition, PartitionQuery::JOIN_MODE_LEFT); } public function join($fromAlias, $join, $alias, $condition = null, $joinMode = PartitionQuery::JOIN_MODE_INNER): self { @@ -313,7 +313,7 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { $partitionPredicates = []; foreach ($predicates as $predicate) { - $partition = $this->getPartitionForPredicate((string)$predicate); + $partition = $this->getPartitionForPredicate((string) $predicate); if ($this->mainPartition === $partition) { $partitionPredicates[''][] = $predicate; } elseif ($partition) { @@ -341,7 +341,7 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { $column = $this->quoteHelper->quoteColumnName($this->splitQueries[$alias]->joinToColumn); foreach ($predicates as $predicate) { - if ((string)$predicate === "$column IS NULL") { + if ((string) $predicate === "$column IS NULL") { $this->splitQueries[$alias]->joinMode = PartitionQuery::JOIN_MODE_LEFT_NULL; } else { $this->splitQueries[$alias]->query->andWhere($predicate); @@ -386,14 +386,14 @@ class PartitionedQueryBuilder extends ShardedQueryBuilder { public function setMaxResults($maxResults) { if ($maxResults > 0) { - $this->limit = (int)$maxResults; + $this->limit = (int) $maxResults; } return parent::setMaxResults($maxResults); } public function setFirstResult($firstResult) { if ($firstResult > 0) { - $this->offset = (int)$firstResult; + $this->offset = (int) $firstResult; } return parent::setFirstResult($firstResult); } diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index 56187edb3b6..e18f5529397 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -69,7 +69,7 @@ class QueryBuilder implements IQueryBuilder { * Enable/disable automatic prefixing of table names with the oc_ prefix * * @param bool $enabled If set to true table names will be prefixed with the - * owncloud database prefix automatically. + * owncloud database prefix automatically. * @since 8.2.0 */ public function automaticTablePrefix($enabled) { diff --git a/lib/private/DB/QueryBuilder/Sharded/AutoIncrementHandler.php b/lib/private/DB/QueryBuilder/Sharded/AutoIncrementHandler.php index d40934669d7..c3ce28376e3 100644 --- a/lib/private/DB/QueryBuilder/Sharded/AutoIncrementHandler.php +++ b/lib/private/DB/QueryBuilder/Sharded/AutoIncrementHandler.php @@ -34,7 +34,7 @@ class AutoIncrementHandler { } private function getCache(): IMemcache { - if(is_null($this->cache)) { + if (is_null($this->cache)) { $cache = $this->cacheFactory->createDistributed('shared_autoincrement'); if ($cache instanceof IMemcache) { $this->cache = $cache; @@ -118,7 +118,7 @@ class AutoIncrementHandler { $next = $cache->inc($shardDefinition->table); if (is_int($next) && $next >= self::MIN_VALID_KEY) { return $next; - } elseif(is_int($next)) { + } elseif (is_int($next)) { // key got cleared, invalidate and retry $cache->cas($shardDefinition->table, $next, 'empty-placeholder'); return null; diff --git a/lib/private/DB/QueryBuilder/Sharded/HashShardMapper.php b/lib/private/DB/QueryBuilder/Sharded/HashShardMapper.php index af778489a2d..98dbd8172f8 100644 --- a/lib/private/DB/QueryBuilder/Sharded/HashShardMapper.php +++ b/lib/private/DB/QueryBuilder/Sharded/HashShardMapper.php @@ -15,7 +15,7 @@ use OCP\DB\QueryBuilder\Sharded\IShardMapper; */ class HashShardMapper implements IShardMapper { public function getShardForKey(int $key, int $count): int { - $int = unpack('L', substr(md5((string)$key, true), 0, 4))[1]; + $int = unpack('L', substr(md5((string) $key, true), 0, 4))[1]; return $int % $count; } } diff --git a/lib/private/DB/QueryBuilder/Sharded/ShardQueryRunner.php b/lib/private/DB/QueryBuilder/Sharded/ShardQueryRunner.php index 51cd055e801..8904dbbce0c 100644 --- a/lib/private/DB/QueryBuilder/Sharded/ShardQueryRunner.php +++ b/lib/private/DB/QueryBuilder/Sharded/ShardQueryRunner.php @@ -41,7 +41,7 @@ class ShardQueryRunner { return null; } $shards = array_map(function ($shardKey) { - return $this->shardDefinition->getShardForKey((int)$shardKey); + return $this->shardDefinition->getShardForKey((int) $shardKey); }, $shardKeys); return array_values(array_unique($shards)); } diff --git a/lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php b/lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php index 4caab8aec15..018b891cd71 100644 --- a/lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php +++ b/lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php @@ -67,7 +67,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { private function getKeyValue($value): array { if ($value instanceof Parameter) { - $value = (string)$value; + $value = (string) $value; } if (is_string($value) && str_starts_with($value, ':')) { $param = $this->getParameter(substr($value, 1)); @@ -132,7 +132,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { } return $values; } - $predicate = (string)$predicate; + $predicate = (string) $predicate; // expect a condition in the form of 'alias1.column1 = placeholder' or 'alias1.column1 in placeholder' if (substr_count($predicate, ' ') > 2) { return []; @@ -258,14 +258,14 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { public function setMaxResults($maxResults) { if ($maxResults > 0) { - $this->limit = (int)$maxResults; + $this->limit = (int) $maxResults; } return parent::setMaxResults($maxResults); } public function setFirstResult($firstResult) { if ($firstResult > 0) { - $this->offset = (int)$firstResult; + $this->offset = (int) $firstResult; } if ($this->shardDefinition && count($this->shardDefinition->shards) > 1) { // we have to emulate offset @@ -276,13 +276,13 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { } public function addOrderBy($sort, $order = null) { - $this->registerOrder((string)$sort, (string)$order ?? 'ASC'); + $this->registerOrder((string) $sort, (string) $order ?? 'ASC'); return parent::addOrderBy($sort, $order); } public function orderBy($sort, $order = null) { $this->sortList = []; - $this->registerOrder((string)$sort, (string)$order ?? 'ASC'); + $this->registerOrder((string) $sort, (string) $order ?? 'ASC'); return parent::orderBy($sort, $order); } @@ -343,9 +343,9 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder { throw new InvalidShardedQueryException("Can't update without shard key"); } $oldShards = array_values(array_unique(array_map(function ($shardKey) { - return $this->shardDefinition->getShardForKey((int)$shardKey); + return $this->shardDefinition->getShardForKey((int) $shardKey); }, $oldShardKeys))); - $newShard = $this->shardDefinition->getShardForKey((int)$newShardKey); + $newShard = $this->shardDefinition->getShardForKey((int) $newShardKey); if ($oldShards === [$newShard]) { throw new InvalidShardedQueryException('Update statement would move rows to a different shard'); } diff --git a/lib/private/DB/SchemaWrapper.php b/lib/private/DB/SchemaWrapper.php index 473c0009237..0d5b2040513 100644 --- a/lib/private/DB/SchemaWrapper.php +++ b/lib/private/DB/SchemaWrapper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/DateTimeFormatter.php b/lib/private/DateTimeFormatter.php index cd765a2a14b..2882a7d8cd7 100644 --- a/lib/private/DateTimeFormatter.php +++ b/lib/private/DateTimeFormatter.php @@ -28,8 +28,8 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { /** * Get TimeZone to use * - * @param \DateTimeZone $timeZone The timezone to use - * @return \DateTimeZone The timezone to use, falling back to the current user's timezone + * @param \DateTimeZone $timeZone The timezone to use + * @return \DateTimeZone The timezone to use, falling back to the current user's timezone */ protected function getTimeZone($timeZone = null) { if ($timeZone === null) { @@ -42,8 +42,8 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { /** * Get \OCP\IL10N to use * - * @param \OCP\IL10N $l The locale to use - * @return \OCP\IL10N The locale to use, falling back to the current user's locale + * @param \OCP\IL10N $l The locale to use + * @return \OCP\IL10N The locale to use, falling back to the current user's locale */ protected function getLocale($l = null) { if ($l === null) { @@ -57,7 +57,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { * Generates a DateTime object with the given timestamp and TimeZone * * @param mixed $timestamp - * @param \DateTimeZone $timeZone The timezone to use + * @param \DateTimeZone $timeZone The timezone to use * @return \DateTime */ protected function getDateTime($timestamp, ?\DateTimeZone $timeZone = null) { @@ -77,15 +77,15 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { /** * Formats the date of the given timestamp * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param string $format Either 'full', 'long', 'medium' or 'short' - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' - * long: e.g. 'MMMM d, y' => 'August 20, 2014' - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' - * short: e.g. 'M/d/yy' => '8/20/14' - * The exact format is dependent on the language - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use + * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object + * @param string $format Either 'full', 'long', 'medium' or 'short' + * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' + * long: e.g. 'MMMM d, y' => 'August 20, 2014' + * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' + * short: e.g. 'M/d/yy' => '8/20/14' + * The exact format is dependent on the language + * @param \DateTimeZone $timeZone The timezone to use + * @param \OCP\IL10N $l The locale to use * @return string Formatted date string */ public function formatDate($timestamp, $format = 'long', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) { @@ -95,16 +95,16 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { /** * Formats the date of the given timestamp * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param string $format Either 'full', 'long', 'medium' or 'short' - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' - * long: e.g. 'MMMM d, y' => 'August 20, 2014' - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' - * short: e.g. 'M/d/yy' => '8/20/14' - * The exact format is dependent on the language - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use + * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object + * @param string $format Either 'full', 'long', 'medium' or 'short' + * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' + * long: e.g. 'MMMM d, y' => 'August 20, 2014' + * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' + * short: e.g. 'M/d/yy' => '8/20/14' + * The exact format is dependent on the language + * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable + * @param \DateTimeZone $timeZone The timezone to use + * @param \OCP\IL10N $l The locale to use * @return string Formatted relative date string */ public function formatDateRelativeDay($timestamp, $format = 'long', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) { @@ -119,13 +119,13 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { * Gives the relative date of the timestamp * Only works for past dates * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time - * @param \OCP\IL10N $l The locale to use + * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object + * @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time + * @param \OCP\IL10N $l The locale to use * @return string Formatted date span. Dates returned are: - * < 1 month => Today, Yesterday, n days ago - * < 13 month => last month, n months ago - * >= 13 month => last year, n years ago + * < 1 month => Today, Yesterday, n days ago + * < 13 month => last month, n months ago + * >= 13 month => last year, n years ago */ public function formatDateSpan($timestamp, $baseTimestamp = null, ?\OCP\IL10N $l = null) { $l = $this->getLocale($l); @@ -182,15 +182,15 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { /** * Formats the time of the given timestamp * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param string $format Either 'full', 'long', 'medium' or 'short' - * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' - * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' - * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' - * short: e.g. 'h:mm a' => '11:42 AM' - * The exact format is dependent on the language - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use + * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object + * @param string $format Either 'full', 'long', 'medium' or 'short' + * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' + * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' + * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' + * short: e.g. 'h:mm a' => '11:42 AM' + * The exact format is dependent on the language + * @param \DateTimeZone $timeZone The timezone to use + * @param \OCP\IL10N $l The locale to use * @return string Formatted time string */ public function formatTime($timestamp, $format = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) { @@ -200,16 +200,16 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { /** * Gives the relative past time of the timestamp * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time - * @param \OCP\IL10N $l The locale to use + * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object + * @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time + * @param \OCP\IL10N $l The locale to use * @return string Formatted time span. Dates returned are: - * < 60 sec => seconds ago - * < 1 hour => n minutes ago - * < 1 day => n hours ago - * < 1 month => Yesterday, n days ago - * < 13 month => last month, n months ago - * >= 13 month => last year, n years ago + * < 60 sec => seconds ago + * < 1 hour => n minutes ago + * < 1 day => n hours ago + * < 1 month => Yesterday, n days ago + * < 13 month => last month, n months ago + * >= 13 month => last year, n years ago */ public function formatTimeSpan($timestamp, $baseTimestamp = null, ?\OCP\IL10N $l = null) { $l = $this->getLocale($l); @@ -247,11 +247,11 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { /** * Formats the date and time of the given timestamp * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param string $formatDate See formatDate() for description - * @param string $formatTime See formatTime() for description - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use + * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object + * @param string $formatDate See formatDate() for description + * @param string $formatTime See formatTime() for description + * @param \DateTimeZone $timeZone The timezone to use + * @param \OCP\IL10N $l The locale to use * @return string Formatted date and time string */ public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) { @@ -261,12 +261,12 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { /** * Formats the date and time of the given timestamp * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param string $formatDate See formatDate() for description - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable - * @param string $formatTime See formatTime() for description - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use + * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object + * @param string $formatDate See formatDate() for description + * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable + * @param string $formatTime See formatTime() for description + * @param \DateTimeZone $timeZone The timezone to use + * @param \OCP\IL10N $l The locale to use * @return string Formatted relative date and time string */ public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) { @@ -280,11 +280,11 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { /** * Formats the date and time of the given timestamp * - * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object - * @param string $type One of 'date', 'datetime' or 'time' - * @param string $format Format string - * @param \DateTimeZone $timeZone The timezone to use - * @param \OCP\IL10N $l The locale to use + * @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object + * @param string $type One of 'date', 'datetime' or 'time' + * @param string $format Format string + * @param \DateTimeZone $timeZone The timezone to use + * @param \OCP\IL10N $l The locale to use * @return string Formatted date and time string */ protected function format($timestamp, $type, $format, ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) { diff --git a/lib/private/Diagnostics/Event.php b/lib/private/Diagnostics/Event.php index cf36bf9f82a..11d6505a888 100644 --- a/lib/private/Diagnostics/Event.php +++ b/lib/private/Diagnostics/Event.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Diagnostics/EventLogger.php b/lib/private/Diagnostics/EventLogger.php index 40cbd3e9e5d..b7790c604b7 100644 --- a/lib/private/Diagnostics/EventLogger.php +++ b/lib/private/Diagnostics/EventLogger.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -41,8 +42,8 @@ class EventLogger implements IEventLogger { } public function isLoggingActivated(): bool { - $systemValue = (bool)$this->config->getValue('diagnostics.logging', false) - || (bool)$this->config->getValue('profiler', false); + $systemValue = (bool) $this->config->getValue('diagnostics.logging', false) + || (bool) $this->config->getValue('profiler', false); if ($systemValue && $this->config->getValue('debug', false)) { return true; @@ -106,7 +107,7 @@ class EventLogger implements IEventLogger { $duration = $event->getDuration(); $timeInMs = round($duration * 1000, 4); - $loggingMinimum = (int)$this->config->getValue('diagnostics.logging.threshold', 0); + $loggingMinimum = (int) $this->config->getValue('diagnostics.logging.threshold', 0); if ($loggingMinimum === 0 || $timeInMs < $loggingMinimum) { return; } diff --git a/lib/private/Diagnostics/QueryLogger.php b/lib/private/Diagnostics/QueryLogger.php index 5efe99d1a74..30c2ce748cd 100644 --- a/lib/private/Diagnostics/QueryLogger.php +++ b/lib/private/Diagnostics/QueryLogger.php @@ -52,7 +52,7 @@ class QueryLogger implements IQueryLogger { public function stopQuery() { if ($this->activated && $this->activeQuery) { $this->activeQuery->end(microtime(true)); - $this->queries[(string)$this->index] = $this->activeQuery; + $this->queries[(string) $this->index] = $this->activeQuery; $this->index++; $this->activeQuery = null; } diff --git a/lib/private/DirectEditing/Manager.php b/lib/private/DirectEditing/Manager.php index 4b8c6af31e2..67fc3c40817 100644 --- a/lib/private/DirectEditing/Manager.php +++ b/lib/private/DirectEditing/Manager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/DirectEditing/Token.php b/lib/private/DirectEditing/Token.php index 594cef98086..19a9c9a7aa6 100644 --- a/lib/private/DirectEditing/Token.php +++ b/lib/private/DirectEditing/Token.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Encryption/DecryptAll.php b/lib/private/Encryption/DecryptAll.php index f9a92d07d20..0007467298c 100644 --- a/lib/private/Encryption/DecryptAll.php +++ b/lib/private/Encryption/DecryptAll.php @@ -17,13 +17,13 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class DecryptAll { - /** @var OutputInterface */ + /** @var OutputInterface */ protected $output; - /** @var InputInterface */ + /** @var InputInterface */ protected $input; - /** @var array files which couldn't be decrypted */ + /** @var array files which couldn't be decrypted */ protected $failed; public function __construct( @@ -114,7 +114,7 @@ class DecryptAll { $fetchUsersProgress = new ProgressBar($this->output); $fetchUsersProgress->setFormat(" %message% \n [%bar%]"); $fetchUsersProgress->start(); - $fetchUsersProgress->setMessage("Fetch list of users..."); + $fetchUsersProgress->setMessage('Fetch list of users...'); $fetchUsersProgress->advance(); foreach ($this->userManager->getBackends() as $backend) { @@ -128,7 +128,7 @@ class DecryptAll { $offset += $limit; $fetchUsersProgress->advance(); } while (count($users) >= $limit); - $fetchUsersProgress->setMessage("Fetch list of users... finished"); + $fetchUsersProgress->setMessage('Fetch list of users... finished'); $fetchUsersProgress->finish(); } } else { @@ -140,7 +140,7 @@ class DecryptAll { $progress = new ProgressBar($this->output); $progress->setFormat(" %message% \n [%bar%]"); $progress->start(); - $progress->setMessage("starting to decrypt files..."); + $progress->setMessage('starting to decrypt files...'); $progress->advance(); $numberOfUsers = count($userList); @@ -151,7 +151,7 @@ class DecryptAll { $userNo++; } - $progress->setMessage("starting to decrypt files... finished"); + $progress->setMessage('starting to decrypt files... finished'); $progress->finish(); $this->output->writeln("\n\n"); diff --git a/lib/private/Encryption/EncryptionWrapper.php b/lib/private/Encryption/EncryptionWrapper.php index d3bf0aeb4d8..aec93a3ce4d 100644 --- a/lib/private/Encryption/EncryptionWrapper.php +++ b/lib/private/Encryption/EncryptionWrapper.php @@ -26,10 +26,10 @@ use Psr\Log\LoggerInterface; * @package OC\Encryption */ class EncryptionWrapper { - /** @var ArrayCache */ + /** @var ArrayCache */ private $arrayCache; - /** @var Manager */ + /** @var Manager */ private $manager; private LoggerInterface $logger; diff --git a/lib/private/Encryption/File.php b/lib/private/Encryption/File.php index a29d62946c4..26e643d1006 100644 --- a/lib/private/Encryption/File.php +++ b/lib/private/Encryption/File.php @@ -92,7 +92,7 @@ class File implements \OCP\Encryption\IFile { } // check if it is a group mount - if ($this->getAppManager()->isEnabledForUser("files_external")) { + if ($this->getAppManager()->isEnabledForUser('files_external')) { /** @var GlobalStoragesService $storageService */ $storageService = \OC::$server->get(GlobalStoragesService::class); $storages = $storageService->getAllStorages(); diff --git a/lib/private/Encryption/HookManager.php b/lib/private/Encryption/HookManager.php index 5ce51229e4e..39e7edabb95 100644 --- a/lib/private/Encryption/HookManager.php +++ b/lib/private/Encryption/HookManager.php @@ -42,7 +42,7 @@ class HookManager { $user = \OC::$server->getUserManager()->get($owner); } if (!$user) { - throw new \Exception("Inconsistent data, File unshared, but owner not found. Should not happen"); + throw new \Exception('Inconsistent data, File unshared, but owner not found. Should not happen'); } $uid = ''; diff --git a/lib/private/Encryption/Keys/Storage.php b/lib/private/Encryption/Keys/Storage.php index 532d1a51dd6..3586f782ba0 100644 --- a/lib/private/Encryption/Keys/Storage.php +++ b/lib/private/Encryption/Keys/Storage.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/EventSource.php b/lib/private/EventSource.php index dbeda25049e..c403cf6b6b9 100644 --- a/lib/private/EventSource.php +++ b/lib/private/EventSource.php @@ -33,7 +33,7 @@ class EventSource implements IEventSource { header('X-Accel-Buffering: no'); $this->fallback = isset($_GET['fallback']) and $_GET['fallback'] == 'true'; if ($this->fallback) { - $this->fallBackId = (int)$_GET['fallback_id']; + $this->fallBackId = (int) $_GET['fallback_id']; /** * FIXME: The default content-security-policy of ownCloud forbids inline * JavaScript for security reasons. IE starting on Windows 10 will @@ -45,10 +45,10 @@ class EventSource implements IEventSource { * @link https://github.com/owncloud/core/issues/14286 */ header("Content-Security-Policy: default-src 'none'; script-src 'unsafe-inline'"); - header("Content-Type: text/html"); + header('Content-Type: text/html'); echo str_repeat('<span></span>' . PHP_EOL, 10); //dummy data to keep IE happy } else { - header("Content-Type: text/event-stream"); + header('Content-Type: text/event-stream'); } if (!$this->request->passesStrictCookieCheck()) { header('Location: '.\OC::$WEBROOT); @@ -69,7 +69,7 @@ class EventSource implements IEventSource { * @param mixed $data * * @throws \BadMethodCallException - * if only one parameter is given, a typeless message will be send with that parameter as data + * if only one parameter is given, a typeless message will be send with that parameter as data * @suppress PhanDeprecatedFunction */ public function send($type, $data = null) { diff --git a/lib/private/Federation/CloudFederationFactory.php b/lib/private/Federation/CloudFederationFactory.php index f5f25d14ea1..d06de0f2f58 100644 --- a/lib/private/Federation/CloudFederationFactory.php +++ b/lib/private/Federation/CloudFederationFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Federation/CloudFederationNotification.php b/lib/private/Federation/CloudFederationNotification.php index 855580843ba..6ae805df1d9 100644 --- a/lib/private/Federation/CloudFederationNotification.php +++ b/lib/private/Federation/CloudFederationNotification.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Federation/CloudFederationShare.php b/lib/private/Federation/CloudFederationShare.php index aa86905f234..fd79c35666f 100644 --- a/lib/private/Federation/CloudFederationShare.php +++ b/lib/private/Federation/CloudFederationShare.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Federation/CloudIdManager.php b/lib/private/Federation/CloudIdManager.php index 8f2717b54aa..f68eeed4f8c 100644 --- a/lib/private/Federation/CloudIdManager.php +++ b/lib/private/Federation/CloudIdManager.php @@ -61,7 +61,7 @@ class CloudIdManager implements ICloudIdManager { if ($event instanceof CardUpdatedEvent) { $data = $event->getCardData()['carddata']; foreach (explode("\r\n", $data) as $line) { - if (str_starts_with($line, "CLOUD;")) { + if (str_starts_with($line, 'CLOUD;')) { $parts = explode(':', $line, 2); if (isset($parts[1])) { $key = $parts[1]; diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 6cada09613d..4ce27cffe48 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -151,18 +151,18 @@ class Cache implements ICache { */ public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) { //fix types - $data['name'] = (string)$data['name']; - $data['path'] = (string)$data['path']; - $data['fileid'] = (int)$data['fileid']; - $data['parent'] = (int)$data['parent']; + $data['name'] = (string) $data['name']; + $data['path'] = (string) $data['path']; + $data['fileid'] = (int) $data['fileid']; + $data['parent'] = (int) $data['parent']; $data['size'] = Util::numericToNumber($data['size']); $data['unencrypted_size'] = Util::numericToNumber($data['unencrypted_size'] ?? 0); - $data['mtime'] = (int)$data['mtime']; - $data['storage_mtime'] = (int)$data['storage_mtime']; - $data['encryptedVersion'] = (int)$data['encrypted']; - $data['encrypted'] = (bool)$data['encrypted']; + $data['mtime'] = (int) $data['mtime']; + $data['storage_mtime'] = (int) $data['storage_mtime']; + $data['encryptedVersion'] = (int) $data['encrypted']; + $data['encrypted'] = (bool) $data['encrypted']; $data['storage_id'] = $data['storage']; - $data['storage'] = (int)$data['storage']; + $data['storage'] = (int) $data['storage']; $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']); $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']); if ($data['storage_mtime'] == 0) { @@ -171,12 +171,12 @@ class Cache implements ICache { if (isset($data['f_permissions'])) { $data['scan_permissions'] = $data['f_permissions']; } - $data['permissions'] = (int)$data['permissions']; + $data['permissions'] = (int) $data['permissions']; if (isset($data['creation_time'])) { - $data['creation_time'] = (int)$data['creation_time']; + $data['creation_time'] = (int) $data['creation_time']; } if (isset($data['upload_time'])) { - $data['upload_time'] = (int)$data['upload_time']; + $data['upload_time'] = (int) $data['upload_time']; } return new CacheEntry($data); } @@ -475,7 +475,7 @@ class Cache implements ICache { $id = $result->fetchOne(); $result->closeCursor(); - return $id === false ? -1 : (int)$id; + return $id === false ? -1 : (int) $id; } /** @@ -489,7 +489,7 @@ class Cache implements ICache { return -1; } else { $parent = $this->getParentPath($file); - return (int)$this->getId($parent); + return (int) $this->getId($parent); } } @@ -838,7 +838,7 @@ class Cache implements ICache { $result->closeCursor(); if ($size !== false) { - if ((int)$size === -1) { + if ((int) $size === -1) { return self::SHALLOW; } else { return self::COMPLETE; @@ -923,7 +923,7 @@ class Cache implements ICache { ->andWhere($query->expr()->eq('size', $query->createNamedParameter(-1, IQueryBuilder::PARAM_INT))); $result = $query->execute(); - $size = (int)$result->fetchOne(); + $size = (int) $result->fetchOne(); $result->closeCursor(); return $size; @@ -1047,7 +1047,7 @@ class Cache implements ICache { $result->closeCursor(); return array_map(function ($id) { - return (int)$id; + return (int) $id; }, $files); } @@ -1073,7 +1073,7 @@ class Cache implements ICache { $path = $result->fetchOne(); $result->closeCursor(); - return $path === false ? false : (string)$path; + return $path === false ? false : (string) $path; } /** @@ -1097,7 +1097,7 @@ class Cache implements ICache { return null; } - return (string)$path; + return (string) $path; } /** diff --git a/lib/private/Files/Cache/CacheEntry.php b/lib/private/Files/Cache/CacheEntry.php index e9417c8012a..7c8bea130d0 100644 --- a/lib/private/Files/Cache/CacheEntry.php +++ b/lib/private/Files/Cache/CacheEntry.php @@ -47,7 +47,7 @@ class CacheEntry implements ICacheEntry { } public function getId() { - return (int)$this->data['fileid']; + return (int) $this->data['fileid']; } public function getStorageId() { @@ -56,7 +56,7 @@ class CacheEntry implements ICacheEntry { public function getPath() { - return (string)$this->data['path']; + return (string) $this->data['path']; } diff --git a/lib/private/Files/Cache/FailedCache.php b/lib/private/Files/Cache/FailedCache.php index 8ba2ac491bf..44c1016ca8e 100644 --- a/lib/private/Files/Cache/FailedCache.php +++ b/lib/private/Files/Cache/FailedCache.php @@ -125,7 +125,7 @@ class FailedCache implements ICache { } public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int { - throw new \Exception("Invalid cache"); + throw new \Exception('Invalid cache'); } public function getQueryFilterForStorage(): ISearchOperator { diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php index d04cc6e0364..48ccad22e66 100644 --- a/lib/private/Files/Cache/Propagator.php +++ b/lib/private/Files/Cache/Propagator.php @@ -64,7 +64,7 @@ class Propagator implements IPropagator { } } - $time = min((int)$time, $this->clock->now()->getTimestamp()); + $time = min((int) $time, $this->clock->now()->getTimestamp()); $storageId = $this->storage->getStorageCache()->getNumericId(); @@ -188,7 +188,7 @@ class Propagator implements IPropagator { $this->connection->beginTransaction(); $query = $this->connection->getQueryBuilder(); - $storageId = (int)$this->storage->getStorageCache()->getNumericId(); + $storageId = (int) $this->storage->getStorageCache()->getNumericId(); $query->update('filecache') ->set('mtime', $query->func()->greatest('mtime', $query->createParameter('time'))) diff --git a/lib/private/Files/Cache/QuerySearchHelper.php b/lib/private/Files/Cache/QuerySearchHelper.php index 0b164912301..b138694fae4 100644 --- a/lib/private/Files/Cache/QuerySearchHelper.php +++ b/lib/private/Files/Cache/QuerySearchHelper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -194,7 +195,7 @@ class QuerySearchHelper { protected function requireUser(ISearchQuery $searchQuery): IUser { $user = $searchQuery->getUser(); if ($user === null) { - throw new \InvalidArgumentException("This search operation requires the user to be set in the query"); + throw new \InvalidArgumentException('This search operation requires the user to be set in the query'); } return $user; } diff --git a/lib/private/Files/Cache/SearchBuilder.php b/lib/private/Files/Cache/SearchBuilder.php index 4200fb45692..29bd9d7cbdb 100644 --- a/lib/private/Files/Cache/SearchBuilder.php +++ b/lib/private/Files/Cache/SearchBuilder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -203,7 +204,7 @@ class SearchBuilder { return [$resultField, $values, ISearchComparison::COMPARE_IN, $paramType]; } if ($field === 'mimetype') { - $value = (string)$value; + $value = (string) $value; if ($type === ISearchComparison::COMPARE_EQUAL) { $value = $this->mimetypeLoader->getId($value); } elseif ($type === ISearchComparison::COMPARE_LIKE) { @@ -234,7 +235,7 @@ class SearchBuilder { $field = 'file.fileid'; } elseif ($field === 'path' && $type === ISearchComparison::COMPARE_EQUAL && $pathEqHash) { $field = 'path_hash'; - $value = md5((string)$value); + $value = md5((string) $value); } elseif ($field === 'owner') { $field = 'uid_owner'; } @@ -295,7 +296,7 @@ class SearchBuilder { throw new \InvalidArgumentException('Cannot search non indexed metadata key'); } - switch($operator->getExtra()) { + switch ($operator->getExtra()) { case IMetadataQuery::EXTRA: $metadataQuery->joinIndex($field); // join index table if not joined yet $field = $metadataQuery->getMetadataValueField($field); diff --git a/lib/private/Files/Cache/Storage.php b/lib/private/Files/Cache/Storage.php index 0929907fcff..e7a32d0d34d 100644 --- a/lib/private/Files/Cache/Storage.php +++ b/lib/private/Files/Cache/Storage.php @@ -53,14 +53,14 @@ class Storage { $this->storageId = self::adjustStorageId($this->storageId); if ($row = self::getStorageById($this->storageId)) { - $this->numericId = (int)$row['numeric_id']; + $this->numericId = (int) $row['numeric_id']; } else { $available = $isAvailable ? 1 : 0; if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId, 'available' => $available])) { $this->numericId = $connection->lastInsertId('*PREFIX*storages'); } else { if ($row = self::getStorageById($this->storageId)) { - $this->numericId = (int)$row['numeric_id']; + $this->numericId = (int) $row['numeric_id']; } else { throw new \RuntimeException('Storage could neither be inserted nor be selected from the database: ' . $this->storageId); } @@ -80,7 +80,7 @@ class Storage { * Adjusts the storage id to use md5 if too long * @param string $storageId storage id * @return string unchanged $storageId if its length is less than 64 characters, - * else returns the md5 of $storageId + * else returns the md5 of $storageId */ public static function adjustStorageId($storageId) { if (strlen($storageId) > 64) { @@ -119,7 +119,7 @@ class Storage { $storageId = self::adjustStorageId($storageId); if ($row = self::getStorageById($storageId)) { - return (int)$row['numeric_id']; + return (int) $row['numeric_id']; } else { return null; } @@ -131,7 +131,7 @@ class Storage { public function getAvailability() { if ($row = self::getStorageById($this->storageId)) { return [ - 'available' => (int)$row['available'] === 1, + 'available' => (int) $row['available'] === 1, 'last_checked' => $row['last_checked'] ]; } else { diff --git a/lib/private/Files/Cache/StorageGlobal.php b/lib/private/Files/Cache/StorageGlobal.php index b55c0fcdb91..d288e38ce13 100644 --- a/lib/private/Files/Cache/StorageGlobal.php +++ b/lib/private/Files/Cache/StorageGlobal.php @@ -66,7 +66,7 @@ class StorageGlobal { if ($row) { $this->cache[$storageId] = $row; - $this->numericIdCache[(int)$row['numeric_id']] = $row; + $this->numericIdCache[(int) $row['numeric_id']] = $row; } } return $this->cache[$storageId] ?? null; diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php index fa9e80004db..561600d9b7b 100644 --- a/lib/private/Files/Cache/Updater.php +++ b/lib/private/Files/Cache/Updater.php @@ -116,7 +116,7 @@ class Updater implements IUpdater { } // encryption is a pita and touches the cache itself - if (isset($data['encrypted']) && !!$data['encrypted']) { + if (isset($data['encrypted']) && (bool) $data['encrypted']) { $sizeDifference = null; } @@ -284,7 +284,7 @@ class Updater implements IUpdater { // ignore the failure. // with failures concurrent updates, someone else would have already done it. // in the worst case the `storage_mtime` isn't updated, which should at most only trigger an extra rescan - $this->logger->warning("Error while updating parent storage_mtime, should be safe to ignore", ['exception' => $e]); + $this->logger->warning('Error while updating parent storage_mtime, should be safe to ignore', ['exception' => $e]); } } } diff --git a/lib/private/Files/Cache/Wrapper/JailPropagator.php b/lib/private/Files/Cache/Wrapper/JailPropagator.php index 19ca4a13ece..d6409b7875e 100644 --- a/lib/private/Files/Cache/Wrapper/JailPropagator.php +++ b/lib/private/Files/Cache/Wrapper/JailPropagator.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Files/Config/CachedMountFileInfo.php b/lib/private/Files/Config/CachedMountFileInfo.php index 41dbec87ef5..ce20b0d985c 100644 --- a/lib/private/Files/Config/CachedMountFileInfo.php +++ b/lib/private/Files/Config/CachedMountFileInfo.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php index 0e103690b6b..1dbc469c8c3 100644 --- a/lib/private/Files/Config/MountProviderCollection.php +++ b/lib/private/Files/Config/MountProviderCollection.php @@ -131,9 +131,9 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { } $lateMounts = $this->filterMounts($user, $lateMounts); - $this->eventLogger->start("fs:setup:add-mounts", "Add mounts to the filesystem"); + $this->eventLogger->start('fs:setup:add-mounts', 'Add mounts to the filesystem'); array_walk($lateMounts, [$mountManager, 'addMount']); - $this->eventLogger->end("fs:setup:add-mounts"); + $this->eventLogger->end('fs:setup:add-mounts'); return array_merge($lateMounts, $firstMounts); } @@ -223,7 +223,7 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { }, []); if (count($mounts) === 0) { - throw new \Exception("No root mounts provided by any provider"); + throw new \Exception('No root mounts provided by any provider'); } return $mounts; diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php index 67b2cad7ea2..ae80d754381 100644 --- a/lib/private/Files/Config/UserMountCache.php +++ b/lib/private/Files/Config/UserMountCache.php @@ -199,13 +199,13 @@ class UserMountCache implements IUserMountCache { $user = new LazyUser($row['user_id'], $this->userManager); $mount_id = $row['mount_id']; if (!is_null($mount_id)) { - $mount_id = (int)$mount_id; + $mount_id = (int) $mount_id; } if ($pathCallback) { return new LazyPathCachedMountInfo( $user, - (int)$row['storage_id'], - (int)$row['root_id'], + (int) $row['storage_id'], + (int) $row['root_id'], $row['mount_point'], $row['mount_provider_class'] ?? '', $mount_id, @@ -214,8 +214,8 @@ class UserMountCache implements IUserMountCache { } else { return new CachedMountInfo( $user, - (int)$row['storage_id'], - (int)$row['root_id'], + (int) $row['storage_id'], + (int) $row['root_id'], $row['mount_point'], $row['mount_provider_class'] ?? '', $mount_id, @@ -327,9 +327,9 @@ class UserMountCache implements IUserMountCache { if (is_array($row)) { $this->cacheInfoCache[$fileId] = [ - (int)$row['storage'], - (string)$row['path'], - (int)$row['mimetype'] + (int) $row['storage'], + (string) $row['path'], + (int) $row['mimetype'] ]; } else { throw new NotFoundException('File with id "' . $fileId . '" not found'); @@ -477,7 +477,7 @@ class UserMountCache implements IUserMountCache { } } - throw new NotFoundException("No cached mount for path " . $path); + throw new NotFoundException('No cached mount for path ' . $path); } public function getMountsInPath(IUser $user, string $path): array { diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index c3dcb531342..f861206fea1 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -134,7 +134,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * @return int|null */ public function getId() { - return isset($this->data['fileid']) ? (int) $this->data['fileid'] : null; + return isset($this->data['fileid']) ? (int) $this->data['fileid'] : null; } /** diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index db7420c3c4c..fa4bebe1db6 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -623,7 +623,7 @@ class Filesystem { * conversion should get removed as soon as all existing * function calls have been fixed. */ - $path = (string)$path; + $path = (string) $path; if ($path === '') { return '/'; @@ -674,7 +674,7 @@ class Filesystem { * * @param string $path * @param bool|string $includeMountPoints whether to add mountpoint sizes, - * defaults to true + * defaults to true * @return \OC\Files\FileInfo|false False if file does not exist */ public static function getFileInfo($path, $includeMountPoints = true) { diff --git a/lib/private/Files/Mount/Manager.php b/lib/private/Files/Mount/Manager.php index c2267af3c96..d118021afa2 100644 --- a/lib/private/Files/Mount/Manager.php +++ b/lib/private/Files/Mount/Manager.php @@ -84,7 +84,7 @@ class Manager implements IMountManager { if (count($this->mounts) === 0) { $this->setupManager->setupRoot(); if (count($this->mounts) === 0) { - throw new \Exception("No mounts even after explicitly setting up the root mounts"); + throw new \Exception('No mounts even after explicitly setting up the root mounts'); } } @@ -104,7 +104,7 @@ class Manager implements IMountManager { } } - throw new NotFoundException("No mount for path " . $path . " existing mounts (" . count($this->mounts) ."): " . implode(",", array_keys($this->mounts))); + throw new NotFoundException('No mount for path ' . $path . ' existing mounts (' . count($this->mounts) .'): ' . implode(',', array_keys($this->mounts))); } /** diff --git a/lib/private/Files/Mount/MountPoint.php b/lib/private/Files/Mount/MountPoint.php index cb3a3e8a22d..f3115afdb59 100644 --- a/lib/private/Files/Mount/MountPoint.php +++ b/lib/private/Files/Mount/MountPoint.php @@ -215,7 +215,7 @@ class MountPoint implements IMountPoint { $internalPath = substr($path, strlen($this->mountPoint)); } // substr returns false instead of an empty string, we always want a string - return (string)$internalPath; + return (string) $internalPath; } /** @@ -273,7 +273,7 @@ class MountPoint implements IMountPoint { if ($storage === null) { $this->rootId = -1; } else { - $this->rootId = (int)$storage->getCache()->getId(''); + $this->rootId = (int) $storage->getCache()->getId(''); } } return $this->rootId; diff --git a/lib/private/Files/Mount/RootMountProvider.php b/lib/private/Files/Mount/RootMountProvider.php index 7ad7a7f059c..86f8188978f 100644 --- a/lib/private/Files/Mount/RootMountProvider.php +++ b/lib/private/Files/Mount/RootMountProvider.php @@ -56,7 +56,7 @@ class RootMountProvider implements IRootMountProvider { } private function getLocalRootMount(IStorageFactory $loader): MountPoint { - $configDataDirectory = $this->config->getSystemValue("datadirectory", OC::$SERVERROOT . "/data"); + $configDataDirectory = $this->config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data'); return new MountPoint(LocalRootStorage::class, '/', ['datadir' => $configDataDirectory], $loader, null, null, self::class); } diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php index 9936487abb3..dabec2aafc6 100644 --- a/lib/private/Files/Node/Folder.php +++ b/lib/private/Files/Node/Folder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -308,7 +309,7 @@ class Folder extends Node implements \OCP\Files\Folder { * @return \OCP\Files\Node[] */ public function getById($id) { - return $this->root->getByIdInPath((int)$id, $this->getPath()); + return $this->root->getByIdInPath((int) $id, $this->getPath()); } public function getFirstNodeById(int $id): ?\OCP\Files\Node { @@ -422,7 +423,7 @@ class Folder extends Node implements \OCP\Files\Folder { $filterNonRecentFiles = new SearchComparison( ISearchComparison::COMPARE_GREATER_THAN, 'mtime', - strtotime("-2 week") + strtotime('-2 week') ); if ($offset === 0 && $limit <= 100) { $query = new SearchQuery( diff --git a/lib/private/Files/Node/LazyFolder.php b/lib/private/Files/Node/LazyFolder.php index 83ed7e534a7..308989d0cf7 100644 --- a/lib/private/Files/Node/LazyFolder.php +++ b/lib/private/Files/Node/LazyFolder.php @@ -472,7 +472,7 @@ class LazyFolder implements Folder { * @inheritDoc */ public function getById($id) { - return $this->getRootFolder()->getByIdInPath((int)$id, $this->getPath()); + return $this->getRootFolder()->getByIdInPath((int) $id, $this->getPath()); } public function getFirstNodeById(int $id): ?\OCP\Files\Node { diff --git a/lib/private/Files/Node/LazyUserFolder.php b/lib/private/Files/Node/LazyUserFolder.php index f9908b9b7b6..77479c2fa5e 100644 --- a/lib/private/Files/Node/LazyUserFolder.php +++ b/lib/private/Files/Node/LazyUserFolder.php @@ -59,7 +59,7 @@ class LazyUserFolder extends LazyFolder { } $mountPoint = $this->mountManager->find('/' . $this->user->getUID()); if (is_null($mountPoint)) { - throw new \Exception("No mountpoint for user folder"); + throw new \Exception('No mountpoint for user folder'); } return $mountPoint; } diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index f547d87a83e..5dbdc4054bf 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -158,7 +158,7 @@ class Node implements INode { public function getStorage() { $storage = $this->getMountPoint()->getStorage(); if (!$storage) { - throw new \Exception("No storage for node"); + throw new \Exception('No storage for node'); } return $storage; } diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php index e1bbfae97d9..7ad81d56248 100644 --- a/lib/private/Files/Node/Root.php +++ b/lib/private/Files/Node/Root.php @@ -463,7 +463,7 @@ class Root extends Folder implements IRootFolder { if ($folder instanceof Folder) { return $folder->getByIdInRootMount($id); } else { - throw new \Exception("getByIdInPath with non folder"); + throw new \Exception('getByIdInPath with non folder'); } } return []; diff --git a/lib/private/Files/Notify/Change.php b/lib/private/Files/Notify/Change.php index d2448e5deec..c8eccd11ae2 100644 --- a/lib/private/Files/Notify/Change.php +++ b/lib/private/Files/Notify/Change.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Files/Notify/RenameChange.php b/lib/private/Files/Notify/RenameChange.php index 98fd7099a58..28554ceaa26 100644 --- a/lib/private/Files/Notify/RenameChange.php +++ b/lib/private/Files/Notify/RenameChange.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php b/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php index 66fa74172d3..b2c5ef43b12 100644 --- a/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php @@ -19,7 +19,7 @@ class AppdataPreviewObjectStoreStorage extends ObjectStoreStorage { if (!isset($params['internal-id'])) { throw new \Exception('missing id in parameters'); } - $this->internalId = (string)$params['internal-id']; + $this->internalId = (string) $params['internal-id']; parent::__construct($params); } diff --git a/lib/private/Files/ObjectStore/Azure.php b/lib/private/Files/ObjectStore/Azure.php index 55400d4131c..9021dd56f65 100644 --- a/lib/private/Files/ObjectStore/Azure.php +++ b/lib/private/Files/ObjectStore/Azure.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -21,7 +22,7 @@ class Azure implements IObjectStore { private $blobClient = null; /** @var string|null */ private $endpoint = null; - /** @var bool */ + /** @var bool */ private $autoCreate = false; /** @@ -45,7 +46,7 @@ class Azure implements IObjectStore { private function getBlobClient() { if (!$this->blobClient) { $protocol = $this->endpoint ? substr($this->endpoint, 0, strpos($this->endpoint, ':')) : 'https'; - $connectionString = "DefaultEndpointsProtocol=" . $protocol . ";AccountName=" . $this->accountName . ";AccountKey=" . $this->accountKey; + $connectionString = 'DefaultEndpointsProtocol=' . $protocol . ';AccountName=' . $this->accountName . ';AccountKey=' . $this->accountKey; if ($this->endpoint) { $connectionString .= ';BlobEndpoint=' . $this->endpoint; } diff --git a/lib/private/Files/ObjectStore/Mapper.php b/lib/private/Files/ObjectStore/Mapper.php index e1174a285a6..a9633c363a8 100644 --- a/lib/private/Files/ObjectStore/Mapper.php +++ b/lib/private/Files/ObjectStore/Mapper.php @@ -44,11 +44,11 @@ class Mapper { // Allow us to prevent writing in old filled buckets $config = $this->config->getSystemValue('objectstore_multibucket'); $minBucket = is_array($config) && isset($config['arguments']['min_bucket']) - ? (int)$config['arguments']['min_bucket'] + ? (int) $config['arguments']['min_bucket'] : 0; $hash = md5($this->user->getUID()); $num = hexdec(substr($hash, 0, 4)); - return (string)(($num % ($numBuckets - $minBucket)) + $minBucket); + return (string) (($num % ($numBuckets - $minBucket)) + $minBucket); } } diff --git a/lib/private/Files/ObjectStore/ObjectStoreScanner.php b/lib/private/Files/ObjectStore/ObjectStoreScanner.php index 444f8235722..1dd84b5bb6a 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreScanner.php +++ b/lib/private/Files/ObjectStore/ObjectStoreScanner.php @@ -74,6 +74,6 @@ class ObjectStoreScanner extends Scanner { } // Make sure Oracle does not continue with null for empty strings - return (string)$path; + return (string) $path; } } diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 4b7d9cb1429..a2e145b2d22 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -58,9 +58,9 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil $this->objectPrefix = $params['objectPrefix']; } if (isset($params['validateWrites'])) { - $this->validateWrites = (bool)$params['validateWrites']; + $this->validateWrites = (bool) $params['validateWrites']; } - $this->handleCopiesAsOwned = (bool)($params['handleCopiesAsOwned'] ?? false); + $this->handleCopiesAsOwned = (bool) ($params['handleCopiesAsOwned'] ?? false); $this->logger = \OCP\Server::get(LoggerInterface::class); } @@ -317,7 +317,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil $streamStat = fstat($handle); $actualSize = $streamStat['size'] ?? -1; if ($actualSize > -1 && $actualSize !== $filesize) { - $this->getCache()->update((int)$stat['fileid'], ['size' => $actualSize]); + $this->getCache()->update((int) $stat['fileid'], ['size' => $actualSize]); } return $handle; } catch (NotFoundException $e) { @@ -383,7 +383,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil public function file_exists($path) { $path = $this->normalizePath($path); - return (bool)$this->stat($path); + return (bool) $this->stat($path); } public function rename($source, $target) { @@ -483,7 +483,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil } // update stat with new data $mTime = time(); - $stat['size'] = (int)$size; + $stat['size'] = (int) $size; $stat['mtime'] = $mTime; $stat['storage_mtime'] = $mTime; @@ -721,7 +721,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil $sourceUrn = $this->getURN($sourceEntry->getId()); if (!$cache instanceof Cache) { - throw new \Exception("Invalid source cache for object store copy"); + throw new \Exception('Invalid source cache for object store copy'); } $targetId = $cache->copyFromCache($cache, $sourceEntry, $to); @@ -767,7 +767,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil $cacheEntry = $this->getCache()->get($targetPath); $urn = $this->getURN($cacheEntry->getId()); - $result = $this->objectStore->uploadMultipartPart($urn, $writeToken, (int)$chunkId, $data, $size); + $result = $this->objectStore->uploadMultipartPart($urn, $writeToken, (int) $chunkId, $data, $size); $parts[$chunkId] = [ 'PartNumber' => $chunkId, diff --git a/lib/private/Files/ObjectStore/S3.php b/lib/private/Files/ObjectStore/S3.php index 72c19d951e4..27319d67869 100644 --- a/lib/private/Files/ObjectStore/S3.php +++ b/lib/private/Files/ObjectStore/S3.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -36,7 +37,7 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload { if ($uploadId === null) { throw new Exception('No upload id returned'); } - return (string)$uploadId; + return (string) $uploadId; } public function uploadMultipartPart(string $urn, string $uploadId, int $partId, $stream, $size): Result { @@ -82,7 +83,7 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload { 'Bucket' => $this->bucket, 'Key' => $urn, ] + $this->getSSECParameters()); - return (int)$stat->get('ContentLength'); + return (int) $stat->get('ContentLength'); } public function abortMultipartUpload($urn, $uploadId): void { diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php index 5002cd8cd21..513444d4bab 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -29,7 +30,7 @@ trait S3ConnectionTrait { protected function parseParams($params) { if (empty($params['bucket'])) { - throw new \Exception("Bucket has to be configured."); + throw new \Exception('Bucket has to be configured.'); } $this->id = 'amazon::' . $params['bucket']; @@ -44,7 +45,7 @@ trait S3ConnectionTrait { $this->uploadPartSize = $params['uploadPartSize'] ?? 524288000; $this->putSizeLimit = $params['putSizeLimit'] ?? 104857600; $this->copySizeLimit = $params['copySizeLimit'] ?? 5242880000; - $this->useMultipartCopy = (bool)($params['useMultipartCopy'] ?? true); + $this->useMultipartCopy = (bool) ($params['useMultipartCopy'] ?? true); $params['region'] = empty($params['region']) ? 'eu-west-1' : $params['region']; $params['hostname'] = empty($params['hostname']) ? 's3.' . $params['region'] . '.amazonaws.com' : $params['hostname']; $params['s3-accelerate'] = $params['hostname'] === 's3-accelerate.amazonaws.com' || $params['hostname'] === 's3-accelerate.dualstack.amazonaws.com'; @@ -137,7 +138,7 @@ trait S3ConnectionTrait { try { $logger->info('Bucket "' . $this->bucket . '" does not exist - creating it.', ['app' => 'objectstore']); if (!$this->connection::isBucketDnsCompatible($this->bucket)) { - throw new StorageNotAvailableException("The bucket will not be created because the name is not dns compatible, please correct it: " . $this->bucket); + throw new StorageNotAvailableException('The bucket will not be created because the name is not dns compatible, please correct it: ' . $this->bucket); } $this->connection->createBucket(['Bucket' => $this->bucket]); $this->testTimeout(); @@ -202,7 +203,7 @@ trait S3ConnectionTrait { } protected function getCertificateBundlePath(): ?string { - if ((int)($this->params['use_nextcloud_bundle'] ?? "0")) { + if ((int) ($this->params['use_nextcloud_bundle'] ?? '0')) { // since we store the certificate bundles on the primary storage, we can't get the bundle while setting up the primary storage if (!isset($this->params['primary_storage'])) { /** @var ICertificateManager $certManager */ diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index 5d00c184ca7..220bec14738 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -127,7 +127,7 @@ trait S3ObjectTrait { if ($e->getState()->isInitiated() && (array_key_exists('UploadId', $uploadInfo))) { $this->getConnection()->abortMultipartUpload($uploadInfo); } - throw new \OCA\DAV\Connector\Sabre\Exception\BadGateway("Error while uploading to S3 bucket", 0, $e); + throw new \OCA\DAV\Connector\Sabre\Exception\BadGateway('Error while uploading to S3 bucket', 0, $e); } } @@ -144,7 +144,7 @@ trait S3ObjectTrait { // ($psrStream->isSeekable() && $psrStream->getSize() !== null) evaluates to true for a On-Seekable stream // so the optimisation does not apply - $buffer = new Psr7\Stream(fopen("php://memory", 'rwb+')); + $buffer = new Psr7\Stream(fopen('php://memory', 'rwb+')); Utils::copyToStream($psrStream, $buffer, $this->putSizeLimit); $buffer->seek(0); if ($buffer->getSize() < $this->putSizeLimit) { @@ -179,18 +179,18 @@ trait S3ObjectTrait { 'Key' => $from, ] + $this->getSSECParameters()); - $size = (int)($sourceMetadata->get('Size') ?? $sourceMetadata->get('ContentLength')); + $size = (int) ($sourceMetadata->get('Size') ?? $sourceMetadata->get('ContentLength')); if ($this->useMultipartCopy && $size > $this->copySizeLimit) { $copy = new MultipartCopy($this->getConnection(), [ - "source_bucket" => $this->getBucket(), - "source_key" => $from + 'source_bucket' => $this->getBucket(), + 'source_key' => $from ], array_merge([ - "bucket" => $this->getBucket(), - "key" => $to, - "acl" => "private", - "params" => $this->getSSECParameters() + $this->getSSECParameters(true), - "source_metadata" => $sourceMetadata + 'bucket' => $this->getBucket(), + 'key' => $to, + 'acl' => 'private', + 'params' => $this->getSSECParameters() + $this->getSSECParameters(true), + 'source_metadata' => $sourceMetadata ], $options)); $copy->copy(); } else { diff --git a/lib/private/Files/ObjectStore/S3Signature.php b/lib/private/Files/ObjectStore/S3Signature.php index e3a522b6581..c4edb92f271 100644 --- a/lib/private/Files/ObjectStore/S3Signature.php +++ b/lib/private/Files/ObjectStore/S3Signature.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -99,7 +100,7 @@ class S3Signature implements SignatureInterface { } /** - * @param RequestInterface $request + * @param RequestInterface $request * @param CredentialsInterface $creds * * @return RequestInterface diff --git a/lib/private/Files/ObjectStore/StorageObjectStore.php b/lib/private/Files/ObjectStore/StorageObjectStore.php index 4361795ec45..888602a62e4 100644 --- a/lib/private/Files/ObjectStore/StorageObjectStore.php +++ b/lib/private/Files/ObjectStore/StorageObjectStore.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Files/ObjectStore/SwiftFactory.php b/lib/private/Files/ObjectStore/SwiftFactory.php index f2ef1910285..118724159e5 100644 --- a/lib/private/Files/ObjectStore/SwiftFactory.php +++ b/lib/private/Files/ObjectStore/SwiftFactory.php @@ -170,7 +170,7 @@ class SwiftFactory { try { /** @var \OpenStack\Identity\v2\Models\Token $token */ $token = $authService->model(\OpenStack\Identity\v2\Models\Token::class, $cachedToken['token']); - $now = new \DateTimeImmutable("now"); + $now = new \DateTimeImmutable('now'); if ($token->expires > $now) { $hasValidCachedToken = true; $this->params['v2cachedToken'] = $token; diff --git a/lib/private/Files/Search/QueryOptimizer/MergeDistributiveOperations.php b/lib/private/Files/Search/QueryOptimizer/MergeDistributiveOperations.php index 4949ca7396b..e166f233746 100644 --- a/lib/private/Files/Search/QueryOptimizer/MergeDistributiveOperations.php +++ b/lib/private/Files/Search/QueryOptimizer/MergeDistributiveOperations.php @@ -88,7 +88,7 @@ class MergeDistributiveOperations extends ReplacingOptimizerStep { if ($operator instanceof ISearchBinaryOperator && count($operator->getArguments()) > 0) { /** @var SearchBinaryOperator|SearchComparison $child */ $child = $operator->getArguments()[$index]; - $childKey = (string)$child; + $childKey = (string) $child; $result[$childKey][] = $operator; } else { $result[] = [$operator]; diff --git a/lib/private/Files/Search/SearchBinaryOperator.php b/lib/private/Files/Search/SearchBinaryOperator.php index 59a1ba2dfaf..49f599933f4 100644 --- a/lib/private/Files/Search/SearchBinaryOperator.php +++ b/lib/private/Files/Search/SearchBinaryOperator.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Files/Search/SearchOrder.php b/lib/private/Files/Search/SearchOrder.php index f3f62b933a1..b7e713b338a 100644 --- a/lib/private/Files/Search/SearchOrder.php +++ b/lib/private/Files/Search/SearchOrder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Files/Search/SearchQuery.php b/lib/private/Files/Search/SearchQuery.php index e7cb031da3e..97f32000fc7 100644 --- a/lib/private/Files/Search/SearchQuery.php +++ b/lib/private/Files/Search/SearchQuery.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -11,13 +12,13 @@ use OCP\Files\Search\ISearchQuery; use OCP\IUser; class SearchQuery implements ISearchQuery { - /** @var ISearchOperator */ + /** @var ISearchOperator */ private $searchOperation; - /** @var integer */ + /** @var integer */ private $limit; - /** @var integer */ + /** @var integer */ private $offset; - /** @var ISearchOrder[] */ + /** @var ISearchOrder[] */ private $order; /** @var ?IUser */ private $user; diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php index 4d1e379ea58..3b3256484ea 100644 --- a/lib/private/Files/SetupManager.php +++ b/lib/private/Files/SetupManager.php @@ -382,7 +382,7 @@ class SetupManager { } // for the user's home folder, and includes children we need everything always - if (rtrim($path) === "/" . $user->getUID() . "/files" && $includeChildren) { + if (rtrim($path) === '/' . $user->getUID() . '/files' && $includeChildren) { $this->setupForUser($user); return; } @@ -412,7 +412,7 @@ class SetupManager { $setupProviders[] = $cachedMount->getMountProvider(); $mounts = $this->mountProviderCollection->getUserMountsForProviderClasses($user, [$cachedMount->getMountProvider()]); } else { - $this->logger->debug("mount at " . $cachedMount->getMountPoint() . " has no provider set, performing full setup"); + $this->logger->debug('mount at ' . $cachedMount->getMountPoint() . ' has no provider set, performing full setup'); $this->eventLogger->end('fs:setup:user:path:find'); $this->setupForUser($user); $this->eventLogger->end('fs:setup:user:path'); @@ -429,7 +429,7 @@ class SetupManager { }, false); if ($needsFullSetup) { - $this->logger->debug("mount has no provider set, performing full setup"); + $this->logger->debug('mount has no provider set, performing full setup'); $this->setupForUser($user); $this->eventLogger->end('fs:setup:user:path'); return; @@ -491,7 +491,7 @@ class SetupManager { return; } - $this->eventLogger->start('fs:setup:user:providers', "Setup filesystem for " . implode(', ', $providers)); + $this->eventLogger->start('fs:setup:user:providers', 'Setup filesystem for ' . implode(', ', $providers)); $this->oneTimeUserSetup($user); diff --git a/lib/private/Files/SimpleFS/SimpleFile.php b/lib/private/Files/SimpleFS/SimpleFile.php index cbb3af4db29..3b4f383468c 100644 --- a/lib/private/Files/SimpleFS/SimpleFile.php +++ b/lib/private/Files/SimpleFS/SimpleFile.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Files/SimpleFS/SimpleFolder.php b/lib/private/Files/SimpleFS/SimpleFolder.php index 0da552e402b..62f3db25e9b 100644 --- a/lib/private/Files/SimpleFS/SimpleFolder.php +++ b/lib/private/Files/SimpleFS/SimpleFolder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 9704c0aa5b5..7ea5820620a 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -162,7 +162,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { } public function file_get_contents($path) { - $handle = $this->fopen($path, "r"); + $handle = $this->fopen($path, 'r'); if (!$handle) { return false; } @@ -172,7 +172,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { } public function file_put_contents($path, $data) { - $handle = $this->fopen($path, "w"); + $handle = $this->fopen($path, 'w'); if (!$handle) { return false; } @@ -339,7 +339,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { if (!isset($this->watcher)) { $this->watcher = new Watcher($storage); $globalPolicy = \OC::$server->getConfig()->getSystemValue('filesystem_check_changes', Watcher::CHECK_NEVER); - $this->watcher->setPolicy((int)$this->getMountOption('filesystem_check_changes', $globalPolicy)); + $this->watcher->setPolicy((int) $this->getMountOption('filesystem_check_changes', $globalPolicy)); } return $this->watcher; } @@ -433,11 +433,11 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { if ($this->stat('')) { return true; } - \OC::$server->get(LoggerInterface::class)->info("External storage not available: stat() failed"); + \OC::$server->get(LoggerInterface::class)->info('External storage not available: stat() failed'); return false; } catch (\Exception $e) { \OC::$server->get(LoggerInterface::class)->warning( - "External storage not available: " . $e->getMessage(), + 'External storage not available: ' . $e->getMessage(), ['exception' => $e] ); return false; @@ -585,7 +585,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { $this->getCache()->remove($targetInternalPath); } } - return (bool)$result; + return (bool) $result; } /** @@ -841,7 +841,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { try { [$count, $result] = \OC_Helper::streamCopy($stream, $target); if (!$result) { - throw new GenericFileException("Failed to copy stream"); + throw new GenericFileException('Failed to copy stream'); } } finally { fclose($target); diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index e2df66cb054..3480ee29248 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -90,9 +90,9 @@ class DAV extends Common { if (isset($params['host']) && isset($params['user']) && isset($params['password'])) { $host = $params['host']; //remove leading http[s], will be generated in createBaseUri() - if (str_starts_with($host, "https://")) { + if (str_starts_with($host, 'https://')) { $host = substr($host, 8); - } elseif (str_starts_with($host, "http://")) { + } elseif (str_starts_with($host, 'http://')) { $host = substr($host, 7); } $this->host = $host; @@ -105,7 +105,7 @@ class DAV extends Common { if (is_string($params['secure'])) { $this->secure = ($params['secure'] === 'true'); } else { - $this->secure = (bool)$params['secure']; + $this->secure = (bool) $params['secure']; } } else { $this->secure = false; @@ -162,13 +162,13 @@ class DAV extends Common { $lastRequestStart = 0; $this->client->on('beforeRequest', function (RequestInterface $request) use (&$lastRequestStart) { - $this->logger->debug("sending dav " . $request->getMethod() . " request to external storage: " . $request->getAbsoluteUrl(), ['app' => 'dav']); + $this->logger->debug('sending dav ' . $request->getMethod() . ' request to external storage: ' . $request->getAbsoluteUrl(), ['app' => 'dav']); $lastRequestStart = microtime(true); - $this->eventLogger->start('fs:storage:dav:request', "Sending dav request to external storage"); + $this->eventLogger->start('fs:storage:dav:request', 'Sending dav request to external storage'); }); $this->client->on('afterRequest', function (RequestInterface $request) use (&$lastRequestStart) { $elapsed = microtime(true) - $lastRequestStart; - $this->logger->debug("dav " . $request->getMethod() . " request to external storage: " . $request->getAbsoluteUrl() . " took " . round($elapsed * 1000, 1) . "ms", ['app' => 'dav']); + $this->logger->debug('dav ' . $request->getMethod() . ' request to external storage: ' . $request->getAbsoluteUrl() . ' took ' . round($elapsed * 1000, 1) . 'ms', ['app' => 'dav']); $this->eventLogger->end('fs:storage:dav:request'); }); } @@ -284,11 +284,11 @@ class DAV extends Common { return false; } $responseType = []; - if (isset($response["{DAV:}resourcetype"])) { + if (isset($response['{DAV:}resourcetype'])) { /** @var ResourceType[] $response */ - $responseType = $response["{DAV:}resourcetype"]->getValue(); + $responseType = $response['{DAV:}resourcetype']->getValue(); } - return (count($responseType) > 0 and $responseType[0] == "{DAV:}collection") ? 'dir' : 'file'; + return (count($responseType) > 0 and $responseType[0] == '{DAV:}collection') ? 'dir' : 'file'; } catch (\Exception $e) { $this->convertException($e, $path); } @@ -583,11 +583,11 @@ class DAV extends Common { } $responseType = []; - if (isset($response["{DAV:}resourcetype"])) { + if (isset($response['{DAV:}resourcetype'])) { /** @var ResourceType[] $response */ - $responseType = $response["{DAV:}resourcetype"]->getValue(); + $responseType = $response['{DAV:}resourcetype']->getValue(); } - $type = (count($responseType) > 0 and $responseType[0] == "{DAV:}collection") ? 'dir' : 'file'; + $type = (count($responseType) > 0 and $responseType[0] == '{DAV:}collection') ? 'dir' : 'file'; if ($type === 'dir') { $mimeType = 'httpd/unix-directory'; } elseif (isset($response['{DAV:}getcontenttype'])) { @@ -704,22 +704,22 @@ class DAV extends Common { /** {@inheritdoc} */ public function isUpdatable($path) { - return (bool)($this->getPermissions($path) & Constants::PERMISSION_UPDATE); + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_UPDATE); } /** {@inheritdoc} */ public function isCreatable($path) { - return (bool)($this->getPermissions($path) & Constants::PERMISSION_CREATE); + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_CREATE); } /** {@inheritdoc} */ public function isSharable($path) { - return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE); + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_SHARE); } /** {@inheritdoc} */ public function isDeletable($path) { - return (bool)($this->getPermissions($path) & Constants::PERMISSION_DELETE); + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_DELETE); } /** {@inheritdoc} */ @@ -792,7 +792,7 @@ class DAV extends Common { if (($cachedData === false) || (!empty($etag) && ($cachedData['etag'] !== $etag))) { return true; } elseif (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) { - $sharePermissions = (int)$response['{http://open-collaboration-services.org/ns}share-permissions']; + $sharePermissions = (int) $response['{http://open-collaboration-services.org/ns}share-permissions']; return $sharePermissions !== $cachedData['permissions']; } elseif (isset($response['{http://owncloud.org/ns}permissions'])) { $permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']); @@ -833,9 +833,9 @@ class DAV extends Common { * @param string $path optional path from the operation * * @throws StorageInvalidException if the storage is invalid, for example - * when the authentication expired or is invalid + * when the authentication expired or is invalid * @throws StorageNotAvailableException if the storage is not available, - * which might be temporary + * which might be temporary * @throws ForbiddenException if the action is not allowed */ protected function convertException(Exception $e, $path = '') { diff --git a/lib/private/Files/Storage/Home.php b/lib/private/Files/Storage/Home.php index 9a336d2efcc..a8d1f82b987 100644 --- a/lib/private/Files/Storage/Home.php +++ b/lib/private/Files/Storage/Home.php @@ -28,7 +28,7 @@ class Home extends Local implements \OCP\Files\IHomeStorage { * Construct a Home storage instance * * @param array $arguments array with "user" containing the - * storage owner + * storage owner */ public function __construct($arguments) { $this->user = $arguments['user']; diff --git a/lib/private/Files/Storage/StorageFactory.php b/lib/private/Files/Storage/StorageFactory.php index 18fca1d28e3..612592e2d3a 100644 --- a/lib/private/Files/Storage/StorageFactory.php +++ b/lib/private/Files/Storage/StorageFactory.php @@ -26,7 +26,7 @@ class StorageFactory implements IStorageFactory { * @param int $priority wrappers with the lower priority are applied last (meaning they get called first) * @param \OCP\Files\Mount\IMountPoint[] $existingMounts existing mount points to apply the wrapper to * @return bool true if the wrapper was added, false if there was already a wrapper with this - * name registered + * name registered */ public function addStorageWrapper($wrapperName, $callback, $priority = 50, $existingMounts = []) { if (isset($this->storageWrappers[$wrapperName])) { diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 3b1d7b74165..f950a4c2d78 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -65,7 +65,7 @@ class Encryption extends Wrapper { /** @var array remember for which path we execute the repair step to avoid recursions */ private $fixUnencryptedSizeOf = []; - /** @var ArrayCache */ + /** @var ArrayCache */ private $arrayCache; /** @var CappedMemoryCache<bool> */ @@ -204,7 +204,7 @@ class Encryption extends Wrapper { $encryptionModule = $this->getEncryptionModule($path); if ($encryptionModule) { - $handle = $this->fopen($path, "r"); + $handle = $this->fopen($path, 'r'); if (!$handle) { return false; } @@ -824,7 +824,7 @@ class Encryption extends Wrapper { $this->getCache()->remove($targetInternalPath); } } - return (bool)$result; + return (bool) $result; } public function getLocalFile($path) { diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index f95206cc537..0f3bd9b8afd 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -40,7 +40,7 @@ class Quota extends Wrapper { if ($this->quota === null) { $quotaCallback = $this->quotaCallback; if ($quotaCallback === null) { - throw new \Exception("No quota or quota callback provider"); + throw new \Exception('No quota or quota callback provider'); } $this->quota = $quotaCallback(); } diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index 29acc9ad1c2..f8aa9d963dc 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -40,7 +40,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea */ public function getWrapperStorage() { if (!$this->storage) { - $message = "storage wrapper " . get_class($this) . " doesn't have a wrapped storage set"; + $message = 'storage wrapper ' . get_class($this) . " doesn't have a wrapped storage set"; $logger = Server::get(LoggerInterface::class); $logger->error($message); $this->storage = new FailedStorage(['exception' => new \Exception($message)]); diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php index 32c0021cd23..32ead9d574d 100644 --- a/lib/private/Files/Stream/Encryption.php +++ b/lib/private/Files/Stream/Encryption.php @@ -55,7 +55,7 @@ class Encryption extends Wrapper { /** @var string */ protected $fullPath; - /** @var bool */ + /** @var bool */ protected $signed; /** @@ -344,7 +344,7 @@ class Encryption extends Wrapper { // for seekable streams the pointer is moved back to the beginning of the encrypted block // flush will start writing there when the position moves to another block - $positionInFile = (int)floor($this->position / $this->unencryptedBlockSize) * + $positionInFile = (int) floor($this->position / $this->unencryptedBlockSize) * $this->util->getBlockSize() + $this->headerSize; $resultFseek = $this->parentStreamSeek($positionInFile); @@ -408,7 +408,7 @@ class Encryption extends Wrapper { return $return; } - $newFilePosition = (int)floor($newPosition / $this->unencryptedBlockSize) + $newFilePosition = (int) floor($newPosition / $this->unencryptedBlockSize) * $this->util->getBlockSize() + $this->headerSize; $oldFilePosition = parent::stream_tell(); @@ -424,7 +424,7 @@ class Encryption extends Wrapper { public function stream_close() { $this->flush('end'); - $position = (int)floor($this->position / $this->unencryptedBlockSize); + $position = (int) floor($this->position / $this->unencryptedBlockSize); $remainingData = $this->encryptionModule->end($this->fullPath, $position . 'end'); if ($this->readOnly === false) { if (!empty($remainingData)) { @@ -457,7 +457,7 @@ class Encryption extends Wrapper { // automatically attempted when the file is written to disk - // we are handling that separately here and we don't want to // get into an infinite loop - $position = (int)floor($this->position / $this->unencryptedBlockSize); + $position = (int) floor($this->position / $this->unencryptedBlockSize); $encrypted = $this->encryptionModule->encrypt($this->cache, $position . $positionPrefix); $bytesWritten = parent::stream_write($encrypted); $this->writeFlag = false; @@ -465,8 +465,8 @@ class Encryption extends Wrapper { // If so then update the encrypted filesize // Note that the unencrypted pointer and filesize are NOT yet updated when flush() is called // We recalculate the encrypted filesize as we do not know the context of calling flush() - $completeBlocksInFile = (int)floor($this->unencryptedSize / $this->unencryptedBlockSize); - if ($completeBlocksInFile === (int)floor($this->position / $this->unencryptedBlockSize)) { + $completeBlocksInFile = (int) floor($this->unencryptedSize / $this->unencryptedBlockSize); + if ($completeBlocksInFile === (int) floor($this->position / $this->unencryptedBlockSize)) { $this->size = $this->util->getBlockSize() * $completeBlocksInFile; $this->size += $bytesWritten; $this->size += $this->headerSize; @@ -485,8 +485,8 @@ class Encryption extends Wrapper { if ($this->cache === '' && !($this->position === $this->unencryptedSize && ($this->position % $this->unencryptedBlockSize) === 0)) { // Get the data from the file handle $data = $this->stream_read_block($this->util->getBlockSize()); - $position = (int)floor($this->position / $this->unencryptedBlockSize); - $numberOfChunks = (int)($this->unencryptedSize / $this->unencryptedBlockSize); + $position = (int) floor($this->position / $this->unencryptedBlockSize); + $numberOfChunks = (int) ($this->unencryptedSize / $this->unencryptedBlockSize); if ($numberOfChunks === $position) { $position .= 'end'; } diff --git a/lib/private/Files/Stream/SeekableHttpStream.php b/lib/private/Files/Stream/SeekableHttpStream.php index 02ed1470fbd..6ce0a880e8d 100644 --- a/lib/private/Files/Stream/SeekableHttpStream.php +++ b/lib/private/Files/Stream/SeekableHttpStream.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -90,7 +91,7 @@ class SeekableHttpStream implements File { continue 2; } } - throw new \Exception("Failed to get source stream from stream wrapper of " . get_class($responseHead)); + throw new \Exception('Failed to get source stream from stream wrapper of ' . get_class($responseHead)); } $rangeHeaders = array_values(array_filter($responseHead, function ($v) { diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index 48907b3473f..0a5ac4cddab 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -71,12 +71,12 @@ class Detection implements IMimeTypeDetector { public function registerTypeArray(array $types): void { // Register the types, foreach ($types as $extension => $mimeType) { - $this->registerType((string)$extension, $mimeType[0], $mimeType[1] ?? null); + $this->registerType((string) $extension, $mimeType[0], $mimeType[1] ?? null); } // Update the alternative mimetypes to avoid having to look them up each time. foreach ($this->mimetypes as $extension => $mimeType) { - if (str_starts_with((string)$extension, '_comment')) { + if (str_starts_with((string) $extension, '_comment')) { continue; } diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 32ed358f6cf..137e970c185 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -223,7 +223,7 @@ class View { $relPath = '/' . $pathParts[3]; $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); \OC_Hook::emit( - Filesystem::CLASSNAME, "umount", + Filesystem::CLASSNAME, 'umount', [Filesystem::signal_param_path => $relPath] ); $this->changeLock($relPath, ILockingProvider::LOCK_EXCLUSIVE, true); @@ -231,7 +231,7 @@ class View { $this->changeLock($relPath, ILockingProvider::LOCK_SHARED, true); if ($result) { \OC_Hook::emit( - Filesystem::CLASSNAME, "post_umount", + Filesystem::CLASSNAME, 'post_umount', [Filesystem::signal_param_path => $relPath] ); } @@ -708,7 +708,7 @@ class View { $absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($target)); if (str_starts_with($absolutePath2, $absolutePath1 . '/')) { - throw new ForbiddenException("Moving a folder into a child folder is forbidden", false); + throw new ForbiddenException('Moving a folder into a child folder is forbidden', false); } /** @var IMountManager $mountManager */ @@ -1403,7 +1403,7 @@ class View { * * @param string $path * @param bool|string $includeMountPoints true to add mountpoint sizes, - * 'ext' to add only ext storage mount point sizes. Defaults to true. + * 'ext' to add only ext storage mount point sizes. Defaults to true. * @return \OC\Files\FileInfo|false False if file does not exist */ public function getFileInfo($path, $includeMountPoints = true) { @@ -1799,7 +1799,7 @@ class View { * @throws NotFoundException */ public function getPath($id, ?int $storageId = null) { - $id = (int)$id; + $id = (int) $id; $manager = Filesystem::getMountManager(); $mounts = $manager->findIn($this->fakeRoot); $mounts[] = $manager->find($this->fakeRoot); @@ -1990,7 +1990,7 @@ class View { * * @param string $absolutePath absolute path * @param bool $useParentMount true to return parent mount instead of whatever - * is mounted directly on the given path, false otherwise + * is mounted directly on the given path, false otherwise * @return IMountPoint mount point for which to apply locks */ private function getMountForLock(string $absolutePath, bool $useParentMount = false): IMountPoint { @@ -2196,7 +2196,7 @@ class View { * @param string $absolutePath absolute path which is under "files" * * @return string path relative to "files" with trimmed slashes or null - * if the path was NOT relative to files + * if the path was NOT relative to files * * @throws \InvalidArgumentException if the given path was not under "files" * @since 8.1.0 diff --git a/lib/private/FilesMetadata/MetadataQuery.php b/lib/private/FilesMetadata/MetadataQuery.php index aac93a23446..65a1cb274dd 100644 --- a/lib/private/FilesMetadata/MetadataQuery.php +++ b/lib/private/FilesMetadata/MetadataQuery.php @@ -71,7 +71,7 @@ class MetadataQuery implements IMetadataQuery { */ public function extractMetadata(array $row): IFilesMetadata { $fileId = (array_key_exists($this->fileIdField, $row)) ? $row[$this->fileIdField] : 0; - $metadata = new FilesMetadata((int)$fileId); + $metadata = new FilesMetadata((int) $fileId); try { $metadata->importFromDatabase($row, $this->alias . '_'); } catch (FilesMetadataNotFoundException) { diff --git a/lib/private/FilesMetadata/Model/MetadataValueWrapper.php b/lib/private/FilesMetadata/Model/MetadataValueWrapper.php index 710a8129340..e05b4361cb0 100644 --- a/lib/private/FilesMetadata/Model/MetadataValueWrapper.php +++ b/lib/private/FilesMetadata/Model/MetadataValueWrapper.php @@ -221,7 +221,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { throw new FilesMetadataNotFoundException('value is not set'); } - return (string)$this->value; + return (string) $this->value; } /** @@ -237,7 +237,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { throw new FilesMetadataNotFoundException('value is not set'); } - return (int)$this->value; + return (int) $this->value; } /** @@ -253,7 +253,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { throw new FilesMetadataNotFoundException('value is not set'); } - return (float)$this->value; + return (float) $this->value; } /** @@ -269,7 +269,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { throw new FilesMetadataNotFoundException('value is not set'); } - return (bool)$this->value; + return (bool) $this->value; } /** @@ -285,7 +285,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { throw new FilesMetadataNotFoundException('value is not set'); } - return (array)$this->value; + return (array) $this->value; } /** @@ -301,7 +301,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { throw new FilesMetadataNotFoundException('value is not set'); } - return (array)$this->value; + return (array) $this->value; } /** @@ -317,7 +317,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper { throw new FilesMetadataNotFoundException('value is not set'); } - return (array)$this->value; + return (array) $this->value; } /** diff --git a/lib/private/FilesMetadata/Service/IndexRequestService.php b/lib/private/FilesMetadata/Service/IndexRequestService.php index 32248ff5c24..b50fb378325 100644 --- a/lib/private/FilesMetadata/Service/IndexRequestService.php +++ b/lib/private/FilesMetadata/Service/IndexRequestService.php @@ -82,9 +82,9 @@ class IndexRequestService { private function insertIndexString(int $fileId, string $key, string $value): void { $qb = $this->dbConnection->getQueryBuilder(); $qb->insert(self::TABLE_METADATA_INDEX) - ->setValue('meta_key', $qb->createNamedParameter($key)) - ->setValue('meta_value_string', $qb->createNamedParameter($value)) - ->setValue('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)); + ->setValue('meta_key', $qb->createNamedParameter($key)) + ->setValue('meta_value_string', $qb->createNamedParameter($value)) + ->setValue('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)); $qb->executeStatement(); } @@ -100,9 +100,9 @@ class IndexRequestService { public function insertIndexInt(int $fileId, string $key, int $value): void { $qb = $this->dbConnection->getQueryBuilder(); $qb->insert(self::TABLE_METADATA_INDEX) - ->setValue('meta_key', $qb->createNamedParameter($key)) - ->setValue('meta_value_int', $qb->createNamedParameter($value, IQueryBuilder::PARAM_INT)) - ->setValue('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)); + ->setValue('meta_key', $qb->createNamedParameter($key)) + ->setValue('meta_value_int', $qb->createNamedParameter($value, IQueryBuilder::PARAM_INT)) + ->setValue('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)); $qb->executeStatement(); } @@ -118,9 +118,9 @@ class IndexRequestService { public function insertIndexBool(int $fileId, string $key, bool $value): void { $qb = $this->dbConnection->getQueryBuilder(); $qb->insert(self::TABLE_METADATA_INDEX) - ->setValue('meta_key', $qb->createNamedParameter($key)) - ->setValue('meta_value_int', $qb->createNamedParameter(($value) ? '1' : '0', IQueryBuilder::PARAM_INT)) - ->setValue('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)); + ->setValue('meta_key', $qb->createNamedParameter($key)) + ->setValue('meta_value_int', $qb->createNamedParameter(($value) ? '1' : '0', IQueryBuilder::PARAM_INT)) + ->setValue('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)); $qb->executeStatement(); } @@ -167,7 +167,7 @@ class IndexRequestService { $qb = $this->dbConnection->getQueryBuilder(); $expr = $qb->expr(); $qb->delete(self::TABLE_METADATA_INDEX) - ->where($expr->eq('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT))); + ->where($expr->eq('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT))); if ($key !== '') { $qb->andWhere($expr->eq('meta_key', $qb->createNamedParameter($key))); diff --git a/lib/private/FilesMetadata/Service/MetadataRequestService.php b/lib/private/FilesMetadata/Service/MetadataRequestService.php index bb3833c2fb6..a486d06c7a7 100644 --- a/lib/private/FilesMetadata/Service/MetadataRequestService.php +++ b/lib/private/FilesMetadata/Service/MetadataRequestService.php @@ -59,11 +59,11 @@ class MetadataRequestService { public function store(IFilesMetadata $filesMetadata): void { $qb = $this->dbConnection->getQueryBuilder(); $qb->insert(self::TABLE_METADATA) - ->hintShardKey('storage', $this->getStorageId($filesMetadata)) - ->setValue('file_id', $qb->createNamedParameter($filesMetadata->getFileId(), IQueryBuilder::PARAM_INT)) - ->setValue('json', $qb->createNamedParameter(json_encode($filesMetadata->jsonSerialize()))) - ->setValue('sync_token', $qb->createNamedParameter($this->generateSyncToken())) - ->setValue('last_update', (string) $qb->createFunction('NOW()')); + ->hintShardKey('storage', $this->getStorageId($filesMetadata)) + ->setValue('file_id', $qb->createNamedParameter($filesMetadata->getFileId(), IQueryBuilder::PARAM_INT)) + ->setValue('json', $qb->createNamedParameter(json_encode($filesMetadata->jsonSerialize()))) + ->setValue('sync_token', $qb->createNamedParameter($this->generateSyncToken())) + ->setValue('last_update', (string) $qb->createFunction('NOW()')); $qb->executeStatement(); } @@ -139,7 +139,7 @@ class MetadataRequestService { public function dropMetadata(int $fileId): void { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete(self::TABLE_METADATA) - ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT))); + ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT))); $qb->executeStatement(); } @@ -156,16 +156,16 @@ class MetadataRequestService { $expr = $qb->expr(); $qb->update(self::TABLE_METADATA) - ->hintShardKey('files_metadata', $this->getStorageId($filesMetadata)) - ->set('json', $qb->createNamedParameter(json_encode($filesMetadata->jsonSerialize()))) - ->set('sync_token', $qb->createNamedParameter($this->generateSyncToken())) - ->set('last_update', $qb->createFunction('NOW()')) - ->where( - $expr->andX( - $expr->eq('file_id', $qb->createNamedParameter($filesMetadata->getFileId(), IQueryBuilder::PARAM_INT)), - $expr->eq('sync_token', $qb->createNamedParameter($filesMetadata->getSyncToken())) - ) - ); + ->hintShardKey('files_metadata', $this->getStorageId($filesMetadata)) + ->set('json', $qb->createNamedParameter(json_encode($filesMetadata->jsonSerialize()))) + ->set('sync_token', $qb->createNamedParameter($this->generateSyncToken())) + ->set('last_update', $qb->createFunction('NOW()')) + ->where( + $expr->andX( + $expr->eq('file_id', $qb->createNamedParameter($filesMetadata->getFileId(), IQueryBuilder::PARAM_INT)), + $expr->eq('sync_token', $qb->createNamedParameter($filesMetadata->getSyncToken())) + ) + ); return $qb->executeStatement(); } diff --git a/lib/private/FullTextSearch/Model/IndexDocument.php b/lib/private/FullTextSearch/Model/IndexDocument.php index 6f9da9416fa..8bd20bad1e0 100644 --- a/lib/private/FullTextSearch/Model/IndexDocument.php +++ b/lib/private/FullTextSearch/Model/IndexDocument.php @@ -402,7 +402,7 @@ class IndexDocument implements IIndexDocument, JsonSerializable { return $this; } - $this->hash = hash("md5", $this->getContent()); + $this->hash = hash('md5', $this->getContent()); return $this; } @@ -556,9 +556,9 @@ class IndexDocument implements IIndexDocument, JsonSerializable { * @since 16.0.0 */ private function cleanExcerpt(string $excerpt): string { - $excerpt = str_replace("\\n", ' ', $excerpt); - $excerpt = str_replace("\\r", ' ', $excerpt); - $excerpt = str_replace("\\t", ' ', $excerpt); + $excerpt = str_replace('\\n', ' ', $excerpt); + $excerpt = str_replace('\\r', ' ', $excerpt); + $excerpt = str_replace('\\t', ' ', $excerpt); $excerpt = str_replace("\n", ' ', $excerpt); $excerpt = str_replace("\r", ' ', $excerpt); $excerpt = str_replace("\t", ' ', $excerpt); diff --git a/lib/private/GlobalScale/Config.php b/lib/private/GlobalScale/Config.php index 02acc1ab50a..2f729c2702e 100644 --- a/lib/private/GlobalScale/Config.php +++ b/lib/private/GlobalScale/Config.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Group/Backend.php b/lib/private/Group/Backend.php index f6844308a15..a72685acfc2 100644 --- a/lib/private/Group/Backend.php +++ b/lib/private/Group/Backend.php @@ -53,7 +53,7 @@ abstract class Backend implements \OCP\GroupInterface { * compared with \OC\Group\Backend::CREATE_GROUP etc. */ public function implementsActions($actions) { - return (bool)($this->getSupportedActions() & $actions); + return (bool) ($this->getSupportedActions() & $actions); } /** diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index 5827a31172d..2a454fa1c71 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -325,17 +325,17 @@ class Database extends ABackend implements $qb = $this->dbConn->getQueryBuilder(); $qb->select('gid', 'displayname') - ->from('groups') - ->where($qb->expr()->in('gid', $qb->createParameter('ids'))); + ->from('groups') + ->where($qb->expr()->in('gid', $qb->createParameter('ids'))); foreach (array_chunk($notFoundGids, 1000) as $chunk) { $qb->setParameter('ids', $chunk, IQueryBuilder::PARAM_STR_ARRAY); $result = $qb->executeQuery(); while ($row = $result->fetch()) { - $this->groupCache[(string)$row['gid']] = [ - 'displayname' => (string)$row['displayname'], - 'gid' => (string)$row['gid'], + $this->groupCache[(string) $row['gid']] = [ + 'displayname' => (string) $row['displayname'], + 'gid' => (string) $row['gid'], ]; - $existingGroups[] = (string)$row['gid']; + $existingGroups[] = (string) $row['gid']; } $result->closeCursor(); } @@ -428,7 +428,7 @@ class Database extends ABackend implements $result->closeCursor(); if ($count !== false) { - $count = (int)$count; + $count = (int) $count; } else { $count = 0; } @@ -460,7 +460,7 @@ class Database extends ABackend implements $result->closeCursor(); if ($count !== false) { - $count = (int)$count; + $count = (int) $count; } else { $count = 0; } @@ -527,10 +527,10 @@ class Database extends ABackend implements $result = $query->executeQuery(); while ($row = $result->fetch()) { - $details[(string)$row['gid']] = ['displayName' => (string)$row['displayname']]; - $this->groupCache[(string)$row['gid']] = [ - 'displayname' => (string)$row['displayname'], - 'gid' => (string)$row['gid'], + $details[(string) $row['gid']] = ['displayName' => (string) $row['displayname']]; + $this->groupCache[(string) $row['gid']] = [ + 'displayname' => (string) $row['displayname'], + 'gid' => (string) $row['gid'], ]; } $result->closeCursor(); diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php index dcda7c29bb5..147c5baf543 100644 --- a/lib/private/Group/Group.php +++ b/lib/private/Group/Group.php @@ -30,7 +30,7 @@ use OCP\IUser; use OCP\IUserManager; class Group implements IGroup { - /** @var null|string */ + /** @var null|string */ protected $displayName; /** @var string */ @@ -46,7 +46,7 @@ class Group implements IGroup { private $backends; /** @var IEventDispatcher */ private $dispatcher; - /** @var \OC\User\Manager|IUserManager */ + /** @var \OC\User\Manager|IUserManager */ private $userManager; /** @var PublicEmitter */ private $emitter; diff --git a/lib/private/Group/MetaData.php b/lib/private/Group/MetaData.php index da553c89a7b..fe0d931cb09 100644 --- a/lib/private/Group/MetaData.php +++ b/lib/private/Group/MetaData.php @@ -41,7 +41,7 @@ class MetaData { * [0] array containing meta data about admin groups * [1] array containing meta data about unprivileged groups * @param string $groupSearch only effective when instance was created with - * isAdmin being true + * isAdmin being true * @param string $userSearch the pattern users are search for */ public function get(string $groupSearch = '', string $userSearch = ''): array { diff --git a/lib/private/Hooks/BasicEmitter.php b/lib/private/Hooks/BasicEmitter.php index c9444b40473..091334b71c8 100644 --- a/lib/private/Hooks/BasicEmitter.php +++ b/lib/private/Hooks/BasicEmitter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Hooks/Emitter.php b/lib/private/Hooks/Emitter.php index 8a63ac9ed3a..86eb410860c 100644 --- a/lib/private/Hooks/Emitter.php +++ b/lib/private/Hooks/Emitter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Hooks/EmitterTrait.php b/lib/private/Hooks/EmitterTrait.php index 8bffb6f7c3b..7b2ec4ad7fe 100644 --- a/lib/private/Hooks/EmitterTrait.php +++ b/lib/private/Hooks/EmitterTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Hooks/PublicEmitter.php b/lib/private/Hooks/PublicEmitter.php index 042b616e264..77cb2bf30dd 100644 --- a/lib/private/Hooks/PublicEmitter.php +++ b/lib/private/Hooks/PublicEmitter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Http/Client/Client.php b/lib/private/Http/Client/Client.php index 7cadf3fdf6e..0b72522c218 100644 --- a/lib/private/Http/Client/Client.php +++ b/lib/private/Http/Client/Client.php @@ -176,27 +176,27 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'query' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'query' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IResponse * @throws \Exception If the request could not get completed */ @@ -212,22 +212,22 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IResponse * @throws \Exception If the request could not get completed */ @@ -242,27 +242,27 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IResponse * @throws \Exception If the request could not get completed */ @@ -283,27 +283,27 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IResponse * @throws \Exception If the request could not get completed */ @@ -318,27 +318,27 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IResponse * @throws \Exception If the request could not get completed */ @@ -353,27 +353,27 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IResponse * @throws \Exception If the request could not get completed */ @@ -388,27 +388,27 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IResponse * @throws \Exception If the request could not get completed */ @@ -440,27 +440,27 @@ class Client implements IClient { * @param string $method The HTTP method to use * @param string $uri * @param array $options Array such as - * 'query' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'query' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IResponse * @throws \Exception If the request could not get completed */ @@ -483,27 +483,27 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'query' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'query' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IPromise */ public function getAsync(string $uri, array $options = []): IPromise { @@ -517,22 +517,22 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IPromise */ public function headAsync(string $uri, array $options = []): IPromise { @@ -546,27 +546,27 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IPromise */ public function postAsync(string $uri, array $options = []): IPromise { @@ -585,27 +585,27 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IPromise */ public function putAsync(string $uri, array $options = []): IPromise { @@ -619,27 +619,27 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IPromise */ public function deleteAsync(string $uri, array $options = []): IPromise { @@ -653,27 +653,27 @@ class Client implements IClient { * * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, - * 'timeout' => 5, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, + * 'timeout' => 5, * @return IPromise */ public function optionsAsync(string $uri, array $options = []): IPromise { diff --git a/lib/private/Http/Client/ClientService.php b/lib/private/Http/Client/ClientService.php index 9a170be8752..b719f3d369d 100644 --- a/lib/private/Http/Client/ClientService.php +++ b/lib/private/Http/Client/ClientService.php @@ -61,7 +61,7 @@ class ClientService implements IClientService { $stack->push($this->dnsPinMiddleware->addDnsPinning()); } $stack->push(Middleware::tap(function (RequestInterface $request) { - $this->eventLogger->start('http:request', $request->getMethod() . " request to " . $request->getRequestTarget()); + $this->eventLogger->start('http:request', $request->getMethod() . ' request to ' . $request->getRequestTarget()); }, function () { $this->eventLogger->end('http:request'); }), 'event logger'); diff --git a/lib/private/Http/Client/DnsPinMiddleware.php b/lib/private/Http/Client/DnsPinMiddleware.php index a3d6a64611f..9af3a9fb6d5 100644 --- a/lib/private/Http/Client/DnsPinMiddleware.php +++ b/lib/private/Http/Client/DnsPinMiddleware.php @@ -109,7 +109,7 @@ class DnsPinMiddleware { return $handler($request, $options); } - $hostName = (string)$request->getUri()->getHost(); + $hostName = (string) $request->getUri()->getHost(); $port = $request->getUri()->getPort(); $ports = [ @@ -118,7 +118,7 @@ class DnsPinMiddleware { ]; if ($port !== null) { - $ports[] = (string)$port; + $ports[] = (string) $port; } $targetIps = $this->dnsResolve(idn_to_utf8($hostName), 0); diff --git a/lib/private/Http/Client/GuzzlePromiseAdapter.php b/lib/private/Http/Client/GuzzlePromiseAdapter.php index dc8be9bd2e0..03a9ed9a599 100644 --- a/lib/private/Http/Client/GuzzlePromiseAdapter.php +++ b/lib/private/Http/Client/GuzzlePromiseAdapter.php @@ -36,7 +36,7 @@ class GuzzlePromiseAdapter implements IPromise { * a new promise resolving to the return value of the called handler. * * @param ?callable(IResponse): void $onFulfilled Invoked when the promise fulfills. Gets an \OCP\Http\Client\IResponse passed in as argument - * @param ?callable(Exception): void $onRejected Invoked when the promise is rejected. Gets an \Exception passed in as argument + * @param ?callable(Exception): void $onRejected Invoked when the promise is rejected. Gets an \Exception passed in as argument * * @return IPromise * @since 28.0.0 @@ -115,7 +115,7 @@ class GuzzlePromiseAdapter implements IPromise { * @return mixed * * @throws LogicException if the promise has no wait function or if the - * promise does not settle after waiting. + * promise does not settle after waiting. * @since 28.0.0 */ public function wait(bool $unwrap = true): mixed { diff --git a/lib/private/Http/Client/NegativeDnsCache.php b/lib/private/Http/Client/NegativeDnsCache.php index d5e32fa7c2d..83a66caa539 100644 --- a/lib/private/Http/Client/NegativeDnsCache.php +++ b/lib/private/Http/Client/NegativeDnsCache.php @@ -20,14 +20,14 @@ class NegativeDnsCache { } private function createCacheKey(string $domain, int $type) : string { - return $domain . "-" . (string)$type; + return $domain . '-' . (string) $type; } public function setNegativeCacheForDnsType(string $domain, int $type, int $ttl) : void { - $this->cache->set($this->createCacheKey($domain, $type), "true", $ttl); + $this->cache->set($this->createCacheKey($domain, $type), 'true', $ttl); } public function isNegativeCached(string $domain, int $type) : bool { - return (bool)$this->cache->hasKey($this->createCacheKey($domain, $type)); + return (bool) $this->cache->hasKey($this->createCacheKey($domain, $type)); } } diff --git a/lib/private/Http/WellKnown/RequestManager.php b/lib/private/Http/WellKnown/RequestManager.php index 38dde0eade2..3624bf73962 100644 --- a/lib/private/Http/WellKnown/RequestManager.php +++ b/lib/private/Http/WellKnown/RequestManager.php @@ -74,11 +74,11 @@ class RequestManager { $context = $this->coordinator->getRegistrationContext(); if ($context === null) { - throw new RuntimeException("Well known handlers requested before the apps had been fully registered"); + throw new RuntimeException('Well known handlers requested before the apps had been fully registered'); } $registrations = $context->getWellKnownHandlers(); - $this->logger->debug(count($registrations) . " well known handlers registered"); + $this->logger->debug(count($registrations) . ' well known handlers registered'); return array_filter( array_map(function (ServiceRegistration $registration) { diff --git a/lib/private/Installer.php b/lib/private/Installer.php index ad80b26d8bc..7395e365d00 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -298,19 +298,19 @@ class Installer { ); } - if ((string)$xml->id !== $appId) { + if ((string) $xml->id !== $appId) { throw new \Exception( sprintf( 'App for id %s has a wrong app ID in info.xml: %s', $appId, - (string)$xml->id + (string) $xml->id ) ); } // Check if the version is lower than before $currentVersion = \OCP\Server::get(IAppManager::class)->getAppVersion($appId, true); - $newVersion = (string)$xml->version; + $newVersion = (string) $xml->version; if (version_compare($currentVersion, $newVersion) === 1) { throw new \Exception( sprintf( @@ -499,7 +499,7 @@ class Installer { while (false !== ($filename = readdir($dir))) { if ($filename[0] !== '.' and is_dir($app_dir['path']."/$filename")) { if (file_exists($app_dir['path']."/$filename/appinfo/info.xml")) { - if ($config->getAppValue($filename, "installed_version", null) === null) { + if ($config->getAppValue($filename, 'installed_version', null) === null) { $enabled = $appManager->isDefaultEnabled($filename); if (($enabled || in_array($filename, $appManager->getAlwaysEnabledApps())) && $config->getAppValue($filename, 'enabled') !== 'no') { diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php index 39d778f80d6..1cb03ca6dd2 100644 --- a/lib/private/L10N/L10N.php +++ b/lib/private/L10N/L10N.php @@ -159,7 +159,7 @@ class L10N implements IL10N { $data = strtotime($data); $value->setTimestamp($data); } elseif ($data !== null) { - $data = (int)$data; + $data = (int) $data; $value->setTimestamp($data); } diff --git a/lib/private/L10N/LanguageNotFoundException.php b/lib/private/L10N/LanguageNotFoundException.php index 31b08b2ec14..087a384e00e 100644 --- a/lib/private/L10N/LanguageNotFoundException.php +++ b/lib/private/L10N/LanguageNotFoundException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/LDAP/NullLDAPProviderFactory.php b/lib/private/LDAP/NullLDAPProviderFactory.php index 55561b5692e..60588e4d15b 100644 --- a/lib/private/LDAP/NullLDAPProviderFactory.php +++ b/lib/private/LDAP/NullLDAPProviderFactory.php @@ -16,7 +16,7 @@ class NullLDAPProviderFactory implements ILDAPProviderFactory { } public function getLDAPProvider() { - throw new \Exception("No LDAP provider is available"); + throw new \Exception('No LDAP provider is available'); } public function isAvailable(): bool { diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php index 4d96e79ead4..1970e83c781 100755 --- a/lib/private/LargeFileHelper.php +++ b/lib/private/LargeFileHelper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -31,7 +32,7 @@ class LargeFileHelper { * PHP platform. */ public function __construct() { - $pow_2_53 = (float)self::POW_2_53_MINUS_1 + 1.0; + $pow_2_53 = (float) self::POW_2_53_MINUS_1 + 1.0; if ($this->formatUnsignedInteger($pow_2_53) !== self::POW_2_53) { throw new \RuntimeException( 'This class assumes floats to be double precision or "better".' @@ -171,7 +172,7 @@ class LargeFileHelper { if (\OCP\Util::isFunctionEnabled('exec')) { $os = strtolower(php_uname('s')); if (str_contains($os, 'linux')) { - return (int)($this->exec('stat -c %Y ' . escapeshellarg($fullPath)) ?? -1); + return (int) ($this->exec('stat -c %Y ' . escapeshellarg($fullPath)) ?? -1); } } } diff --git a/lib/private/Lock/DBLockingProvider.php b/lib/private/Lock/DBLockingProvider.php index d19f2cf3791..170da9f70db 100644 --- a/lib/private/Lock/DBLockingProvider.php +++ b/lib/private/Lock/DBLockingProvider.php @@ -86,7 +86,7 @@ class DBLockingProvider extends AbstractLockingProvider { ->from('file_locks') ->where($query->expr()->eq('key', $query->createNamedParameter($path))); $result = $query->executeQuery(); - $lockValue = (int)$result->fetchOne(); + $lockValue = (int) $result->fetchOne(); if ($type === self::LOCK_SHARED) { if ($this->isLocallyLocked($path)) { // if we have a shared lock we kept open locally but it's released we always have at least 1 shared lock in the db diff --git a/lib/private/Lock/MemcacheLockingProvider.php b/lib/private/Lock/MemcacheLockingProvider.php index ab9b9699bf3..8cc0c27bbf9 100644 --- a/lib/private/Lock/MemcacheLockingProvider.php +++ b/lib/private/Lock/MemcacheLockingProvider.php @@ -62,8 +62,8 @@ class MemcacheLockingProvider extends AbstractLockingProvider { if ($type === self::LOCK_SHARED) { // save the old TTL to for `restoreTTL` $this->oldTTLs[$path] = [ - "ttl" => $this->getTTL($path), - "time" => $this->timeFactory->getTime() + 'ttl' => $this->getTTL($path), + 'time' => $this->timeFactory->getTime() ]; if (!$this->memcache->inc($path)) { throw new LockedException($path, null, $this->getExistingLockForException($path), $readablePath); diff --git a/lib/private/Lockdown/Filesystem/NullCache.php b/lib/private/Lockdown/Filesystem/NullCache.php index e84ff40e00c..c6f9fbb6548 100644 --- a/lib/private/Lockdown/Filesystem/NullCache.php +++ b/lib/private/Lockdown/Filesystem/NullCache.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Lockdown/Filesystem/NullStorage.php b/lib/private/Lockdown/Filesystem/NullStorage.php index 7175594a01d..e8538f66aba 100644 --- a/lib/private/Lockdown/Filesystem/NullStorage.php +++ b/lib/private/Lockdown/Filesystem/NullStorage.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Lockdown/LockdownManager.php b/lib/private/Lockdown/LockdownManager.php index 3b45709d5c9..4f351812bad 100644 --- a/lib/private/Lockdown/LockdownManager.php +++ b/lib/private/Lockdown/LockdownManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Log.php b/lib/private/Log.php index d7283b53a43..24526bf2630 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -276,7 +276,7 @@ class Log implements ILogger, IDataLogger { $configLogLevel = $this->config->getValue('loglevel', ILogger::WARN); if (is_numeric($configLogLevel)) { $this->nestingLevel--; - return min((int)$configLogLevel, ILogger::FATAL); + return min((int) $configLogLevel, ILogger::FATAL); } // Invalid configuration, warn the user and fall back to default level of WARN @@ -343,7 +343,7 @@ class Log implements ILogger, IDataLogger { try { $serializer = $this->getSerializer(); } catch (Throwable $e) { - $this->error("Failed to load ExceptionSerializer serializer while trying to log " . $exception->getMessage()); + $this->error('Failed to load ExceptionSerializer serializer while trying to log ' . $exception->getMessage()); return; } $data = $context; diff --git a/lib/private/Log/ExceptionSerializer.php b/lib/private/Log/ExceptionSerializer.php index 25e52e66f39..f5c5a7940ff 100644 --- a/lib/private/Log/ExceptionSerializer.php +++ b/lib/private/Log/ExceptionSerializer.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -256,7 +257,7 @@ class ExceptionSerializer { } // Only log the first 5 elements of an array unless we are on debug - if ((int)$this->systemConfig->getValue('loglevel', 2) !== 0) { + if ((int) $this->systemConfig->getValue('loglevel', 2) !== 0) { $elemCount = count($arg); if ($elemCount > 5) { $arg = array_slice($arg, 0, 5); diff --git a/lib/private/Log/File.php b/lib/private/Log/File.php index 28cc856b980..bc14de4ffdf 100644 --- a/lib/private/Log/File.php +++ b/lib/private/Log/File.php @@ -73,7 +73,7 @@ class File extends LogDetails implements IWriter, IFileBased { * get entries from the log in reverse chronological order */ public function getEntries(int $limit = 50, int $offset = 0): array { - $minLevel = $this->config->getValue("loglevel", ILogger::WARN); + $minLevel = $this->config->getValue('loglevel', ILogger::WARN); $entries = []; $handle = @fopen($this->logFile, 'rb'); if ($handle) { diff --git a/lib/private/Log/LogDetails.php b/lib/private/Log/LogDetails.php index bf2c1a22c49..9673bf17e5a 100644 --- a/lib/private/Log/LogDetails.php +++ b/lib/private/Log/LogDetails.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -22,7 +23,7 @@ abstract class LogDetails { } catch (\Exception $e) { $timezone = new \DateTimeZone('UTC'); } - $time = \DateTime::createFromFormat("U.u", number_format(microtime(true), 4, ".", "")); + $time = \DateTime::createFromFormat('U.u', number_format(microtime(true), 4, '.', '')); if ($time === false) { $time = new \DateTime('now', $timezone); } else { diff --git a/lib/private/Log/LogFactory.php b/lib/private/Log/LogFactory.php index a5a7290bd9c..384d9287cca 100644 --- a/lib/private/Log/LogFactory.php +++ b/lib/private/Log/LogFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Log/PsrLoggerAdapter.php b/lib/private/Log/PsrLoggerAdapter.php index 16e609eefdb..49bdb699b99 100644 --- a/lib/private/Log/PsrLoggerAdapter.php +++ b/lib/private/Log/PsrLoggerAdapter.php @@ -35,20 +35,20 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { /** * System is unusable. * - * @param $message + * @param $message * @param mixed[] $context */ public function emergency($message, array $context = []): void { if ($this->containsThrowable($context)) { $this->logger->logException($context['exception'], array_merge( [ - 'message' => (string)$message, + 'message' => (string) $message, 'level' => ILogger::FATAL, ], $context )); } else { - $this->logger->emergency((string)$message, $context); + $this->logger->emergency((string) $message, $context); } } @@ -58,20 +58,20 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * - * @param $message + * @param $message * @param mixed[] $context */ public function alert($message, array $context = []): void { if ($this->containsThrowable($context)) { $this->logger->logException($context['exception'], array_merge( [ - 'message' => (string)$message, + 'message' => (string) $message, 'level' => ILogger::ERROR, ], $context )); } else { - $this->logger->alert((string)$message, $context); + $this->logger->alert((string) $message, $context); } } @@ -80,20 +80,20 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * * Example: Application component unavailable, unexpected exception. * - * @param $message + * @param $message * @param mixed[] $context */ public function critical($message, array $context = []): void { if ($this->containsThrowable($context)) { $this->logger->logException($context['exception'], array_merge( [ - 'message' => (string)$message, + 'message' => (string) $message, 'level' => ILogger::ERROR, ], $context )); } else { - $this->logger->critical((string)$message, $context); + $this->logger->critical((string) $message, $context); } } @@ -101,20 +101,20 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * Runtime errors that do not require immediate action but should typically * be logged and monitored. * - * @param $message + * @param $message * @param mixed[] $context */ public function error($message, array $context = []): void { if ($this->containsThrowable($context)) { $this->logger->logException($context['exception'], array_merge( [ - 'message' => (string)$message, + 'message' => (string) $message, 'level' => ILogger::ERROR, ], $context )); } else { - $this->logger->error((string)$message, $context); + $this->logger->error((string) $message, $context); } } @@ -124,40 +124,40 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * Example: Use of deprecated APIs, poor use of an API, undesirable things * that are not necessarily wrong. * - * @param $message + * @param $message * @param mixed[] $context */ public function warning($message, array $context = []): void { if ($this->containsThrowable($context)) { $this->logger->logException($context['exception'], array_merge( [ - 'message' => (string)$message, + 'message' => (string) $message, 'level' => ILogger::WARN, ], $context )); } else { - $this->logger->warning((string)$message, $context); + $this->logger->warning((string) $message, $context); } } /** * Normal but significant events. * - * @param $message + * @param $message * @param mixed[] $context */ public function notice($message, array $context = []): void { if ($this->containsThrowable($context)) { $this->logger->logException($context['exception'], array_merge( [ - 'message' => (string)$message, + 'message' => (string) $message, 'level' => ILogger::INFO, ], $context )); } else { - $this->logger->notice((string)$message, $context); + $this->logger->notice((string) $message, $context); } } @@ -166,40 +166,40 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * * Example: User logs in, SQL logs. * - * @param $message + * @param $message * @param mixed[] $context */ public function info($message, array $context = []): void { if ($this->containsThrowable($context)) { $this->logger->logException($context['exception'], array_merge( [ - 'message' => (string)$message, + 'message' => (string) $message, 'level' => ILogger::INFO, ], $context )); } else { - $this->logger->info((string)$message, $context); + $this->logger->info((string) $message, $context); } } /** * Detailed debug information. * - * @param $message + * @param $message * @param mixed[] $context */ public function debug($message, array $context = []): void { if ($this->containsThrowable($context)) { $this->logger->logException($context['exception'], array_merge( [ - 'message' => (string)$message, + 'message' => (string) $message, 'level' => ILogger::DEBUG, ], $context )); } else { - $this->logger->debug((string)$message, $context); + $this->logger->debug((string) $message, $context); } } @@ -207,7 +207,7 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { * Logs with an arbitrary level. * * @param mixed $level - * @param $message + * @param $message * @param mixed[] $context * * @throws InvalidArgumentException @@ -219,13 +219,13 @@ final class PsrLoggerAdapter implements LoggerInterface, IDataLogger { if ($this->containsThrowable($context)) { $this->logger->logException($context['exception'], array_merge( [ - 'message' => (string)$message, + 'message' => (string) $message, 'level' => $level, ], $context )); } else { - $this->logger->log($level, (string)$message, $context); + $this->logger->log($level, (string) $message, $context); } } diff --git a/lib/private/Log/Systemdlog.php b/lib/private/Log/Systemdlog.php index 4e33a4e5419..a5dcb9b1075 100644 --- a/lib/private/Log/Systemdlog.php +++ b/lib/private/Log/Systemdlog.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php index 8047cb80bad..2cb222fd137 100644 --- a/lib/private/Mail/EMailTemplate.php +++ b/lib/private/Mail/EMailTemplate.php @@ -346,7 +346,7 @@ EOF; * Adds a heading to the email * * @param string|bool $plainTitle Title that is used in the plain text email - * if empty the $title is used, if false none will be used + * if empty the $title is used, if false none will be used */ public function addHeading(string $title, $plainTitle = ''): void { if ($this->footerAdded) { @@ -379,7 +379,7 @@ EOF; * * @param string $text Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email * @param string|bool $plainText Text that is used in the plain text email - * if empty the $text is used, if false none will be used + * if empty the $text is used, if false none will be used */ public function addBodyText(string $text, $plainText = ''): void { if ($this->footerAdded) { @@ -406,9 +406,9 @@ EOF; * @param string $metaInfo Note: When $plainMetaInfo falls back to this, HTML is automatically escaped in the HTML email * @param string $icon Absolute path, must be 16*16 pixels * @param string|bool $plainText Text that is used in the plain text email - * if empty or true the $text is used, if false none will be used + * if empty or true the $text is used, if false none will be used * @param string|bool $plainMetaInfo Meta info that is used in the plain text email - * if empty or true the $metaInfo is used, if false none will be used + * if empty or true the $metaInfo is used, if false none will be used * @param integer $plainIndent plainIndent If > 0, Indent plainText by this amount. * @since 12.0.0 */ @@ -425,7 +425,7 @@ EOF; if ($plainText === '' || $plainText === true) { $plainText = $text; $text = htmlspecialchars($text); - $text = str_replace("\n", "<br/>", $text); // convert newlines to HTML breaks + $text = str_replace("\n", '<br/>', $text); // convert newlines to HTML breaks } if ($plainMetaInfo === '' || $plainMetaInfo === true) { $plainMetaInfo = $metaInfo; @@ -536,7 +536,7 @@ EOF; * @param string $text Text of button; Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email * @param string $url URL of button * @param string|false $plainText Text of button in plain text version - * if empty the $text is used, if false none will be used + * if empty the $text is used, if false none will be used * * @since 12.0.0 */ diff --git a/lib/private/Mail/Provider/Manager.php b/lib/private/Mail/Provider/Manager.php index 244aa86d68d..14ffeac287b 100644 --- a/lib/private/Mail/Provider/Manager.php +++ b/lib/private/Mail/Provider/Manager.php @@ -60,7 +60,7 @@ class Manager implements IManager { * * @since 30.0.0 * - * @return array<string,string> collection of provider id and label ['jmap' => 'JMap Connector'] + * @return array<string,string> collection of provider id and label ['jmap' => 'JMap Connector'] */ public function types(): array { @@ -80,7 +80,7 @@ class Manager implements IManager { * * @since 30.0.0 * - * @return array<string,IProvider> collection of provider id and object ['jmap' => IProviderObject] + * @return array<string,IProvider> collection of provider id and object ['jmap' => IProviderObject] */ public function providers(): array { @@ -121,11 +121,11 @@ class Manager implements IManager { * * @since 30.0.0 * - * @param string $providerId provider id + * @param string $providerId provider id * * @return IProvider|null */ - public function findProviderById(string $providerId): IProvider | null { + public function findProviderById(string $providerId): IProvider|null { // evaluate if we already have a cached collection of providers if (!is_array($this->providersCollection)) { @@ -145,9 +145,9 @@ class Manager implements IManager { * * @since 30.0.0 * - * @param string $userId user id + * @param string $userId user id * - * @return array<string,array<string,IService>> collection of provider id, service id and object ['jmap' => ['Service1' => IServiceObject]] + * @return array<string,array<string,IService>> collection of provider id, service id and object ['jmap' => ['Service1' => IServiceObject]] */ public function services(string $userId): array { @@ -172,13 +172,13 @@ class Manager implements IManager { * * @since 30.0.0 * - * @param string $userId user id - * @param string $serviceId service id - * @param string $providerId provider id + * @param string $userId user id + * @param string $serviceId service id + * @param string $providerId provider id * - * @return IService|null returns service object or null if none found + * @return IService|null returns service object or null if none found */ - public function findServiceById(string $userId, string $serviceId, ?string $providerId = null): IService | null { + public function findServiceById(string $userId, string $serviceId, ?string $providerId = null): IService|null { // evaluate if provider id was specified if ($providerId !== null) { @@ -216,13 +216,13 @@ class Manager implements IManager { * * @since 30.0.0 * - * @param string $userId user id - * @param string $address mail address (e.g. test@example.com) - * @param string $providerId provider id + * @param string $userId user id + * @param string $address mail address (e.g. test@example.com) + * @param string $providerId provider id * - * @return IService|null returns service object or null if none found + * @return IService|null returns service object or null if none found */ - public function findServiceByAddress(string $userId, string $address, ?string $providerId = null): IService | null { + public function findServiceByAddress(string $userId, string $address, ?string $providerId = null): IService|null { // evaluate if provider id was specified if ($providerId !== null) { diff --git a/lib/private/Memcache/APCu.php b/lib/private/Memcache/APCu.php index 024462d227b..937f8a863ab 100644 --- a/lib/private/Memcache/APCu.php +++ b/lib/private/Memcache/APCu.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Memcache/ArrayCache.php b/lib/private/Memcache/ArrayCache.php index 4cac60c272c..9b3540b771f 100644 --- a/lib/private/Memcache/ArrayCache.php +++ b/lib/private/Memcache/ArrayCache.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Memcache/CADTrait.php b/lib/private/Memcache/CADTrait.php index 3bf94246338..d0f6611c4f3 100644 --- a/lib/private/Memcache/CADTrait.php +++ b/lib/private/Memcache/CADTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Memcache/CASTrait.php b/lib/private/Memcache/CASTrait.php index 945f1539f99..8c2d2a46b19 100644 --- a/lib/private/Memcache/CASTrait.php +++ b/lib/private/Memcache/CASTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Memcache/Cache.php b/lib/private/Memcache/Cache.php index 2a2a6e2a23f..774769b25fe 100644 --- a/lib/private/Memcache/Cache.php +++ b/lib/private/Memcache/Cache.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Memcache/Factory.php b/lib/private/Memcache/Factory.php index 370130912d6..d9427f9b9db 100644 --- a/lib/private/Memcache/Factory.php +++ b/lib/private/Memcache/Factory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php index 620013feda6..48db13a9704 100644 --- a/lib/private/Memcache/Memcached.php +++ b/lib/private/Memcache/Memcached.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Memcache/NullCache.php b/lib/private/Memcache/NullCache.php index b667869bf0d..eac1e6ddadc 100644 --- a/lib/private/Memcache/NullCache.php +++ b/lib/private/Memcache/NullCache.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Memcache/ProfilerWrapperCache.php b/lib/private/Memcache/ProfilerWrapperCache.php index a13d647c6a4..97d9d828a32 100644 --- a/lib/private/Memcache/ProfilerWrapperCache.php +++ b/lib/private/Memcache/ProfilerWrapperCache.php @@ -18,7 +18,7 @@ use OCP\IMemcacheTTL; * @template-implements \ArrayAccess<string,mixed> */ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL, \ArrayAccess { - /** @var Redis $wrappedCache*/ + /** @var Redis $wrappedCache */ protected $wrappedCache; /** @var string $prefix */ diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php index 714759e8fbf..94693ccf74f 100644 --- a/lib/private/Memcache/Redis.php +++ b/lib/private/Memcache/Redis.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -75,7 +76,7 @@ class Redis extends Cache implements IMemcacheTTL { } public function hasKey($key) { - return (bool)$this->getCache()->exists($this->getPrefix() . $key); + return (bool) $this->getCache()->exists($this->getPrefix() . $key); } public function remove($key) { @@ -185,7 +186,7 @@ class Redis extends Cache implements IMemcacheTTL { public function getTTL(string $key): int|false { $ttl = $this->getCache()->ttl($this->getPrefix() . $key); - return $ttl > 0 ? (int)$ttl : false; + return $ttl > 0 ? (int) $ttl : false; } public function compareSetTTL(string $key, mixed $value, int $ttl): bool { diff --git a/lib/private/Migration/ConsoleOutput.php b/lib/private/Migration/ConsoleOutput.php index 7ccc4e7825a..31412bf4ff0 100644 --- a/lib/private/Migration/ConsoleOutput.php +++ b/lib/private/Migration/ConsoleOutput.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2015 ownCloud GmbH diff --git a/lib/private/Migration/MetadataManager.php b/lib/private/Migration/MetadataManager.php index 324c169c626..cdaa604ce5a 100644 --- a/lib/private/Migration/MetadataManager.php +++ b/lib/private/Migration/MetadataManager.php @@ -43,7 +43,7 @@ class MetadataManager { $ms = new MigrationService($appId, $this->connection); $metadata = []; - foreach($ms->getAvailableVersions() as $version) { + foreach ($ms->getAvailableVersions() as $version) { $metadata[$version] = []; $class = new ReflectionClass($ms->createInstance($version)); $attributes = $class->getAttributes(); diff --git a/lib/private/Migration/NullOutput.php b/lib/private/Migration/NullOutput.php index 3f4cc38dba8..8db7b950af8 100644 --- a/lib/private/Migration/NullOutput.php +++ b/lib/private/Migration/NullOutput.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only diff --git a/lib/private/Migration/SimpleOutput.php b/lib/private/Migration/SimpleOutput.php index 31420d49932..b7a07cc6ff2 100644 --- a/lib/private/Migration/SimpleOutput.php +++ b/lib/private/Migration/SimpleOutput.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2015 ownCloud GmbH diff --git a/lib/private/NaturalSort.php b/lib/private/NaturalSort.php index 120e05a8eb2..ce81e4a7437 100644 --- a/lib/private/NaturalSort.php +++ b/lib/private/NaturalSort.php @@ -82,7 +82,7 @@ class NaturalSort { * @param string $a first string to compare * @param string $b second string to compare * @return int -1 if $b comes before $a, 1 if $a comes before $b - * or 0 if the strings are identical + * or 0 if the strings are identical */ public function compare($a, $b) { // Needed because PHP doesn't sort correctly when numbers are enclosed in @@ -98,8 +98,8 @@ class NaturalSort { if ($aChunk !== $bChunk) { // test first character (character comparison, not number comparison) if ($aChunk[0] >= '0' && $aChunk[0] <= '9' && $bChunk[0] >= '0' && $bChunk[0] <= '9') { - $aNum = (int)$aChunk; - $bNum = (int)$bChunk; + $aNum = (int) $aChunk; + $bNum = (int) $bChunk; return $aNum - $bNum; } return self::getCollator()->compare($aChunk, $bChunk); diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index 5d71c83e77a..28d13a4a311 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -95,7 +95,7 @@ class NavigationManager implements INavigationManager { // This is the default app that will always be shown first $entry['default'] = ($entry['app'] ?? false) === $this->defaultApp; // Set order from user defined app order - $entry['order'] = (int)($this->customAppOrder[$id]['order'] ?? $entry['order'] ?? 100); + $entry['order'] = (int) ($this->customAppOrder[$id]['order'] ?? $entry['order'] ?? 100); } $this->entries[$id] = $entry; diff --git a/lib/private/Net/IpAddressClassifier.php b/lib/private/Net/IpAddressClassifier.php index b73d41fd79b..752480ac806 100644 --- a/lib/private/Net/IpAddressClassifier.php +++ b/lib/private/Net/IpAddressClassifier.php @@ -42,9 +42,9 @@ class IpAddressClassifier { } /* Replace by normalized form */ if ($parsedIp instanceof IPv6) { - $ip = (string)($parsedIp->toIPv4() ?? $parsedIp); + $ip = (string) ($parsedIp->toIPv4() ?? $parsedIp); } else { - $ip = (string)$parsedIp; + $ip = (string) $parsedIp; } if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { diff --git a/lib/private/Notification/Manager.php b/lib/private/Notification/Manager.php index 7d042e6f8d8..8edbca0380d 100644 --- a/lib/private/Notification/Manager.php +++ b/lib/private/Notification/Manager.php @@ -68,7 +68,7 @@ class Manager implements IManager { } /** * @param string $appClass The service must implement IApp, otherwise a - * \InvalidArgumentException is thrown later + * \InvalidArgumentException is thrown later * @since 17.0.0 */ public function registerApp(string $appClass): void { @@ -78,8 +78,8 @@ class Manager implements IManager { /** * @param \Closure $service The service must implement INotifier, otherwise a * \InvalidArgumentException is thrown later - * @param \Closure $info An array with the keys 'id' and 'name' containing - * the app id and the app name + * @param \Closure $info An array with the keys 'id' and 'name' containing + * the app id and the app name * @deprecated 17.0.0 use registerNotifierService instead. * @since 8.2.0 - Parameter $info was added in 9.0.0 */ @@ -93,7 +93,7 @@ class Manager implements IManager { /** * @param string $notifierService The service must implement INotifier, otherwise a - * \InvalidArgumentException is thrown later + * \InvalidArgumentException is thrown later * @since 17.0.0 */ public function registerNotifierService(string $notifierService): void { diff --git a/lib/private/OCM/Model/OCMProvider.php b/lib/private/OCM/Model/OCMProvider.php index 17a356428f7..ffd2f4cb9a9 100644 --- a/lib/private/OCM/Model/OCMProvider.php +++ b/lib/private/OCM/Model/OCMProvider.php @@ -145,7 +145,7 @@ class OCMProvider implements IOCMProvider { throw new OCMArgumentException('protocol not found'); } - return (string)$entry; + return (string) $entry; } } @@ -163,8 +163,8 @@ class OCMProvider implements IOCMProvider { */ public function import(array $data): static { $this->setEnabled(is_bool($data['enabled'] ?? '') ? $data['enabled'] : false) - ->setApiVersion((string)($data['apiVersion'] ?? '')) - ->setEndPoint($data['endPoint'] ?? ''); + ->setApiVersion((string) ($data['apiVersion'] ?? '')) + ->setEndPoint($data['endPoint'] ?? ''); $resources = []; foreach (($data['resourceTypes'] ?? []) as $resourceData) { diff --git a/lib/private/OCM/Model/OCMResource.php b/lib/private/OCM/Model/OCMResource.php index c69763ca4ba..74e60c6bd0b 100644 --- a/lib/private/OCM/Model/OCMResource.php +++ b/lib/private/OCM/Model/OCMResource.php @@ -84,9 +84,9 @@ class OCMResource implements IOCMResource { * @see self::jsonSerialize() */ public function import(array $data): static { - return $this->setName((string)($data['name'] ?? '')) - ->setShareTypes($data['shareTypes'] ?? []) - ->setProtocols($data['protocols'] ?? []); + return $this->setName((string) ($data['name'] ?? '')) + ->setShareTypes($data['shareTypes'] ?? []) + ->setProtocols($data['protocols'] ?? []); } /** diff --git a/lib/private/OCS/DiscoveryService.php b/lib/private/OCS/DiscoveryService.php index fc9c1bd4796..0b849268d5b 100644 --- a/lib/private/OCS/DiscoveryService.php +++ b/lib/private/OCS/DiscoveryService.php @@ -108,6 +108,6 @@ class DiscoveryService implements IDiscoveryService { * @return bool */ protected function isSafeUrl(string $url): bool { - return (bool)preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url); + return (bool) preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url); } } diff --git a/lib/private/OCS/Exception.php b/lib/private/OCS/Exception.php index eca8ec26df0..f10c4fd94d9 100644 --- a/lib/private/OCS/Exception.php +++ b/lib/private/OCS/Exception.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Preview/BackgroundCleanupJob.php b/lib/private/Preview/BackgroundCleanupJob.php index 85fe8d3303e..55ee20c44ad 100644 --- a/lib/private/Preview/BackgroundCleanupJob.php +++ b/lib/private/Preview/BackgroundCleanupJob.php @@ -49,7 +49,7 @@ class BackgroundCleanupJob extends TimedJob { public function run($argument) { foreach ($this->getDeletedFiles() as $fileId) { try { - $preview = $this->previewFolder->getFolder((string)$fileId); + $preview = $this->previewFolder->getFolder((string) $fileId); $preview->delete(); } catch (NotFoundException $e) { // continue @@ -196,7 +196,7 @@ class BackgroundCleanupJob extends TimedJob { if (count($rows) > 0) { $minId = $rows[count($rows) - 1]['fileid']; yield array_map(function ($row) { - return (int)$row['name']; + return (int) $row['name']; }, $rows); } else { break; diff --git a/lib/private/Preview/Bundled.php b/lib/private/Preview/Bundled.php index 836dc4bd357..6100e8262a4 100644 --- a/lib/private/Preview/Bundled.php +++ b/lib/private/Preview/Bundled.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index 4083b9f4f61..a84b790f3bc 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -171,7 +172,7 @@ class Generator { $previewFiles[] = $preview; } } catch (\InvalidArgumentException $e) { - throw new NotFoundException("", 0, $e); + throw new NotFoundException('', 0, $e); } if ($preview->getSize() === 0) { @@ -272,13 +273,13 @@ class Generator { $hardwareConcurrency = self::getHardwareConcurrency(); switch ($type) { - case "preview_concurrency_all": + case 'preview_concurrency_all': $fallback = $hardwareConcurrency > 0 ? $hardwareConcurrency * 2 : 8; $concurrency_all = $this->config->getSystemValueInt($type, $fallback); - $concurrency_new = $this->getNumConcurrentPreviews("preview_concurrency_new"); + $concurrency_new = $this->getNumConcurrentPreviews('preview_concurrency_new'); $cached[$type] = max($concurrency_all, $concurrency_new); break; - case "preview_concurrency_new": + case 'preview_concurrency_new': $fallback = $hardwareConcurrency > 0 ? $hardwareConcurrency : 4; $cached[$type] = $this->config->getSystemValueInt($type, $fallback); break; @@ -369,7 +370,7 @@ class Generator { */ private function getPreviewSize(ISimpleFile $file, string $prefix = '') { $size = explode('-', substr($file->getName(), strlen($prefix))); - return [(int)$size[0], (int)$size[1]]; + return [(int) $size[0], (int) $size[1]]; } /** @@ -382,7 +383,7 @@ class Generator { * @return string */ private function generatePath($width, $height, $crop, $max, $mimeType, $prefix) { - $path = $prefix . (string)$width . '-' . (string)$height; + $path = $prefix . (string) $width . '-' . (string) $height; if ($crop) { $path .= '-crop'; } @@ -480,7 +481,7 @@ class Generator { $height /= $ratio; } - return [(int)round($width), (int)round($height)]; + return [(int) round($width), (int) round($height)]; } /** @@ -518,10 +519,10 @@ class Generator { $scaleH = $maxHeight / $widthR; $scaleW = $width; } - $preview = $preview->preciseResizeCopy((int)round($scaleW), (int)round($scaleH)); + $preview = $preview->preciseResizeCopy((int) round($scaleW), (int) round($scaleH)); } - $cropX = (int)floor(abs($width - $preview->width()) * 0.5); - $cropY = (int)floor(abs($height - $preview->height()) * 0.5); + $cropX = (int) floor(abs($width - $preview->width()) * 0.5); + $cropY = (int) floor(abs($height - $preview->height()) * 0.5); $preview = $preview->cropCopy($cropX, $cropY, $width, $height); } else { $preview = $maxPreview->resizeCopy(max($width, $height)); @@ -575,7 +576,7 @@ class Generator { */ private function getPreviewFolder(File $file) { // Obtain file id outside of try catch block to prevent the creation of an existing folder - $fileId = (string)$file->getId(); + $fileId = (string) $file->getId(); try { $folder = $this->appData->getFolder($fileId); diff --git a/lib/private/Preview/GeneratorHelper.php b/lib/private/Preview/GeneratorHelper.php index 5f43c94b624..e914dcc2002 100644 --- a/lib/private/Preview/GeneratorHelper.php +++ b/lib/private/Preview/GeneratorHelper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Preview/HEIC.php b/lib/private/Preview/HEIC.php index d198f11fdef..8895cf8bb63 100644 --- a/lib/private/Preview/HEIC.php +++ b/lib/private/Preview/HEIC.php @@ -31,7 +31,7 @@ class HEIC extends ProviderV2 { * {@inheritDoc} */ public function isAvailable(FileInfo $file): bool { - return in_array('HEIC', \Imagick::queryFormats("HEI*")); + return in_array('HEIC', \Imagick::queryFormats('HEI*')); } /** diff --git a/lib/private/Preview/Imaginary.php b/lib/private/Preview/Imaginary.php index baa883f4bd9..b1e5834ffbc 100644 --- a/lib/private/Preview/Imaginary.php +++ b/lib/private/Preview/Imaginary.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -170,8 +171,8 @@ class Imaginary extends ProviderV2 { $image = new StreamImage( $response->getBody(), $response->getHeader('Content-Type'), - (int)$response->getHeader('Image-Width'), - (int)$response->getHeader('Image-Height'), + (int) $response->getHeader('Image-Width'), + (int) $response->getHeader('Image-Height'), ); } else { $image = new Image(); diff --git a/lib/private/Preview/Krita.php b/lib/private/Preview/Krita.php index 2e77c7befd2..e96fac993aa 100644 --- a/lib/private/Preview/Krita.php +++ b/lib/private/Preview/Krita.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Preview/MarkDown.php b/lib/private/Preview/MarkDown.php index 41a79455042..a91b870c6ca 100644 --- a/lib/private/Preview/MarkDown.php +++ b/lib/private/Preview/MarkDown.php @@ -63,7 +63,7 @@ class MarkDown extends TXT { $canUseTTF = function_exists('imagettftext'); - $textOffset = (int)min($maxX * 0.05, $maxY * 0.05); + $textOffset = (int) min($maxX * 0.05, $maxY * 0.05); $nextLineStart = 0; $y = $textOffset; foreach ($lines as $line) { @@ -89,14 +89,14 @@ class MarkDown extends TXT { // Add spacing before headlines if ($actualFontSize !== $fontSize && $y !== $textOffset) { - $y += (int)($actualFontSize * 2); + $y += (int) ($actualFontSize * 2); } $x = $textOffset; - $y += (int)($nextLineStart + $actualFontSize); + $y += (int) ($nextLineStart + $actualFontSize); if ($canUseTTF === true) { - $wordWrap = (int)((1 / $actualFontSize * 1.3) * $maxX); + $wordWrap = (int) ((1 / $actualFontSize * 1.3) * $maxX); // Get rid of markdown symbols that we still needed for the font size $line = preg_replace('/^#*\s/', '', $line); @@ -104,7 +104,7 @@ class MarkDown extends TXT { $wrappedText = wordwrap($line, $wordWrap, "\n"); $linesWrapped = count(explode("\n", $wrappedText)); imagettftext($image, $actualFontSize, 0, $x, $y, $textColor, $actualFontSize === $fontSize ? $fontFile : $fontFileBold, $wrappedText); - $nextLineStart = (int)($linesWrapped * ceil($actualFontSize * 2)); + $nextLineStart = (int) ($linesWrapped * ceil($actualFontSize * 2)); if ($actualFontSize !== $fontSize && $y !== $textOffset) { $nextLineStart -= $actualFontSize; } diff --git a/lib/private/Preview/MimeIconProvider.php b/lib/private/Preview/MimeIconProvider.php index 167dd21b262..580768bf2ec 100644 --- a/lib/private/Preview/MimeIconProvider.php +++ b/lib/private/Preview/MimeIconProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Preview/Movie.php b/lib/private/Preview/Movie.php index cfc05b8cce9..7b7d6fe40e8 100644 --- a/lib/private/Preview/Movie.php +++ b/lib/private/Preview/Movie.php @@ -103,12 +103,12 @@ class Movie extends ProviderV2 { $binaryType = substr(strrchr($this->binary, '/'), 1); if ($binaryType === 'avconv') { - $cmd = [$this->binary, '-y', '-ss', (string)$second, + $cmd = [$this->binary, '-y', '-ss', (string) $second, '-i', $absPath, '-an', '-f', 'mjpeg', '-vframes', '1', '-vsync', '1', $tmpPath]; } elseif ($binaryType === 'ffmpeg') { - $cmd = [$this->binary, '-y', '-ss', (string)$second, + $cmd = [$this->binary, '-y', '-ss', (string) $second, '-i', $absPath, '-f', 'mjpeg', '-vframes', '1', $tmpPath]; @@ -120,7 +120,7 @@ class Movie extends ProviderV2 { $proc = proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes); $returnCode = -1; - $output = ""; + $output = ''; if (is_resource($proc)) { $stdout = trim(stream_get_contents($pipes[1])); $stderr = trim(stream_get_contents($pipes[2])); diff --git a/lib/private/Preview/ProviderV1Adapter.php b/lib/private/Preview/ProviderV1Adapter.php index ba8826ef765..beb76884666 100644 --- a/lib/private/Preview/ProviderV1Adapter.php +++ b/lib/private/Preview/ProviderV1Adapter.php @@ -23,11 +23,11 @@ class ProviderV1Adapter implements IProviderV2 { } public function getMimeType(): string { - return (string)$this->providerV1->getMimeType(); + return (string) $this->providerV1->getMimeType(); } public function isAvailable(FileInfo $file): bool { - return (bool)$this->providerV1->isAvailable($file); + return (bool) $this->providerV1->isAvailable($file); } public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { diff --git a/lib/private/Preview/SGI.php b/lib/private/Preview/SGI.php index 06ea9c0c69a..78b1ea5828a 100644 --- a/lib/private/Preview/SGI.php +++ b/lib/private/Preview/SGI.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Preview/TGA.php b/lib/private/Preview/TGA.php index 62e5aadc2af..675907b4e49 100644 --- a/lib/private/Preview/TGA.php +++ b/lib/private/Preview/TGA.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Preview/Watcher.php b/lib/private/Preview/Watcher.php index abddd7b5acb..115b0e59ccd 100644 --- a/lib/private/Preview/Watcher.php +++ b/lib/private/Preview/Watcher.php @@ -47,7 +47,7 @@ class Watcher { if (is_null($node->getId())) { return; } - $folder = $this->appData->getFolder((string)$node->getId()); + $folder = $this->appData->getFolder((string) $node->getId()); $folder->delete(); } catch (NotFoundException $e) { //Nothing to do diff --git a/lib/private/Preview/WebP.php b/lib/private/Preview/WebP.php index 25b922e9190..4b12546d6d5 100644 --- a/lib/private/Preview/WebP.php +++ b/lib/private/Preview/WebP.php @@ -19,6 +19,6 @@ class WebP extends Image { } public function isAvailable(FileInfo $file): bool { - return (bool)(imagetypes() & IMG_WEBP); + return (bool) (imagetypes() & IMG_WEBP); } } diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index 6571643d3d0..68f5ed9aade 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -389,7 +389,7 @@ class PreviewManager implements IPreview { if (is_string($movieBinary)) { - $this->registerCoreProvider(Preview\Movie::class, '/video\/.*/', ["movieBinary" => $movieBinary]); + $this->registerCoreProvider(Preview\Movie::class, '/video\/.*/', ['movieBinary' => $movieBinary]); } } } diff --git a/lib/private/PreviewNotAvailableException.php b/lib/private/PreviewNotAvailableException.php index b1fec912769..582f337acd1 100644 --- a/lib/private/PreviewNotAvailableException.php +++ b/lib/private/PreviewNotAvailableException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Profiler/FileProfilerStorage.php b/lib/private/Profiler/FileProfilerStorage.php index 8cb6f2e6f79..2f377ba3a5a 100644 --- a/lib/private/Profiler/FileProfilerStorage.php +++ b/lib/private/Profiler/FileProfilerStorage.php @@ -81,7 +81,7 @@ class FileProfilerStorage { $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST); foreach ($iterator as $file) { - $file = (string)$file->getPathInfo(); + $file = (string) $file->getPathInfo(); if (is_file($file)) { unlink($file); } else { diff --git a/lib/private/RedisFactory.php b/lib/private/RedisFactory.php index b5779cbfbaa..bbe4c27ac5c 100644 --- a/lib/private/RedisFactory.php +++ b/lib/private/RedisFactory.php @@ -13,7 +13,7 @@ class RedisFactory { public const REDIS_MINIMAL_VERSION = '4.0.0'; public const REDIS_EXTRA_PARAMETERS_MINIMAL_VERSION = '5.3.0'; - /** @var \Redis|\RedisCluster */ + /** @var \Redis|\RedisCluster */ private $instance; private SystemConfig $config; @@ -44,8 +44,8 @@ class RedisFactory { $readTimeout = $config['read_timeout'] ?? 0.0; $auth = null; - if (isset($config['password']) && (string)$config['password'] !== '') { - if (isset($config['user']) && (string)$config['user'] !== '') { + if (isset($config['password']) && (string) $config['password'] !== '') { + if (isset($config['user']) && (string) $config['user'] !== '') { $auth = [$config['user'], $config['password']]; } else { $auth = $config['password']; diff --git a/lib/private/Remote/Api/ApiBase.php b/lib/private/Remote/Api/ApiBase.php index dff3edb51b9..b2f96fb3c24 100644 --- a/lib/private/Remote/Api/ApiBase.php +++ b/lib/private/Remote/Api/ApiBase.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Remote/Api/ApiCollection.php b/lib/private/Remote/Api/ApiCollection.php index 65039f4b5aa..f154cd21926 100644 --- a/lib/private/Remote/Api/ApiCollection.php +++ b/lib/private/Remote/Api/ApiCollection.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Remote/Api/ApiFactory.php b/lib/private/Remote/Api/ApiFactory.php index 7daddd16011..795584e566a 100644 --- a/lib/private/Remote/Api/ApiFactory.php +++ b/lib/private/Remote/Api/ApiFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Remote/Api/NotFoundException.php b/lib/private/Remote/Api/NotFoundException.php index 5251313f5f0..361d03d24ed 100644 --- a/lib/private/Remote/Api/NotFoundException.php +++ b/lib/private/Remote/Api/NotFoundException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Remote/Api/OCS.php b/lib/private/Remote/Api/OCS.php index de07eb8bc56..36bc22751a5 100644 --- a/lib/private/Remote/Api/OCS.php +++ b/lib/private/Remote/Api/OCS.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Remote/Credentials.php b/lib/private/Remote/Credentials.php index fb0f03ae148..7f1ffaa727c 100644 --- a/lib/private/Remote/Credentials.php +++ b/lib/private/Remote/Credentials.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Remote/Instance.php b/lib/private/Remote/Instance.php index ac3233b93c9..59d12de3ebb 100644 --- a/lib/private/Remote/Instance.php +++ b/lib/private/Remote/Instance.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Remote/InstanceFactory.php b/lib/private/Remote/InstanceFactory.php index f3047b851b2..f1b7a1de4ba 100644 --- a/lib/private/Remote/InstanceFactory.php +++ b/lib/private/Remote/InstanceFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Remote/User.php b/lib/private/Remote/User.php index 5c8e9d3ca4e..ae1032cdc1c 100644 --- a/lib/private/Remote/User.php +++ b/lib/private/Remote/User.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair.php b/lib/private/Repair.php index cfcdfc22d0d..501b9b1300f 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -100,7 +100,7 @@ class Repair implements IOutput { try { $step->run($this); } catch (\Exception $e) { - $this->logger->error("Exception while executing repair step " . $step->getName(), ['exception' => $e]); + $this->logger->error('Exception while executing repair step ' . $step->getName(), ['exception' => $e]); $this->dispatcher->dispatchTyped(new RepairErrorEvent($e->getMessage())); } } diff --git a/lib/private/Repair/AddAppConfigLazyMigration.php b/lib/private/Repair/AddAppConfigLazyMigration.php index 7ae83e87669..30683325dc2 100644 --- a/lib/private/Repair/AddAppConfigLazyMigration.php +++ b/lib/private/Repair/AddAppConfigLazyMigration.php @@ -36,7 +36,7 @@ class AddAppConfigLazyMigration implements IRepairStep { $c = 0; foreach (self::$lazyAppConfig as $appId => $configKeys) { foreach ($configKeys as $configKey) { - $c += (int)$this->appConfig->updateLazy($appId, $configKey, true); + $c += (int) $this->appConfig->updateLazy($appId, $configKey, true); } } diff --git a/lib/private/Repair/AddCleanupUpdaterBackupsJob.php b/lib/private/Repair/AddCleanupUpdaterBackupsJob.php index 8bd938b7e3a..e631a3303f1 100644 --- a/lib/private/Repair/AddCleanupUpdaterBackupsJob.php +++ b/lib/private/Repair/AddCleanupUpdaterBackupsJob.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/AddMetadataGenerationJob.php b/lib/private/Repair/AddMetadataGenerationJob.php index 4535fb0c9e0..76c60f303a7 100644 --- a/lib/private/Repair/AddMetadataGenerationJob.php +++ b/lib/private/Repair/AddMetadataGenerationJob.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/CleanTags.php b/lib/private/Repair/CleanTags.php index b7960a1def1..7b796bc3d4b 100644 --- a/lib/private/Repair/CleanTags.php +++ b/lib/private/Repair/CleanTags.php @@ -147,8 +147,8 @@ class CleanTags implements IRepairStep { * @param string $deleteId * @param string $sourceTable * @param string $sourceId - * @param string $sourceNullColumn If this column is null in the source table, - * the entry is deleted in the $deleteTable + * @param string $sourceNullColumn If this column is null in the source table, + * the entry is deleted in the $deleteTable */ protected function deleteOrphanEntries(IOutput $output, $repairInfo, $deleteTable, $deleteId, $sourceTable, $sourceId, $sourceNullColumn) { $qb = $this->connection->getQueryBuilder(); diff --git a/lib/private/Repair/ClearFrontendCaches.php b/lib/private/Repair/ClearFrontendCaches.php index 77a3df5598a..5c57a63379d 100644 --- a/lib/private/Repair/ClearFrontendCaches.php +++ b/lib/private/Repair/ClearFrontendCaches.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/ClearGeneratedAvatarCache.php b/lib/private/Repair/ClearGeneratedAvatarCache.php index 2dea4bd2d61..0f743afbb4c 100644 --- a/lib/private/Repair/ClearGeneratedAvatarCache.php +++ b/lib/private/Repair/ClearGeneratedAvatarCache.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/ClearGeneratedAvatarCacheJob.php b/lib/private/Repair/ClearGeneratedAvatarCacheJob.php index 38cf03b731a..524a470e62a 100644 --- a/lib/private/Repair/ClearGeneratedAvatarCacheJob.php +++ b/lib/private/Repair/ClearGeneratedAvatarCacheJob.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/Collation.php b/lib/private/Repair/Collation.php index a01a684151b..9557aabd718 100644 --- a/lib/private/Repair/Collation.php +++ b/lib/private/Repair/Collation.php @@ -15,7 +15,7 @@ use OCP\Migration\IRepairStep; use Psr\Log\LoggerInterface; class Collation implements IRepairStep { - /** @var IConfig */ + /** @var IConfig */ protected $config; protected LoggerInterface $logger; @@ -92,14 +92,14 @@ class Collation implements IRepairStep { * @return string[] */ protected function getAllNonUTF8BinTables(IDBConnection $connection) { - $dbName = $this->config->getSystemValueString("dbname"); + $dbName = $this->config->getSystemValueString('dbname'); $characterSet = $this->config->getSystemValueBool('mysql.utf8mb4', false) ? 'utf8mb4' : 'utf8'; // fetch tables by columns $statement = $connection->executeQuery( - "SELECT DISTINCT(TABLE_NAME) AS `table`" . - " FROM INFORMATION_SCHEMA . COLUMNS" . - " WHERE TABLE_SCHEMA = ?" . + 'SELECT DISTINCT(TABLE_NAME) AS `table`' . + ' FROM INFORMATION_SCHEMA . COLUMNS' . + ' WHERE TABLE_SCHEMA = ?' . " AND (COLLATION_NAME <> '" . $characterSet . "_bin' OR CHARACTER_SET_NAME <> '" . $characterSet . "')" . " AND TABLE_NAME LIKE '*PREFIX*%'", [$dbName] @@ -112,9 +112,9 @@ class Collation implements IRepairStep { // fetch tables by collation $statement = $connection->executeQuery( - "SELECT DISTINCT(TABLE_NAME) AS `table`" . - " FROM INFORMATION_SCHEMA . TABLES" . - " WHERE TABLE_SCHEMA = ?" . + 'SELECT DISTINCT(TABLE_NAME) AS `table`' . + ' FROM INFORMATION_SCHEMA . TABLES' . + ' WHERE TABLE_SCHEMA = ?' . " AND TABLE_COLLATION <> '" . $characterSet . "_bin'" . " AND TABLE_NAME LIKE '*PREFIX*%'", [$dbName] diff --git a/lib/private/Repair/MoveUpdaterStepFile.php b/lib/private/Repair/MoveUpdaterStepFile.php index c9b51b308c4..e6a42890032 100644 --- a/lib/private/Repair/MoveUpdaterStepFile.php +++ b/lib/private/Repair/MoveUpdaterStepFile.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/NC13/AddLogRotateJob.php b/lib/private/Repair/NC13/AddLogRotateJob.php index 8fe68a42819..bd6c510785f 100644 --- a/lib/private/Repair/NC13/AddLogRotateJob.php +++ b/lib/private/Repair/NC13/AddLogRotateJob.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php b/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php index 4f80b3809e8..5cee33b381c 100644 --- a/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php +++ b/lib/private/Repair/NC21/AddCheckForUserCertificatesJob.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/NC25/AddMissingSecretJob.php b/lib/private/Repair/NC25/AddMissingSecretJob.php index b407ef2a2a9..46b89d5f6f7 100644 --- a/lib/private/Repair/NC25/AddMissingSecretJob.php +++ b/lib/private/Repair/NC25/AddMissingSecretJob.php @@ -33,7 +33,7 @@ class AddMissingSecretJob implements IRepairStep { try { $this->config->setSystemValue('passwordsalt', $this->random->generate(30)); } catch (HintException $e) { - $output->warning("passwordsalt is missing from your config.php and your config.php is read only. Please fix it manually."); + $output->warning('passwordsalt is missing from your config.php and your config.php is read only. Please fix it manually.'); } } @@ -42,7 +42,7 @@ class AddMissingSecretJob implements IRepairStep { try { $this->config->setSystemValue('secret', $this->random->generate(48)); } catch (HintException $e) { - $output->warning("secret is missing from your config.php and your config.php is read only. Please fix it manually."); + $output->warning('secret is missing from your config.php and your config.php is read only. Please fix it manually.'); } } } diff --git a/lib/private/Repair/OldGroupMembershipShares.php b/lib/private/Repair/OldGroupMembershipShares.php index 54f2078395e..660812e256f 100644 --- a/lib/private/Repair/OldGroupMembershipShares.php +++ b/lib/private/Repair/OldGroupMembershipShares.php @@ -57,9 +57,9 @@ class OldGroupMembershipShares implements IRepairStep { ->from('share', 's1') ->where($query->expr()->isNotNull('s1.parent')) // \OC\Share\Constant::$shareTypeGroupUserUnique === 2 - ->andWhere($query->expr()->eq('s1.share_type', $query->expr()->literal(2))) - ->andWhere($query->expr()->isNotNull('s2.id')) - ->andWhere($query->expr()->eq('s2.share_type', $query->expr()->literal(IShare::TYPE_GROUP))) + ->andWhere($query->expr()->eq('s1.share_type', $query->expr()->literal(2))) + ->andWhere($query->expr()->isNotNull('s2.id')) + ->andWhere($query->expr()->eq('s2.share_type', $query->expr()->literal(IShare::TYPE_GROUP))) ->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id')); $deleteQuery = $this->connection->getQueryBuilder(); diff --git a/lib/private/Repair/Owncloud/CleanPreviews.php b/lib/private/Repair/Owncloud/CleanPreviews.php index 86e173cf402..50ee965e087 100644 --- a/lib/private/Repair/Owncloud/CleanPreviews.php +++ b/lib/private/Repair/Owncloud/CleanPreviews.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/Owncloud/DropAccountTermsTable.php b/lib/private/Repair/Owncloud/DropAccountTermsTable.php index 18f169c9b49..534825c146a 100644 --- a/lib/private/Repair/Owncloud/DropAccountTermsTable.php +++ b/lib/private/Repair/Owncloud/DropAccountTermsTable.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/Owncloud/MigrateOauthTables.php b/lib/private/Repair/Owncloud/MigrateOauthTables.php index 466b8d7adb7..de26a907e02 100644 --- a/lib/private/Repair/Owncloud/MigrateOauthTables.php +++ b/lib/private/Repair/Owncloud/MigrateOauthTables.php @@ -44,7 +44,7 @@ class MigrateOauthTables implements IRepairStep { public function run(IOutput $output) { $schema = new SchemaWrapper($this->db); if (!$schema->hasTable('oauth2_clients')) { - $output->info("oauth2_clients table does not exist."); + $output->info('oauth2_clients table does not exist.'); return; } @@ -154,7 +154,7 @@ class MigrateOauthTables implements IRepairStep { $result->closeCursor(); // 2. Insert them into the client_identifier column. - foreach ($identifiers as ["id" => $id, "identifier" => $clientIdentifier]) { + foreach ($identifiers as ['id' => $id, 'identifier' => $clientIdentifier]) { $insertQuery = $this->db->getQueryBuilder(); $insertQuery->update('oauth2_clients') ->set('client_identifier', $insertQuery->createNamedParameter($clientIdentifier, IQueryBuilder::PARAM_STR)) diff --git a/lib/private/Repair/Owncloud/MoveAvatars.php b/lib/private/Repair/Owncloud/MoveAvatars.php index 7fdabae7a66..9e3f4b89b13 100644 --- a/lib/private/Repair/Owncloud/MoveAvatars.php +++ b/lib/private/Repair/Owncloud/MoveAvatars.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/Owncloud/SaveAccountsTableData.php b/lib/private/Repair/Owncloud/SaveAccountsTableData.php index 1b6da7c858f..a5d47abd00d 100644 --- a/lib/private/Repair/Owncloud/SaveAccountsTableData.php +++ b/lib/private/Repair/Owncloud/SaveAccountsTableData.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/Owncloud/UpdateLanguageCodes.php b/lib/private/Repair/Owncloud/UpdateLanguageCodes.php index e27ab06b2f3..8d9046ad49f 100644 --- a/lib/private/Repair/Owncloud/UpdateLanguageCodes.php +++ b/lib/private/Repair/Owncloud/UpdateLanguageCodes.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Repair/RemoveLinkShares.php b/lib/private/Repair/RemoveLinkShares.php index f128b6f731b..65ed319207d 100644 --- a/lib/private/Repair/RemoveLinkShares.php +++ b/lib/private/Repair/RemoveLinkShares.php @@ -152,7 +152,7 @@ class RemoveLinkShares implements IRepairStep { $this->addToNotify($data['uid_owner']); $this->addToNotify($data['uid_initiator']); - $this->deleteShare((int)$id); + $this->deleteShare((int) $id); } /** diff --git a/lib/private/Repair/RepairInvalidShares.php b/lib/private/Repair/RepairInvalidShares.php index f28ae1c45fb..d6d154bf872 100644 --- a/lib/private/Repair/RepairInvalidShares.php +++ b/lib/private/Repair/RepairInvalidShares.php @@ -65,7 +65,7 @@ class RepairInvalidShares implements IRepairStep { $query->select('s1.parent') ->from('share', 's1') ->where($query->expr()->isNotNull('s1.parent')) - ->andWhere($query->expr()->isNull('s2.id')) + ->andWhere($query->expr()->isNull('s2.id')) ->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id')) ->groupBy('s1.parent') ->setMaxResults(self::CHUNK_SIZE); diff --git a/lib/private/Repair/RepairMimeTypes.php b/lib/private/Repair/RepairMimeTypes.php index ce13151b581..b3451a9270c 100644 --- a/lib/private/Repair/RepairMimeTypes.php +++ b/lib/private/Repair/RepairMimeTypes.php @@ -52,7 +52,7 @@ class RepairMimeTypes implements IRepairStep { if (empty($this->folderMimeTypeId)) { $query->setParameter('mimetype', 'httpd/unix-directory'); $result = $query->execute(); - $this->folderMimeTypeId = (int)$result->fetchOne(); + $this->folderMimeTypeId = (int) $result->fetchOne(); $result->closeCursor(); } @@ -70,7 +70,7 @@ class RepairMimeTypes implements IRepairStep { // get target mimetype id $query->setParameter('mimetype', $mimetype); $result = $query->execute(); - $mimetypeId = (int)$result->fetchOne(); + $mimetypeId = (int) $result->fetchOne(); $result->closeCursor(); if (!$mimetypeId) { @@ -227,10 +227,10 @@ class RepairMimeTypes implements IRepairStep { */ private function introduceFlatOpenDocumentType(): IResult|int|null { $updatedMimetypes = [ - "fodt" => "application/vnd.oasis.opendocument.text-flat-xml", - "fods" => "application/vnd.oasis.opendocument.spreadsheet-flat-xml", - "fodg" => "application/vnd.oasis.opendocument.graphics-flat-xml", - "fodp" => "application/vnd.oasis.opendocument.presentation-flat-xml", + 'fodt' => 'application/vnd.oasis.opendocument.text-flat-xml', + 'fods' => 'application/vnd.oasis.opendocument.spreadsheet-flat-xml', + 'fodg' => 'application/vnd.oasis.opendocument.graphics-flat-xml', + 'fodp' => 'application/vnd.oasis.opendocument.presentation-flat-xml', ]; return $this->updateMimetypes($updatedMimetypes); @@ -252,8 +252,8 @@ class RepairMimeTypes implements IRepairStep { */ private function introduceOnlyofficeFormType(): IResult|int|null { $updatedMimetypes = [ - "oform" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform", - "docxf" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf", + 'oform' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform', + 'docxf' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf', ]; return $this->updateMimetypes($updatedMimetypes); diff --git a/lib/private/RichObjectStrings/Validator.php b/lib/private/RichObjectStrings/Validator.php index 41c2456ba27..3cbdc65c9b8 100644 --- a/lib/private/RichObjectStrings/Validator.php +++ b/lib/private/RichObjectStrings/Validator.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Route/CachingRouter.php b/lib/private/Route/CachingRouter.php index 7dd26827d3c..95bf559fa39 100644 --- a/lib/private/Route/CachingRouter.php +++ b/lib/private/Route/CachingRouter.php @@ -42,7 +42,7 @@ class CachingRouter extends Router { */ public function generate($name, $parameters = [], $absolute = false) { asort($parameters); - $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . (int)$absolute; + $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . (int) $absolute; $cachedKey = $this->cache->get($key); if ($cachedKey) { return $cachedKey; diff --git a/lib/private/Route/Route.php b/lib/private/Route/Route.php index 2fef3b10806..ab5a1f6b59a 100644 --- a/lib/private/Route/Route.php +++ b/lib/private/Route/Route.php @@ -128,7 +128,7 @@ class Route extends SymfonyRoute implements IRoute { */ public function actionInclude($file) { $function = function ($param) use ($file) { - unset($param["_route"]); + unset($param['_route']); $_GET = array_merge($_GET, $param); unset($param); require_once "$file"; diff --git a/lib/private/Search/SearchQuery.php b/lib/private/Search/SearchQuery.php index a78443922ae..791edb7a0f7 100644 --- a/lib/private/Search/SearchQuery.php +++ b/lib/private/Search/SearchQuery.php @@ -25,7 +25,7 @@ class SearchQuery implements ISearchQuery { private int $limit = self::LIMIT_DEFAULT, private int|string|null $cursor = null, private string $route = '', - private array $routeParameters = [], + private array $routeParameters = [], ) { } diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php index 7e310035ce4..9254281132a 100644 --- a/lib/private/Security/Bruteforce/Throttler.php +++ b/lib/private/Security/Bruteforce/Throttler.php @@ -55,7 +55,7 @@ class Throttler implements IThrottler { } $ipAddress = new IpAddress($ip); - if ($this->isBypassListed((string)$ipAddress)) { + if ($this->isBypassListed((string) $ipAddress)) { return; } @@ -71,7 +71,7 @@ class Throttler implements IThrottler { ); $this->backend->registerAttempt( - (string)$ipAddress, + (string) $ipAddress, $ipAddress->getSubnet(), $this->timeFactory->getTime(), $action, @@ -113,7 +113,7 @@ class Throttler implements IThrottler { $cx = explode('/', $cidr); $addr = $cx[0]; - $mask = (int)$cx[1]; + $mask = (int) $cx[1]; // Do not compare ipv4 to ipv6 if (($type === 4 && !filter_var($addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) || @@ -125,8 +125,8 @@ class Throttler implements IThrottler { $valid = true; for ($i = 0; $i < $mask; $i++) { - $part = ord($addr[(int)($i / 8)]); - $orig = ord($ip[(int)($i / 8)]); + $part = ord($addr[(int) ($i / 8)]); + $orig = ord($ip[(int) ($i / 8)]); $bitmask = 1 << (7 - ($i % 8)); @@ -172,7 +172,7 @@ class Throttler implements IThrottler { } $ipAddress = new IpAddress($ip); - if ($this->isBypassListed((string)$ipAddress)) { + if ($this->isBypassListed((string) $ipAddress)) { return 0; } @@ -217,7 +217,7 @@ class Throttler implements IThrottler { } $ipAddress = new IpAddress($ip); - if ($this->isBypassListed((string)$ipAddress)) { + if ($this->isBypassListed((string) $ipAddress)) { return; } @@ -240,7 +240,7 @@ class Throttler implements IThrottler { } $ipAddress = new IpAddress($ip); - if ($this->isBypassListed((string)$ipAddress)) { + if ($this->isBypassListed((string) $ipAddress)) { return; } diff --git a/lib/private/Security/CSP/ContentSecurityPolicyManager.php b/lib/private/Security/CSP/ContentSecurityPolicyManager.php index 77ecceb03c3..1b9b4a79977 100644 --- a/lib/private/Security/CSP/ContentSecurityPolicyManager.php +++ b/lib/private/Security/CSP/ContentSecurityPolicyManager.php @@ -51,7 +51,7 @@ class ContentSecurityPolicyManager implements IContentSecurityPolicyManager { ContentSecurityPolicy $defaultPolicy, EmptyContentSecurityPolicy $originalPolicy, ): ContentSecurityPolicy { - foreach ((object)(array)$originalPolicy as $name => $value) { + foreach ((object) (array) $originalPolicy as $name => $value) { $setter = 'set'.ucfirst($name); if (\is_array($value)) { $getter = 'get'.ucfirst($name); diff --git a/lib/private/Security/FeaturePolicy/FeaturePolicyManager.php b/lib/private/Security/FeaturePolicy/FeaturePolicyManager.php index e50aaac0faf..3b9b4385ac8 100644 --- a/lib/private/Security/FeaturePolicy/FeaturePolicyManager.php +++ b/lib/private/Security/FeaturePolicy/FeaturePolicyManager.php @@ -44,7 +44,7 @@ class FeaturePolicyManager { FeaturePolicy $defaultPolicy, EmptyFeaturePolicy $originalPolicy, ): FeaturePolicy { - foreach ((object)(array)$originalPolicy as $name => $value) { + foreach ((object) (array) $originalPolicy as $name => $value) { $setter = 'set' . ucfirst($name); if (\is_array($value)) { $getter = 'get' . ucfirst($name); diff --git a/lib/private/Security/Hasher.php b/lib/private/Security/Hasher.php index 3ab0e1bbcac..3141ecf474d 100644 --- a/lib/private/Security/Hasher.php +++ b/lib/private/Security/Hasher.php @@ -84,8 +84,8 @@ class Hasher implements IHasher { protected function splitHash(string $prefixedHash): ?array { $explodedString = explode('|', $prefixedHash, 2); if (\count($explodedString) === 2) { - if ((int)$explodedString[0] > 0) { - return ['version' => (int)$explodedString[0], 'hash' => $explodedString[1]]; + if ((int) $explodedString[0] > 0) { + return ['version' => (int) $explodedString[0], 'hash' => $explodedString[1]]; } } diff --git a/lib/private/Security/Ip/Address.php b/lib/private/Security/Ip/Address.php index 217dae5feff..ef45b988525 100644 --- a/lib/private/Security/Ip/Address.php +++ b/lib/private/Security/Ip/Address.php @@ -34,7 +34,7 @@ class Address implements IAddress { } public function matches(IRange... $ranges): bool { - foreach($ranges as $range) { + foreach ($ranges as $range) { if ($range->contains($this)) { return true; } diff --git a/lib/private/Security/RateLimiting/Backend/DatabaseBackend.php b/lib/private/Security/RateLimiting/Backend/DatabaseBackend.php index 34fddff539b..f4ec15ead46 100644 --- a/lib/private/Security/RateLimiting/Backend/DatabaseBackend.php +++ b/lib/private/Security/RateLimiting/Backend/DatabaseBackend.php @@ -57,7 +57,7 @@ class DatabaseBackend implements IBackend { $row = $cursor->fetchOne(); $cursor->closeCursor(); - return (int)$row; + return (int) $row; } /** diff --git a/lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php b/lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php index 84eb9fbd084..99511e0d68d 100644 --- a/lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php +++ b/lib/private/Security/RateLimiting/Backend/MemoryCacheBackend.php @@ -93,7 +93,7 @@ class MemoryCacheBackend implements IBackend { $existingAttempts = array_values($existingAttempts); // Store the new attempt - $existingAttempts[] = (string)($currentTime + $period); + $existingAttempts[] = (string) ($currentTime + $period); if (!$this->config->getSystemValueBool('ratelimit.protection.enabled', true)) { return; diff --git a/lib/private/Security/SecureRandom.php b/lib/private/Security/SecureRandom.php index 459d43475b7..b2a3d19ce74 100644 --- a/lib/private/Security/SecureRandom.php +++ b/lib/private/Security/SecureRandom.php @@ -24,7 +24,7 @@ class SecureRandom implements ISecureRandom { * Generate a secure random string of specified length. * @param int $length The length of the generated string * @param string $characters An optional list of characters to use if no character list is - * specified all valid base64 characters are used. + * specified all valid base64 characters are used. * @throws \LengthException if an invalid length is requested */ public function generate( diff --git a/lib/private/Security/VerificationToken/CleanUpJob.php b/lib/private/Security/VerificationToken/CleanUpJob.php index ba8f4352f80..a3836ba97aa 100644 --- a/lib/private/Security/VerificationToken/CleanUpJob.php +++ b/lib/private/Security/VerificationToken/CleanUpJob.php @@ -33,10 +33,10 @@ class CleanUpJob extends Job { public function setArgument($argument): void { parent::setArgument($argument); $args = \json_decode($argument, true); - $this->userId = (string)$args['userId']; - $this->subject = (string)$args['subject']; - $this->pwdPrefix = (string)$args['pp']; - $this->runNotBefore = (int)$args['notBefore']; + $this->userId = (string) $args['userId']; + $this->subject = (string) $args['subject']; + $this->pwdPrefix = (string) $args['pp']; + $this->runNotBefore = (int) $args['notBefore']; } protected function run($argument): void { diff --git a/lib/private/Server.php b/lib/private/Server.php index 2ba8eed8aea..b68fcdfbf97 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index c96b73474fa..6a47597d465 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Settings/Section.php b/lib/private/Settings/Section.php index 4f8234254b1..6cd8885d2df 100644 --- a/lib/private/Settings/Section.php +++ b/lib/private/Settings/Section.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -32,7 +33,7 @@ class Section implements IIconSection { /** * @return string The ID of the section. It is supposed to be a lower case string, - * e.g. 'ldap' + * e.g. 'ldap' */ public function getID() { return $this->id; @@ -40,7 +41,7 @@ class Section implements IIconSection { /** * @return string The translated name as it should be displayed, e.g. 'LDAP / AD - * integration'. Use the L10N service to translate it. + * integration'. Use the L10N service to translate it. */ public function getName() { return $this->name; @@ -48,8 +49,8 @@ class Section implements IIconSection { /** * @return int whether the form should be rather on the top or bottom of - * the settings navigation. The sections are arranged in ascending order of - * the priority values. It is required to return a value between 0 and 99. + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. * * E.g.: 70 */ @@ -59,7 +60,7 @@ class Section implements IIconSection { /** * @return string The relative path to an 16*16 icon describing the section. - * e.g. '/core/img/places/files.svg' + * e.g. '/core/img/places/files.svg' * * @since 12 */ diff --git a/lib/private/Setup.php b/lib/private/Setup.php index b7ba2f24eab..5a26484efca 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -148,7 +148,7 @@ class Setup { * a few system checks. * * @return array of system info, including an "errors" value - * in case of errors/warnings + * in case of errors/warnings */ public function getSystemInfo(bool $allowAllDatabases = false): array { $databases = $this->getSupportedDatabases($allowAllDatabases); @@ -231,7 +231,7 @@ class Setup { $error[] = $l->t('Set an admin password.'); } if (empty($options['directory'])) { - $options['directory'] = \OC::$SERVERROOT . "/data"; + $options['directory'] = \OC::$SERVERROOT . '/data'; } if (!isset(self::$dbSetupClasses[$dbType])) { @@ -249,7 +249,7 @@ class Setup { // validate the data directory if ((!is_dir($dataDir) && !mkdir($dataDir)) || !is_writable($dataDir)) { - $error[] = $l->t("Cannot create or write into the data directory %s", [$dataDir]); + $error[] = $l->t('Cannot create or write into the data directory %s', [$dataDir]); } if (!empty($error)) { @@ -341,7 +341,7 @@ class Setup { } $config = Server::get(IConfig::class); - $config->setAppValue('core', 'installedat', (string)microtime(true)); + $config->setAppValue('core', 'installedat', (string) microtime(true)); $appConfig = Server::get(IAppConfig::class); $appConfig->setValueInt('core', 'lastupdatedat', time()); @@ -393,7 +393,7 @@ class Setup { $userSession->login($username, $password); $user = $userSession->getUser(); if (!$user) { - $error[] = "No account found in session."; + $error[] = 'No account found in session.'; return $error; } $userSession->createSessionToken($request, $user->getUID(), $username, $password); @@ -510,12 +510,12 @@ class Setup { if (function_exists('disk_free_space')) { $df = disk_free_space(\OC::$SERVERROOT); $size = strlen($content) + 10240; - if ($df !== false && $df < (float)$size) { - throw new \Exception(\OC::$SERVERROOT . " does not have enough space for writing the htaccess file! Not writing it back!"); + if ($df !== false && $df < (float) $size) { + throw new \Exception(\OC::$SERVERROOT . ' does not have enough space for writing the htaccess file! Not writing it back!'); } } //suppress errors in case we don't have permissions for it - return (bool)@file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent . $content . "\n"); + return (bool) @file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent . $content . "\n"); } public static function protectDataDirectory(): void { @@ -544,7 +544,7 @@ class Setup { $content .= "# Section for Apache 2.2 to 2.6\n"; $content .= "<IfModule mod_autoindex.c>\n"; $content .= " IndexIgnore *\n"; - $content .= "</IfModule>"; + $content .= '</IfModule>'; $baseDir = Server::get(IConfig::class)->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data'); file_put_contents($baseDir . '/.htaccess', $content); @@ -557,8 +557,8 @@ class Setup { /** @var mixed $vendor */ /** @var mixed $OC_Channel */ return [ - 'vendor' => (string)$vendor, - 'channel' => (string)$OC_Channel, + 'vendor' => (string) $vendor, + 'channel' => (string) $OC_Channel, ]; } diff --git a/lib/private/Setup/AbstractDatabase.php b/lib/private/Setup/AbstractDatabase.php index e96ca8a2f3e..b1d93f55cc0 100644 --- a/lib/private/Setup/AbstractDatabase.php +++ b/lib/private/Setup/AbstractDatabase.php @@ -50,14 +50,14 @@ abstract class AbstractDatabase { public function validate($config) { $errors = []; if (empty($config['dbuser']) && empty($config['dbname'])) { - $errors[] = $this->trans->t("Enter the database Login and name for %s", [$this->dbprettyname]); + $errors[] = $this->trans->t('Enter the database Login and name for %s', [$this->dbprettyname]); } elseif (empty($config['dbuser'])) { - $errors[] = $this->trans->t("Enter the database Login for %s", [$this->dbprettyname]); + $errors[] = $this->trans->t('Enter the database Login for %s', [$this->dbprettyname]); } elseif (empty($config['dbname'])) { - $errors[] = $this->trans->t("Enter the database name for %s", [$this->dbprettyname]); + $errors[] = $this->trans->t('Enter the database name for %s', [$this->dbprettyname]); } if (substr_count($config['dbname'], '.') >= 1) { - $errors[] = $this->trans->t("You cannot use dots in the database name %s", [$this->dbprettyname]); + $errors[] = $this->trans->t('You cannot use dots in the database name %s', [$this->dbprettyname]); } return $errors; } @@ -70,9 +70,9 @@ abstract class AbstractDatabase { $dbPort = !empty($config['dbport']) ? $config['dbport'] : ''; $dbTablePrefix = $config['dbtableprefix'] ?? 'oc_'; - $createUserConfig = $this->config->getValue("setup_create_db_user", true); + $createUserConfig = $this->config->getValue('setup_create_db_user', true); // accept `false` both as bool and string, since setting config values from env will result in a string - $this->tryCreateDbUser = $createUserConfig !== false && $createUserConfig !== "false"; + $this->tryCreateDbUser = $createUserConfig !== false && $createUserConfig !== 'false'; $this->config->setValues([ 'dbname' => $dbName, @@ -133,7 +133,7 @@ abstract class AbstractDatabase { abstract public function setupDatabase($username); public function runMigrations(?IOutput $output = null) { - if (!is_dir(\OC::$SERVERROOT."/core/Migrations")) { + if (!is_dir(\OC::$SERVERROOT.'/core/Migrations')) { return; } $ms = new MigrationService('core', \OC::$server->get(Connection::class), $output); diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php index 93aee667d18..a207965d725 100644 --- a/lib/private/Setup/MySQL.php +++ b/lib/private/Setup/MySQL.php @@ -162,7 +162,7 @@ class MySQL extends AbstractDatabase { break; } else { //repeat with different username - $length = strlen((string)$i); + $length = strlen((string) $i); $adminUser = substr('oc_' . $username, 0, 16 - $length) . $i; $i++; } diff --git a/lib/private/Setup/OCI.php b/lib/private/Setup/OCI.php index 3a0fa34d8d1..47e5e5436a5 100644 --- a/lib/private/Setup/OCI.php +++ b/lib/private/Setup/OCI.php @@ -31,11 +31,11 @@ class OCI extends AbstractDatabase { public function validate($config) { $errors = []; if (empty($config['dbuser']) && empty($config['dbname'])) { - $errors[] = $this->trans->t("Enter the database Login and name for %s", [$this->dbprettyname]); + $errors[] = $this->trans->t('Enter the database Login and name for %s', [$this->dbprettyname]); } elseif (empty($config['dbuser'])) { - $errors[] = $this->trans->t("Enter the database Login for %s", [$this->dbprettyname]); + $errors[] = $this->trans->t('Enter the database Login for %s', [$this->dbprettyname]); } elseif (empty($config['dbname'])) { - $errors[] = $this->trans->t("Enter the database name for %s", [$this->dbprettyname]); + $errors[] = $this->trans->t('Enter the database name for %s', [$this->dbprettyname]); } return $errors; } diff --git a/lib/private/Setup/PostgreSQL.php b/lib/private/Setup/PostgreSQL.php index 4ece8957ce6..c2d5ca2c28d 100644 --- a/lib/private/Setup/PostgreSQL.php +++ b/lib/private/Setup/PostgreSQL.php @@ -101,7 +101,7 @@ class PostgreSQL extends AbstractDatabase { private function createDatabase(Connection $connection) { if (!$this->databaseExists($connection)) { //The database does not exists... let's create it - $query = $connection->prepare("CREATE DATABASE " . addslashes($this->dbName) . " OWNER \"" . addslashes($this->dbUser) . '"'); + $query = $connection->prepare('CREATE DATABASE ' . addslashes($this->dbName) . ' OWNER "' . addslashes($this->dbUser) . '"'); try { $query->execute(); } catch (DatabaseException $e) { @@ -110,7 +110,7 @@ class PostgreSQL extends AbstractDatabase { ]); } } else { - $query = $connection->prepare("REVOKE ALL PRIVILEGES ON DATABASE " . addslashes($this->dbName) . " FROM PUBLIC"); + $query = $connection->prepare('REVOKE ALL PRIVILEGES ON DATABASE ' . addslashes($this->dbName) . ' FROM PUBLIC'); try { $query->execute(); } catch (DatabaseException $e) { @@ -151,7 +151,7 @@ class PostgreSQL extends AbstractDatabase { } // create the user - $query = $connection->prepare("CREATE USER \"" . addslashes($this->dbUser) . "\" CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'"); + $query = $connection->prepare('CREATE USER "' . addslashes($this->dbUser) . "\" CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'"); $query->execute(); if ($this->databaseExists($connection)) { $query = $connection->prepare('GRANT CONNECT ON DATABASE ' . addslashes($this->dbName) . ' TO "' . addslashes($this->dbUser) . '"'); diff --git a/lib/private/Share/Helper.php b/lib/private/Share/Helper.php index 76e7daeb9e5..aaa6c2b3ae5 100644 --- a/lib/private/Share/Helper.php +++ b/lib/private/Share/Helper.php @@ -22,7 +22,7 @@ class Helper extends \OC\Share\Constants { if ($defaultExpireDate === 'yes') { $enforceExpireDate = $config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'); $defaultExpireSettings['defaultExpireDateSet'] = true; - $defaultExpireSettings['expireAfterDays'] = (int)$config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); + $defaultExpireSettings['expireAfterDays'] = (int) $config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); $defaultExpireSettings['enforceExpireDate'] = $enforceExpireDate === 'yes'; } diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 0af264fb968..a3b3a049f2e 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -139,7 +139,7 @@ class Share extends Constants { if (!isset($result[$key]['grouped'])) { $result[$key]['grouped'][] = $result[$key]; } - $result[$key]['permissions'] = (int)$item['permissions'] | (int)$r['permissions']; + $result[$key]['permissions'] = (int) $item['permissions'] | (int) $r['permissions']; $result[$key]['grouped'][] = $item; $grouped = true; break; @@ -175,6 +175,6 @@ class Share extends Constants { * @return int */ public static function getExpireInterval() { - return (int)\OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); + return (int) \OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); } } diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 686091b2296..d5257d79304 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -175,7 +175,7 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv // Update mandatory data $id = $qb->getLastInsertId(); - $share->setId((string)$id); + $share->setId((string) $id); $share->setProviderId($this->identifier()); $share->setShareTime(\DateTime::createFromImmutable($shareTime)); @@ -597,7 +597,7 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv public function getSharesInFolder($userId, Folder $node, $reshares, $shallow = true) { if (!$shallow) { - throw new \Exception("non-shallow getSharesInFolder is no longer supported"); + throw new \Exception('non-shallow getSharesInFolder is no longer supported'); } $qb = $this->dbConn->getQueryBuilder(); @@ -972,17 +972,17 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv */ private function createShare($data) { $share = new Share($this->rootFolder, $this->userManager); - $share->setId((int)$data['id']) - ->setShareType((int)$data['share_type']) - ->setPermissions((int)$data['permissions']) + $share->setId((int) $data['id']) + ->setShareType((int) $data['share_type']) + ->setPermissions((int) $data['permissions']) ->setTarget($data['file_target']) - ->setNote((string)$data['note']) - ->setMailSend((bool)$data['mail_send']) - ->setStatus((int)$data['accepted']) + ->setNote((string) $data['note']) + ->setMailSend((bool) $data['mail_send']) + ->setStatus((int) $data['accepted']) ->setLabel($data['label'] ?? ''); $shareTime = new \DateTime(); - $shareTime->setTimestamp((int)$data['stime']); + $shareTime->setTimestamp((int) $data['stime']); $share->setShareTime($shareTime); if ($share->getShareType() === IShare::TYPE_USER) { @@ -999,7 +999,7 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv } } elseif ($share->getShareType() === IShare::TYPE_LINK) { $share->setPassword($data['password']); - $share->setSendPasswordByTalk((bool)$data['password_by_talk']); + $share->setSendPasswordByTalk((bool) $data['password_by_talk']); $share->setToken($data['token']); } @@ -1008,7 +1008,7 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv $share->setSharedBy($data['uid_initiator']); $share->setShareOwner($data['uid_owner']); - $share->setNodeId((int)$data['file_source']); + $share->setNodeId((int) $data['file_source']); $share->setNodeType($data['item_type']); if ($data['expiration'] !== null) { @@ -1025,7 +1025,7 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv } $share->setProviderId($this->identifier()); - $share->setHideDownload((int)$data['hide_download'] === 1); + $share->setHideDownload((int) $data['hide_download'] === 1); return $share; } @@ -1057,8 +1057,8 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv while ($data = $stmt->fetch()) { if (array_key_exists($data['parent'], $shareMap)) { - $shareMap[$data['parent']]->setPermissions((int)$data['permissions']); - $shareMap[$data['parent']]->setStatus((int)$data['accepted']); + $shareMap[$data['parent']]->setPermissions((int) $data['permissions']); + $shareMap[$data['parent']]->setStatus((int) $data['accepted']); $shareMap[$data['parent']]->setTarget($data['file_target']); $shareMap[$data['parent']]->setParent($data['parent']); } @@ -1152,7 +1152,7 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv $cursor = $qb->execute(); $ids = []; while ($row = $cursor->fetch()) { - $ids[] = (int)$row['id']; + $ids[] = (int) $row['id']; } $cursor->closeCursor(); @@ -1200,7 +1200,7 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv $cursor = $qb->executeQuery(); $ids = []; while ($row = $cursor->fetch()) { - $ids[] = (int)$row['id']; + $ids[] = (int) $row['id']; } $cursor->closeCursor(); @@ -1304,7 +1304,7 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv $users = []; $link = false; while ($row = $cursor->fetch()) { - $type = (int)$row['share_type']; + $type = (int) $row['share_type']; if ($type === IShare::TYPE_USER) { $uid = $row['share_with']; $users[$uid] = $users[$uid] ?? []; diff --git a/lib/private/Share20/Exception/BackendError.php b/lib/private/Share20/Exception/BackendError.php index 60f7dcc1a17..b2585367727 100644 --- a/lib/private/Share20/Exception/BackendError.php +++ b/lib/private/Share20/Exception/BackendError.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Share20/Exception/InvalidShare.php b/lib/private/Share20/Exception/InvalidShare.php index 755efdfd2cc..8756455f9d2 100644 --- a/lib/private/Share20/Exception/InvalidShare.php +++ b/lib/private/Share20/Exception/InvalidShare.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/lib/private/Share20/LegacyHooks.php b/lib/private/Share20/LegacyHooks.php index 99c2b0a9a87..5b659e2f387 100644 --- a/lib/private/Share20/LegacyHooks.php +++ b/lib/private/Share20/LegacyHooks.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 6bf2c1c73f2..cfc96a70417 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -292,7 +292,7 @@ class Manager implements IManager { // If $expirationDate is falsy, noExpirationDate is true and expiration not enforced // Then skip expiration date validation as null is accepted - if(!$share->getNoExpirationDate() || $isEnforced) { + if (!$share->getNoExpirationDate() || $isEnforced) { if ($expirationDate !== null) { $expirationDate->setTimezone($this->dateTimeZone->getTimeZone()); $expirationDate->setTime(0, 0, 0); @@ -316,7 +316,7 @@ class Manager implements IManager { if ($fullId === null && $expirationDate === null && $defaultExpireDate) { $expirationDate = new \DateTime('now', $this->dateTimeZone->getTimeZone()); $expirationDate->setTime(0, 0, 0); - $days = (int)$this->config->getAppValue('core', $configProp, (string)$defaultExpireDays); + $days = (int) $this->config->getAppValue('core', $configProp, (string) $defaultExpireDays); if ($days > $defaultExpireDays) { $days = $defaultExpireDays; } @@ -372,7 +372,7 @@ class Manager implements IManager { // If $expirationDate is falsy, noExpirationDate is true and expiration not enforced // Then skip expiration date validation as null is accepted - if(!($share->getNoExpirationDate() && !$isEnforced)) { + if (!($share->getNoExpirationDate() && !$isEnforced)) { if ($expirationDate !== null) { $expirationDate->setTimezone($this->dateTimeZone->getTimeZone()); $expirationDate->setTime(0, 0, 0); @@ -397,7 +397,7 @@ class Manager implements IManager { $expirationDate = new \DateTime('now', $this->dateTimeZone->getTimeZone()); $expirationDate->setTime(0, 0, 0); - $days = (int)$this->config->getAppValue('core', 'link_defaultExpDays', (string)$this->shareApiLinkDefaultExpireDays()); + $days = (int) $this->config->getAppValue('core', 'link_defaultExpDays', (string) $this->shareApiLinkDefaultExpireDays()); if ($days > $this->shareApiLinkDefaultExpireDays()) { $days = $this->shareApiLinkDefaultExpireDays(); } @@ -958,7 +958,7 @@ class Manager implements IManager { * * @param IShare $share the share to update its password. * @param IShare $originalShare the original share to compare its - * password with. + * password with. * @return boolean whether the password was updated or not. */ private function updateSharePasswordIfNeeded(IShare $share, IShare $originalShare) { @@ -1219,7 +1219,7 @@ class Manager implements IManager { public function getSharesInFolder($userId, Folder $node, $reshares = false, $shallow = true) { $providers = $this->factory->getAllProviders(); if (!$shallow) { - throw new \Exception("non-shallow getSharesInFolder is no longer supported"); + throw new \Exception('non-shallow getSharesInFolder is no longer supported'); } return array_reduce($providers, function ($shares, IShareProvider $provider) use ($userId, $node, $reshares) { @@ -1743,7 +1743,7 @@ class Manager implements IManager { $excludedGroups = json_decode($this->config->getAppValue('core', 'shareapi_allow_links_exclude_groups', '[]')); if ($excludedGroups) { $userGroups = $this->groupManager->getUserGroupIds($user); - return !(bool)array_intersect($excludedGroups, $userGroups); + return !(bool) array_intersect($excludedGroups, $userGroups); } } @@ -1763,7 +1763,7 @@ class Manager implements IManager { $user = $this->userSession->getUser(); if ($user) { $userGroups = $this->groupManager->getUserGroupIds($user); - if ((bool)array_intersect($excludedGroups, $userGroups)) { + if ((bool) array_intersect($excludedGroups, $userGroups)) { return false; } } @@ -1798,7 +1798,7 @@ class Manager implements IManager { * @return int */ public function shareApiLinkDefaultExpireDays() { - return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); + return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); } /** @@ -1845,7 +1845,7 @@ class Manager implements IManager { * @return int */ public function shareApiInternalDefaultExpireDays(): int { - return (int)$this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); + return (int) $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); } /** @@ -1854,7 +1854,7 @@ class Manager implements IManager { * @return int */ public function shareApiRemoteDefaultExpireDays(): int { - return (int)$this->config->getAppValue('core', 'shareapi_remote_expire_after_n_days', '7'); + return (int) $this->config->getAppValue('core', 'shareapi_remote_expire_after_n_days', '7'); } /** diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php index 37af0482838..e1a2c9a5375 100644 --- a/lib/private/Share20/ProviderFactory.php +++ b/lib/private/Share20/ProviderFactory.php @@ -44,9 +44,9 @@ class ProviderFactory implements IProviderFactory { private $defaultProvider = null; /** @var FederatedShareProvider */ private $federatedProvider = null; - /** @var ShareByMailProvider */ + /** @var ShareByMailProvider */ private $shareByMailProvider; - /** @var \OCA\Circles\ShareByCircleProvider */ + /** @var \OCA\Circles\ShareByCircleProvider */ private $shareByCircleProvider = null; /** @var bool */ private $circlesAreNotAvailable = false; diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index 35dcf6073f8..9098eaa04fd 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -86,7 +86,7 @@ class Share implements IShare { public function setId($id) { /** @var mixed $id Let's be safe until strong typing */ if (is_int($id)) { - $id = (string)$id; + $id = (string) $id; } if (!is_string($id)) { @@ -190,7 +190,7 @@ class Share implements IShare { } if ($this->fileId === null) { - throw new NotFoundException("Share source not found"); + throw new NotFoundException('Share source not found'); } else { return $this->fileId; } diff --git a/lib/private/Share20/ShareAttributes.php b/lib/private/Share20/ShareAttributes.php index fbdcbf1ad26..96da1e336e3 100644 --- a/lib/private/Share20/ShareAttributes.php +++ b/lib/private/Share20/ShareAttributes.php @@ -47,9 +47,9 @@ class ShareAttributes implements IAttributes { foreach ($this->attributes as $scope => $keys) { foreach ($keys as $key => $value) { $result[] = [ - "scope" => $scope, - "key" => $key, - "value" => $value, + 'scope' => $scope, + 'key' => $key, + 'value' => $value, ]; } } diff --git a/lib/private/Share20/ShareHelper.php b/lib/private/Share20/ShareHelper.php index d4a54f1d687..3f6bab98a7f 100644 --- a/lib/private/Share20/ShareHelper.php +++ b/lib/private/Share20/ShareHelper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Streamer.php b/lib/private/Streamer.php index 4eca1105002..1f510f730ee 100644 --- a/lib/private/Streamer.php +++ b/lib/private/Streamer.php @@ -32,7 +32,7 @@ class Streamer { * @param IRequest $request * @param int|float $size The size of the files in bytes * @param int $numberOfFiles The number of files (and directories) that will - * be included in the streamed file + * be included in the streamed file */ public function __construct(IRequest $request, int|float $size, int $numberOfFiles) { /** diff --git a/lib/private/Support/Subscription/Registry.php b/lib/private/Support/Subscription/Registry.php index 3d3daa97abb..2fe7cbced3d 100644 --- a/lib/private/Support/Subscription/Registry.php +++ b/lib/private/Support/Subscription/Registry.php @@ -224,10 +224,10 @@ class Registry implements IRegistry { } protected function reIssue(): bool { - $lastNotification = (int)$this->config->getAppValue('lib', 'last_subscription_reminder', '0'); + $lastNotification = (int) $this->config->getAppValue('lib', 'last_subscription_reminder', '0'); if ((time() - $lastNotification) >= 86400) { - $this->config->setAppValue('lib', 'last_subscription_reminder', (string)time()); + $this->config->setAppValue('lib', 'last_subscription_reminder', (string) time()); return true; } return false; diff --git a/lib/private/SystemTag/SystemTagManager.php b/lib/private/SystemTag/SystemTagManager.php index dcc689d326c..0bed1674336 100644 --- a/lib/private/SystemTag/SystemTagManager.php +++ b/lib/private/SystemTag/SystemTagManager.php @@ -103,7 +103,7 @@ class SystemTagManager implements ISystemTagManager { ->from(self::TAG_TABLE); if (!\is_null($visibilityFilter)) { - $query->andWhere($query->expr()->eq('visibility', $query->createNamedParameter((int)$visibilityFilter))); + $query->andWhere($query->expr()->eq('visibility', $query->createNamedParameter((int) $visibilityFilter))); } if (!empty($nameSearchPattern)) { @@ -181,7 +181,7 @@ class SystemTagManager implements ISystemTagManager { $tagId = $query->getLastInsertId(); $tag = new SystemTag( - (string)$tagId, + (string) $tagId, $truncatedTagName, $userVisible, $userAssignable @@ -348,7 +348,7 @@ class SystemTagManager implements ISystemTagManager { } private function createSystemTagFromRow($row): SystemTag { - return new SystemTag((string)$row['id'], $row['name'], (bool)$row['visibility'], (bool)$row['editable']); + return new SystemTag((string) $row['id'], $row['name'], (bool) $row['visibility'], (bool) $row['editable']); } /** diff --git a/lib/private/SystemTag/SystemTagObjectMapper.php b/lib/private/SystemTag/SystemTagObjectMapper.php index 10117eebeaa..0aa5fd199a3 100644 --- a/lib/private/SystemTag/SystemTagObjectMapper.php +++ b/lib/private/SystemTag/SystemTagObjectMapper.php @@ -231,7 +231,7 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { $result->closeCursor(); if ($all) { - return ((int)$row[0] === \count($objIds)); + return ((int) $row[0] === \count($objIds)); } return (bool) $row; diff --git a/lib/private/TagManager.php b/lib/private/TagManager.php index 3258ce50bc5..d71a2714d90 100644 --- a/lib/private/TagManager.php +++ b/lib/private/TagManager.php @@ -43,7 +43,7 @@ class TagManager implements ITagManager, IEventListener { * @param array $defaultTags An array of default tags to be used if none are stored. * @param boolean $includeShared Whether to include tags for items shared with this user by others. * @param string $userId user for which to retrieve the tags, defaults to the currently - * logged in user + * logged in user * @return \OCP\ITags * * since 20.0.0 $includeShared isn't used anymore @@ -104,7 +104,7 @@ class TagManager implements ITagManager, IEventListener { return; } - $tagsIds = array_map(fn (array $row) => (int)$row['id'], $result->fetchAll()); + $tagsIds = array_map(fn (array $row) => (int) $row['id'], $result->fetchAll()); $result->closeCursor(); if (count($tagsIds) === 0) { diff --git a/lib/private/Tags.php b/lib/private/Tags.php index d12a0f04b8c..b5c42f84f61 100644 --- a/lib/private/Tags.php +++ b/lib/private/Tags.php @@ -149,7 +149,7 @@ class Tags implements ITags { * * @param array $objIds array of object ids * @return array|false of tags id as key to array of tag names - * or false if an error occurred + * or false if an error occurred */ public function getTagsForObjects(array $objIds) { $entries = []; @@ -169,7 +169,7 @@ class Tags implements ITags { $qb->setParameter('chunk', $chunk, IQueryBuilder::PARAM_INT_ARRAY); $result = $qb->executeQuery(); while ($row = $result->fetch()) { - $objId = (int)$row['objid']; + $objId = (int) $row['objid']; if (!isset($entries[$objId])) { $entries[$objId] = []; } @@ -233,7 +233,7 @@ class Tags implements ITags { } while ($row = $result->fetch()) { - $ids[] = (int)$row['objid']; + $ids[] = (int) $row['objid']; } $result->closeCursor(); @@ -342,7 +342,7 @@ class Tags implements ITags { * Add a list of new tags. * * @param string|string[] $names A string with a name or an array of strings containing - * the name(s) of the tag(s) to add. + * the name(s) of the tag(s) to add. * @param bool $sync When true, save the tags * @param int|null $id int Optional object id to add to this|these tag(s) * @return bool Returns false on error. diff --git a/lib/private/Talk/Broker.php b/lib/private/Talk/Broker.php index fc8e0280043..86e7e7ff4c1 100644 --- a/lib/private/Talk/Broker.php +++ b/lib/private/Talk/Broker.php @@ -47,7 +47,7 @@ class Broker implements IBroker { $context = $this->coordinator->getRegistrationContext(); if ($context === null) { // Backend requested too soon, e.g. from the bootstrap `register` method of an app - throw new RuntimeException("Not all apps have been registered yet"); + throw new RuntimeException('Not all apps have been registered yet'); } $backendRegistration = $context->getTalkBackendRegistration(); if ($backendRegistration === null) { @@ -63,7 +63,7 @@ class Broker implements IBroker { // Remember and return return $this->hasBackend = true; } catch (Throwable $e) { - $this->logger->error("Talk backend {class} could not be loaded: " . $e->getMessage(), [ + $this->logger->error('Talk backend {class} could not be loaded: ' . $e->getMessage(), [ 'class' => $backendRegistration->getService(), 'exception' => $e, ]); @@ -81,7 +81,7 @@ class Broker implements IBroker { array $moderators, ?IConversationOptions $options = null): IConversation { if (!$this->hasBackend()) { - throw new NoBackendException("The Talk broker has no registered backend"); + throw new NoBackendException('The Talk broker has no registered backend'); } return $this->backend->createConversation( @@ -93,7 +93,7 @@ class Broker implements IBroker { public function deleteConversation(string $id): void { if (!$this->hasBackend()) { - throw new NoBackendException("The Talk broker has no registered backend"); + throw new NoBackendException('The Talk broker has no registered backend'); } $this->backend->deleteConversation($id); diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index 0e1c830ead7..04082ddb59a 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -70,7 +70,7 @@ class Manager implements IManager { public const LEGACY_PREFIX_TEXTTOIMAGE = 'legacy:TextToImage:'; public const LEGACY_PREFIX_SPEECHTOTEXT = 'legacy:SpeechToText:'; - /** @var list<IProvider>|null */ + /** @var list<IProvider>|null */ private ?array $providers = null; /** @@ -183,7 +183,7 @@ class Manager implements IManager { } try { return ['output' => $this->provider->process($input['input'])]; - } catch(\RuntimeException $e) { + } catch (\RuntimeException $e) { throw new ProcessingException($e->getMessage(), 0, $e); } } @@ -314,7 +314,7 @@ class Manager implements IManager { public function process(?string $userId, array $input, callable $reportProgress): array { try { $folder = $this->appData->getFolder('text2image'); - } catch(\OCP\Files\NotFoundException) { + } catch (\OCP\Files\NotFoundException) { $folder = $this->appData->newFolder('text2image'); } $resources = []; @@ -1025,7 +1025,7 @@ class Manager implements IManager { } $newInputOutput = []; $spec = array_reduce($specs, fn ($carry, $spec) => $carry + $spec, []); - foreach($spec as $key => $descriptor) { + foreach ($spec as $key => $descriptor) { $type = $descriptor->getShapeType(); if (!isset($input[$key])) { continue; @@ -1036,14 +1036,14 @@ class Manager implements IManager { } if (EShapeType::getScalarType($type) === $type) { // is scalar - $node = $this->validateFileId((int)$input[$key]); + $node = $this->validateFileId((int) $input[$key]); $this->validateUserAccessToFile($input[$key], $userId); $newInputOutput[$key] = $node; } else { // is list $newInputOutput[$key] = []; foreach ($input[$key] as $item) { - $node = $this->validateFileId((int)$item); + $node = $this->validateFileId((int) $item); $this->validateUserAccessToFile($item, $userId); $newInputOutput[$key][] = $node; } @@ -1117,7 +1117,7 @@ class Manager implements IManager { $folder = $this->appData->newFolder('TaskProcessing'); } $spec = array_reduce($specs, fn ($carry, $spec) => $carry + $spec, []); - foreach($spec as $key => $descriptor) { + foreach ($spec as $key => $descriptor) { $type = $descriptor->getShapeType(); if (!isset($output[$key])) { continue; @@ -1262,7 +1262,7 @@ class Manager implements IManager { private function validateOutputFileIds(array $output, ...$specs): array { $newOutput = []; $spec = array_reduce($specs, fn ($carry, $spec) => $carry + $spec, []); - foreach($spec as $key => $descriptor) { + foreach ($spec as $key => $descriptor) { $type = $descriptor->getShapeType(); if (!isset($output[$key])) { continue; @@ -1347,9 +1347,9 @@ class Manager implements IManager { ]; try { $client->request($httpMethod, $uri, $options); - } catch (ClientException | ServerException $e) { + } catch (ClientException|ServerException $e) { $this->logger->warning('Task processing HTTP webhook failed for task ' . $task->getId() . '. Request failed', ['exception' => $e]); - } catch (\Exception | \Throwable $e) { + } catch (\Exception|\Throwable $e) { $this->logger->warning('Task processing HTTP webhook failed for task ' . $task->getId() . '. Unknown error', ['exception' => $e]); } } elseif (str_starts_with($method, 'AppAPI:') && str_starts_with($uri, '/')) { diff --git a/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php b/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php index 1374da5f9b8..c6f26e3aa8b 100644 --- a/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php @@ -65,7 +65,7 @@ class RemoveOldTasksBackgroundJob extends TimedJob { * @return void */ private function clearFilesOlderThan(ISimpleFolder $folder, int $ageInSeconds): void { - foreach($folder->getDirectoryListing() as $file) { + foreach ($folder->getDirectoryListing() as $file) { if ($file->getMTime() < time() - $ageInSeconds) { try { $file->delete(); diff --git a/lib/private/Teams/TeamManager.php b/lib/private/Teams/TeamManager.php index 3d5f9f6d2a2..f4dd890a12b 100644 --- a/lib/private/Teams/TeamManager.php +++ b/lib/private/Teams/TeamManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/TempManager.php b/lib/private/TempManager.php index e63b1b32794..6452b7e92db 100644 --- a/lib/private/TempManager.php +++ b/lib/private/TempManager.php @@ -102,7 +102,7 @@ class TempManager implements ITempManager { \OC_Helper::rmdirr($file); } catch (\UnexpectedValueException $ex) { $this->log->warning( - "Error deleting temporary file/folder: {file} - Reason: {error}", + 'Error deleting temporary file/folder: {file} - Reason: {error}', [ 'file' => $file, 'error' => $ex->getMessage(), diff --git a/lib/private/Template/JSCombiner.php b/lib/private/Template/JSCombiner.php index 5fce3effb3f..a94f822a448 100644 --- a/lib/private/Template/JSCombiner.php +++ b/lib/private/Template/JSCombiner.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index b5799b33ab7..48e7db5fc90 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -94,7 +94,7 @@ class JSConfigHelper { $defaultExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; $defaultExpireDate = $enforceDefaultExpireDate = null; if ($defaultExpireDateEnabled) { - $defaultExpireDate = (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); + $defaultExpireDate = (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); $enforceDefaultExpireDate = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; } $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; @@ -102,14 +102,14 @@ class JSConfigHelper { $defaultInternalExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no') === 'yes'; $defaultInternalExpireDate = $defaultInternalExpireDateEnforced = null; if ($defaultInternalExpireDateEnabled) { - $defaultInternalExpireDate = (int)$this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); + $defaultInternalExpireDate = (int) $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); $defaultInternalExpireDateEnforced = $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no') === 'yes'; } $defaultRemoteExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_remote_expire_date', 'no') === 'yes'; $defaultRemoteExpireDate = $defaultRemoteExpireDateEnforced = null; if ($defaultRemoteExpireDateEnabled) { - $defaultRemoteExpireDate = (int)$this->config->getAppValue('core', 'shareapi_remote_expire_after_n_days', '7'); + $defaultRemoteExpireDate = (int) $this->config->getAppValue('core', 'shareapi_remote_expire_after_n_days', '7'); $defaultRemoteExpireDateEnforced = $this->config->getAppValue('core', 'shareapi_enforce_remote_expire_date', 'no') === 'yes'; } @@ -135,7 +135,7 @@ class JSConfigHelper { $capabilities = $this->capabilitiesManager->getCapabilities(false, true); $userFirstDay = $this->config->getUserValue($uid, 'core', AUserData::USER_FIELD_FIRST_DAY_OF_WEEK, null); - $firstDay = (int)($userFirstDay ?? $this->l->l('firstday', null)); + $firstDay = (int) ($userFirstDay ?? $this->l->l('firstday', null)); $config = [ /** @deprecated 30.0.0 - use files capabilities instead */ @@ -160,16 +160,16 @@ class JSConfigHelper { ]; $array = [ - "_oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false', - "_oc_isadmin" => $uid !== null && $this->groupManager->isAdmin($uid) ? 'true' : 'false', - "backendAllowsPasswordConfirmation" => $userBackendAllowsPasswordConfirmation ? 'true' : 'false', - "oc_dataURL" => is_string($dataLocation) ? "\"" . $dataLocation . "\"" : 'false', - "_oc_webroot" => "\"" . \OC::$WEBROOT . "\"", - "_oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution - "datepickerFormatDate" => json_encode($this->l->l('jsdate', null)), + '_oc_debug' => $this->config->getSystemValue('debug', false) ? 'true' : 'false', + '_oc_isadmin' => $uid !== null && $this->groupManager->isAdmin($uid) ? 'true' : 'false', + 'backendAllowsPasswordConfirmation' => $userBackendAllowsPasswordConfirmation ? 'true' : 'false', + 'oc_dataURL' => is_string($dataLocation) ? '"' . $dataLocation . '"' : 'false', + '_oc_webroot' => '"' . \OC::$WEBROOT . '"', + '_oc_appswebroots' => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution + 'datepickerFormatDate' => json_encode($this->l->l('jsdate', null)), 'nc_lastLogin' => $lastConfirmTimestamp, 'nc_pageLoad' => time(), - "dayNames" => json_encode([ + 'dayNames' => json_encode([ $this->l->t('Sunday'), $this->l->t('Monday'), $this->l->t('Tuesday'), @@ -178,7 +178,7 @@ class JSConfigHelper { $this->l->t('Friday'), $this->l->t('Saturday') ]), - "dayNamesShort" => json_encode([ + 'dayNamesShort' => json_encode([ $this->l->t('Sun.'), $this->l->t('Mon.'), $this->l->t('Tue.'), @@ -187,7 +187,7 @@ class JSConfigHelper { $this->l->t('Fri.'), $this->l->t('Sat.') ]), - "dayNamesMin" => json_encode([ + 'dayNamesMin' => json_encode([ $this->l->t('Su'), $this->l->t('Mo'), $this->l->t('Tu'), @@ -196,7 +196,7 @@ class JSConfigHelper { $this->l->t('Fr'), $this->l->t('Sa') ]), - "monthNames" => json_encode([ + 'monthNames' => json_encode([ $this->l->t('January'), $this->l->t('February'), $this->l->t('March'), @@ -210,7 +210,7 @@ class JSConfigHelper { $this->l->t('November'), $this->l->t('December') ]), - "monthNamesShort" => json_encode([ + 'monthNamesShort' => json_encode([ $this->l->t('Jan.'), $this->l->t('Feb.'), $this->l->t('Mar.'), @@ -224,9 +224,9 @@ class JSConfigHelper { $this->l->t('Nov.'), $this->l->t('Dec.') ]), - "firstDay" => json_encode($firstDay), - "_oc_config" => json_encode($config), - "oc_appconfig" => json_encode([ + 'firstDay' => json_encode($firstDay), + '_oc_config' => json_encode($config), + 'oc_appconfig' => json_encode([ 'core' => [ 'defaultExpireDateEnabled' => $defaultExpireDateEnabled, 'defaultExpireDate' => $defaultExpireDate, @@ -246,7 +246,7 @@ class JSConfigHelper { 'defaultRemoteExpireDateEnforced' => $defaultRemoteExpireDateEnforced, ] ]), - "_theme" => json_encode([ + '_theme' => json_encode([ 'entity' => $this->defaults->getEntity(), 'name' => $this->defaults->getName(), 'productName' => $this->defaults->getProductName(), @@ -264,7 +264,7 @@ class JSConfigHelper { if ($this->currentUser !== null) { $array['oc_userconfig'] = json_encode([ 'avatar' => [ - 'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0), + 'version' => (int) $this->config->getUserValue($uid, 'avatar', 'version', 0), 'generated' => $this->config->getUserValue($uid, 'avatar', 'generated', 'true') === 'true', ] ]); @@ -281,7 +281,7 @@ class JSConfigHelper { $result = ''; // Echo it - foreach ($array as $setting => $value) { + foreach ($array as $setting => $value) { $result .= 'var '. $setting . '='. $value . ';' . PHP_EOL; } diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index fe475ecf403..93142444c72 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -73,8 +73,8 @@ class TemplateLayout extends \OC_Template { $this->initialState->provideInitialState('core', 'apps', array_values($this->navigationManager->getAll())); if ($this->config->getSystemValueBool('unified_search.enabled', false) || !$this->config->getSystemValueBool('enable_non-accessible_features', true)) { - $this->initialState->provideInitialState('unified-search', 'limit-default', (int)$this->config->getAppValue('core', 'unified-search.limit-default', (string)SearchQuery::LIMIT_DEFAULT)); - $this->initialState->provideInitialState('unified-search', 'min-search-length', (int)$this->config->getAppValue('core', 'unified-search.min-search-length', (string)1)); + $this->initialState->provideInitialState('unified-search', 'limit-default', (int) $this->config->getAppValue('core', 'unified-search.limit-default', (string) SearchQuery::LIMIT_DEFAULT)); + $this->initialState->provideInitialState('unified-search', 'min-search-length', (int) $this->config->getAppValue('core', 'unified-search.min-search-length', (string) 1)); $this->initialState->provideInitialState('unified-search', 'live-search', $this->config->getAppValue('core', 'unified-search.live-search', 'yes') === 'yes'); Util::addScript('core', 'legacy-unified-search', 'core'); } else { @@ -299,7 +299,7 @@ class TemplateLayout extends \OC_Template { protected function getVersionHashSuffix(string $path = '', string $file = ''): string { if ($this->config->getSystemValueBool('debug', false)) { // allows chrome workspace mapping in debug mode - return ""; + return ''; } if ($this->config->getSystemValueBool('installed', false) === false) { diff --git a/lib/private/TextToImage/Manager.php b/lib/private/TextToImage/Manager.php index 6ad3592a1b7..d8567fe15a3 100644 --- a/lib/private/TextToImage/Manager.php +++ b/lib/private/TextToImage/Manager.php @@ -119,13 +119,13 @@ class Manager implements IManager { } try { $folder = $this->appData->getFolder('text2image'); - } catch(NotFoundException) { + } catch (NotFoundException) { $this->logger->debug('Creating folder in appdata for Text2Image results'); $folder = $this->appData->newFolder('text2image'); } try { $folder = $folder->getFolder((string) $task->getId()); - } catch(NotFoundException) { + } catch (NotFoundException) { $this->logger->debug('Creating new folder in appdata Text2Image results folder'); $folder = $folder->newFolder((string) $task->getId()); } @@ -162,7 +162,7 @@ class Manager implements IManager { if (isset($files, $files[$i])) { try { $files[$i]->delete(); - } catch(NotPermittedException $e) { + } catch (NotPermittedException $e) { $this->logger->warning('Failed to clean up Text2Image result file after error', ['exception' => $e]); } } diff --git a/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php b/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php index b25353d7b15..678da031ea8 100644 --- a/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php @@ -47,7 +47,7 @@ class RemoveOldTasksBackgroundJob extends TimedJob { $folder = $this->appData->getFolder('text2image'); foreach ($deletedTasks as $deletedTask) { try { - $folder->getFolder((string)$deletedTask->getId())->delete(); + $folder->getFolder((string) $deletedTask->getId())->delete(); } catch (NotFoundException) { // noop } catch (NotPermittedException $e) { @@ -56,7 +56,7 @@ class RemoveOldTasksBackgroundJob extends TimedJob { } } catch (Exception $e) { $this->logger->warning('Failed to delete stale text to image tasks', ['exception' => $e]); - } catch(NotFoundException) { + } catch (NotFoundException) { // noop } } diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index 39b825e427b..91683c0c2a5 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -112,7 +112,7 @@ class URLGenerator implements IURLGenerator { * @param string $appName app * @param string $file file * @param array $args array with param=>value, will be appended to the returned url - * The value of $args will be urlencoded + * The value of $args will be urlencoded * @return string the url * * Returns a url to the given app and file. @@ -303,7 +303,7 @@ class URLGenerator implements IURLGenerator { */ public function getBaseUrl(): string { // BaseUrl can be equal to 'http(s)://' during the first steps of the initial setup. - if ($this->baseUrl === null || $this->baseUrl === "http://" || $this->baseUrl === "https://") { + if ($this->baseUrl === null || $this->baseUrl === 'http://' || $this->baseUrl === 'https://') { $this->baseUrl = $this->request->getServerProtocol() . '://' . $this->request->getServerHost() . \OC::$WEBROOT; } return $this->baseUrl; diff --git a/lib/private/Updater/ChangesCheck.php b/lib/private/Updater/ChangesCheck.php index df017b09040..73a02ab43ac 100644 --- a/lib/private/Updater/ChangesCheck.php +++ b/lib/private/Updater/ChangesCheck.php @@ -127,12 +127,12 @@ class ChangesCheck { $xml = @simplexml_load_string($body); } if ($xml !== false) { - $data['changelogURL'] = (string)$xml->changelog['href']; + $data['changelogURL'] = (string) $xml->changelog['href']; $data['whatsNew'] = []; foreach ($xml->whatsNew as $infoSet) { - $data['whatsNew'][(string)$infoSet['lang']] = [ - 'regular' => (array)$infoSet->regular->item, - 'admin' => (array)$infoSet->admin->item, + $data['whatsNew'][(string) $infoSet['lang']] = [ + 'regular' => (array) $infoSet->regular->item, + 'admin' => (array) $infoSet->admin->item, ]; } } else { diff --git a/lib/private/Updater/VersionCheck.php b/lib/private/Updater/VersionCheck.php index 9ad129db1a4..6ca0c32007a 100644 --- a/lib/private/Updater/VersionCheck.php +++ b/lib/private/Updater/VersionCheck.php @@ -48,7 +48,7 @@ class VersionCheck { $this->appConfig->setValueInt('core', 'lastupdatedat', time()); if ($this->config->getAppValue('core', 'installedat', '') === '') { - $this->config->setAppValue('core', 'installedat', (string)microtime(true)); + $this->config->setAppValue('core', 'installedat', (string) microtime(true)); } $version = Util::getVersion(); @@ -85,13 +85,13 @@ class VersionCheck { $data = @simplexml_load_string($xml); } if ($data !== false) { - $tmp['version'] = (string)$data->version; - $tmp['versionstring'] = (string)$data->versionstring; - $tmp['url'] = (string)$data->url; - $tmp['web'] = (string)$data->web; - $tmp['changes'] = isset($data->changes) ? (string)$data->changes : ''; - $tmp['autoupdater'] = (string)$data->autoupdater; - $tmp['eol'] = isset($data->eol) ? (string)$data->eol : '0'; + $tmp['version'] = (string) $data->version; + $tmp['versionstring'] = (string) $data->versionstring; + $tmp['url'] = (string) $data->url; + $tmp['web'] = (string) $data->web; + $tmp['changes'] = isset($data->changes) ? (string) $data->changes : ''; + $tmp['autoupdater'] = (string) $data->autoupdater; + $tmp['eol'] = isset($data->eol) ? (string) $data->eol : '0'; } else { libxml_clear_errors(); } diff --git a/lib/private/User/Backend.php b/lib/private/User/Backend.php index 9b6a9a890ef..86e427defdc 100644 --- a/lib/private/User/Backend.php +++ b/lib/private/User/Backend.php @@ -69,7 +69,7 @@ abstract class Backend implements UserInterface { * compared with self::CREATE_USER etc. */ public function implementsActions($actions) { - return (bool)($this->getSupportedActions() & $actions); + return (bool) ($this->getSupportedActions() & $actions); } /** diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index bd6aa7ba2c2..49f3b0be054 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -253,7 +253,7 @@ class Database extends ABackend implements * @return string display name */ public function getDisplayName($uid): string { - $uid = (string)$uid; + $uid = (string) $uid; $this->loadUser($uid); return empty($this->cache[$uid]['displayname']) ? $uid : $this->cache[$uid]['displayname']; } @@ -292,7 +292,7 @@ class Database extends ABackend implements $result = $query->executeQuery(); $displayNames = []; while ($row = $result->fetch()) { - $displayNames[(string)$row['uid']] = (string)$row['displayname']; + $displayNames[(string) $row['uid']] = (string) $row['displayname']; } return $displayNames; @@ -332,7 +332,7 @@ class Database extends ABackend implements $result = $query->execute(); $displayNames = []; while ($row = $result->fetch()) { - $displayNames[(string)$row['uid']] = (string)$row['displayname']; + $displayNames[(string) $row['uid']] = (string) $row['displayname']; } return $displayNames; @@ -358,7 +358,7 @@ class Database extends ABackend implements if (!empty($newHash)) { $this->updatePassword($loginName, $newHash); } - return (string)$this->cache[$loginName]['uid']; + return (string) $this->cache[$loginName]['uid']; } } @@ -374,7 +374,7 @@ class Database extends ABackend implements private function loadUser($uid) { $this->fixDI(); - $uid = (string)$uid; + $uid = (string) $uid; if (!isset($this->cache[$uid])) { //guests $uid could be NULL or '' if ($uid === '') { @@ -397,9 +397,9 @@ class Database extends ABackend implements // "uid" is primary key, so there can only be a single result if ($row !== false) { $this->cache[$uid] = [ - 'uid' => (string)$row['uid'], - 'displayname' => (string)$row['displayname'], - 'password' => (string)$row['password'], + 'uid' => (string) $row['uid'], + 'displayname' => (string) $row['displayname'], + 'password' => (string) $row['password'], ]; } else { $this->cache[$uid] = false; @@ -423,7 +423,7 @@ class Database extends ABackend implements $users = $this->getDisplayNames($search, $limit, $offset); $userIds = array_map(function ($uid) { - return (string)$uid; + return (string) $uid; }, array_keys($users)); sort($userIds, SORT_STRING | SORT_FLAG_CASE); return $userIds; diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index 229abb273ff..9b230798e03 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -462,7 +462,7 @@ class Manager extends PublicEmitter implements IUserManager { * returns how many users per backend exist (if supported by backend) * * @param boolean $hasLoggedIn when true only users that have a lastLogin - * entry in the preferences table will be affected + * entry in the preferences table will be affected * @return array<string, int> an array of backend class as key and count number as value */ public function countUsers() { @@ -519,7 +519,7 @@ class Manager extends PublicEmitter implements IUserManager { * @psalm-param \Closure(\OCP\IUser):?bool $callback * @param string $search * @param boolean $onlySeen when true only users that have a lastLogin entry - * in the preferences table will be affected + * in the preferences table will be affected * @since 9.0.0 */ public function callForAllUsers(\Closure $callback, $search = '', $onlySeen = false) { @@ -567,7 +567,7 @@ class Manager extends PublicEmitter implements IUserManager { $result->closeCursor(); if ($count !== false) { - $count = (int)$count; + $count = (int) $count; } else { $count = 0; } @@ -590,7 +590,7 @@ class Manager extends PublicEmitter implements IUserManager { $query = $queryBuilder->execute(); - $result = (int)$query->fetchOne(); + $result = (int) $query->fetchOne(); $query->closeCursor(); return $result; diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 31d387c7583..9ab568f9bb5 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -871,7 +872,7 @@ class Session implements IUserSession, Emitter { // replace successfully used token with a new one $this->config->deleteUserValue($uid, 'login_token', $currentToken); $newToken = $this->random->generate(32); - $this->config->setUserValue($uid, 'login_token', $newToken, (string)$this->timeFactory->getTime()); + $this->config->setUserValue($uid, 'login_token', $newToken, (string) $this->timeFactory->getTime()); $this->logger->debug('Remember-me token replaced', [ 'app' => 'core', 'user' => $uid, @@ -923,7 +924,7 @@ class Session implements IUserSession, Emitter { */ public function createRememberMeToken(IUser $user) { $token = $this->random->generate(32); - $this->config->setUserValue($user->getUID(), 'login_token', $token, (string)$this->timeFactory->getTime()); + $this->config->setUserValue($user->getUID(), 'login_token', $token, (string) $this->timeFactory->getTime()); $this->setMagicInCookie($user->getUID(), $token); } diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 1f519179065..ee42191fdae 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -223,7 +223,7 @@ class User implements IUser { if ($now - $previousLogin > 60) { $this->lastLogin = time(); $this->config->setUserValue( - $this->uid, 'login', 'lastLogin', (string)$this->lastLogin); + $this->uid, 'login', 'lastLogin', (string) $this->lastLogin); } return $firstTimeLogin; diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 3347e4a6ec2..b789fe00228 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -171,7 +171,7 @@ class OC_App { * * @param bool $forceRefresh whether to refresh the cache * @param bool $all whether to return apps for all users, not only the - * currently logged in one + * currently logged in one * @return string[] */ public static function getEnabledApps(bool $forceRefresh = false, bool $all = false): array { diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php index e4eefd52038..f719e05a24c 100644 --- a/lib/private/legacy/OC_Files.php +++ b/lib/private/legacy/OC_Files.php @@ -30,7 +30,7 @@ class OC_Files { private static function getBoundary(): string { if (empty(self::$multipartBoundary)) { - self::$multipartBoundary = md5((string)mt_rand()); + self::$multipartBoundary = md5((string) mt_rand()); } return self::$multipartBoundary; } @@ -44,7 +44,7 @@ class OC_Files { OC_Response::setContentDispositionHeader($name, 'attachment'); header('Content-Transfer-Encoding: binary', true); header('Expires: 0'); - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); $fileSize = \OC\Files\Filesystem::filesize($filename); $type = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename)); if ($fileSize > -1) { @@ -144,7 +144,7 @@ class OC_Files { OC_Util::obEnd(); $streamer->sendHeaders($name); - $executionTime = (int)OC::$server->get(IniGetWrapper::class)->getNumeric('max_execution_time'); + $executionTime = (int) OC::$server->get(IniGetWrapper::class)->getNumeric('max_execution_time'); if (!str_contains(@ini_get('disable_functions'), 'set_time_limit')) { @set_time_limit(0); } @@ -339,8 +339,8 @@ class OC_Files { foreach ($rangeArray as $range) { echo "\r\n--".self::getBoundary()."\r\n". - "Content-type: ".$type."\r\n". - "Content-range: bytes ".$range['from']."-".$range['to']."/".$range['size']."\r\n\r\n"; + 'Content-type: '.$type."\r\n". + 'Content-range: bytes '.$range['from'].'-'.$range['to'].'/'.$range['size']."\r\n\r\n"; $view->readfilePart($filename, $range['from'], $range['to']); } echo "\r\n--".self::getBoundary()."--\r\n"; diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index f26257dddeb..185394e3ed1 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -44,7 +44,7 @@ class OC_Helper { */ public static function humanFileSize(int|float $bytes): string { if ($bytes < 0) { - return "?"; + return '?'; } if ($bytes < 1024) { return "$bytes B"; @@ -99,7 +99,7 @@ class OC_Helper { 'p' => 1024 * 1024 * 1024 * 1024 * 1024, ]; - $bytes = (float)$str; + $bytes = (float) $str; if (preg_match('#([kmgtp]?b?)$#si', $str, $matches) && isset($bytes_array[$matches[1]])) { $bytes *= $bytes_array[$matches[1]]; @@ -127,7 +127,7 @@ class OC_Helper { } $files = scandir($src); foreach ($files as $file) { - if ($file != "." && $file != "..") { + if ($file != '.' && $file != '..') { self::copyr("$src/$file", "$dest/$file"); } } @@ -195,21 +195,21 @@ class OC_Helper { * @param bool $path * @internal param string $program name * @internal param string $optional search path, defaults to $PATH - * @return bool true if executable program found in path + * @return bool true if executable program found in path */ public static function canExecute($name, $path = false) { // path defaults to PATH from environment if not set if ($path === false) { - $path = getenv("PATH"); + $path = getenv('PATH'); } // we look for an executable file of that name - $exts = [""]; - $check_fn = "is_executable"; + $exts = ['']; + $check_fn = 'is_executable'; // Default check will be done with $path directories : $dirs = explode(PATH_SEPARATOR, $path); // WARNING : We have to check if open_basedir is enabled : $obd = OC::$server->get(IniGetWrapper::class)->getString('open_basedir'); - if ($obd != "none") { + if ($obd != 'none') { $obd_values = explode(PATH_SEPARATOR, $obd); if (count($obd_values) > 0 and $obd_values[0]) { // open_basedir is in effect ! @@ -516,13 +516,13 @@ class OC_Helper { $free = 0.0; } } catch (\Exception $e) { - if ($path === "") { + if ($path === '') { throw $e; } /** @var LoggerInterface $logger */ $logger = \OC::$server->get(LoggerInterface::class); - $logger->warning("Error while getting quota info, using root quota", ['exception' => $e]); - $rootInfo = self::getStorageInfo(""); + $logger->warning('Error while getting quota info, using root quota', ['exception' => $e]); + $rootInfo = self::getStorageInfo(''); $memcache->set($cacheKey, $rootInfo, 5 * 60); return $rootInfo; } @@ -575,7 +575,7 @@ class OC_Helper { if ($isRemoteShare === false && $hasOwnerId && $path === '/') { // If path is root, store this as last known quota usage for this user - \OCP\Server::get(\OCP\IConfig::class)->setUserValue($ownerId, 'files', 'lastSeenQuotaUsage', (string)$relative); + \OCP\Server::get(\OCP\IConfig::class)->setUserValue($ownerId, 'files', 'lastSeenQuotaUsage', (string) $relative); } $memcache->set($cacheKey, $info, 5 * 60); diff --git a/lib/private/legacy/OC_Hook.php b/lib/private/legacy/OC_Hook.php index 2f6686f9126..5c36a253895 100644 --- a/lib/private/legacy/OC_Hook.php +++ b/lib/private/legacy/OC_Hook.php @@ -43,8 +43,8 @@ class OC_Hook { } // Connect the hook handler to the requested emitter self::$registered[$signalClass][$signalName][] = [ - "class" => $slotClass, - "name" => $slotName + 'class' => $slotClass, + 'name' => $slotName ]; // No chance for failure ;-) @@ -79,7 +79,7 @@ class OC_Hook { // Call all slots foreach (self::$registered[$signalClass][$signalName] as $i) { try { - call_user_func([ $i["class"], $i["name"] ], $params); + call_user_func([ $i['class'], $i['name'] ], $params); } catch (Exception $e) { self::$thrownExceptions[] = $e; \OC::$server->getLogger()->logException($e); diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php index 827ea16039b..51aaea49a5a 100644 --- a/lib/private/legacy/OC_Image.php +++ b/lib/private/legacy/OC_Image.php @@ -334,18 +334,18 @@ class OC_Image implements \OCP\IImage { } ob_start(); switch ($this->mimeType) { - case "image/png": + case 'image/png': $res = imagepng($this->resource); break; - case "image/jpeg": + case 'image/jpeg': imageinterlace($this->resource, true); $quality = $this->getJpegQuality(); $res = imagejpeg($this->resource, null, $quality); break; - case "image/gif": + case 'image/gif': $res = imagegif($this->resource); break; - case "image/webp": + case 'image/webp': $res = imagewebp($this->resource, null, $this->getWebpQuality()); break; default: @@ -434,7 +434,7 @@ class OC_Image implements \OCP\IImage { return -1; } $this->exif = $exif; - return (int)$exif['Orientation']; + return (int) $exif['Orientation']; } public function readExif($data): void { @@ -883,7 +883,7 @@ class OC_Image implements \OCP\IImage { $newHeight = $maxSize; } - return $this->preciseResizeNew((int)round($newWidth), (int)round($newHeight)); + return $this->preciseResizeNew((int) round($newWidth), (int) round($newHeight)); } /** @@ -1072,7 +1072,7 @@ class OC_Image implements \OCP\IImage { $newWidth = min($maxWidth, $ratio * $maxHeight); $newHeight = min($maxHeight, $maxWidth / $ratio); - $this->preciseResize((int)round($newWidth), (int)round($newHeight)); + $this->preciseResize((int) round($newWidth), (int) round($newHeight)); return true; } diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php index e3e9a7abc5f..422709cec7d 100644 --- a/lib/private/legacy/OC_Template.php +++ b/lib/private/legacy/OC_Template.php @@ -95,7 +95,7 @@ class OC_Template extends \OC\Template\Base { * @param string $tag tag name of the element * @param array $attributes array of attributes for the element * @param string $text the text content for the element. If $text is null then the - * element will be written as empty element. So use "" to get a closing tag. + * element will be written as empty element. So use "" to get a closing tag. */ public function addHeader($tag, $attributes, $text = null) { $this->headers[] = [ @@ -172,7 +172,7 @@ class OC_Template extends \OC\Template\Base { * @return boolean|null */ public static function printUserPage($application, $name, $parameters = []) { - $content = new OC_Template($application, $name, "user"); + $content = new OC_Template($application, $name, 'user'); foreach ($parameters as $key => $value) { $content->assign($key, $value); } @@ -187,7 +187,7 @@ class OC_Template extends \OC\Template\Base { * @return bool */ public static function printAdminPage($application, $name, $parameters = []) { - $content = new OC_Template($application, $name, "admin"); + $content = new OC_Template($application, $name, 'admin'); foreach ($parameters as $key => $value) { $content->assign($key, $value); } diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php index f78d2186f1e..9562d1cab6f 100644 --- a/lib/private/legacy/OC_User.php +++ b/lib/private/legacy/OC_User.php @@ -145,7 +145,7 @@ class OC_User { public static function loginWithApache(\OCP\Authentication\IApacheBackend $backend) { $uid = $backend->getCurrentUserId(); $run = true; - OC_Hook::emit("OC_User", "pre_login", ["run" => &$run, "uid" => $uid, 'backend' => $backend]); + OC_Hook::emit('OC_User', 'pre_login', ['run' => &$run, 'uid' => $uid, 'backend' => $backend]); if ($uid) { if (self::getUser() !== $uid) { @@ -221,9 +221,9 @@ class OC_User { * Verify with Apache whether user is authenticated. * * @return boolean|null - * true: authenticated - * false: not authenticated - * null: not handled / no backend available + * true: authenticated + * false: not authenticated + * null: not handled / no backend available */ public static function handleApacheAuth() { $backend = self::findFirstActiveUsedBackend(); diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 3b5222fee64..2c7624087ac 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -296,7 +296,7 @@ class OC_Util { private static function generatePath($application, $directory, $file) { if (is_null($file)) { $file = $application; - $application = ""; + $application = ''; } if (!empty($application)) { return "$application/$directory/$file"; @@ -322,7 +322,7 @@ class OC_Util { if ($application !== 'core' && $file !== null) { self::addTranslations($application); } - self::addExternalResource($application, $prepend, $path, "script"); + self::addExternalResource($application, $prepend, $path, 'script'); } /** @@ -335,7 +335,7 @@ class OC_Util { */ public static function addVendorScript($application, $file = null, $prepend = false) { $path = OC_Util::generatePath($application, 'vendor', $file); - self::addExternalResource($application, $prepend, $path, "script"); + self::addExternalResource($application, $prepend, $path, 'script'); } /** @@ -356,7 +356,7 @@ class OC_Util { } else { $path = "l10n/$languageCode"; } - self::addExternalResource($application, $prepend, $path, "script"); + self::addExternalResource($application, $prepend, $path, 'script'); } /** @@ -369,7 +369,7 @@ class OC_Util { */ public static function addStyle($application, $file = null, $prepend = false) { $path = OC_Util::generatePath($application, 'css', $file); - self::addExternalResource($application, $prepend, $path, "style"); + self::addExternalResource($application, $prepend, $path, 'style'); } /** @@ -382,7 +382,7 @@ class OC_Util { */ public static function addVendorStyle($application, $file = null, $prepend = false) { $path = OC_Util::generatePath($application, 'vendor', $file); - self::addExternalResource($application, $prepend, $path, "style"); + self::addExternalResource($application, $prepend, $path, 'style'); } /** @@ -394,8 +394,8 @@ class OC_Util { * @param string $type (script or style) * @return void */ - private static function addExternalResource($application, $prepend, $path, $type = "script") { - if ($type === "style") { + private static function addExternalResource($application, $prepend, $path, $type = 'script') { + if ($type === 'style') { if (!in_array($path, self::$styles)) { if ($prepend === true) { array_unshift(self::$styles, $path); @@ -403,7 +403,7 @@ class OC_Util { self::$styles[] = $path; } } - } elseif ($type === "script") { + } elseif ($type === 'script') { if (!in_array($path, self::$scripts)) { if ($prepend === true) { array_unshift(self::$scripts, $path); @@ -806,7 +806,7 @@ class OC_Util { }, $value); } else { // Specify encoding for PHP<5.4 - $value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8'); + $value = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8'); } return $value; } @@ -991,7 +991,7 @@ class OC_Util { * @return string the theme */ public static function getTheme() { - $theme = \OC::$server->getSystemConfig()->getValue("theme", ''); + $theme = \OC::$server->getSystemConfig()->getValue('theme', ''); if ($theme === '') { if (is_dir(OC::$SERVERROOT . '/themes/default')) { diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php index 84ada2aa6d8..4f14d439026 100644 --- a/lib/private/legacy/template/functions.php +++ b/lib/private/legacy/template/functions.php @@ -102,7 +102,7 @@ function print_unescaped($string) { * * @param string $app the appname * @param string|string[] $file the filename, - * if an array is given it will add all scripts + * if an array is given it will add all scripts */ function script($app, $file = null) { if (is_array($file)) { @@ -118,7 +118,7 @@ function script($app, $file = null) { * Shortcut for adding vendor scripts to a page * @param string $app the appname * @param string|string[] $file the filename, - * if an array is given it will add all scripts + * if an array is given it will add all scripts */ function vendor_script($app, $file = null) { if (is_array($file)) { @@ -134,7 +134,7 @@ function vendor_script($app, $file = null) { * Shortcut for adding styles to a page * @param string $app the appname * @param string|string[] $file the filename, - * if an array is given it will add all styles + * if an array is given it will add all styles */ function style($app, $file = null) { if (is_array($file)) { @@ -150,7 +150,7 @@ function style($app, $file = null) { * Shortcut for adding vendor styles to a page * @param string $app the appname * @param string|string[] $file the filename, - * if an array is given it will add all styles + * if an array is given it will add all styles */ function vendor_style($app, $file = null) { if (is_array($file)) { @@ -165,7 +165,7 @@ function vendor_style($app, $file = null) { /** * Shortcut for adding translations to a page * @param string $app the appname - * if an array is given it will add all styles + * if an array is given it will add all styles */ function translation($app) { OC_Util::addTranslations($app); @@ -175,7 +175,7 @@ function translation($app) { * Shortcut for HTML imports * @param string $app the appname * @param string|string[] $file the path relative to the app's component folder, - * if an array is given it will add all components + * if an array is given it will add all components */ function component($app, $file) { if (is_array($file)) { @@ -269,7 +269,7 @@ function human_file_size($bytes) { function strip_time($timestamp) { $date = new \DateTime("@{$timestamp}"); $date->setTime(0, 0, 0); - return (int)$date->format('U'); + return (int) $date->format('U'); } /** diff --git a/lib/public/Accounts/IAccount.php b/lib/public/Accounts/IAccount.php index 906fd8baf38..f9218f5fdf6 100644 --- a/lib/public/Accounts/IAccount.php +++ b/lib/public/Accounts/IAccount.php @@ -22,7 +22,7 @@ interface IAccount extends \JsonSerializable { * * @since 15.0.0 * - * @param string $property Must be one of the PROPERTY_ prefixed constants of \OCP\Accounts\IAccountManager + * @param string $property Must be one of the PROPERTY_ prefixed constants of \OCP\Accounts\IAccountManager * @param string $value * @param string $scope Must be one of the VISIBILITY_ prefixed constants of \OCP\Accounts\IAccountManager * @param string $verified \OCP\Accounts\IAccountManager::NOT_VERIFIED | \OCP\Accounts\IAccountManager::VERIFICATION_IN_PROGRESS | \OCP\Accounts\IAccountManager::VERIFIED diff --git a/lib/public/Accounts/IAccountManager.php b/lib/public/Accounts/IAccountManager.php index 9168e17ea10..33477db7679 100644 --- a/lib/public/Accounts/IAccountManager.php +++ b/lib/public/Accounts/IAccountManager.php @@ -228,9 +228,9 @@ interface IAccountManager { * Search for users based on account data * * @param string $property - property or property collection name – since - * NC 22 the implementation MAY add a fitting property collection into the - * search even if a property name was given e.g. email property and email - * collection) + * NC 22 the implementation MAY add a fitting property collection into the + * search even if a property name was given e.g. email property and email + * collection) * @param string[] $values * @return array * diff --git a/lib/public/Accounts/PropertyDoesNotExistException.php b/lib/public/Accounts/PropertyDoesNotExistException.php index d0f10cdf12f..1d27ef1df30 100644 --- a/lib/public/Accounts/PropertyDoesNotExistException.php +++ b/lib/public/Accounts/PropertyDoesNotExistException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Activity/ActivitySettings.php b/lib/public/Activity/ActivitySettings.php index 24e4681ee54..fa187164e19 100644 --- a/lib/public/Activity/ActivitySettings.php +++ b/lib/public/Activity/ActivitySettings.php @@ -38,8 +38,8 @@ abstract class ActivitySettings implements ISetting { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 20.0.0 */ abstract public function getPriority(); diff --git a/lib/public/Activity/IEventMerger.php b/lib/public/Activity/IEventMerger.php index e9355c88004..5d0f691f2d4 100644 --- a/lib/public/Activity/IEventMerger.php +++ b/lib/public/Activity/IEventMerger.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Activity/IFilter.php b/lib/public/Activity/IFilter.php index 2f1f4ccda80..008de6f5bca 100644 --- a/lib/public/Activity/IFilter.php +++ b/lib/public/Activity/IFilter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -25,8 +26,8 @@ interface IFilter { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority(); diff --git a/lib/public/Activity/IProvider.php b/lib/public/Activity/IProvider.php index 17fffbb26e2..dec4e7ade64 100644 --- a/lib/public/Activity/IProvider.php +++ b/lib/public/Activity/IProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Activity/ISetting.php b/lib/public/Activity/ISetting.php index 306a0d85632..1304ab8c658 100644 --- a/lib/public/Activity/ISetting.php +++ b/lib/public/Activity/ISetting.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -25,8 +26,8 @@ interface ISetting { /** * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * @since 11.0.0 */ public function getPriority(); diff --git a/lib/public/App/AppPathNotFoundException.php b/lib/public/App/AppPathNotFoundException.php index 5e3ea7a9919..56d6571ea68 100644 --- a/lib/public/App/AppPathNotFoundException.php +++ b/lib/public/App/AppPathNotFoundException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/AppFramework/ApiController.php b/lib/public/AppFramework/ApiController.php index d3c83005ad1..7a2226399ea 100644 --- a/lib/public/AppFramework/ApiController.php +++ b/lib/public/AppFramework/ApiController.php @@ -27,13 +27,13 @@ abstract class ApiController extends Controller { * @param string $appName the name of the app * @param IRequest $request an instance of the request * @param string $corsMethods comma separated string of HTTP verbs which - * should be allowed for websites or webapps when calling your API, defaults to - * 'PUT, POST, GET, DELETE, PATCH' + * should be allowed for websites or webapps when calling your API, defaults to + * 'PUT, POST, GET, DELETE, PATCH' * @param string $corsAllowedHeaders comma separated string of HTTP headers - * which should be allowed for websites or webapps when calling your API, - * defaults to 'Authorization, Content-Type, Accept' + * which should be allowed for websites or webapps when calling your API, + * defaults to 'Authorization, Content-Type, Accept' * @param int $corsMaxAge number in seconds how long a preflighted OPTIONS - * request should be cached, defaults to 1728000 seconds + * request should be cached, defaults to 1728000 seconds * @since 7.0.0 */ public function __construct($appName, @@ -67,7 +67,7 @@ abstract class ApiController extends Controller { $response = new Response(); $response->addHeader('Access-Control-Allow-Origin', $origin); $response->addHeader('Access-Control-Allow-Methods', $this->corsMethods); - $response->addHeader('Access-Control-Max-Age', (string)$this->corsMaxAge); + $response->addHeader('Access-Control-Max-Age', (string) $this->corsMaxAge); $response->addHeader('Access-Control-Allow-Headers', $this->corsAllowedHeaders); $response->addHeader('Access-Control-Allow-Credentials', 'false'); return $response; diff --git a/lib/public/AppFramework/App.php b/lib/public/AppFramework/App.php index a8ba6b701f9..06404baea70 100644 --- a/lib/public/AppFramework/App.php +++ b/lib/public/AppFramework/App.php @@ -32,7 +32,7 @@ class App { * some_app_id -> OCA\SomeAppId * @param string $appId the app id * @param string $topNamespace the namespace which should be prepended to - * the transformed app id, defaults to OCA\ + * the transformed app id, defaults to OCA\ * @return string the starting namespace for the app * @since 8.0.0 */ diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php index 44e8cecd810..99fed5350e5 100644 --- a/lib/public/AppFramework/Controller.php +++ b/lib/public/AppFramework/Controller.php @@ -123,7 +123,7 @@ abstract class Controller { /** * Serializes and formats a response * @param mixed $response the value that was returned from a controller and - * is not a Response instance + * is not a Response instance * @param string $format the format for which a formatter has been registered * @throws \DomainException if format does not match a registered formatter * @return Response diff --git a/lib/public/AppFramework/Db/Entity.php b/lib/public/AppFramework/Db/Entity.php index ac6aa100024..8a0d3fb140f 100644 --- a/lib/public/AppFramework/Db/Entity.php +++ b/lib/public/AppFramework/Db/Entity.php @@ -28,7 +28,7 @@ abstract class Entity { /** * Simple alternative constructor for building entities from a request * @param array $params the array which was obtained via $this->params('key') - * in the controller + * in the controller * @since 7.0.0 */ public static function fromParams(array $params): static { diff --git a/lib/public/AppFramework/Db/QBMapper.php b/lib/public/AppFramework/Db/QBMapper.php index 41160b29fa5..cd09a6b11b6 100644 --- a/lib/public/AppFramework/Db/QBMapper.php +++ b/lib/public/AppFramework/Db/QBMapper.php @@ -34,7 +34,7 @@ abstract class QBMapper { * @param IDBConnection $db Instance of the Db abstraction layer * @param string $tableName the name of the table. set this to allow entity * @param class-string<T>|null $entityClass the name of the entity that the sql should be - * mapped to queries without using sql + * mapped to queries without using sql * @since 14.0.0 */ public function __construct(IDBConnection $db, string $tableName, ?string $entityClass = null) { @@ -203,7 +203,7 @@ abstract class QBMapper { * Returns the type parameter for the QueryBuilder for a specific property * of the $entity * - * @param Entity $entity The entity to get the types from + * @param Entity $entity The entity to get the types from * @psalm-param T $entity * @param string $property The property of $entity to get the type for * @return int|string diff --git a/lib/public/AppFramework/Http/Attribute/OpenAPI.php b/lib/public/AppFramework/Http/Attribute/OpenAPI.php index 26d01937cfb..1b44b2a57fe 100644 --- a/lib/public/AppFramework/Http/Attribute/OpenAPI.php +++ b/lib/public/AppFramework/Http/Attribute/OpenAPI.php @@ -60,12 +60,12 @@ class OpenAPI { /** * @param self::SCOPE_*|string $scope Scopes are used to define different clients. - * It is recommended to go with the scopes available as self::SCOPE_* constants, - * but in exotic cases other APIs might need documentation as well, - * then a free string can be provided (but it should be `a-z` only). + * It is recommended to go with the scopes available as self::SCOPE_* constants, + * but in exotic cases other APIs might need documentation as well, + * then a free string can be provided (but it should be `a-z` only). * @param ?list<string> $tags Tags can be used to group routes inside a scope - * for easier implementation and reviewing of the API specification. - * It defaults to the controller name in snake_case (should be `a-z` and underscore only). + * for easier implementation and reviewing of the API specification. + * It defaults to the controller name in snake_case (should be `a-z` and underscore only). * @since 28.0.0 */ public function __construct( diff --git a/lib/public/AppFramework/Http/ContentSecurityPolicy.php b/lib/public/AppFramework/Http/ContentSecurityPolicy.php index 281aaa06eb8..11ec79bbdb7 100644 --- a/lib/public/AppFramework/Http/ContentSecurityPolicy.php +++ b/lib/public/AppFramework/Http/ContentSecurityPolicy.php @@ -38,7 +38,7 @@ class ContentSecurityPolicy extends EmptyContentSecurityPolicy { ]; /** * @var bool Whether inline CSS is allowed - * TODO: Disallow per default + * TODO: Disallow per default * @link https://github.com/owncloud/core/issues/13458 */ protected $inlineStyleAllowed = true; diff --git a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php index d638e8ae0af..0a6258be941 100644 --- a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php +++ b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php @@ -26,7 +26,7 @@ class EmptyContentSecurityPolicy { protected $strictDynamicAllowedOnScripts = null; /** * @var bool Whether eval in JS scripts is allowed - * TODO: Disallow per default + * TODO: Disallow per default * @link https://github.com/owncloud/core/issues/11925 */ protected $evalScriptAllowed = null; @@ -36,7 +36,7 @@ class EmptyContentSecurityPolicy { protected $allowedScriptDomains = null; /** * @var bool Whether inline CSS is allowed - * TODO: Disallow per default + * TODO: Disallow per default * @link https://github.com/owncloud/core/issues/13458 */ protected $inlineStyleAllowed = null; diff --git a/lib/public/AppFramework/Http/FileDisplayResponse.php b/lib/public/AppFramework/Http/FileDisplayResponse.php index fda160eafc5..c18404b7d91 100644 --- a/lib/public/AppFramework/Http/FileDisplayResponse.php +++ b/lib/public/AppFramework/Http/FileDisplayResponse.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/AppFramework/Http/JSONResponse.php b/lib/public/AppFramework/Http/JSONResponse.php index fd27698e3d0..efcf79d5e87 100644 --- a/lib/public/AppFramework/Http/JSONResponse.php +++ b/lib/public/AppFramework/Http/JSONResponse.php @@ -67,7 +67,7 @@ class JSONResponse extends Response { * Sets values in the data json array * @psalm-suppress InvalidTemplateParam * @param T $data an array or object which will be transformed - * to JSON + * to JSON * @return JSONResponse Reference to this object * @since 6.0.0 - return value was added in 7.0.0 */ diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php index 26237d581cf..046faa9f205 100644 --- a/lib/public/AppFramework/Http/Response.php +++ b/lib/public/AppFramework/Http/Response.php @@ -111,8 +111,8 @@ class Response { * @param string $name The name of the cookie * @param string $value The value of the cookie * @param \DateTime|null $expireDate Date on that the cookie should expire, if set - * to null cookie will be considered as session - * cookie. + * to null cookie will be considered as session + * cookie. * @param string $sameSite The samesite value of the cookie. Defaults to Lax. Other possibilities are Strict or None * @return $this * @since 8.0.0 @@ -289,7 +289,7 @@ class Response { /** * Get the currently used Content-Security-Policy * @return EmptyContentSecurityPolicy|null Used Content-Security-Policy or null if - * none specified. + * none specified. * @since 8.1.0 */ public function getContentSecurityPolicy() { diff --git a/lib/public/AppFramework/Http/Template/ExternalShareMenuAction.php b/lib/public/AppFramework/Http/Template/ExternalShareMenuAction.php index cddf5d19171..3c93c9a142b 100644 --- a/lib/public/AppFramework/Http/Template/ExternalShareMenuAction.php +++ b/lib/public/AppFramework/Http/Template/ExternalShareMenuAction.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/AppFramework/Http/Template/IMenuAction.php b/lib/public/AppFramework/Http/Template/IMenuAction.php index d3962300923..1fa5ef75b5b 100644 --- a/lib/public/AppFramework/Http/Template/IMenuAction.php +++ b/lib/public/AppFramework/Http/Template/IMenuAction.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/AppFramework/Http/Template/LinkMenuAction.php b/lib/public/AppFramework/Http/Template/LinkMenuAction.php index 69e835f6b82..9d747e93310 100644 --- a/lib/public/AppFramework/Http/Template/LinkMenuAction.php +++ b/lib/public/AppFramework/Http/Template/LinkMenuAction.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php index 64bb9bee994..bd898486038 100644 --- a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php +++ b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/AppFramework/Http/Template/SimpleMenuAction.php b/lib/public/AppFramework/Http/Template/SimpleMenuAction.php index 2bb60975f26..cb822bf941b 100644 --- a/lib/public/AppFramework/Http/Template/SimpleMenuAction.php +++ b/lib/public/AppFramework/Http/Template/SimpleMenuAction.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/AppFramework/Http/TemplateResponse.php b/lib/public/AppFramework/Http/TemplateResponse.php index db4a02450b1..55b9f2b06af 100644 --- a/lib/public/AppFramework/Http/TemplateResponse.php +++ b/lib/public/AppFramework/Http/TemplateResponse.php @@ -72,7 +72,7 @@ class TemplateResponse extends Response { * @param string $appName the name of the app to load the template from * @param string $templateName the name of the template * @param array $params an array of parameters which should be passed to the - * template + * template * @param string $renderAs how the page should be rendered, defaults to user * @param S $status * @param H $headers diff --git a/lib/public/AppFramework/OCS/OCSBadRequestException.php b/lib/public/AppFramework/OCS/OCSBadRequestException.php index c229468fb0d..77b8ec6c86d 100644 --- a/lib/public/AppFramework/OCS/OCSBadRequestException.php +++ b/lib/public/AppFramework/OCS/OCSBadRequestException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/AppFramework/OCS/OCSException.php b/lib/public/AppFramework/OCS/OCSException.php index 962bad830e7..02901992f8d 100644 --- a/lib/public/AppFramework/OCS/OCSException.php +++ b/lib/public/AppFramework/OCS/OCSException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/AppFramework/OCS/OCSForbiddenException.php b/lib/public/AppFramework/OCS/OCSForbiddenException.php index 03b1db6104f..0d001377043 100644 --- a/lib/public/AppFramework/OCS/OCSForbiddenException.php +++ b/lib/public/AppFramework/OCS/OCSForbiddenException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/AppFramework/OCS/OCSNotFoundException.php b/lib/public/AppFramework/OCS/OCSNotFoundException.php index 997b0c390f9..67cea9ed759 100644 --- a/lib/public/AppFramework/OCS/OCSNotFoundException.php +++ b/lib/public/AppFramework/OCS/OCSNotFoundException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php b/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php index 2e67263bcb9..4fc2820eaec 100644 --- a/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php +++ b/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/AppFramework/OCSController.php b/lib/public/AppFramework/OCSController.php index b4bb62c41ed..7cde2a7e427 100644 --- a/lib/public/AppFramework/OCSController.php +++ b/lib/public/AppFramework/OCSController.php @@ -44,13 +44,13 @@ abstract class OCSController extends ApiController { * @param string $appName the name of the app * @param IRequest $request an instance of the request * @param string $corsMethods comma separated string of HTTP verbs which - * should be allowed for websites or webapps when calling your API, defaults to - * 'PUT, POST, GET, DELETE, PATCH' + * should be allowed for websites or webapps when calling your API, defaults to + * 'PUT, POST, GET, DELETE, PATCH' * @param string $corsAllowedHeaders comma separated string of HTTP headers - * which should be allowed for websites or webapps when calling your API, - * defaults to 'Authorization, Content-Type, Accept' + * which should be allowed for websites or webapps when calling your API, + * defaults to 'Authorization, Content-Type, Accept' * @param int $corsMaxAge number in seconds how long a preflighted OPTIONS - * request should be cached, defaults to 1728000 seconds + * request should be cached, defaults to 1728000 seconds * @since 8.1.0 */ public function __construct($appName, @@ -81,7 +81,7 @@ abstract class OCSController extends ApiController { * Since the OCS endpoints default to XML we need to find out the format * again * @param mixed $response the value that was returned from a controller and - * is not a Response instance + * is not a Response instance * @param string $format the format for which a formatter has been registered * @throws \DomainException if format does not match a registered formatter * @return Response diff --git a/lib/public/AppFramework/Utility/IControllerMethodReflector.php b/lib/public/AppFramework/Utility/IControllerMethodReflector.php index 577191cac40..95d7fbebb56 100644 --- a/lib/public/AppFramework/Utility/IControllerMethodReflector.php +++ b/lib/public/AppFramework/Utility/IControllerMethodReflector.php @@ -31,9 +31,9 @@ interface IControllerMethodReflector { * Inspects the PHPDoc parameters for types * * @param string $parameter the parameter whose type comments should be - * parsed + * parsed * @return string|null type in the type parameters (@param int $something) - * would return int or null if not existing + * would return int or null if not existing * @since 8.0.0 * @deprecated 22.0.0 this method is only used internally */ diff --git a/lib/public/Authentication/Exceptions/CredentialsUnavailableException.php b/lib/public/Authentication/Exceptions/CredentialsUnavailableException.php index 835fd1eac9d..6ca8e68ed95 100644 --- a/lib/public/Authentication/Exceptions/CredentialsUnavailableException.php +++ b/lib/public/Authentication/Exceptions/CredentialsUnavailableException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Authentication/Exceptions/PasswordUnavailableException.php b/lib/public/Authentication/Exceptions/PasswordUnavailableException.php index 6a425f4ddd9..89e254e8ba1 100644 --- a/lib/public/Authentication/Exceptions/PasswordUnavailableException.php +++ b/lib/public/Authentication/Exceptions/PasswordUnavailableException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Authentication/IProvideUserSecretBackend.php b/lib/public/Authentication/IProvideUserSecretBackend.php index c005f6c9d59..dfab35c5f48 100644 --- a/lib/public/Authentication/IProvideUserSecretBackend.php +++ b/lib/public/Authentication/IProvideUserSecretBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only diff --git a/lib/public/Authentication/LoginCredentials/ICredentials.php b/lib/public/Authentication/LoginCredentials/ICredentials.php index a1c802f73b0..9848bbbe821 100644 --- a/lib/public/Authentication/LoginCredentials/ICredentials.php +++ b/lib/public/Authentication/LoginCredentials/ICredentials.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Authentication/TwoFactorAuth/IRegistry.php b/lib/public/Authentication/TwoFactorAuth/IRegistry.php index f4cffd7c34c..6817f1763cf 100644 --- a/lib/public/Authentication/TwoFactorAuth/IRegistry.php +++ b/lib/public/Authentication/TwoFactorAuth/IRegistry.php @@ -38,7 +38,7 @@ interface IRegistry { * * @since 14.0.0 * @return array<string, bool> where the array key is the provider ID (string) and the - * value is the enabled state (bool) + * value is the enabled state (bool) */ public function getProviderStates(IUser $user): array; diff --git a/lib/public/BeforeSabrePubliclyLoadedEvent.php b/lib/public/BeforeSabrePubliclyLoadedEvent.php index c69cf867a43..33f9f8bc378 100644 --- a/lib/public/BeforeSabrePubliclyLoadedEvent.php +++ b/lib/public/BeforeSabrePubliclyLoadedEvent.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Calendar/BackendTemporarilyUnavailableException.php b/lib/public/Calendar/BackendTemporarilyUnavailableException.php index e02ef1a84fd..c2bbb1417ee 100644 --- a/lib/public/Calendar/BackendTemporarilyUnavailableException.php +++ b/lib/public/Calendar/BackendTemporarilyUnavailableException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Calendar/ICalendar.php b/lib/public/Calendar/ICalendar.php index 76257579a8f..2f74d329119 100644 --- a/lib/public/Calendar/ICalendar.php +++ b/lib/public/Calendar/ICalendar.php @@ -44,7 +44,7 @@ interface ICalendar { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options - optional parameters: - * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] + * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] * @param int|null $limit - limit number of search results * @param int|null $offset - offset for paging of search results * @return array an array of events/journals/todos which are arrays of key-value-pairs. the events are sorted by start date (closest first, furthest last) diff --git a/lib/public/Calendar/IHandleImipMessage.php b/lib/public/Calendar/IHandleImipMessage.php index f42ee0fcda7..27190f93f24 100644 --- a/lib/public/Calendar/IHandleImipMessage.php +++ b/lib/public/Calendar/IHandleImipMessage.php @@ -24,7 +24,7 @@ interface IHandleImipMessage extends ICalendar { * * @since 26.0.0 * - * @throws CalendarException on validation failure or calendar write error + * @throws CalendarException on validation failure or calendar write error */ public function handleIMipMessage(string $name, string $calendarData): void; } diff --git a/lib/public/Calendar/IManager.php b/lib/public/Calendar/IManager.php index ff752c0d06e..8a9fe485871 100644 --- a/lib/public/Calendar/IManager.php +++ b/lib/public/Calendar/IManager.php @@ -46,7 +46,7 @@ interface IManager { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options - optional parameters: - * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] + * ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]] * @param integer|null $limit - limit number of search results * @param integer|null $offset - offset for paging of search results * @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs diff --git a/lib/public/Calendar/IMetadataProvider.php b/lib/public/Calendar/IMetadataProvider.php index bee840c955f..acacf7efdaf 100644 --- a/lib/public/Calendar/IMetadataProvider.php +++ b/lib/public/Calendar/IMetadataProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Calendar/Resource/IBackend.php b/lib/public/Calendar/Resource/IBackend.php index b43d79e3618..23d37c102f2 100644 --- a/lib/public/Calendar/Resource/IBackend.php +++ b/lib/public/Calendar/Resource/IBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Calendar/Resource/IResource.php b/lib/public/Calendar/Resource/IResource.php index f284eee955f..15abe4e2d0f 100644 --- a/lib/public/Calendar/Resource/IResource.php +++ b/lib/public/Calendar/Resource/IResource.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Calendar/Resource/IResourceMetadata.php b/lib/public/Calendar/Resource/IResourceMetadata.php index acf02bc3609..29f628d6f7f 100644 --- a/lib/public/Calendar/Resource/IResourceMetadata.php +++ b/lib/public/Calendar/Resource/IResourceMetadata.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Calendar/Room/IBackend.php b/lib/public/Calendar/Room/IBackend.php index 52ec2fa5948..c99f5fbdb72 100644 --- a/lib/public/Calendar/Room/IBackend.php +++ b/lib/public/Calendar/Room/IBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Calendar/Room/IRoom.php b/lib/public/Calendar/Room/IRoom.php index 580c676331f..526e65b8f5f 100644 --- a/lib/public/Calendar/Room/IRoom.php +++ b/lib/public/Calendar/Room/IRoom.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Calendar/Room/IRoomMetadata.php b/lib/public/Calendar/Room/IRoomMetadata.php index 3fb4089b6a7..15d4b501e12 100644 --- a/lib/public/Calendar/Room/IRoomMetadata.php +++ b/lib/public/Calendar/Room/IRoomMetadata.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Capabilities/IPublicCapability.php b/lib/public/Capabilities/IPublicCapability.php index 3936d6032af..1a9dd965b16 100644 --- a/lib/public/Capabilities/IPublicCapability.php +++ b/lib/public/Capabilities/IPublicCapability.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Collaboration/AutoComplete/IManager.php b/lib/public/Collaboration/AutoComplete/IManager.php index 55a1fe5cec3..2d5443b921d 100644 --- a/lib/public/Collaboration/AutoComplete/IManager.php +++ b/lib/public/Collaboration/AutoComplete/IManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -20,7 +21,7 @@ interface IManager { /** * @param array $sorters list of sorter IDs, separated by "|" * @param array $sortArray array representation of OCP\Collaboration\Collaborators\ISearchResult - * @param array{itemType: string, itemId: string, search?: string} $context context info of the search + * @param array{itemType: string, itemId: string, search?: string} $context context info of the search * @since 13.0.0 */ public function runSorters(array $sorters, array &$sortArray, array $context); diff --git a/lib/public/Collaboration/AutoComplete/ISorter.php b/lib/public/Collaboration/AutoComplete/ISorter.php index 4b9f2b72e7c..1009092af6a 100644 --- a/lib/public/Collaboration/AutoComplete/ISorter.php +++ b/lib/public/Collaboration/AutoComplete/ISorter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Collaboration/Collaborators/ISearch.php b/lib/public/Collaboration/Collaborators/ISearch.php index a991a683acc..d2c5c85c07f 100644 --- a/lib/public/Collaboration/Collaborators/ISearch.php +++ b/lib/public/Collaboration/Collaborators/ISearch.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,7 +25,7 @@ interface ISearch { /** * @param array $pluginInfo with keys 'shareType' containing the name of a corresponding constant in \OCP\Share and - * 'class' with the class name of the plugin + * 'class' with the class name of the plugin * @since 13.0.0 */ public function registerPlugin(array $pluginInfo); diff --git a/lib/public/Collaboration/Collaborators/ISearchPlugin.php b/lib/public/Collaboration/Collaborators/ISearchPlugin.php index ec875d7d017..e55a095e2b6 100644 --- a/lib/public/Collaboration/Collaborators/ISearchPlugin.php +++ b/lib/public/Collaboration/Collaborators/ISearchPlugin.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Collaboration/Collaborators/ISearchResult.php b/lib/public/Collaboration/Collaborators/ISearchResult.php index 8e693caa677..bcc5a91ce99 100644 --- a/lib/public/Collaboration/Collaborators/ISearchResult.php +++ b/lib/public/Collaboration/Collaborators/ISearchResult.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Collaboration/Collaborators/SearchResultType.php b/lib/public/Collaboration/Collaborators/SearchResultType.php index f5ea0751c7b..d45019b238d 100644 --- a/lib/public/Collaboration/Collaborators/SearchResultType.php +++ b/lib/public/Collaboration/Collaborators/SearchResultType.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -11,7 +12,7 @@ namespace OCP\Collaboration\Collaborators; * @since 13.0.0 */ class SearchResultType { - /** @var string */ + /** @var string */ protected $label; /** @@ -39,7 +40,7 @@ class SearchResultType { * @since 13.0.0 */ protected function getValidatedType($type) { - $type = trim((string)$type); + $type = trim((string) $type); if ($type === '') { throw new \InvalidArgumentException('Type must not be empty'); diff --git a/lib/public/Collaboration/Reference/LinkReferenceProvider.php b/lib/public/Collaboration/Reference/LinkReferenceProvider.php index 86d2c03918c..36e2991d20c 100644 --- a/lib/public/Collaboration/Reference/LinkReferenceProvider.php +++ b/lib/public/Collaboration/Reference/LinkReferenceProvider.php @@ -69,7 +69,7 @@ class LinkReferenceProvider implements IReferenceProvider, IPublicReferenceProvi return false; } - return (bool)preg_match(IURLGenerator::URL_REGEX, $referenceText); + return (bool) preg_match(IURLGenerator::URL_REGEX, $referenceText); } /** @@ -121,7 +121,7 @@ class LinkReferenceProvider implements IReferenceProvider, IPublicReferenceProvi } $linkContentLength = $headResponse->getHeader('Content-Length'); - if (is_numeric($linkContentLength) && (int)$linkContentLength > self::MAX_CONTENT_LENGTH) { + if (is_numeric($linkContentLength) && (int) $linkContentLength > self::MAX_CONTENT_LENGTH) { $this->logger->debug('[Head] Skip resolving links pointing to content length > 5 MiB'); return; } diff --git a/lib/public/Color.php b/lib/public/Color.php index f48655ca04d..55cde95a28d 100644 --- a/lib/public/Color.php +++ b/lib/public/Color.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -83,7 +84,7 @@ class Color { * @since 25.0.0 */ public function name(): string { - return sprintf("#%02x%02x%02x", $this->r, $this->g, $this->b); + return sprintf('#%02x%02x%02x', $this->r, $this->g, $this->b); } /** @@ -115,9 +116,9 @@ class Color { */ public function alphaBlending(float $opacity, Color $source): Color { return new Color( - (int)((1 - $opacity) * $source->red() + $opacity * $this->red()), - (int)((1 - $opacity) * $source->green() + $opacity * $this->green()), - (int)((1 - $opacity) * $source->blue() + $opacity * $this->blue()) + (int) ((1 - $opacity) * $source->red() + $opacity * $this->red()), + (int) ((1 - $opacity) * $source->green() + $opacity * $this->green()), + (int) ((1 - $opacity) * $source->blue() + $opacity * $this->blue()) ); } diff --git a/lib/public/Comments/CommentsEntityEvent.php b/lib/public/Comments/CommentsEntityEvent.php index 2d0c50ad95b..39568151b61 100644 --- a/lib/public/Comments/CommentsEntityEvent.php +++ b/lib/public/Comments/CommentsEntityEvent.php @@ -38,9 +38,9 @@ class CommentsEntityEvent extends Event { /** * @param string $name * @param \Closure $entityExistsFunction The closure should take one - * argument, which is the id of the entity, that comments - * should be handled for. The return should then be bool, - * depending on whether comments are allowed (true) or not. + * argument, which is the id of the entity, that comments + * should be handled for. The return should then be bool, + * depending on whether comments are allowed (true) or not. * @throws \OutOfBoundsException when the entity name is already taken * @since 9.1.0 */ diff --git a/lib/public/Comments/ICommentsEventHandler.php b/lib/public/Comments/ICommentsEventHandler.php index dc0a554ff11..148ead2c367 100644 --- a/lib/public/Comments/ICommentsEventHandler.php +++ b/lib/public/Comments/ICommentsEventHandler.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Comments/ICommentsManager.php b/lib/public/Comments/ICommentsManager.php index 15a7d8f8cb1..af9d0fe61f0 100644 --- a/lib/public/Comments/ICommentsManager.php +++ b/lib/public/Comments/ICommentsManager.php @@ -85,10 +85,10 @@ interface ICommentsManager { * @param string $objectType the object type, e.g. 'files' * @param string $objectId the id of the object * @param int $limit optional, number of maximum comments to be returned. if - * not specified, all comments are returned. + * not specified, all comments are returned. * @param int $offset optional, starting point * @param \DateTime|null $notOlderThan optional, timestamp of the oldest comments - * that may be returned + * that may be returned * @return list<IComment> * @since 9.0.0 */ @@ -106,7 +106,7 @@ interface ICommentsManager { * @param int $lastKnownCommentId the last known comment (will be used as offset) * @param string $sortDirection direction of the comments (`asc` or `desc`) * @param int $limit optional, number of maximum comments to be returned. if - * set to 0, all comments are returned. + * set to 0, all comments are returned. * @param bool $includeLastKnown * @return list<IComment> * @since 14.0.0 @@ -128,7 +128,7 @@ interface ICommentsManager { * @param int $lastKnownCommentId the last known comment (will be used as offset) * @param string $sortDirection direction of the comments (`asc` or `desc`) * @param int $limit optional, number of maximum comments to be returned. if - * set to 0, all comments are returned. + * set to 0, all comments are returned. * @param bool $includeLastKnown * @return list<IComment> * @since 24.0.0 @@ -175,7 +175,7 @@ interface ICommentsManager { * @param $objectType string the object type, e.g. 'files' * @param $objectId string the id of the object * @param \DateTime|null $notOlderThan optional, timestamp of the oldest comments - * that may be returned + * that may be returned * @param string $verb Limit the verb of the comment - Added in 14.0.0 * @return Int * @since 9.0.0 diff --git a/lib/public/Constants.php b/lib/public/Constants.php index 8326aa6570e..62772d195b2 100644 --- a/lib/public/Constants.php +++ b/lib/public/Constants.php @@ -52,7 +52,7 @@ class Constants { * @since 8.0.0 - Updated in 9.0.0 to allow all POSIX chars since we no * longer support windows as server platform. */ - public const FILENAME_INVALID_CHARS = "\\/"; + public const FILENAME_INVALID_CHARS = '\\/'; /** * @since 21.0.0 – default value for autocomplete/search results limit, diff --git a/lib/public/Contacts/ContactsMenu/IAction.php b/lib/public/Contacts/ContactsMenu/IAction.php index 4a7133a999b..00fe8ba35c4 100644 --- a/lib/public/Contacts/ContactsMenu/IAction.php +++ b/lib/public/Contacts/ContactsMenu/IAction.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Contacts/ContactsMenu/IActionFactory.php b/lib/public/Contacts/ContactsMenu/IActionFactory.php index a4785d1c70c..69e6030e95b 100644 --- a/lib/public/Contacts/ContactsMenu/IActionFactory.php +++ b/lib/public/Contacts/ContactsMenu/IActionFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Contacts/ContactsMenu/IContactsStore.php b/lib/public/Contacts/ContactsMenu/IContactsStore.php index ceb68d99849..67913a2d919 100644 --- a/lib/public/Contacts/ContactsMenu/IContactsStore.php +++ b/lib/public/Contacts/ContactsMenu/IContactsStore.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Contacts/ContactsMenu/IEntry.php b/lib/public/Contacts/ContactsMenu/IEntry.php index c361b71bb7c..9ae8a207297 100644 --- a/lib/public/Contacts/ContactsMenu/IEntry.php +++ b/lib/public/Contacts/ContactsMenu/IEntry.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Contacts/ContactsMenu/ILinkAction.php b/lib/public/Contacts/ContactsMenu/ILinkAction.php index 92bccfd8dda..559e04885c5 100644 --- a/lib/public/Contacts/ContactsMenu/ILinkAction.php +++ b/lib/public/Contacts/ContactsMenu/ILinkAction.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Contacts/IManager.php b/lib/public/Contacts/IManager.php index f19e72e0763..60abb18b382 100644 --- a/lib/public/Contacts/IManager.php +++ b/lib/public/Contacts/IManager.php @@ -68,14 +68,14 @@ interface IManager { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options = array() to define the search behavior - * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array - * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']] - * - 'escape_like_param' - If set to false wildcards _ and % are not escaped - * - 'limit' - Set a numeric limit for the search results - * - 'offset' - Set the offset for the limited search results - * - 'enumeration' - (since 23.0.0) Whether user enumeration on system address book is allowed - * - 'fullmatch' - (since 23.0.0) Whether matching on full detail in system address book is allowed - * - 'strict_search' - (since 23.0.0) Whether the search pattern is full string or partial search + * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array + * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']] + * - 'escape_like_param' - If set to false wildcards _ and % are not escaped + * - 'limit' - Set a numeric limit for the search results + * - 'offset' - Set the offset for the limited search results + * - 'enumeration' - (since 23.0.0) Whether user enumeration on system address book is allowed + * - 'fullmatch' - (since 23.0.0) Whether matching on full detail in system address book is allowed + * - 'strict_search' - (since 23.0.0) Whether the search pattern is full string or partial search * @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, enumeration?: bool, fullmatch?: bool, strict_search?: bool} $options * @return array an array of contacts which are arrays of key-value-pairs * @since 6.0.0 diff --git a/lib/public/DB/ISchemaWrapper.php b/lib/public/DB/ISchemaWrapper.php index 16b776c05b9..dcf22b52d3d 100644 --- a/lib/public/DB/ISchemaWrapper.php +++ b/lib/public/DB/ISchemaWrapper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/DB/QueryBuilder/IExpressionBuilder.php b/lib/public/DB/QueryBuilder/IExpressionBuilder.php index 26c7a36a6af..12e30a45071 100644 --- a/lib/public/DB/QueryBuilder/IExpressionBuilder.php +++ b/lib/public/DB/QueryBuilder/IExpressionBuilder.php @@ -51,7 +51,7 @@ interface IExpressionBuilder { * $expr->andX('u.type = ?', 'u.role = ?')); * * @param mixed ...$x Optional clause. Defaults = null, but requires - * at least one defined when converting to string. + * at least one defined when converting to string. * * @return \OCP\DB\QueryBuilder\ICompositeExpression * @since 8.2.0 @@ -71,7 +71,7 @@ interface IExpressionBuilder { * $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?')); * * @param mixed ...$x Optional clause. Defaults = null, but requires - * at least one defined when converting to string. + * at least one defined when converting to string. * * @return \OCP\DB\QueryBuilder\ICompositeExpression * @since 8.2.0 @@ -88,7 +88,7 @@ interface IExpressionBuilder { * @param string $operator One of the IExpressionBuilder::* constants. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 8.2.0 - Parameter $type was added in 9.0.0 @@ -113,7 +113,7 @@ interface IExpressionBuilder { * @param mixed $x The left expression. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 8.2.0 - Parameter $type was added in 9.0.0 @@ -136,7 +136,7 @@ interface IExpressionBuilder { * @param mixed $x The left expression. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 8.2.0 - Parameter $type was added in 9.0.0 @@ -159,7 +159,7 @@ interface IExpressionBuilder { * @param mixed $x The left expression. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 8.2.0 - Parameter $type was added in 9.0.0 @@ -182,7 +182,7 @@ interface IExpressionBuilder { * @param mixed $x The left expression. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 8.2.0 - Parameter $type was added in 9.0.0 @@ -205,7 +205,7 @@ interface IExpressionBuilder { * @param mixed $x The left expression. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 8.2.0 - Parameter $type was added in 9.0.0 @@ -228,7 +228,7 @@ interface IExpressionBuilder { * @param mixed $x The left expression. * @param mixed $y The right expression. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 8.2.0 - Parameter $type was added in 9.0.0 @@ -269,7 +269,7 @@ interface IExpressionBuilder { * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by LIKE() comparison. * @param mixed $y Argument to be used in LIKE() comparison. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 8.2.0 - Parameter $type was added in 9.0.0 @@ -286,7 +286,7 @@ interface IExpressionBuilder { * @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by NOT LIKE() comparison. * @param mixed $y Argument to be used in NOT LIKE() comparison. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 8.2.0 - Parameter $type was added in 9.0.0 @@ -303,7 +303,7 @@ interface IExpressionBuilder { * @param string $x Field in string format to be inspected by ILIKE() comparison. * @param mixed $y Argument to be used in ILIKE() comparison. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 9.0.0 @@ -320,7 +320,7 @@ interface IExpressionBuilder { * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by IN() comparison. * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by IN() comparison. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 8.2.0 - Parameter $type was added in 9.0.0 @@ -337,7 +337,7 @@ interface IExpressionBuilder { * @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by NOT IN() comparison. * @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by NOT IN() comparison. * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants - * required when comparing text fields for oci compatibility + * required when comparing text fields for oci compatibility * * @return string * @since 8.2.0 - Parameter $type was added in 9.0.0 diff --git a/lib/public/DB/QueryBuilder/IFunctionBuilder.php b/lib/public/DB/QueryBuilder/IFunctionBuilder.php index 84c3780dbce..480ec1cb1ac 100644 --- a/lib/public/DB/QueryBuilder/IFunctionBuilder.php +++ b/lib/public/DB/QueryBuilder/IFunctionBuilder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/DB/QueryBuilder/IQueryBuilder.php b/lib/public/DB/QueryBuilder/IQueryBuilder.php index 2812f349c45..72b2ccbecff 100644 --- a/lib/public/DB/QueryBuilder/IQueryBuilder.php +++ b/lib/public/DB/QueryBuilder/IQueryBuilder.php @@ -71,7 +71,7 @@ interface IQueryBuilder { * Enable/disable automatic prefixing of table names with the oc_ prefix * * @param bool $enabled If set to true table names will be prefixed with the - * owncloud database prefix automatically. + * owncloud database prefix automatically. * @since 8.2.0 */ public function automaticTablePrefix($enabled); diff --git a/lib/public/DirectEditing/ACreateEmpty.php b/lib/public/DirectEditing/ACreateEmpty.php index f30cc2465f9..6ad499ec760 100644 --- a/lib/public/DirectEditing/ACreateEmpty.php +++ b/lib/public/DirectEditing/ACreateEmpty.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/DirectEditing/ACreateFromTemplate.php b/lib/public/DirectEditing/ACreateFromTemplate.php index 6348b5d3545..e56e9c09cbb 100644 --- a/lib/public/DirectEditing/ACreateFromTemplate.php +++ b/lib/public/DirectEditing/ACreateFromTemplate.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/DirectEditing/ATemplate.php b/lib/public/DirectEditing/ATemplate.php index cc0ed24336b..a70488d8e89 100644 --- a/lib/public/DirectEditing/ATemplate.php +++ b/lib/public/DirectEditing/ATemplate.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/DirectEditing/IToken.php b/lib/public/DirectEditing/IToken.php index 53a67883f54..64abbf939f4 100644 --- a/lib/public/DirectEditing/IToken.php +++ b/lib/public/DirectEditing/IToken.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/DirectEditing/RegisterDirectEditorEvent.php b/lib/public/DirectEditing/RegisterDirectEditorEvent.php index 72d5ea39fe8..cbf9b07185d 100644 --- a/lib/public/DirectEditing/RegisterDirectEditorEvent.php +++ b/lib/public/DirectEditing/RegisterDirectEditorEvent.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Encryption/IEncryptionModule.php b/lib/public/Encryption/IEncryptionModule.php index 2c3f33847c9..fbac291c1b9 100644 --- a/lib/public/Encryption/IEncryptionModule.php +++ b/lib/public/Encryption/IEncryptionModule.php @@ -42,8 +42,8 @@ interface IEncryptionModule { * @param array $accessList who has access to the file contains the key 'users' and 'public' * * @return array $header contain data as key-value pairs which should be - * written to the header, in case of a write operation - * or if no additional data is needed return a empty array + * written to the header, in case of a write operation + * or if no additional data is needed return a empty array * @since 8.1.0 */ public function begin($path, $user, $mode, array $header, array $accessList); diff --git a/lib/public/Federation/Exceptions/ActionNotSupportedException.php b/lib/public/Federation/Exceptions/ActionNotSupportedException.php index 690e7a554c7..7f0e0f46907 100644 --- a/lib/public/Federation/Exceptions/ActionNotSupportedException.php +++ b/lib/public/Federation/Exceptions/ActionNotSupportedException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Federation/Exceptions/AuthenticationFailedException.php b/lib/public/Federation/Exceptions/AuthenticationFailedException.php index f9482c3a19c..6ce5314844e 100644 --- a/lib/public/Federation/Exceptions/AuthenticationFailedException.php +++ b/lib/public/Federation/Exceptions/AuthenticationFailedException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Federation/Exceptions/BadRequestException.php b/lib/public/Federation/Exceptions/BadRequestException.php index 52e3b0e0db4..0210437a8d5 100644 --- a/lib/public/Federation/Exceptions/BadRequestException.php +++ b/lib/public/Federation/Exceptions/BadRequestException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php b/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php index 606fb08d0fc..f753f5f3326 100644 --- a/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php +++ b/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php b/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php index 7f1218c349e..168eb2b8aeb 100644 --- a/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php +++ b/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php b/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php index 4b3d0341fe9..64dfcf0f856 100644 --- a/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php +++ b/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Federation/ICloudFederationFactory.php b/lib/public/Federation/ICloudFederationFactory.php index a25e4ee30f7..5238188b4fa 100644 --- a/lib/public/Federation/ICloudFederationFactory.php +++ b/lib/public/Federation/ICloudFederationFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Federation/ICloudFederationNotification.php b/lib/public/Federation/ICloudFederationNotification.php index 8545c9d51f2..c550a936927 100644 --- a/lib/public/Federation/ICloudFederationNotification.php +++ b/lib/public/Federation/ICloudFederationNotification.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Federation/ICloudFederationProvider.php b/lib/public/Federation/ICloudFederationProvider.php index 067ceba160e..b30041f81d6 100644 --- a/lib/public/Federation/ICloudFederationProvider.php +++ b/lib/public/Federation/ICloudFederationProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Federation/ICloudFederationProviderManager.php b/lib/public/Federation/ICloudFederationProviderManager.php index 9f5258721ab..68adb4b4da7 100644 --- a/lib/public/Federation/ICloudFederationProviderManager.php +++ b/lib/public/Federation/ICloudFederationProviderManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Federation/ICloudFederationShare.php b/lib/public/Federation/ICloudFederationShare.php index 197ebf1af9a..0b67bbfadee 100644 --- a/lib/public/Federation/ICloudFederationShare.php +++ b/lib/public/Federation/ICloudFederationShare.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files.php b/lib/public/Files.php index d176c2f2a7b..dccabb8efe3 100644 --- a/lib/public/Files.php +++ b/lib/public/Files.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -30,7 +31,7 @@ class Files { * Get the mimetype form a local file * @param string $path * @return string - * does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead + * does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead * @since 5.0.0 * @deprecated 14.0.0 */ diff --git a/lib/public/Files/Cache/ICache.php b/lib/public/Files/Cache/ICache.php index 6a64fc26386..bb5608e8480 100644 --- a/lib/public/Files/Cache/ICache.php +++ b/lib/public/Files/Cache/ICache.php @@ -219,7 +219,7 @@ interface ICache { * search for files by mimetype * * @param string $mimetype either a full mimetype to search ('text/plain') or only the first part of a mimetype ('image') - * where it will search for all mimetypes in the group ('image/*') + * where it will search for all mimetypes in the group ('image/*') * @return ICacheEntry[] an array of cache entries where the mimetype matches the search * @since 9.0.0 * @deprecated 9.0.0 due to lack of pagination, not all backends might implement this diff --git a/lib/public/Files/Config/ICachedMountFileInfo.php b/lib/public/Files/Config/ICachedMountFileInfo.php index 7b331059645..a9b30d8ba6d 100644 --- a/lib/public/Files/Config/ICachedMountFileInfo.php +++ b/lib/public/Files/Config/ICachedMountFileInfo.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/DavUtil.php b/lib/public/Files/DavUtil.php index 40d17c77c88..6dde3179bb8 100644 --- a/lib/public/Files/DavUtil.php +++ b/lib/public/Files/DavUtil.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only diff --git a/lib/public/Files/EmptyFileNameException.php b/lib/public/Files/EmptyFileNameException.php index ec13a9fc2be..1630ce63ea2 100644 --- a/lib/public/Files/EmptyFileNameException.php +++ b/lib/public/Files/EmptyFileNameException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/GenericFileException.php b/lib/public/Files/GenericFileException.php index 288d668e3e7..66a3b5e5ac4 100644 --- a/lib/public/Files/GenericFileException.php +++ b/lib/public/Files/GenericFileException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/IAppData.php b/lib/public/Files/IAppData.php index e5a5c2b7143..4d0c4da6a8a 100644 --- a/lib/public/Files/IAppData.php +++ b/lib/public/Files/IAppData.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/InvalidDirectoryException.php b/lib/public/Files/InvalidDirectoryException.php index 7f87eed1a17..b9640209cbf 100644 --- a/lib/public/Files/InvalidDirectoryException.php +++ b/lib/public/Files/InvalidDirectoryException.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/Notify/IChange.php b/lib/public/Files/Notify/IChange.php index 8f252411a5a..c7c758eec11 100644 --- a/lib/public/Files/Notify/IChange.php +++ b/lib/public/Files/Notify/IChange.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/Notify/INotifyHandler.php b/lib/public/Files/Notify/INotifyHandler.php index 8777779ca4a..09b3dbca919 100644 --- a/lib/public/Files/Notify/INotifyHandler.php +++ b/lib/public/Files/Notify/INotifyHandler.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/Notify/IRenameChange.php b/lib/public/Files/Notify/IRenameChange.php index 3e1ae7ed447..b1bfae5fc00 100644 --- a/lib/public/Files/Notify/IRenameChange.php +++ b/lib/public/Files/Notify/IRenameChange.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/Search/ISearchBinaryOperator.php b/lib/public/Files/Search/ISearchBinaryOperator.php index 661be44596d..fa7ef4d1bb3 100644 --- a/lib/public/Files/Search/ISearchBinaryOperator.php +++ b/lib/public/Files/Search/ISearchBinaryOperator.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/Search/ISearchComparison.php b/lib/public/Files/Search/ISearchComparison.php index 01b69f5d24c..6718a04b5c5 100644 --- a/lib/public/Files/Search/ISearchComparison.php +++ b/lib/public/Files/Search/ISearchComparison.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/Search/ISearchOperator.php b/lib/public/Files/Search/ISearchOperator.php index a604bd96b9d..f6ae8edcbb1 100644 --- a/lib/public/Files/Search/ISearchOperator.php +++ b/lib/public/Files/Search/ISearchOperator.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/Search/ISearchOrder.php b/lib/public/Files/Search/ISearchOrder.php index 23f71e2133e..e6e68849443 100644 --- a/lib/public/Files/Search/ISearchOrder.php +++ b/lib/public/Files/Search/ISearchOrder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/Search/ISearchQuery.php b/lib/public/Files/Search/ISearchQuery.php index 109998aee65..1b400c56e5b 100644 --- a/lib/public/Files/Search/ISearchQuery.php +++ b/lib/public/Files/Search/ISearchQuery.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/SimpleFS/ISimpleFile.php b/lib/public/Files/SimpleFS/ISimpleFile.php index 2682c22580d..2e24ebafdbb 100644 --- a/lib/public/Files/SimpleFS/ISimpleFile.php +++ b/lib/public/Files/SimpleFS/ISimpleFile.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/SimpleFS/ISimpleFolder.php b/lib/public/Files/SimpleFS/ISimpleFolder.php index 79b9fca1dac..95efc676688 100644 --- a/lib/public/Files/SimpleFS/ISimpleFolder.php +++ b/lib/public/Files/SimpleFS/ISimpleFolder.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/SimpleFS/ISimpleRoot.php b/lib/public/Files/SimpleFS/ISimpleRoot.php index 5c01c6a2a2e..6be8a1d47c9 100644 --- a/lib/public/Files/SimpleFS/ISimpleRoot.php +++ b/lib/public/Files/SimpleFS/ISimpleRoot.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/Storage/IChunkedFileWrite.php b/lib/public/Files/Storage/IChunkedFileWrite.php index 1095ee7cbfc..e9c9e3fb41d 100644 --- a/lib/public/Files/Storage/IChunkedFileWrite.php +++ b/lib/public/Files/Storage/IChunkedFileWrite.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/Storage/IDisableEncryptionStorage.php b/lib/public/Files/Storage/IDisableEncryptionStorage.php index 98a4b4897da..19951da2015 100644 --- a/lib/public/Files/Storage/IDisableEncryptionStorage.php +++ b/lib/public/Files/Storage/IDisableEncryptionStorage.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/Storage/INotifyStorage.php b/lib/public/Files/Storage/INotifyStorage.php index 8656f709116..9e7aefbdda8 100644 --- a/lib/public/Files/Storage/INotifyStorage.php +++ b/lib/public/Files/Storage/INotifyStorage.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Files/Storage/IStorageFactory.php b/lib/public/Files/Storage/IStorageFactory.php index 7c207ca9f0a..e0ec3128876 100644 --- a/lib/public/Files/Storage/IStorageFactory.php +++ b/lib/public/Files/Storage/IStorageFactory.php @@ -22,7 +22,7 @@ interface IStorageFactory { * @param string $wrapperName * @param callable $callback * @return bool true if the wrapper was added, false if there was already a wrapper with this - * name registered + * name registered * @since 8.0.0 */ public function addStorageWrapper($wrapperName, $callback); diff --git a/lib/public/Files/Template/FieldType.php b/lib/public/Files/Template/FieldType.php index ff3080406a7..2d059cadc17 100644 --- a/lib/public/Files/Template/FieldType.php +++ b/lib/public/Files/Template/FieldType.php @@ -11,9 +11,9 @@ namespace OCP\Files\Template; * @since 30.0.0 */ enum FieldType: string { - case RichText = "rich-text"; - case CheckBox = "checkbox"; - case DropDownList = "drop-down-list"; - case Picture = "picture"; - case Date = "date"; + case RichText = 'rich-text'; + case CheckBox = 'checkbox'; + case DropDownList = 'drop-down-list'; + case Picture = 'picture'; + case Date = 'date'; } diff --git a/lib/public/Files/Template/RegisterTemplateCreatorEvent.php b/lib/public/Files/Template/RegisterTemplateCreatorEvent.php index 4f739b1f9d3..ab49d319ad1 100644 --- a/lib/public/Files/Template/RegisterTemplateCreatorEvent.php +++ b/lib/public/Files/Template/RegisterTemplateCreatorEvent.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/GlobalScale/IConfig.php b/lib/public/GlobalScale/IConfig.php index 31df152f644..bae5dd7aa66 100644 --- a/lib/public/GlobalScale/IConfig.php +++ b/lib/public/GlobalScale/IConfig.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Group/Backend/ABackend.php b/lib/public/Group/Backend/ABackend.php index 83fdcfaaa33..f320e25e1de 100644 --- a/lib/public/Group/Backend/ABackend.php +++ b/lib/public/Group/Backend/ABackend.php @@ -46,7 +46,7 @@ abstract class ABackend implements GroupInterface, IBatchMethodsBackend { $implements |= GroupInterface::REMOVE_FROM_GOUP; } - return (bool)($actions & $implements); + return (bool) ($actions & $implements); } /** @@ -64,7 +64,7 @@ abstract class ABackend implements GroupInterface, IBatchMethodsBackend { */ public function getGroupsDetails(array $gids): array { if (!($this instanceof IGroupDetailsBackend || $this->implementsActions(GroupInterface::GROUP_DETAILS))) { - throw new \Exception("Should not have been called"); + throw new \Exception('Should not have been called'); } /** @var IGroupDetailsBackend $this */ $groupData = []; diff --git a/lib/public/Group/Backend/INamedBackend.php b/lib/public/Group/Backend/INamedBackend.php index 8b9ef9ffbba..d98cc8cdb83 100644 --- a/lib/public/Group/Backend/INamedBackend.php +++ b/lib/public/Group/Backend/INamedBackend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Group/Backend/ISearchableGroupBackend.php b/lib/public/Group/Backend/ISearchableGroupBackend.php index 900330da22d..e9909fcdba0 100644 --- a/lib/public/Group/Backend/ISearchableGroupBackend.php +++ b/lib/public/Group/Backend/ISearchableGroupBackend.php @@ -24,11 +24,11 @@ interface ISearchableGroupBackend { * $users = $groupBackend->searchInGroup('admin', 'John', 10, 0); * </code> * - * @param string $gid The group id of the user we want to search + * @param string $gid The group id of the user we want to search * @param string $search The part of the display name or user id of the users we * want to search. This can be empty to get all the users. - * @param int $limit The limit of results - * @param int $offset The offset of the results + * @param int $limit The limit of results + * @param int $offset The offset of the results * @return array<string,IUser> Users indexed by uid * @since 27.0.0 */ diff --git a/lib/public/HintException.php b/lib/public/HintException.php index f9bacbd5887..97abf777ab1 100644 --- a/lib/public/HintException.php +++ b/lib/public/HintException.php @@ -21,12 +21,12 @@ class HintException extends \Exception { * HintException constructor. * * @since 23.0.0 - * @param string $message The error message. It will be not revealed to the - * the user (unless the hint is empty) and thus - * should be not translated. - * @param string $hint A useful message that is presented to the end - * user. It should be translated, but must not - * contain sensitive data. + * @param string $message The error message. It will be not revealed to the + * the user (unless the hint is empty) and thus + * should be not translated. + * @param string $hint A useful message that is presented to the end + * user. It should be translated, but must not + * contain sensitive data. * @param int $code * @param \Exception|null $previous */ diff --git a/lib/public/Http/Client/IClient.php b/lib/public/Http/Client/IClient.php index 995a68f23bc..ad4c018ab7b 100644 --- a/lib/public/Http/Client/IClient.php +++ b/lib/public/Http/Client/IClient.php @@ -18,26 +18,26 @@ interface IClient { * Sends a GET request * @param string $uri * @param array $options Array such as - * 'query' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'query' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IResponse * @throws \Exception If the request could not get completed * @since 8.1.0 @@ -48,21 +48,21 @@ interface IClient { * Sends a HEAD request * @param string $uri * @param array $options Array such as - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IResponse * @throws \Exception If the request could not get completed * @since 8.1.0 @@ -73,26 +73,26 @@ interface IClient { * Sends a POST request * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IResponse * @throws \Exception If the request could not get completed * @since 8.1.0 @@ -103,26 +103,26 @@ interface IClient { * Sends a PUT request * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IResponse * @throws \Exception If the request could not get completed * @since 8.1.0 @@ -133,26 +133,26 @@ interface IClient { * Sends a PATCH request * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IResponse * @throws \Exception If the request could not get completed * @since 29.0.0 @@ -163,26 +163,26 @@ interface IClient { * Sends a DELETE request * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IResponse * @throws \Exception If the request could not get completed * @since 8.1.0 @@ -193,26 +193,26 @@ interface IClient { * Sends an OPTIONS request * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IResponse * @throws \Exception If the request could not get completed * @since 8.1.0 @@ -234,26 +234,26 @@ interface IClient { * @param string $method The HTTP method to use * @param string $uri * @param array $options Array such as - * 'query' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'query' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IResponse * @throws \Exception If the request could not get completed * @since 29.0.0 @@ -264,26 +264,26 @@ interface IClient { * Sends an asynchronous GET request * @param string $uri * @param array $options Array such as - * 'query' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'query' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IPromise * @since 28.0.0 */ @@ -293,21 +293,21 @@ interface IClient { * Sends an asynchronous HEAD request * @param string $uri * @param array $options Array such as - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IPromise * @since 28.0.0 */ @@ -317,26 +317,26 @@ interface IClient { * Sends an asynchronous POST request * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IPromise * @since 28.0.0 */ @@ -346,26 +346,26 @@ interface IClient { * Sends an asynchronous PUT request * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IPromise * @since 28.0.0 */ @@ -375,26 +375,26 @@ interface IClient { * Sends an asynchronous DELETE request * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IPromise * @since 28.0.0 */ @@ -404,26 +404,26 @@ interface IClient { * Sends an asynchronous OPTIONS request * @param string $uri * @param array $options Array such as - * 'body' => [ - * 'field' => 'abc', - * 'other_field' => '123', - * 'file_name' => fopen('/path/to/file', 'r'), - * ], - * 'headers' => [ - * 'foo' => 'bar', - * ], - * 'cookies' => [ - * 'foo' => 'bar', - * ], - * 'allow_redirects' => [ - * 'max' => 10, // allow at most 10 redirects. - * 'strict' => true, // use "strict" RFC compliant redirects. - * 'referer' => true, // add a Referer header - * 'protocols' => ['https'] // only allow https URLs - * ], - * 'sink' => '/path/to/file', // save to a file or a stream - * 'verify' => true, // bool or string to CA file - * 'debug' => true, + * 'body' => [ + * 'field' => 'abc', + * 'other_field' => '123', + * 'file_name' => fopen('/path/to/file', 'r'), + * ], + * 'headers' => [ + * 'foo' => 'bar', + * ], + * 'cookies' => [ + * 'foo' => 'bar', + * ], + * 'allow_redirects' => [ + * 'max' => 10, // allow at most 10 redirects. + * 'strict' => true, // use "strict" RFC compliant redirects. + * 'referer' => true, // add a Referer header + * 'protocols' => ['https'] // only allow https URLs + * ], + * 'sink' => '/path/to/file', // save to a file or a stream + * 'verify' => true, // bool or string to CA file + * 'debug' => true, * @return IPromise * @since 28.0.0 */ diff --git a/lib/public/Http/Client/IPromise.php b/lib/public/Http/Client/IPromise.php index 7abbd7227d7..8778829af0e 100644 --- a/lib/public/Http/Client/IPromise.php +++ b/lib/public/Http/Client/IPromise.php @@ -34,7 +34,7 @@ interface IPromise { * a new promise resolving to the return value of the called handler. * * @param ?callable(IResponse): void $onFulfilled Invoked when the promise fulfills. Gets an \OCP\Http\Client\IResponse passed in as argument - * @param ?callable(Exception): void $onRejected Invoked when the promise is rejected. Gets an \Exception passed in as argument + * @param ?callable(Exception): void $onRejected Invoked when the promise is rejected. Gets an \Exception passed in as argument * * @return IPromise * @since 28.0.0 @@ -76,7 +76,7 @@ interface IPromise { * @return mixed * * @throws LogicException if the promise has no wait function or if the - * promise does not settle after waiting. + * promise does not settle after waiting. * @since 28.0.0 */ public function wait(bool $unwrap = true): mixed; diff --git a/lib/public/IAddressBook.php b/lib/public/IAddressBook.php index 479e421d700..5a5cc487cee 100644 --- a/lib/public/IAddressBook.php +++ b/lib/public/IAddressBook.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -37,19 +38,19 @@ namespace OCP { * @param string $pattern which should match within the $searchProperties * @param array $searchProperties defines the properties within the query pattern should match * @param array $options Options to define the output format and search behavior - * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array - * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']] - * - 'escape_like_param' - If set to false wildcards _ and % are not escaped - * - 'limit' - Set a numeric limit for the search results - * - 'offset' - Set the offset for the limited search results - * - 'wildcard' - (since 23.0.0) Whether the search should use wildcards + * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array + * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']] + * - 'escape_like_param' - If set to false wildcards _ and % are not escaped + * - 'limit' - Set a numeric limit for the search results + * - 'offset' - Set the offset for the limited search results + * - 'wildcard' - (since 23.0.0) Whether the search should use wildcards * @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, wildcard?: bool} $options * @return array an array of contacts which are arrays of key-value-pairs - * example result: - * [ - * ['id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => 'a@b.c', 'GEO' => '37.386013;-122.082932'], - * ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['d@e.f', 'g@h.i']] - * ] + * example result: + * [ + * ['id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => 'a@b.c', 'GEO' => '37.386013;-122.082932'], + * ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['d@e.f', 'g@h.i']] + * ] * @since 5.0.0 */ public function search($pattern, $searchProperties, $options); diff --git a/lib/public/IConfig.php b/lib/public/IConfig.php index b7feabd0ef5..b322267736e 100644 --- a/lib/public/IConfig.php +++ b/lib/public/IConfig.php @@ -206,9 +206,9 @@ interface IConfig { * @param string $userId the userId of the user that we want to get all values from * @psalm-return array<string, array<string, string>> * @return array[] - 2 dimensional array with the following structure: - * [ $appId => - * [ $key => $value ] - * ] + * [ $appId => + * [ $key => $value ] + * ] * @since 24.0.0 */ public function getAllUserValues(string $userId): array; diff --git a/lib/public/IDBConnection.php b/lib/public/IDBConnection.php index 7ef46ed0609..36369732b64 100644 --- a/lib/public/IDBConnection.php +++ b/lib/public/IDBConnection.php @@ -136,8 +136,8 @@ interface IDBConnection { * @param string $table The table name (will replace *PREFIX* with the actual prefix) * @param array $input data that should be inserted into the table (column name => value) * @param array|null $compare List of values that should be checked for "if not exists" - * If this is null or an empty array, all keys of $input will be compared - * Please note: text fields (clob) must not be used in the compare array + * If this is null or an empty array, all keys of $input will be compared + * Please note: text fields (clob) must not be used in the compare array * @return int number of inserted rows * @throws Exception used to be the removed dbal exception, since 21.0.0 it's \OCP\DB\Exception * @since 6.0.0 - parameter $compare was added in 8.1.0, return type changed from boolean in 8.1.0 diff --git a/lib/public/IDateTimeFormatter.php b/lib/public/IDateTimeFormatter.php index 06dc9d41f81..2d47e1182c2 100644 --- a/lib/public/IDateTimeFormatter.php +++ b/lib/public/IDateTimeFormatter.php @@ -16,15 +16,15 @@ interface IDateTimeFormatter { /** * Formats the date of the given timestamp * - * @param int|\DateTime $timestamp - * @param string $format Either 'full', 'long', 'medium' or 'short' - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' - * long: e.g. 'MMMM d, y' => 'August 20, 2014' - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' - * short: e.g. 'M/d/yy' => '8/20/14' - * The exact format is dependent on the language - * @param \DateTimeZone|null $timeZone The timezone to use - * @param \OCP\IL10N|null $l The locale to use + * @param int|\DateTime $timestamp + * @param string $format Either 'full', 'long', 'medium' or 'short' + * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' + * long: e.g. 'MMMM d, y' => 'August 20, 2014' + * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' + * short: e.g. 'M/d/yy' => '8/20/14' + * The exact format is dependent on the language + * @param \DateTimeZone|null $timeZone The timezone to use + * @param \OCP\IL10N|null $l The locale to use * @return string Formatted date string * @since 8.0.0 */ @@ -33,16 +33,16 @@ interface IDateTimeFormatter { /** * Formats the date of the given timestamp * - * @param int|\DateTime $timestamp - * @param string $format Either 'full', 'long', 'medium' or 'short' - * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' - * long: e.g. 'MMMM d, y' => 'August 20, 2014' - * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' - * short: e.g. 'M/d/yy' => '8/20/14' - * The exact format is dependent on the language - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable - * @param \DateTimeZone|null $timeZone The timezone to use - * @param \OCP\IL10N|null $l The locale to use + * @param int|\DateTime $timestamp + * @param string $format Either 'full', 'long', 'medium' or 'short' + * full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014' + * long: e.g. 'MMMM d, y' => 'August 20, 2014' + * medium: e.g. 'MMM d, y' => 'Aug 20, 2014' + * short: e.g. 'M/d/yy' => '8/20/14' + * The exact format is dependent on the language + * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable + * @param \DateTimeZone|null $timeZone The timezone to use + * @param \OCP\IL10N|null $l The locale to use * @return string Formatted relative date string * @since 8.0.0 */ @@ -52,13 +52,13 @@ interface IDateTimeFormatter { * Gives the relative date of the timestamp * Only works for past dates * - * @param int|\DateTime $timestamp - * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time - * @param \OCP\IL10N|null $l The locale to use - * @return string Dates returned are: - * < 1 month => Today, Yesterday, n days ago - * < 13 month => last month, n months ago - * >= 13 month => last year, n years ago + * @param int|\DateTime $timestamp + * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time + * @param \OCP\IL10N|null $l The locale to use + * @return string Dates returned are: + * < 1 month => Today, Yesterday, n days ago + * < 13 month => last month, n months ago + * >= 13 month => last year, n years ago * @since 8.0.0 */ public function formatDateSpan($timestamp, $baseTimestamp = null, ?\OCP\IL10N $l = null); @@ -67,14 +67,14 @@ interface IDateTimeFormatter { * Formats the time of the given timestamp * * @param int|\DateTime $timestamp - * @param string $format Either 'full', 'long', 'medium' or 'short' - * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' - * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' - * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' - * short: e.g. 'h:mm a' => '11:42 AM' - * The exact format is dependent on the language - * @param \DateTimeZone|null $timeZone The timezone to use - * @param \OCP\IL10N|null $l The locale to use + * @param string $format Either 'full', 'long', 'medium' or 'short' + * full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00' + * long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT' + * medium: e.g. 'h:mm:ss a' => '11:42:13 AM' + * short: e.g. 'h:mm a' => '11:42 AM' + * The exact format is dependent on the language + * @param \DateTimeZone|null $timeZone The timezone to use + * @param \OCP\IL10N|null $l The locale to use * @return string Formatted time string * @since 8.0.0 */ @@ -83,16 +83,16 @@ interface IDateTimeFormatter { /** * Gives the relative past time of the timestamp * - * @param int|\DateTime $timestamp - * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time - * @param \OCP\IL10N|null $l The locale to use - * @return string Dates returned are: - * < 60 sec => seconds ago - * < 1 hour => n minutes ago - * < 1 day => n hours ago - * < 1 month => Yesterday, n days ago - * < 13 month => last month, n months ago - * >= 13 month => last year, n years ago + * @param int|\DateTime $timestamp + * @param int|\DateTime|null $baseTimestamp Timestamp to compare $timestamp against, defaults to current time + * @param \OCP\IL10N|null $l The locale to use + * @return string Dates returned are: + * < 60 sec => seconds ago + * < 1 hour => n minutes ago + * < 1 day => n hours ago + * < 1 month => Yesterday, n days ago + * < 13 month => last month, n months ago + * >= 13 month => last year, n years ago * @since 8.0.0 */ public function formatTimeSpan($timestamp, $baseTimestamp = null, ?\OCP\IL10N $l = null); @@ -101,10 +101,10 @@ interface IDateTimeFormatter { * Formats the date and time of the given timestamp * * @param int|\DateTime $timestamp - * @param string $formatDate See formatDate() for description - * @param string $formatTime See formatTime() for description - * @param \DateTimeZone|null $timeZone The timezone to use - * @param \OCP\IL10N|null $l The locale to use + * @param string $formatDate See formatDate() for description + * @param string $formatTime See formatTime() for description + * @param \DateTimeZone|null $timeZone The timezone to use + * @param \OCP\IL10N|null $l The locale to use * @return string Formatted date and time string * @since 8.0.0 */ @@ -114,11 +114,11 @@ interface IDateTimeFormatter { * Formats the date and time of the given timestamp * * @param int|\DateTime $timestamp - * @param string $formatDate See formatDate() for description - * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable - * @param string $formatTime See formatTime() for description - * @param \DateTimeZone|null $timeZone The timezone to use - * @param \OCP\IL10N|null $l The locale to use + * @param string $formatDate See formatDate() for description + * Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable + * @param string $formatTime See formatTime() for description + * @param \DateTimeZone|null $timeZone The timezone to use + * @param \OCP\IL10N|null $l The locale to use * @return string Formatted relative date and time string * @since 8.0.0 */ diff --git a/lib/public/IImage.php b/lib/public/IImage.php index 5cc1187d33e..b201754536d 100644 --- a/lib/public/IImage.php +++ b/lib/public/IImage.php @@ -79,7 +79,7 @@ interface IImage { /** * @return string Returns the mimetype of the data. Returns null - * if the data is not valid. + * if the data is not valid. * @since 13.0.0 */ public function dataMimeType(): ?string; diff --git a/lib/public/IL10N.php b/lib/public/IL10N.php index bbc2d535535..9f7dedc5ff2 100644 --- a/lib/public/IL10N.php +++ b/lib/public/IL10N.php @@ -52,7 +52,7 @@ interface IL10N { * @param string $type Type of localization * @param \DateTime|int|string $data parameters for this localization * @param array $options currently supports following options: - * - 'width': handed into \Punic\Calendar::formatDate as second parameter + * - 'width': handed into \Punic\Calendar::formatDate as second parameter * @return string|int|false * * Returns the localized data. diff --git a/lib/public/IRequest.php b/lib/public/IRequest.php index a5b1660d89d..2639a234ad5 100644 --- a/lib/public/IRequest.php +++ b/lib/public/IRequest.php @@ -108,11 +108,11 @@ interface IRequest { * @psalm-taint-source input * * @param string $key the key which you want to access in the URL Parameter - * placeholder, $_POST or $_GET array. - * The priority how they're returned is the following: - * 1. URL parameters - * 2. POST parameters - * 3. GET parameters + * placeholder, $_POST or $_GET array. + * The priority how they're returned is the following: + * 1. URL parameters + * 2. POST parameters + * 3. GET parameters * @param mixed $default If the key is not found, this value will be returned * @return mixed the content of the array * @since 6.0.0 diff --git a/lib/public/ITagManager.php b/lib/public/ITagManager.php index 392cfc3cca6..8c37104828f 100644 --- a/lib/public/ITagManager.php +++ b/lib/public/ITagManager.php @@ -30,7 +30,7 @@ interface ITagManager { * @param array $defaultTags An array of default tags to be used if none are stored. * @param boolean $includeShared Whether to include tags for items shared with this user by others. - always false since 20.0.0 * @param string $userId user for which to retrieve the tags, defaults to the currently - * logged in user + * logged in user * @return \OCP\ITags * @since 6.0.0 - parameter $includeShared and $userId were added in 8.0.0 - $includeShared is always false since 20.0.0 */ diff --git a/lib/public/ITags.php b/lib/public/ITags.php index 004ff00f25e..1ba6abae5a2 100644 --- a/lib/public/ITags.php +++ b/lib/public/ITags.php @@ -78,7 +78,7 @@ interface ITags { * * @param array $objIds item ids * @return array|false with object id as key and an array - * of tag names as value or false if an error occurred + * of tag names as value or false if an error occurred * @since 8.0.0 */ public function getTagsForObjects(array $objIds); @@ -136,7 +136,7 @@ interface ITags { * Add a list of new tags. * * @param string|string[] $names A string with a name or an array of strings containing - * the name(s) of the to add. + * the name(s) of the to add. * @param bool $sync When true, save the tags * @param int|null $id int Optional object id to add to this|these tag(s) * @return bool Returns false on error. diff --git a/lib/public/IURLGenerator.php b/lib/public/IURLGenerator.php index e950d82cb54..a336d18b00f 100644 --- a/lib/public/IURLGenerator.php +++ b/lib/public/IURLGenerator.php @@ -64,7 +64,7 @@ interface IURLGenerator { * @param string $appName the name of the app * @param string $file the name of the file * @param array $args array with param=>value, will be appended to the returned url - * The value of $args will be urlencoded + * The value of $args will be urlencoded * @return string the url * @since 6.0.0 */ diff --git a/lib/public/LDAP/IDeletionFlagSupport.php b/lib/public/LDAP/IDeletionFlagSupport.php index 89615c67307..d4861c96554 100644 --- a/lib/public/LDAP/IDeletionFlagSupport.php +++ b/lib/public/LDAP/IDeletionFlagSupport.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/LDAP/ILDAPProvider.php b/lib/public/LDAP/ILDAPProvider.php index 584b554aa81..3cd00235f1a 100644 --- a/lib/public/LDAP/ILDAPProvider.php +++ b/lib/public/LDAP/ILDAPProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/LDAP/ILDAPProviderFactory.php b/lib/public/LDAP/ILDAPProviderFactory.php index f175a3abfd0..720027ce012 100644 --- a/lib/public/LDAP/ILDAPProviderFactory.php +++ b/lib/public/LDAP/ILDAPProviderFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Lockdown/ILockdownManager.php b/lib/public/Lockdown/ILockdownManager.php index 4ae846ae8da..fe8adaecf91 100644 --- a/lib/public/Lockdown/ILockdownManager.php +++ b/lib/public/Lockdown/ILockdownManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Log/IFileBased.php b/lib/public/Log/IFileBased.php index e3ea25fad09..ace10ee1b68 100644 --- a/lib/public/Log/IFileBased.php +++ b/lib/public/Log/IFileBased.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Log/ILogFactory.php b/lib/public/Log/ILogFactory.php index 49b56ff102c..db7adca2192 100644 --- a/lib/public/Log/ILogFactory.php +++ b/lib/public/Log/ILogFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Log/IWriter.php b/lib/public/Log/IWriter.php index 8d2b438a0fe..2fcbc094881 100644 --- a/lib/public/Log/IWriter.php +++ b/lib/public/Log/IWriter.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Log/RotationTrait.php b/lib/public/Log/RotationTrait.php index 1481ed71833..68987601bbe 100644 --- a/lib/public/Log/RotationTrait.php +++ b/lib/public/Log/RotationTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -39,9 +40,9 @@ trait RotationTrait { * @since 14.0.0 */ protected function shouldRotateBySize():bool { - if ((int)$this->maxSize > 0 && file_exists($this->filePath)) { + if ((int) $this->maxSize > 0 && file_exists($this->filePath)) { $filesize = @filesize($this->filePath); - if ($filesize >= (int)$this->maxSize) { + if ($filesize >= (int) $this->maxSize) { return true; } } diff --git a/lib/public/Mail/IEMailTemplate.php b/lib/public/Mail/IEMailTemplate.php index 71a02eff19e..66379abd8ae 100644 --- a/lib/public/Mail/IEMailTemplate.php +++ b/lib/public/Mail/IEMailTemplate.php @@ -57,7 +57,7 @@ interface IEMailTemplate { * * @param string $title * @param string|bool $plainTitle Title that is used in the plain text email - * if empty the $title is used, if false none will be used + * if empty the $title is used, if false none will be used * * @since 12.0.0 */ @@ -68,7 +68,7 @@ interface IEMailTemplate { * * @param string $text; Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email * @param string|bool $plainText Text that is used in the plain text email - * if empty the $text is used, if false none will be used + * if empty the $text is used, if false none will be used * * @since 12.0.0 */ @@ -81,9 +81,9 @@ interface IEMailTemplate { * @param string $metaInfo; Note: When $plainMetaInfo falls back to this, HTML is automatically escaped in the HTML email * @param string $icon Absolute path, must be 16*16 pixels * @param string|bool $plainText Text that is used in the plain text email - * if empty the $text is used, if false none will be used + * if empty the $text is used, if false none will be used * @param string|bool $plainMetaInfo Meta info that is used in the plain text email - * if empty the $metaInfo is used, if false none will be used + * if empty the $metaInfo is used, if false none will be used * @param integer plainIndent If > 0, Indent plainText by this amount. * @since 12.0.0 */ @@ -109,7 +109,7 @@ interface IEMailTemplate { * @param string $text Text of button; Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email * @param string $url URL of button * @param string|false $plainText Text of button in plain text version - * if empty the $text is used, if false none will be used + * if empty the $text is used, if false none will be used * * @since 12.0.0 */ diff --git a/lib/public/Mail/IMailer.php b/lib/public/Mail/IMailer.php index 93efdce1a2d..18eaef541c0 100644 --- a/lib/public/Mail/IMailer.php +++ b/lib/public/Mail/IMailer.php @@ -69,9 +69,9 @@ interface IMailer { * * @param IMessage $message Message to send * @return string[] Array with failed recipients. Be aware that this depends on the used mail backend and - * therefore should be considered + * therefore should be considered * @throws \Exception In case it was not possible to send the message. (for example if an invalid mail address - * has been supplied.) + * has been supplied.) * @since 8.1.0 */ public function send(IMessage $message): array; diff --git a/lib/public/Mail/Provider/Address.php b/lib/public/Mail/Provider/Address.php index 9cd2859a8a5..44a5544ee4b 100644 --- a/lib/public/Mail/Provider/Address.php +++ b/lib/public/Mail/Provider/Address.php @@ -23,8 +23,8 @@ class Address implements \OCP\Mail\Provider\IAddress { * * @since 30.0.0 * - * @param string|null $address mail address (e.g test@example.com) - * @param string|null $label mail address label/name + * @param string|null $address mail address (e.g test@example.com) + * @param string|null $label mail address label/name */ public function __construct( protected ?string $address = null, @@ -37,9 +37,9 @@ class Address implements \OCP\Mail\Provider\IAddress { * * @since 30.0.0 * - * @param string $value mail address (e.g. test@example.com) + * @param string $value mail address (e.g. test@example.com) * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setAddress(string $value): self { $this->address = $value; @@ -51,9 +51,9 @@ class Address implements \OCP\Mail\Provider\IAddress { * * @since 30.0.0 * - * @return string|null returns the mail address or null if one is not set + * @return string|null returns the mail address or null if one is not set */ - public function getAddress(): string | null { + public function getAddress(): string|null { return $this->address; } @@ -62,9 +62,9 @@ class Address implements \OCP\Mail\Provider\IAddress { * * @since 30.0.0 * - * @param string $value mail address label/name + * @param string $value mail address label/name * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setLabel(string $value): self { $this->label = $value; @@ -76,9 +76,9 @@ class Address implements \OCP\Mail\Provider\IAddress { * * @since 30.0.0 * - * @return string|null returns the mail address label/name or null if one is not set + * @return string|null returns the mail address label/name or null if one is not set */ - public function getLabel(): string | null { + public function getLabel(): string|null { return $this->label; } diff --git a/lib/public/Mail/Provider/Attachment.php b/lib/public/Mail/Provider/Attachment.php index d7790a3bbc6..cb7b9b0d241 100644 --- a/lib/public/Mail/Provider/Attachment.php +++ b/lib/public/Mail/Provider/Attachment.php @@ -23,10 +23,10 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @since 30.0.0 * - * @param string|null $contents binary contents of file - * @param string|null $name file name (e.g example.txt) - * @param string|null $type mime type (e.g. text/plain) - * @param bool $embedded embedded status of the attachment, default is false + * @param string|null $contents binary contents of file + * @param string|null $name file name (e.g example.txt) + * @param string|null $type mime type (e.g. text/plain) + * @param bool $embedded embedded status of the attachment, default is false */ public function __construct( protected ?string $contents, @@ -41,9 +41,9 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @since 30.0.0 * - * @param string $value file name (e.g example.txt) + * @param string $value file name (e.g example.txt) * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setName(string $value): self { $this->name = $value; @@ -55,9 +55,9 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @since 30.0.0 * - * @return string | null returns the attachment file name or null if not set + * @return string | null returns the attachment file name or null if not set */ - public function getName(): string | null { + public function getName(): string|null { return $this->name; } @@ -66,9 +66,9 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @since 30.0.0 * - * @param string $value mime type (e.g. text/plain) + * @param string $value mime type (e.g. text/plain) * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setType(string $value): self { $this->type = $value; @@ -80,9 +80,9 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @since 30.0.0 * - * @return string | null returns the attachment mime type or null if not set + * @return string | null returns the attachment mime type or null if not set */ - public function getType(): string | null { + public function getType(): string|null { return $this->type; } @@ -91,9 +91,9 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @since 30.0.0 * - * @param string $value binary contents of file + * @param string $value binary contents of file * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setContents(string $value): self { $this->contents = $value; @@ -105,9 +105,9 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @since 30.0.0 * - * @return string | null returns the attachment contents or null if not set + * @return string | null returns the attachment contents or null if not set */ - public function getContents(): string | null { + public function getContents(): string|null { return $this->contents; } @@ -116,9 +116,9 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @since 30.0.0 * - * @param bool $value true - embedded / false - not embedded + * @param bool $value true - embedded / false - not embedded * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setEmbedded(bool $value): self { $this->embedded = $value; @@ -130,7 +130,7 @@ class Attachment implements \OCP\Mail\Provider\IAttachment { * * @since 30.0.0 * - * @return bool embedded status of the attachment + * @return bool embedded status of the attachment */ public function getEmbedded(): bool { return $this->embedded; diff --git a/lib/public/Mail/Provider/IAddress.php b/lib/public/Mail/Provider/IAddress.php index b980f31150b..b5748a51cc0 100644 --- a/lib/public/Mail/Provider/IAddress.php +++ b/lib/public/Mail/Provider/IAddress.php @@ -23,9 +23,9 @@ interface IAddress { * * @since 30.0.0 * - * @param string $value mail address (test@example.com) + * @param string $value mail address (test@example.com) * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setAddress(string $value): self; @@ -34,18 +34,18 @@ interface IAddress { * * @since 30.0.0 * - * @return string returns the mail address + * @return string returns the mail address */ - public function getAddress(): string | null; + public function getAddress(): string|null; /** * sets the mail address label/name * * @since 30.0.0 * - * @param string $value mail address label/name + * @param string $value mail address label/name * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setLabel(string $value): self; @@ -54,8 +54,8 @@ interface IAddress { * * @since 30.0.0 * - * @return string returns the mail address label/name + * @return string returns the mail address label/name */ - public function getLabel(): string | null; + public function getLabel(): string|null; } diff --git a/lib/public/Mail/Provider/IAttachment.php b/lib/public/Mail/Provider/IAttachment.php index b5bdffc0e81..e27f5ee066b 100644 --- a/lib/public/Mail/Provider/IAttachment.php +++ b/lib/public/Mail/Provider/IAttachment.php @@ -23,9 +23,9 @@ interface IAttachment { * * @since 30.0.0 * - * @param string $value file name (e.g example.txt) + * @param string $value file name (e.g example.txt) * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setName(string $value): self; @@ -34,18 +34,18 @@ interface IAttachment { * * @since 30.0.0 * - * @return string | null returns the attachment file name or null if one is not set + * @return string | null returns the attachment file name or null if one is not set */ - public function getName(): string | null; + public function getName(): string|null; /** * sets the attachment mime type * * @since 30.0.0 * - * @param string $value mime type (e.g. text/plain) + * @param string $value mime type (e.g. text/plain) * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setType(string $value): self; @@ -54,18 +54,18 @@ interface IAttachment { * * @since 30.0.0 * - * @return string | null returns the attachment mime type or null if not set + * @return string | null returns the attachment mime type or null if not set */ - public function getType(): string | null; + public function getType(): string|null; /** * sets the attachment contents (actual data) * * @since 30.0.0 * - * @param string $value binary contents of file + * @param string $value binary contents of file * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setContents(string $value): self; @@ -74,18 +74,18 @@ interface IAttachment { * * @since 30.0.0 * - * @return string | null returns the attachment contents or null if not set + * @return string | null returns the attachment contents or null if not set */ - public function getContents(): string | null; + public function getContents(): string|null; /** * sets the embedded status of the attachment * * @since 30.0.0 * - * @param bool $value true - embedded / false - not embedded + * @param bool $value true - embedded / false - not embedded * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setEmbedded(bool $value): self; @@ -94,7 +94,7 @@ interface IAttachment { * * @since 30.0.0 * - * @return bool embedded status of the attachment + * @return bool embedded status of the attachment */ public function getEmbedded(): bool; diff --git a/lib/public/Mail/Provider/IManager.php b/lib/public/Mail/Provider/IManager.php index 4c06cfff87c..ff01f93d2a4 100644 --- a/lib/public/Mail/Provider/IManager.php +++ b/lib/public/Mail/Provider/IManager.php @@ -41,7 +41,7 @@ interface IManager { * * @since 30.0.0 * - * @return array<string,String> collection of provider id and label ['jmap' => 'JMap Connector'] + * @return array<string,String> collection of provider id and label ['jmap' => 'JMap Connector'] */ public function types(): array; @@ -50,7 +50,7 @@ interface IManager { * * @since 30.0.0 * - * @return array<string,IProvider> collection of provider id and object ['jmap' => IProviderObject] + * @return array<string,IProvider> collection of provider id and object ['jmap' => IProviderObject] */ public function providers(): array; @@ -59,20 +59,20 @@ interface IManager { * * @since 30.0.0 * - * @param string $providerId provider id + * @param string $providerId provider id * * @return IProvider|null */ - public function findProviderById(string $providerId): IProvider | null; + public function findProviderById(string $providerId): IProvider|null; /** * retrieve all services for all registered mail providers * * @since 30.0.0 * - * @param string $userId user id + * @param string $userId user id * - * @return array<string,array<string,IService>> collection of provider id, service id and object ['jmap' => ['Service1' => IServiceObject]] + * @return array<string,array<string,IService>> collection of provider id, service id and object ['jmap' => ['Service1' => IServiceObject]] */ public function services(string $userId): array; @@ -81,13 +81,13 @@ interface IManager { * * @since 30.0.0 * - * @param string $userId user id - * @param string $serviceId service id - * @param string $providerId provider id + * @param string $userId user id + * @param string $serviceId service id + * @param string $providerId provider id * - * @return IService|null returns service object or null if none found + * @return IService|null returns service object or null if none found */ - public function findServiceById(string $userId, string $serviceId, ?string $providerId = null): IService | null; + public function findServiceById(string $userId, string $serviceId, ?string $providerId = null): IService|null; /** * retrieve a service for a specific mail address @@ -95,12 +95,12 @@ interface IManager { * * @since 30.0.0 * - * @param string $userId user id - * @param string $address mail address (e.g. test@example.com) - * @param string $providerId provider id + * @param string $userId user id + * @param string $address mail address (e.g. test@example.com) + * @param string $providerId provider id * - * @return IService|null returns service object or null if none found + * @return IService|null returns service object or null if none found */ - public function findServiceByAddress(string $userId, string $address, ?string $providerId = null): IService | null; + public function findServiceByAddress(string $userId, string $address, ?string $providerId = null): IService|null; } diff --git a/lib/public/Mail/Provider/IMessage.php b/lib/public/Mail/Provider/IMessage.php index 625c8a33556..2ad3b422b9d 100644 --- a/lib/public/Mail/Provider/IMessage.php +++ b/lib/public/Mail/Provider/IMessage.php @@ -23,7 +23,7 @@ interface IMessage { * * @since 30.0.0 * - * @return string id of this message + * @return string id of this message */ public function id(): string; @@ -32,9 +32,9 @@ interface IMessage { * * @since 30.0.0 * - * @param IAddress $value sender's mail address object + * @param IAddress $value sender's mail address object * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setFrom(IAddress $value): self; @@ -43,18 +43,18 @@ interface IMessage { * * @since 30.0.0 * - * @return IAddress|null sender's mail address object + * @return IAddress|null sender's mail address object */ - public function getFrom(): IAddress | null; + public function getFrom(): IAddress|null; /** * sets the sender's reply to address of this message * * @since 30.0.0 * - * @param IAddress $value senders's reply to mail address object + * @param IAddress $value senders's reply to mail address object * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setReplyTo(IAddress $value): self; @@ -63,18 +63,18 @@ interface IMessage { * * @since 30.0.0 * - * @return IAddress|null sender's reply to mail address object + * @return IAddress|null sender's reply to mail address object */ - public function getReplyTo(): IAddress | null; + public function getReplyTo(): IAddress|null; /** * sets the recipient(s) of this message * * @since 30.0.0 * - * @param IAddress ...$value collection of or one or more mail address objects + * @param IAddress ...$value collection of or one or more mail address objects * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setTo(IAddress ...$value): self; @@ -83,7 +83,7 @@ interface IMessage { * * @since 30.0.0 * - * @return array<int,IAddress> collection of all recipient mail address objects + * @return array<int,IAddress> collection of all recipient mail address objects */ public function getTo(): array; @@ -92,9 +92,9 @@ interface IMessage { * * @since 30.0.0 * - * @param IAddress ...$value collection of or one or more mail address objects + * @param IAddress ...$value collection of or one or more mail address objects * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setCc(IAddress ...$value): self; @@ -103,7 +103,7 @@ interface IMessage { * * @since 30.0.0 * - * @return array<int,IAddress> collection of all copied recipient mail address objects + * @return array<int,IAddress> collection of all copied recipient mail address objects */ public function getCc(): array; @@ -112,9 +112,9 @@ interface IMessage { * * @since 30.0.0 * - * @param IAddress ...$value collection of or one or more mail address objects + * @param IAddress ...$value collection of or one or more mail address objects * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setBcc(IAddress ...$value): self; @@ -123,7 +123,7 @@ interface IMessage { * * @since 30.0.0 * - * @return array<int,IAddress> collection of all blind copied recipient mail address objects + * @return array<int,IAddress> collection of all blind copied recipient mail address objects */ public function getBcc(): array; @@ -132,9 +132,9 @@ interface IMessage { * * @since 30.0.0 * - * @param string $value subject of mail message + * @param string $value subject of mail message * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setSubject(string $value): self; @@ -143,19 +143,19 @@ interface IMessage { * * @since 30.0.0 * - * @return string|null subject of message or null if one is not set + * @return string|null subject of message or null if one is not set */ - public function getSubject(): string | null; + public function getSubject(): string|null; /** * sets the plain text or html body of this message * * @since 30.0.0 * - * @param string $value text or html body of message - * @param bool $html html flag - true for html + * @param string $value text or html body of message + * @param bool $html html flag - true for html * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setBody(string $value, bool $html): self; @@ -166,18 +166,18 @@ interface IMessage { * * @since 30.0.0 * - * @return string|null html/plain body of this message or null if one is not set + * @return string|null html/plain body of this message or null if one is not set */ - public function getBody(): string | null; + public function getBody(): string|null; /** * sets the html body of this message * * @since 30.0.0 * - * @param string $value html body of message + * @param string $value html body of message * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setBodyHtml(string $value): self; @@ -186,18 +186,18 @@ interface IMessage { * * @since 30.0.0 * - * @return string|null html body of this message or null if one is not set + * @return string|null html body of this message or null if one is not set */ - public function getBodyHtml(): string | null; + public function getBodyHtml(): string|null; /** * sets the plain text body of this message * * @since 30.0.0 * - * @param string $value plain text body of message + * @param string $value plain text body of message * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setBodyPlain(string $value): self; @@ -206,18 +206,18 @@ interface IMessage { * * @since 30.0.0 * - * @return string|null plain text body of this message or null if one is not set + * @return string|null plain text body of this message or null if one is not set */ - public function getBodyPlain(): string | null; + public function getBodyPlain(): string|null; /** * sets the attachments of this message * * @since 30.0.0 * - * @param IAttachment ...$value collection of or one or more mail attachment objects + * @param IAttachment ...$value collection of or one or more mail attachment objects * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setAttachments(IAttachment ...$value): self; @@ -226,7 +226,7 @@ interface IMessage { * * @since 30.0.0 * - * @return array<int,IAttachment> collection of all mail attachment objects + * @return array<int,IAttachment> collection of all mail attachment objects */ public function getAttachments(): array; } diff --git a/lib/public/Mail/Provider/IMessageSend.php b/lib/public/Mail/Provider/IMessageSend.php index c5c473bcf2e..fe1b2884452 100644 --- a/lib/public/Mail/Provider/IMessageSend.php +++ b/lib/public/Mail/Provider/IMessageSend.php @@ -23,8 +23,8 @@ interface IMessageSend { * * @since 30.0.0 * - * @param IMessage $message mail message object with all required parameters to send a message - * @param array $options array of options reserved for future use + * @param IMessage $message mail message object with all required parameters to send a message + * @param array $options array of options reserved for future use * * @throws \OCP\Mail\Provider\Exception\SendException on failure, check message for reason */ diff --git a/lib/public/Mail/Provider/IProvider.php b/lib/public/Mail/Provider/IProvider.php index 47d6002f9b0..e94ee73217a 100644 --- a/lib/public/Mail/Provider/IProvider.php +++ b/lib/public/Mail/Provider/IProvider.php @@ -23,7 +23,7 @@ interface IProvider { * * @since 30.0.0 * - * @return string id of this provider (e.g. UUID or 'IMAP/SMTP' or anything else) + * @return string id of this provider (e.g. UUID or 'IMAP/SMTP' or anything else) */ public function id(): string; @@ -32,7 +32,7 @@ interface IProvider { * * @since 30.0.0 * - * @return string label/name of this provider (e.g. Plain Old IMAP/SMTP) + * @return string label/name of this provider (e.g. Plain Old IMAP/SMTP) */ public function label(): string; @@ -41,20 +41,20 @@ interface IProvider { * * @since 30.0.0 * - * @param string $userId user id + * @param string $userId user id * - * @return bool true if any services are configure for the user + * @return bool true if any services are configure for the user */ public function hasServices(string $userId): bool; /** * retrieve collection of services for a specific user * - * @param string $userId user id + * @param string $userId user id * * @since 30.0.0 * - * @return array<string,IService> collection of service id and object ['1' => IServiceObject] + * @return array<string,IService> collection of service id and object ['1' => IServiceObject] */ public function listServices(string $userId): array; @@ -63,31 +63,31 @@ interface IProvider { * * @since 30.0.0 * - * @param string $userId user id - * @param string $serviceId service id + * @param string $userId user id + * @param string $serviceId service id * - * @return IService|null returns service object or null if none found + * @return IService|null returns service object or null if none found */ - public function findServiceById(string $userId, string $serviceId): IService | null; + public function findServiceById(string $userId, string $serviceId): IService|null; /** * retrieve a service for a specific mail address * * @since 30.0.0 * - * @param string $userId user id - * @param string $address mail address (e.g. test@example.com) + * @param string $userId user id + * @param string $address mail address (e.g. test@example.com) * - * @return IService|null returns service object or null if none found + * @return IService|null returns service object or null if none found */ - public function findServiceByAddress(string $userId, string $address): IService | null; + public function findServiceByAddress(string $userId, string $address): IService|null; /** * construct a new empty service object * * @since 30.0.0 * - * @return IService blank service object + * @return IService blank service object */ public function initiateService(): IService; diff --git a/lib/public/Mail/Provider/IService.php b/lib/public/Mail/Provider/IService.php index d23c0a92444..e0bb5161aa6 100644 --- a/lib/public/Mail/Provider/IService.php +++ b/lib/public/Mail/Provider/IService.php @@ -23,7 +23,7 @@ interface IService { * * @since 30.0.0 * - * @return string id of this service (e.g. 1 or service1 or anything else) + * @return string id of this service (e.g. 1 or service1 or anything else) */ public function id(): string; @@ -32,9 +32,9 @@ interface IService { * * @since 30.0.0 * - * @param string $value required ability e.g. 'MessageSend' + * @param string $value required ability e.g. 'MessageSend' * - * @return bool true/false if ability is supplied and found in collection + * @return bool true/false if ability is supplied and found in collection */ public function capable(string $value): bool; @@ -43,7 +43,7 @@ interface IService { * * @since 30.0.0 * - * @return array collection of abilities otherwise empty collection + * @return array collection of abilities otherwise empty collection */ public function capabilities(): array; @@ -52,7 +52,7 @@ interface IService { * * @since 30.0.0 * - * @return string label/name of service (e.g. ACME Company Mail Service) + * @return string label/name of service (e.g. ACME Company Mail Service) */ public function getLabel(): string; @@ -61,9 +61,9 @@ interface IService { * * @since 30.0.0 * - * @param string $value label/name of service (e.g. ACME Company Mail Service) + * @param string $value label/name of service (e.g. ACME Company Mail Service) * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setLabel(string $value): self; @@ -72,7 +72,7 @@ interface IService { * * @since 30.0.0 * - * @return IAddress mail address object + * @return IAddress mail address object */ public function getPrimaryAddress(): IAddress; @@ -81,9 +81,9 @@ interface IService { * * @since 30.0.0 * - * @param IAddress $value mail address object + * @param IAddress $value mail address object * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setPrimaryAddress(IAddress $value): self; @@ -92,7 +92,7 @@ interface IService { * * @since 30.0.0 * - * @return array<int, IAddress> collection of mail address objects + * @return array<int, IAddress> collection of mail address objects */ public function getSecondaryAddresses(): array; @@ -101,9 +101,9 @@ interface IService { * * @since 30.0.0 * - * @param IAddress ...$value collection of one or more mail address objects + * @param IAddress ...$value collection of one or more mail address objects * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setSecondaryAddresses(IAddress ...$value): self; @@ -112,7 +112,7 @@ interface IService { * * @since 30.0.0 * - * @return IMessage blank message object + * @return IMessage blank message object */ public function initiateMessage(): IMessage; diff --git a/lib/public/Mail/Provider/Message.php b/lib/public/Mail/Provider/Message.php index b5742985fcf..7814fb849d5 100644 --- a/lib/public/Mail/Provider/Message.php +++ b/lib/public/Mail/Provider/Message.php @@ -23,7 +23,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @param array $data message data array + * @param array $data message data array */ public function __construct( protected array $data = [], @@ -35,7 +35,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @return string id of this message + * @return string id of this message */ public function id(): string { // return id of message @@ -47,9 +47,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @param IAddress $value sender's mail address object + * @param IAddress $value sender's mail address object * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setFrom(IAddress $value): self { // create or update field in data store with value @@ -63,9 +63,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @return IAddress|null sender's mail address object + * @return IAddress|null sender's mail address object */ - public function getFrom(): IAddress | null { + public function getFrom(): IAddress|null { // evaluate if data store field exists and return value(s) or null otherwise return (isset($this->data['from'])) ? $this->data['from'] : null; } @@ -75,9 +75,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @param IAddress $value senders's reply to mail address object + * @param IAddress $value senders's reply to mail address object * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setReplyTo(IAddress $value): self { // create or update field in data store with value @@ -91,9 +91,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @return IAddress|null sender's reply to mail address object + * @return IAddress|null sender's reply to mail address object */ - public function getReplyTo(): IAddress | null { + public function getReplyTo(): IAddress|null { // evaluate if data store field exists and return value(s) or null otherwise return (isset($this->data['replyTo'])) ? $this->data['replyTo'] : null; } @@ -103,9 +103,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @param IAddress ...$value collection of or one or more mail address objects + * @param IAddress ...$value collection of or one or more mail address objects * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setTo(IAddress ...$value): self { // create or update field in data store with value @@ -119,7 +119,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @return array<int,IAddress> collection of all recipient mail address objects + * @return array<int,IAddress> collection of all recipient mail address objects */ public function getTo(): array { // evaluate if data store field exists and return value(s) or empty collection @@ -131,9 +131,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @param IAddress ...$value collection of or one or more mail address objects + * @param IAddress ...$value collection of or one or more mail address objects * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setCc(IAddress ...$value): self { // create or update field in data store with value @@ -147,7 +147,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @return array<int,IAddress> collection of all copied recipient mail address objects + * @return array<int,IAddress> collection of all copied recipient mail address objects */ public function getCc(): array { // evaluate if data store field exists and return value(s) or empty collection @@ -159,9 +159,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @param IAddress ...$value collection of or one or more mail address objects + * @param IAddress ...$value collection of or one or more mail address objects * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setBcc(IAddress ...$value): self { // create or update field in data store with value @@ -175,7 +175,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @return array<int,IAddress> collection of all blind copied recipient mail address objects + * @return array<int,IAddress> collection of all blind copied recipient mail address objects */ public function getBcc(): array { // evaluate if data store field exists and return value(s) or empty collection @@ -187,9 +187,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @param string $value subject of mail message + * @param string $value subject of mail message * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setSubject(string $value): self { // create or update field in data store with value @@ -203,9 +203,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @return string|null subject of message or null if one is not set + * @return string|null subject of message or null if one is not set */ - public function getSubject(): string | null { + public function getSubject(): string|null { // evaluate if data store field exists and return value(s) or null otherwise return (isset($this->data['subject'])) ? $this->data['subject'] : null; } @@ -215,10 +215,10 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @param string $value text or html body of message - * @param bool $html html flag - true for html + * @param string $value text or html body of message + * @param bool $html html flag - true for html * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setBody(string $value, bool $html = false): self { // evaluate html flag and create or update appropriate field in data store with value @@ -238,9 +238,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @return string|null html/plain body of this message or null if one is not set + * @return string|null html/plain body of this message or null if one is not set */ - public function getBody(): string | null { + public function getBody(): string|null { // evaluate if data store field(s) exists and return value if (isset($this->data['bodyHtml'])) { return $this->data['bodyHtml']; @@ -256,9 +256,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @param string $value html body of message + * @param string $value html body of message * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setBodyHtml(string $value): self { // create or update field in data store with value @@ -272,9 +272,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @return string|null html body of this message or null if one is not set + * @return string|null html body of this message or null if one is not set */ - public function getBodyHtml(): string | null { + public function getBodyHtml(): string|null { // evaluate if data store field exists and return value(s) or null otherwise return (isset($this->data['bodyHtml'])) ? $this->data['bodyHtml'] : null; } @@ -284,9 +284,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @param string $value plain text body of message + * @param string $value plain text body of message * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setBodyPlain(string $value): self { // create or update field in data store with value @@ -300,9 +300,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @return string|null plain text body of this message or null if one is not set + * @return string|null plain text body of this message or null if one is not set */ - public function getBodyPlain(): string | null { + public function getBodyPlain(): string|null { // evaluate if data store field exists and return value(s) or null otherwise return (isset($this->data['bodyPlain'])) ? $this->data['bodyPlain'] : null; } @@ -312,9 +312,9 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @param IAttachment ...$value collection of or one or more mail attachment objects + * @param IAttachment ...$value collection of or one or more mail attachment objects * - * @return self return this object for command chaining + * @return self return this object for command chaining */ public function setAttachments(IAttachment ...$value): self { // create or update field in data store with value @@ -328,7 +328,7 @@ class Message implements \OCP\Mail\Provider\IMessage { * * @since 30.0.0 * - * @return array<int,IAttachment> collection of all mail attachment objects + * @return array<int,IAttachment> collection of all mail attachment objects */ public function getAttachments(): array { // evaluate if data store field exists and return value(s) or null otherwise diff --git a/lib/public/Migration/Attributes/MigrationAttribute.php b/lib/public/Migration/Attributes/MigrationAttribute.php index 5b4550c4db5..d5b2d52cafb 100644 --- a/lib/public/Migration/Attributes/MigrationAttribute.php +++ b/lib/public/Migration/Attributes/MigrationAttribute.php @@ -100,7 +100,7 @@ class MigrationAttribute implements JsonSerializable { */ public function import(array $data): self { return $this->setDescription($data['description'] ?? '') - ->setNotes($data['notes'] ?? []); + ->setNotes($data['notes'] ?? []); } /** diff --git a/lib/public/Migration/BigIntMigration.php b/lib/public/Migration/BigIntMigration.php index db50147b28e..0fa7e559f79 100644 --- a/lib/public/Migration/BigIntMigration.php +++ b/lib/public/Migration/BigIntMigration.php @@ -16,7 +16,7 @@ use OCP\DB\ISchemaWrapper; abstract class BigIntMigration extends SimpleMigrationStep { /** * @return array Returns an array with the following structure - * ['table1' => ['column1', 'column2'], ...] + * ['table1' => ['column1', 'column2'], ...] * @since 13.0.0 */ abstract protected function getColumnsByTable(); diff --git a/lib/public/Notification/IManager.php b/lib/public/Notification/IManager.php index 6a16af2d7a0..96427ddff92 100644 --- a/lib/public/Notification/IManager.php +++ b/lib/public/Notification/IManager.php @@ -16,7 +16,7 @@ namespace OCP\Notification; interface IManager extends IApp, INotifier { /** * @param string $appClass The service must implement IApp, otherwise a - * \InvalidArgumentException is thrown later + * \InvalidArgumentException is thrown later * @since 17.0.0 */ public function registerApp(string $appClass): void; @@ -24,8 +24,8 @@ interface IManager extends IApp, INotifier { /** * @param \Closure $service The service must implement INotifier, otherwise a * \InvalidArgumentException is thrown later - * @param \Closure $info An array with the keys 'id' and 'name' containing - * the app id and the app name + * @param \Closure $info An array with the keys 'id' and 'name' containing + * the app id and the app name * @deprecated 17.0.0 use registerNotifierService instead. * @since 8.2.0 - Parameter $info was added in 9.0.0 */ @@ -33,7 +33,7 @@ interface IManager extends IApp, INotifier { /** * @param string $notifierService The service must implement INotifier, otherwise a - * \InvalidArgumentException is thrown later + * \InvalidArgumentException is thrown later * @since 17.0.0 * @deprecated 22.0.0 use the IBootStrap registration context */ diff --git a/lib/public/OCM/Events/ResourceTypeRegisterEvent.php b/lib/public/OCM/Events/ResourceTypeRegisterEvent.php index 11087106cbc..c0129197566 100644 --- a/lib/public/OCM/Events/ResourceTypeRegisterEvent.php +++ b/lib/public/OCM/Events/ResourceTypeRegisterEvent.php @@ -32,7 +32,7 @@ class ResourceTypeRegisterEvent extends Event { * @param string $name * @param list<string> $shareTypes List of supported share recipients, e.g. 'user', 'group', … * @param array<string, string> $protocols List of supported protocols and their location, - * e.g. ['webdav' => '/remote.php/webdav/'] + * e.g. ['webdav' => '/remote.php/webdav/'] * @since 28.0.0 */ public function registerResourceType(string $name, array $shareTypes, array $protocols): void { diff --git a/lib/public/Remote/Api/IApiCollection.php b/lib/public/Remote/Api/IApiCollection.php index da1964997bd..e7181ab20f2 100644 --- a/lib/public/Remote/Api/IApiCollection.php +++ b/lib/public/Remote/Api/IApiCollection.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Remote/Api/IApiFactory.php b/lib/public/Remote/Api/IApiFactory.php index 0e95dc98e70..2089c61be82 100644 --- a/lib/public/Remote/Api/IApiFactory.php +++ b/lib/public/Remote/Api/IApiFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Remote/Api/ICapabilitiesApi.php b/lib/public/Remote/Api/ICapabilitiesApi.php index d9ab037bcc6..d0e3fd7ad80 100644 --- a/lib/public/Remote/Api/ICapabilitiesApi.php +++ b/lib/public/Remote/Api/ICapabilitiesApi.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Remote/Api/IUserApi.php b/lib/public/Remote/Api/IUserApi.php index c8b5e64d003..268594c0340 100644 --- a/lib/public/Remote/Api/IUserApi.php +++ b/lib/public/Remote/Api/IUserApi.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Remote/ICredentials.php b/lib/public/Remote/ICredentials.php index efe87a350c8..c261d57093d 100644 --- a/lib/public/Remote/ICredentials.php +++ b/lib/public/Remote/ICredentials.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Remote/IInstance.php b/lib/public/Remote/IInstance.php index 47c10cb4ac1..6186c2e1819 100644 --- a/lib/public/Remote/IInstance.php +++ b/lib/public/Remote/IInstance.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Remote/IInstanceFactory.php b/lib/public/Remote/IInstanceFactory.php index 15435901a74..1cd2b3330ce 100644 --- a/lib/public/Remote/IInstanceFactory.php +++ b/lib/public/Remote/IInstanceFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Remote/IUser.php b/lib/public/Remote/IUser.php index 3c22695c20b..329e8876c0d 100644 --- a/lib/public/Remote/IUser.php +++ b/lib/public/Remote/IUser.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/RichObjectStrings/Definitions.php b/lib/public/RichObjectStrings/Definitions.php index 5974659e16b..8f0cce8c077 100644 --- a/lib/public/RichObjectStrings/Definitions.php +++ b/lib/public/RichObjectStrings/Definitions.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/RichObjectStrings/IValidator.php b/lib/public/RichObjectStrings/IValidator.php index 96b3b6ea743..96a2bad533d 100644 --- a/lib/public/RichObjectStrings/IValidator.php +++ b/lib/public/RichObjectStrings/IValidator.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/RichObjectStrings/InvalidObjectExeption.php b/lib/public/RichObjectStrings/InvalidObjectExeption.php index 0316310c5f9..603f4432ba6 100644 --- a/lib/public/RichObjectStrings/InvalidObjectExeption.php +++ b/lib/public/RichObjectStrings/InvalidObjectExeption.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Security/ISecureRandom.php b/lib/public/Security/ISecureRandom.php index 188236dd3f9..aa191ca348f 100644 --- a/lib/public/Security/ISecureRandom.php +++ b/lib/public/Security/ISecureRandom.php @@ -58,7 +58,7 @@ interface ISecureRandom { * Generate a random string of specified length. * @param int $length The length of the generated string * @param string $characters An optional list of characters to use if no character list is - * specified all valid base64 characters are used. + * specified all valid base64 characters are used. * @return string * @since 8.0.0 */ diff --git a/lib/public/Settings/IIconSection.php b/lib/public/Settings/IIconSection.php index 5a9fbfebf76..4d0fe40aa29 100644 --- a/lib/public/Settings/IIconSection.php +++ b/lib/public/Settings/IIconSection.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -29,8 +30,8 @@ interface IIconSection { /** * @return int whether the form should be rather on the top or bottom of - * the settings navigation. The sections are arranged in ascending order of - * the priority values. It is required to return a value between 0 and 99. + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. * * E.g.: 70 * @since 9.1 diff --git a/lib/public/Settings/IManager.php b/lib/public/Settings/IManager.php index d73e4055f31..af06580e38d 100644 --- a/lib/public/Settings/IManager.php +++ b/lib/public/Settings/IManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Settings/ISettings.php b/lib/public/Settings/ISettings.php index ed465a07fb3..e33556f0b4a 100644 --- a/lib/public/Settings/ISettings.php +++ b/lib/public/Settings/ISettings.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -25,8 +26,8 @@ interface ISettings { /** * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. * * E.g.: 70 * @since 9.1 diff --git a/lib/public/Share/IAttributes.php b/lib/public/Share/IAttributes.php index fad19c60aad..9ddd8275dd6 100644 --- a/lib/public/Share/IAttributes.php +++ b/lib/public/Share/IAttributes.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 ownCloud GmbH * SPDX-License-Identifier: AGPL-3.0-only diff --git a/lib/public/Share/IShareHelper.php b/lib/public/Share/IShareHelper.php index c4a33e717f9..152fc99a446 100644 --- a/lib/public/Share/IShareHelper.php +++ b/lib/public/Share/IShareHelper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/SystemTag/ISystemTagManager.php b/lib/public/SystemTag/ISystemTagManager.php index 99d806155dc..8d0241e752f 100644 --- a/lib/public/SystemTag/ISystemTagManager.php +++ b/lib/public/SystemTag/ISystemTagManager.php @@ -26,7 +26,7 @@ interface ISystemTagManager { * * @throws \InvalidArgumentException if at least one given tag ids is invalid (string instead of integer, etc.) * @throws TagNotFoundException if at least one given tag ids did no exist - * The message contains a json_encoded array of the ids that could not be found + * The message contains a json_encoded array of the ids that could not be found * * @since 9.0.0, optional parameter $user added in 28.0.0 */ @@ -84,7 +84,7 @@ interface ISystemTagManager { * * @throws TagNotFoundException if tag with the given id does not exist * @throws TagAlreadyExistsException if there is already another tag - * with the same attributes + * with the same attributes * * @since 9.0.0 */ diff --git a/lib/public/SystemTag/ISystemTagObjectMapper.php b/lib/public/SystemTag/ISystemTagObjectMapper.php index b3eb0201ce6..f6e46ad4d84 100644 --- a/lib/public/SystemTag/ISystemTagObjectMapper.php +++ b/lib/public/SystemTag/ISystemTagObjectMapper.php @@ -31,7 +31,7 @@ interface ISystemTagObjectMapper { * @param string $objectType object type * * @return array with object id as key and an array - * of tag ids as value + * of tag ids as value * * @since 9.0.0 */ @@ -48,9 +48,9 @@ interface ISystemTagObjectMapper { * @return string[] array of object ids or empty array if none found * * @throws TagNotFoundException if at least one of the - * given tags does not exist + * given tags does not exist * @throws \InvalidArgumentException When a limit is specified together with - * multiple tag ids + * multiple tag ids * * @since 9.0.0 */ @@ -69,7 +69,7 @@ interface ISystemTagObjectMapper { * @param string|array $tagIds tag id or array of tag ids to assign * * @throws TagNotFoundException if at least one of the - * given tags does not exist + * given tags does not exist * * @since 9.0.0 */ @@ -88,7 +88,7 @@ interface ISystemTagObjectMapper { * @param string|array $tagIds tag id or array of tag ids to unassign * * @throws TagNotFoundException if at least one of the - * given tags does not exist + * given tags does not exist * * @since 9.0.0 */ @@ -101,10 +101,10 @@ interface ISystemTagObjectMapper { * @param string $objectType object type * @param string $tagId tag id to check * @param bool $all true to check that ALL objects have the tag assigned, - * false to check that at least ONE object has the tag. + * false to check that at least ONE object has the tag. * * @return bool true if the condition set by $all is matched, false - * otherwise + * otherwise * * @throws TagNotFoundException if the tag does not exist * diff --git a/lib/public/SystemTag/SystemTagsEntityEvent.php b/lib/public/SystemTag/SystemTagsEntityEvent.php index bccff9eda84..d8f391d0dba 100644 --- a/lib/public/SystemTag/SystemTagsEntityEvent.php +++ b/lib/public/SystemTag/SystemTagsEntityEvent.php @@ -37,9 +37,9 @@ class SystemTagsEntityEvent extends Event { /** * @param string $name * @param \Closure $entityExistsFunction The closure should take one - * argument, which is the id of the entity, that tags - * should be handled for. The return should then be bool, - * depending on whether tags are allowed (true) or not. + * argument, which is the id of the entity, that tags + * should be handled for. The return should then be bool, + * depending on whether tags are allowed (true) or not. * @throws \OutOfBoundsException when the entity name is already taken * @since 9.1.0 */ diff --git a/lib/public/Teams/ITeamManager.php b/lib/public/Teams/ITeamManager.php index 5c4c63b4f23..db875442b7b 100644 --- a/lib/public/Teams/ITeamManager.php +++ b/lib/public/Teams/ITeamManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Teams/ITeamResourceProvider.php b/lib/public/Teams/ITeamResourceProvider.php index 54c4879a47c..ff724ab8ae2 100644 --- a/lib/public/Teams/ITeamResourceProvider.php +++ b/lib/public/Teams/ITeamResourceProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Teams/Team.php b/lib/public/Teams/Team.php index 07fc3f9ccd3..8a73794c957 100644 --- a/lib/public/Teams/Team.php +++ b/lib/public/Teams/Team.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/Teams/TeamResource.php b/lib/public/Teams/TeamResource.php index e9c6470b2c9..acb98380562 100644 --- a/lib/public/Teams/TeamResource.php +++ b/lib/public/Teams/TeamResource.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/TextToImage/Task.php b/lib/public/TextToImage/Task.php index d214354ae34..93601c9a286 100644 --- a/lib/public/TextToImage/Task.php +++ b/lib/public/TextToImage/Task.php @@ -77,7 +77,7 @@ final class Task implements \JsonSerializable { final public function getOutputImages(): ?array { $appData = \OCP\Server::get(IAppDataFactory::class)->get('core'); try { - $folder = $appData->getFolder('text2image')->getFolder((string)$this->getId()); + $folder = $appData->getFolder('text2image')->getFolder((string) $this->getId()); $images = []; for ($i = 0; $i < $this->getNumberOfImages(); $i++) { $image = new Image(); diff --git a/lib/public/User/Backend/ABackend.php b/lib/public/User/Backend/ABackend.php index 2fca83e3be8..e1dc83c0af1 100644 --- a/lib/public/User/Backend/ABackend.php +++ b/lib/public/User/Backend/ABackend.php @@ -51,6 +51,6 @@ abstract class ABackend implements IUserBackend, UserInterface { $implements |= Backend::COUNT_USERS; } - return (bool)($actions & $implements); + return (bool) ($actions & $implements); } } diff --git a/lib/public/Util.php b/lib/public/Util.php index 17794810c1a..d4dcd6271cf 100644 --- a/lib/public/Util.php +++ b/lib/public/Util.php @@ -241,7 +241,7 @@ class Util { * @param string $app app * @param string $file file * @param array $args array with param=>value, will be appended to the returned url - * The value of $args will be urlencoded + * The value of $args will be urlencoded * @return string the url * @since 4.0.0 - parameter $args was added in 4.5.0 */ @@ -321,7 +321,7 @@ class Util { */ public static function numericToNumber(string|float|int $number): int|float { /* This is a hack to cast to (int|float) */ - return 0 + (string)$number; + return 0 + (string) $number; } /** @@ -492,7 +492,7 @@ class Util { * @param string $a first string to compare * @param string $b second string to compare * @return int -1 if $b comes before $a, 1 if $a comes before $b - * or 0 if the strings are identical + * or 0 if the strings are identical * @since 7.0.0 */ public static function naturalSortCompare($a, $b) { diff --git a/lib/public/WorkflowEngine/ICheck.php b/lib/public/WorkflowEngine/ICheck.php index 79c1a864ae0..4671eb84c3e 100644 --- a/lib/public/WorkflowEngine/ICheck.php +++ b/lib/public/WorkflowEngine/ICheck.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/WorkflowEngine/IManager.php b/lib/public/WorkflowEngine/IManager.php index b9235abafef..f66a9460f06 100644 --- a/lib/public/WorkflowEngine/IManager.php +++ b/lib/public/WorkflowEngine/IManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/public/WorkflowEngine/IOperation.php b/lib/public/WorkflowEngine/IOperation.php index 9f867eb811a..cda20acb7e5 100644 --- a/lib/public/WorkflowEngine/IOperation.php +++ b/lib/public/WorkflowEngine/IOperation.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/ocs-provider/index.php b/ocs-provider/index.php index 3f5b2b8f0d0..28844d9e581 100644 --- a/ocs-provider/index.php +++ b/ocs-provider/index.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/ocs/providers.php b/ocs/providers.php index af9863a32f2..94e3a319c46 100644 --- a/ocs/providers.php +++ b/ocs/providers.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/ocs/v1.php b/ocs/v1.php index 91f52a66943..d58dfe48a87 100644 --- a/ocs/v1.php +++ b/ocs/v1.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/ocs/v2.php b/ocs/v2.php index 59c7f99ae3d..c83d3c1b0d2 100644 --- a/ocs/v2.php +++ b/ocs/v2.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Config/ImportTest.php b/tests/Core/Command/Config/ImportTest.php index 91485955e60..b72e87a994d 100644 --- a/tests/Core/Command/Config/ImportTest.php +++ b/tests/Core/Command/Config/ImportTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Config/ListConfigsTest.php b/tests/Core/Command/Config/ListConfigsTest.php index 8b6fdf39192..331bd8188d5 100644 --- a/tests/Core/Command/Config/ListConfigsTest.php +++ b/tests/Core/Command/Config/ListConfigsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Config/System/DeleteConfigTest.php b/tests/Core/Command/Config/System/DeleteConfigTest.php index 9b5b018687e..3c656b4ca91 100644 --- a/tests/Core/Command/Config/System/DeleteConfigTest.php +++ b/tests/Core/Command/Config/System/DeleteConfigTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Config/System/GetConfigTest.php b/tests/Core/Command/Config/System/GetConfigTest.php index db96331680b..7b1f4c93297 100644 --- a/tests/Core/Command/Config/System/GetConfigTest.php +++ b/tests/Core/Command/Config/System/GetConfigTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Config/System/SetConfigTest.php b/tests/Core/Command/Config/System/SetConfigTest.php index d5c54a5e720..0847a93685e 100644 --- a/tests/Core/Command/Config/System/SetConfigTest.php +++ b/tests/Core/Command/Config/System/SetConfigTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php index 4334994e8d3..5ec006c1d66 100644 --- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php +++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -32,7 +33,7 @@ class ChangeKeyStorageRootTest extends TestCase { /** @var IConfig | \PHPUnit\Framework\MockObject\MockObject */ protected $config; - /** @var Util | \PHPUnit\Framework\MockObject\MockObject */ + /** @var Util | \PHPUnit\Framework\MockObject\MockObject */ protected $util; /** @var QuestionHelper | \PHPUnit\Framework\MockObject\MockObject */ @@ -213,7 +214,7 @@ class ChangeKeyStorageRootTest extends TestCase { if ($executeRename) { $this->view->expects($this->once())->method('rename') - ->with('oldRoot/files_encryption', 'newRoot/files_encryption'); + ->with('oldRoot/files_encryption', 'newRoot/files_encryption'); } else { $this->view->expects($this->never())->method('rename'); } diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php index 3ae14a3e12d..5e9b815850c 100644 --- a/tests/Core/Command/Encryption/DecryptAllTest.php +++ b/tests/Core/Command/Encryption/DecryptAllTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -20,13 +21,13 @@ class DecryptAllTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IConfig */ protected $config; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */ protected $encryptionManager; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */ protected $appManager; - /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ protected $consoleInput; /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */ diff --git a/tests/Core/Command/Encryption/DisableTest.php b/tests/Core/Command/Encryption/DisableTest.php index 6c962399e11..a8054ff2e8e 100644 --- a/tests/Core/Command/Encryption/DisableTest.php +++ b/tests/Core/Command/Encryption/DisableTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Encryption/EnableTest.php b/tests/Core/Command/Encryption/EnableTest.php index b535c80b0a8..660deca7ea6 100644 --- a/tests/Core/Command/Encryption/EnableTest.php +++ b/tests/Core/Command/Encryption/EnableTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Encryption/EncryptAllTest.php b/tests/Core/Command/Encryption/EncryptAllTest.php index 83eeb5abdaa..4c8af1bd98b 100644 --- a/tests/Core/Command/Encryption/EncryptAllTest.php +++ b/tests/Core/Command/Encryption/EncryptAllTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -21,13 +22,13 @@ class EncryptAllTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IConfig */ protected $config; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */ protected $encryptionManager; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */ protected $appManager; - /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ protected $consoleInput; /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */ @@ -39,7 +40,7 @@ class EncryptAllTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IEncryptionModule */ protected $encryptionModule; - /** @var EncryptAll */ + /** @var EncryptAll */ protected $command; protected function setUp(): void { diff --git a/tests/Core/Command/Encryption/SetDefaultModuleTest.php b/tests/Core/Command/Encryption/SetDefaultModuleTest.php index 9c4259fb04e..f66b2903414 100644 --- a/tests/Core/Command/Encryption/SetDefaultModuleTest.php +++ b/tests/Core/Command/Encryption/SetDefaultModuleTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Group/AddTest.php b/tests/Core/Command/Group/AddTest.php index 76ef4a74f6a..d6af15e0972 100644 --- a/tests/Core/Command/Group/AddTest.php +++ b/tests/Core/Command/Group/AddTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/Group/AddUserTest.php b/tests/Core/Command/Group/AddUserTest.php index 8c8f4902a16..8c133ddb4e1 100644 --- a/tests/Core/Command/Group/AddUserTest.php +++ b/tests/Core/Command/Group/AddUserTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/Group/DeleteTest.php b/tests/Core/Command/Group/DeleteTest.php index fe1aaff64bc..b403b27af57 100644 --- a/tests/Core/Command/Group/DeleteTest.php +++ b/tests/Core/Command/Group/DeleteTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/Group/InfoTest.php b/tests/Core/Command/Group/InfoTest.php index 6f5a9cce02b..2c5fb801da8 100644 --- a/tests/Core/Command/Group/InfoTest.php +++ b/tests/Core/Command/Group/InfoTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/Group/ListCommandTest.php b/tests/Core/Command/Group/ListCommandTest.php index a995bdc0b20..d4100305874 100644 --- a/tests/Core/Command/Group/ListCommandTest.php +++ b/tests/Core/Command/Group/ListCommandTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/Group/RemoveUserTest.php b/tests/Core/Command/Group/RemoveUserTest.php index 47c782b6f44..386740c25e2 100644 --- a/tests/Core/Command/Group/RemoveUserTest.php +++ b/tests/Core/Command/Group/RemoveUserTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php index 35db7c6d718..b15976bde6f 100644 --- a/tests/Core/Command/Log/FileTest.php +++ b/tests/Core/Command/Log/FileTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Log/ManageTest.php b/tests/Core/Command/Log/ManageTest.php index 5cba6dd626f..8d9111334e0 100644 --- a/tests/Core/Command/Log/ManageTest.php +++ b/tests/Core/Command/Log/ManageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Maintenance/DataFingerprintTest.php b/tests/Core/Command/Maintenance/DataFingerprintTest.php index 03cf37b8f48..809268b99bc 100644 --- a/tests/Core/Command/Maintenance/DataFingerprintTest.php +++ b/tests/Core/Command/Maintenance/DataFingerprintTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php index a4169907167..1e51b071150 100644 --- a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php +++ b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/Maintenance/ModeTest.php b/tests/Core/Command/Maintenance/ModeTest.php index 458699649b2..02e83ce97b3 100644 --- a/tests/Core/Command/Maintenance/ModeTest.php +++ b/tests/Core/Command/Maintenance/ModeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -115,7 +116,7 @@ class ModeTest extends TestCase { * @param string $option The command option. * @param bool $currentMaintenanceState The current maintenance state. * @param null|bool $expectedMaintenanceState - * The expected maintenance state. Null for no change. + * The expected maintenance state. Null for no change. * @param string $expectedOutput The expected command output. * @throws \Exception */ diff --git a/tests/Core/Command/Maintenance/UpdateTheme.php b/tests/Core/Command/Maintenance/UpdateTheme.php index 25229b8997a..f4e6b15f4ce 100644 --- a/tests/Core/Command/Maintenance/UpdateTheme.php +++ b/tests/Core/Command/Maintenance/UpdateTheme.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/Preview/RepairTest.php b/tests/Core/Command/Preview/RepairTest.php index b257c59d9d2..13e16d98c0c 100644 --- a/tests/Core/Command/Preview/RepairTest.php +++ b/tests/Core/Command/Preview/RepairTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -147,7 +148,7 @@ class RepairTest extends TestCase { ->willReturn($directories); $this->rootFolder->expects($this->once()) ->method('get') - ->with("appdata_/preview") + ->with('appdata_/preview') ->willReturn($previewFolder); $this->repair->run($this->input, $this->output); diff --git a/tests/Core/Command/SystemTag/AddTest.php b/tests/Core/Command/SystemTag/AddTest.php index 921b875dc4e..9a24f7ef591 100644 --- a/tests/Core/Command/SystemTag/AddTest.php +++ b/tests/Core/Command/SystemTag/AddTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/SystemTag/DeleteTest.php b/tests/Core/Command/SystemTag/DeleteTest.php index a2ec3767272..8a28e0a08a4 100644 --- a/tests/Core/Command/SystemTag/DeleteTest.php +++ b/tests/Core/Command/SystemTag/DeleteTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/SystemTag/EditTest.php b/tests/Core/Command/SystemTag/EditTest.php index 4273d666ff5..97100af3fc3 100644 --- a/tests/Core/Command/SystemTag/EditTest.php +++ b/tests/Core/Command/SystemTag/EditTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -169,8 +170,8 @@ class EditTest extends TestCase { }); $this->systemTagManager->method('getTagsByIds') - ->with($tagId) - ->willReturn([]); + ->with($tagId) + ->willReturn([]); $this->output->expects($this->once()) ->method('writeln') diff --git a/tests/Core/Command/SystemTag/ListCommandTest.php b/tests/Core/Command/SystemTag/ListCommandTest.php index c7e213a782c..a180e92901d 100644 --- a/tests/Core/Command/SystemTag/ListCommandTest.php +++ b/tests/Core/Command/SystemTag/ListCommandTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/TwoFactorAuth/CleanupTest.php b/tests/Core/Command/TwoFactorAuth/CleanupTest.php index 8f082d76856..040bc08a858 100644 --- a/tests/Core/Command/TwoFactorAuth/CleanupTest.php +++ b/tests/Core/Command/TwoFactorAuth/CleanupTest.php @@ -47,6 +47,6 @@ class CleanupTest extends TestCase { $this->assertEquals(0, $rc); $output = $this->cmd->getDisplay(); - $this->assertStringContainsString("All user-provider associations for provider u2f have been removed", $output); + $this->assertStringContainsString('All user-provider associations for provider u2f have been removed', $output); } } diff --git a/tests/Core/Command/TwoFactorAuth/DisableTest.php b/tests/Core/Command/TwoFactorAuth/DisableTest.php index 4c1db3b1dc2..b123d09848a 100644 --- a/tests/Core/Command/TwoFactorAuth/DisableTest.php +++ b/tests/Core/Command/TwoFactorAuth/DisableTest.php @@ -49,7 +49,7 @@ class DisableTest extends TestCase { ]); $this->assertEquals(1, $rc); - $this->assertStringContainsString("Invalid UID", $this->command->getDisplay()); + $this->assertStringContainsString('Invalid UID', $this->command->getDisplay()); } public function testEnableNotSupported() { @@ -69,7 +69,7 @@ class DisableTest extends TestCase { ]); $this->assertEquals(2, $rc); - $this->assertStringContainsString("The provider does not support this operation", $this->command->getDisplay()); + $this->assertStringContainsString('The provider does not support this operation', $this->command->getDisplay()); } public function testEnabled() { @@ -89,6 +89,6 @@ class DisableTest extends TestCase { ]); $this->assertEquals(0, $rc); - $this->assertStringContainsString("Two-factor provider totp disabled for user ricky", $this->command->getDisplay()); + $this->assertStringContainsString('Two-factor provider totp disabled for user ricky', $this->command->getDisplay()); } } diff --git a/tests/Core/Command/TwoFactorAuth/EnableTest.php b/tests/Core/Command/TwoFactorAuth/EnableTest.php index 79755b9984d..f78085e72a1 100644 --- a/tests/Core/Command/TwoFactorAuth/EnableTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnableTest.php @@ -49,7 +49,7 @@ class EnableTest extends TestCase { ]); $this->assertEquals(1, $rc); - $this->assertStringContainsString("Invalid UID", $this->command->getDisplay()); + $this->assertStringContainsString('Invalid UID', $this->command->getDisplay()); } public function testEnableNotSupported() { @@ -69,7 +69,7 @@ class EnableTest extends TestCase { ]); $this->assertEquals(2, $rc); - $this->assertStringContainsString("The provider does not support this operation", $this->command->getDisplay()); + $this->assertStringContainsString('The provider does not support this operation', $this->command->getDisplay()); } public function testEnabled() { @@ -89,6 +89,6 @@ class EnableTest extends TestCase { ]); $this->assertEquals(0, $rc); - $this->assertStringContainsString("Two-factor provider totp enabled for user belle", $this->command->getDisplay()); + $this->assertStringContainsString('Two-factor provider totp enabled for user belle', $this->command->getDisplay()); } } diff --git a/tests/Core/Command/TwoFactorAuth/EnforceTest.php b/tests/Core/Command/TwoFactorAuth/EnforceTest.php index 073ea7dede8..e709ca2c55a 100644 --- a/tests/Core/Command/TwoFactorAuth/EnforceTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnforceTest.php @@ -46,7 +46,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is enforced for all users", $display); + $this->assertStringContainsString('Two-factor authentication is enforced for all users', $display); } public function testEnforceForOneGroup() { @@ -64,7 +64,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is enforced for members of the group(s) twofactorers", $display); + $this->assertStringContainsString('Two-factor authentication is enforced for members of the group(s) twofactorers', $display); } public function testEnforceForAllExceptOneGroup() { @@ -82,7 +82,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is enforced for all users, except members of yoloers", $display); + $this->assertStringContainsString('Two-factor authentication is enforced for all users, except members of yoloers', $display); } public function testDisableEnforced() { @@ -99,7 +99,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is not enforced", $display); + $this->assertStringContainsString('Two-factor authentication is not enforced', $display); } public function testCurrentStateEnabled() { @@ -111,7 +111,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is enforced for all users", $display); + $this->assertStringContainsString('Two-factor authentication is enforced for all users', $display); } public function testCurrentStateDisabled() { @@ -123,6 +123,6 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is not enforced", $display); + $this->assertStringContainsString('Two-factor authentication is not enforced', $display); } } diff --git a/tests/Core/Command/TwoFactorAuth/StateTest.php b/tests/Core/Command/TwoFactorAuth/StateTest.php index 23cb21f75d6..1d97d152a21 100644 --- a/tests/Core/Command/TwoFactorAuth/StateTest.php +++ b/tests/Core/Command/TwoFactorAuth/StateTest.php @@ -43,7 +43,7 @@ class StateTest extends TestCase { ]); $output = $this->cmd->getDisplay(); - $this->assertStringContainsString("Invalid UID", $output); + $this->assertStringContainsString('Invalid UID', $output); } public function testStateNoProvidersActive() { @@ -66,7 +66,7 @@ class StateTest extends TestCase { ]); $output = $this->cmd->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is not enabled for user eldora", $output); + $this->assertStringContainsString('Two-factor authentication is not enabled for user eldora', $output); } public function testStateOneProviderActive() { @@ -89,6 +89,6 @@ class StateTest extends TestCase { ]); $output = $this->cmd->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is enabled for user mohamed", $output); + $this->assertStringContainsString('Two-factor authentication is enabled for user mohamed', $output); } } diff --git a/tests/Core/Command/User/AddTest.php b/tests/Core/Command/User/AddTest.php index 7a956c173c1..902d073e74a 100644 --- a/tests/Core/Command/User/AddTest.php +++ b/tests/Core/Command/User/AddTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/User/AuthTokens/DeleteTest.php b/tests/Core/Command/User/AuthTokens/DeleteTest.php index bd82475b206..2c5b486efa8 100644 --- a/tests/Core/Command/User/AuthTokens/DeleteTest.php +++ b/tests/Core/Command/User/AuthTokens/DeleteTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/User/DeleteTest.php b/tests/Core/Command/User/DeleteTest.php index 74b98b0246a..28a52b99583 100644 --- a/tests/Core/Command/User/DeleteTest.php +++ b/tests/Core/Command/User/DeleteTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/User/DisableTest.php b/tests/Core/Command/User/DisableTest.php index a080eb9379a..92333be22d1 100644 --- a/tests/Core/Command/User/DisableTest.php +++ b/tests/Core/Command/User/DisableTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/User/EnableTest.php b/tests/Core/Command/User/EnableTest.php index 39af10f2ef3..f55d4e77125 100644 --- a/tests/Core/Command/User/EnableTest.php +++ b/tests/Core/Command/User/EnableTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Command/User/LastSeenTest.php b/tests/Core/Command/User/LastSeenTest.php index 1146c0664d4..1f857d818a7 100644 --- a/tests/Core/Command/User/LastSeenTest.php +++ b/tests/Core/Command/User/LastSeenTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Command/User/SettingTest.php b/tests/Core/Command/User/SettingTest.php index 4dd78708bbd..977e537f1be 100644 --- a/tests/Core/Command/User/SettingTest.php +++ b/tests/Core/Command/User/SettingTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Controller/AutoCompleteControllerTest.php b/tests/Core/Controller/AutoCompleteControllerTest.php index e2797181097..9984e933b3e 100644 --- a/tests/Core/Controller/AutoCompleteControllerTest.php +++ b/tests/Core/Controller/AutoCompleteControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -15,13 +16,13 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class AutoCompleteControllerTest extends TestCase { - /** @var ISearch|MockObject */ + /** @var ISearch|MockObject */ protected $collaboratorSearch; - /** @var IManager|MockObject */ + /** @var IManager|MockObject */ protected $autoCompleteManager; - /** @var IEventDispatcher|MockObject */ + /** @var IEventDispatcher|MockObject */ protected $dispatcher; - /** @var AutoCompleteController */ + /** @var AutoCompleteController */ protected $controller; protected function setUp(): void { diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php index b000482e29a..57375e08d42 100644 --- a/tests/Core/Controller/AvatarControllerTest.php +++ b/tests/Core/Controller/AvatarControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -287,12 +288,12 @@ class AvatarControllerTest extends \Test\TestCase { * Test what happens if the removing of the avatar fails */ public function testDeleteAvatarException() { - $this->avatarMock->method('remove')->will($this->throwException(new \Exception("foo"))); + $this->avatarMock->method('remove')->will($this->throwException(new \Exception('foo'))); $this->avatarManager->method('getAvatar')->willReturn($this->avatarMock); $this->logger->expects($this->once()) ->method('error') - ->with('foo', ['exception' => new \Exception("foo"), 'app' => 'core']); + ->with('foo', ['exception' => new \Exception('foo'), 'app' => 'core']); $expectedResponse = new Http\JSONResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_BAD_REQUEST); $this->assertEquals($expectedResponse, $this->avatarController->deleteAvatar()); } @@ -330,7 +331,7 @@ class AvatarControllerTest extends \Test\TestCase { */ public function testPostAvatarFile() { //Create temp file - $fileName = tempnam('', "avatarTest"); + $fileName = tempnam('', 'avatarTest'); $copyRes = copy(\OC::$SERVERROOT.'/tests/data/testimage.jpg', $fileName); $this->assertTrue($copyRes); @@ -368,7 +369,7 @@ class AvatarControllerTest extends \Test\TestCase { */ public function testPostAvatarFileGif() { //Create temp file - $fileName = tempnam('', "avatarTest"); + $fileName = tempnam('', 'avatarTest'); $copyRes = copy(\OC::$SERVERROOT.'/tests/data/testimage.gif', $fileName); $this->assertTrue($copyRes); @@ -469,7 +470,7 @@ class AvatarControllerTest extends \Test\TestCase { public function testPostAvatarException() { $this->cache->expects($this->once()) ->method('set') - ->will($this->throwException(new \Exception("foo"))); + ->will($this->throwException(new \Exception('foo'))); $file = $this->getMockBuilder('OCP\Files\File') ->disableOriginalConstructor()->getMock(); $file->expects($this->once()) @@ -484,7 +485,7 @@ class AvatarControllerTest extends \Test\TestCase { $this->logger->expects($this->once()) ->method('error') - ->with('foo', ['exception' => new \Exception("foo"), 'app' => 'core']); + ->with('foo', ['exception' => new \Exception('foo'), 'app' => 'core']); $expectedResponse = new Http\JSONResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_OK); $this->assertEquals($expectedResponse, $this->avatarController->postAvatar('avatar.jpg')); } @@ -544,7 +545,7 @@ class AvatarControllerTest extends \Test\TestCase { $this->logger->expects($this->once()) ->method('error') - ->with('foo', ['exception' => new \Exception("foo"), 'app' => 'core']); + ->with('foo', ['exception' => new \Exception('foo'), 'app' => 'core']); $expectedResponse = new Http\JSONResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_BAD_REQUEST); $this->assertEquals($expectedResponse, $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 11])); } diff --git a/tests/Core/Controller/ChangePasswordControllerTest.php b/tests/Core/Controller/ChangePasswordControllerTest.php index 93fb4196d35..f878530c106 100644 --- a/tests/Core/Controller/ChangePasswordControllerTest.php +++ b/tests/Core/Controller/ChangePasswordControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php index 377cfbf2dda..73a1cb36249 100644 --- a/tests/Core/Controller/ClientFlowLoginControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Controller/CssControllerTest.php b/tests/Core/Controller/CssControllerTest.php index 8064f36cddb..efba61b6eea 100644 --- a/tests/Core/Controller/CssControllerTest.php +++ b/tests/Core/Controller/CssControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Controller/GuestAvatarControllerTest.php b/tests/Core/Controller/GuestAvatarControllerTest.php index b2f60665948..6763905cfcc 100644 --- a/tests/Core/Controller/GuestAvatarControllerTest.php +++ b/tests/Core/Controller/GuestAvatarControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Controller/JsControllerTest.php b/tests/Core/Controller/JsControllerTest.php index 5aa853e4ed0..40e63bd84e6 100644 --- a/tests/Core/Controller/JsControllerTest.php +++ b/tests/Core/Controller/JsControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index 1e1771f7a15..e7aaedc15bd 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only @@ -232,10 +233,10 @@ class LostControllerTest extends TestCase { public function testEmailSuccessful() { $this->userManager - ->expects($this->any()) - ->method('get') - ->with('ExistingUser') - ->willReturn($this->existingUser); + ->expects($this->any()) + ->method('get') + ->with('ExistingUser') + ->willReturn($this->existingUser); $this->verificationToken->expects($this->once()) ->method('create') ->willReturn('ThisIsMaybeANotSoSecretToken!'); @@ -289,15 +290,15 @@ class LostControllerTest extends TestCase { public function testEmailWithMailSuccessful() { $this->userManager - ->expects($this->any()) - ->method('get') - ->with('test@example.com') - ->willReturn(null); + ->expects($this->any()) + ->method('get') + ->with('test@example.com') + ->willReturn(null); $this->userManager - ->expects($this->any()) - ->method('getByEmail') - ->with('test@example.com') - ->willReturn([$this->existingUser]); + ->expects($this->any()) + ->method('getByEmail') + ->with('test@example.com') + ->willReturn([$this->existingUser]); $this->verificationToken->expects($this->once()) ->method('create') ->willReturn('ThisIsMaybeANotSoSecretToken!'); @@ -351,10 +352,10 @@ class LostControllerTest extends TestCase { public function testEmailCantSendException() { $this->userManager - ->expects($this->any()) - ->method('get') - ->with('ExistingUser') - ->willReturn($this->existingUser); + ->expects($this->any()) + ->method('get') + ->with('ExistingUser') + ->willReturn($this->existingUser); $this->verificationToken->expects($this->once()) ->method('create') ->willReturn('ThisIsMaybeANotSoSecretToken!'); @@ -709,10 +710,10 @@ class LostControllerTest extends TestCase { public function testTrimEmailInput() { $this->userManager - ->expects($this->once()) - ->method('getByEmail') - ->with('test@example.com') - ->willReturn([$this->existingUser]); + ->expects($this->once()) + ->method('getByEmail') + ->with('test@example.com') + ->willReturn([$this->existingUser]); $this->mailer ->expects($this->once()) @@ -726,10 +727,10 @@ class LostControllerTest extends TestCase { public function testUsernameInput() { $this->userManager - ->expects($this->once()) - ->method('get') - ->with('ExistingUser') - ->willReturn($this->existingUser); + ->expects($this->once()) + ->method('get') + ->with('ExistingUser') + ->willReturn($this->existingUser); $this->mailer ->expects($this->once()) diff --git a/tests/Core/Controller/NavigationControllerTest.php b/tests/Core/Controller/NavigationControllerTest.php index 0d7c91d3034..26b31a2b4d1 100644 --- a/tests/Core/Controller/NavigationControllerTest.php +++ b/tests/Core/Controller/NavigationControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Controller/OCSControllerTest.php b/tests/Core/Controller/OCSControllerTest.php index 19b87a97359..34d6ee70a56 100644 --- a/tests/Core/Controller/OCSControllerTest.php +++ b/tests/Core/Controller/OCSControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/Core/Controller/PreviewControllerTest.php b/tests/Core/Controller/PreviewControllerTest.php index 7c9a32eae38..e0f04dd1a54 100644 --- a/tests/Core/Controller/PreviewControllerTest.php +++ b/tests/Core/Controller/PreviewControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php index f003975b359..3e99c2cad14 100644 --- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php +++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php @@ -288,7 +288,7 @@ class TwoFactorChallengeControllerTest extends TestCase { public function testSolveChallengeTwoFactorException() { $user = $this->createMock(IUser::class); $provider = $this->createMock(IProvider::class); - $exception = new TwoFactorException("2FA failed"); + $exception = new TwoFactorException('2FA failed'); $this->userSession->expects($this->once()) ->method('getUser') diff --git a/tests/Core/Controller/UserControllerTest.php b/tests/Core/Controller/UserControllerTest.php index 09a22913fdc..3a315557b9e 100644 --- a/tests/Core/Controller/UserControllerTest.php +++ b/tests/Core/Controller/UserControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Core/Controller/WellKnownControllerTest.php b/tests/Core/Controller/WellKnownControllerTest.php index 99c693c78b7..35606dc6384 100644 --- a/tests/Core/Controller/WellKnownControllerTest.php +++ b/tests/Core/Controller/WellKnownControllerTest.php @@ -40,7 +40,7 @@ class WellKnownControllerTest extends TestCase { } public function testHandleNotProcessed(): void { - $httpResponse = $this->controller->handle("nodeinfo"); + $httpResponse = $this->controller->handle('nodeinfo'); self::assertInstanceOf(JSONResponse::class, $httpResponse); self::assertArrayHasKey('X-NEXTCLOUD-WELL-KNOWN', $httpResponse->getHeaders()); @@ -55,14 +55,14 @@ class WellKnownControllerTest extends TestCase { $this->manager->expects(self::once()) ->method('process') ->with( - "nodeinfo", + 'nodeinfo', $this->request )->willReturn($response); $jsonResponse->expects(self::once()) ->method('addHeader') ->willReturnSelf(); - $httpResponse = $this->controller->handle("nodeinfo"); + $httpResponse = $this->controller->handle('nodeinfo'); self::assertInstanceOf(JSONResponse::class, $httpResponse); } diff --git a/tests/Core/Data/LoginFlowV2CredentialsTest.php b/tests/Core/Data/LoginFlowV2CredentialsTest.php index 0bb32f1c967..db402b48908 100644 --- a/tests/Core/Data/LoginFlowV2CredentialsTest.php +++ b/tests/Core/Data/LoginFlowV2CredentialsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only diff --git a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php index 2e6407d4c00..1310c4467d2 100644 --- a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php +++ b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only diff --git a/tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php b/tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php index 3d102c8f279..3c4ee2a1cd8 100644 --- a/tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php +++ b/tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -32,7 +33,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase { /** @var CleanPreviewsBackgroundJob */ private $job; - /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */ + /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */ private $userManager; public function setUp(): void { diff --git a/tests/Test/Repair/Owncloud/CleanPreviewsTest.php b/tests/Test/Repair/Owncloud/CleanPreviewsTest.php index 10d2e5d216c..8530422ff0a 100644 --- a/tests/Test/Repair/Owncloud/CleanPreviewsTest.php +++ b/tests/Test/Repair/Owncloud/CleanPreviewsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php b/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php index 856adde5c95..6e53755c4ab 100644 --- a/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php +++ b/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -48,12 +49,12 @@ class UpdateLanguageCodesTest extends TestCase { // insert test data $qb = $this->connection->getQueryBuilder(); $qb->insert('preferences') - ->values([ - 'userid' => $qb->createParameter('userid'), - 'appid' => $qb->createParameter('appid'), - 'configkey' => $qb->createParameter('configkey'), - 'configvalue' => $qb->createParameter('configvalue'), - ]); + ->values([ + 'userid' => $qb->createParameter('userid'), + 'appid' => $qb->createParameter('appid'), + 'configkey' => $qb->createParameter('configkey'), + 'configvalue' => $qb->createParameter('configvalue'), + ]); foreach ($users as $user) { $qb->setParameters([ 'userid' => $user['userid'], diff --git a/tests/apps.php b/tests/apps.php index d845cdf47c1..9a6f089c90a 100644 --- a/tests/apps.php +++ b/tests/apps.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 3fdc6b51fba..5ce6bc400bd 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/enable_all.php b/tests/enable_all.php index db01de6ec41..298409c230e 100644 --- a/tests/enable_all.php +++ b/tests/enable_all.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2018 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2012-2016 ownCloud, Inc. diff --git a/tests/lib/APITest.php b/tests/lib/APITest.php index f7ac3aed4b7..15ed7fbd424 100644 --- a/tests/lib/APITest.php +++ b/tests/lib/APITest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -34,7 +35,7 @@ class APITest extends \Test\TestCase { // Check response is of correct type $this->assertInstanceOf(\OC\OCS\Result::class, $result); // Check if it succeeded - /** @var $result \OC\OCS\Result */ + /** @var \OC\OCS\Result $result */ $this->assertEquals($success, $result->succeeded()); } diff --git a/tests/lib/Accounts/AccountManagerTest.php b/tests/lib/Accounts/AccountManagerTest.php index 9b4a6ca1e25..2d3daf942b9 100644 --- a/tests/lib/Accounts/AccountManagerTest.php +++ b/tests/lib/Accounts/AccountManagerTest.php @@ -1029,7 +1029,7 @@ class AccountManagerTest extends TestCase { $result = $this->invokePrivate($this->accountManager, 'buildDefaultUserRecord', [$user]); $resultProperties = array_column($result, 'name'); - $this->assertEmpty(array_diff($resultProperties, IAccountManager::ALLOWED_PROPERTIES), "Building default user record returned non-allowed properties"); + $this->assertEmpty(array_diff($resultProperties, IAccountManager::ALLOWED_PROPERTIES), 'Building default user record returned non-allowed properties'); foreach ($expectedResultScopes as $expectedResultScopeKey => $expectedResultScopeValue) { $resultScope = $result[array_search($expectedResultScopeKey, $resultProperties)]['scope']; $this->assertEquals($expectedResultScopeValue, $resultScope, "The result scope doesn't follow the value set into the config or defaults correctly."); diff --git a/tests/lib/Accounts/AccountPropertyTest.php b/tests/lib/Accounts/AccountPropertyTest.php index f8aefccdbaa..6abe9d1bc01 100644 --- a/tests/lib/Accounts/AccountPropertyTest.php +++ b/tests/lib/Accounts/AccountPropertyTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Accounts/AccountTest.php b/tests/lib/Accounts/AccountTest.php index d9242b073af..ae718f94c09 100644 --- a/tests/lib/Accounts/AccountTest.php +++ b/tests/lib/Accounts/AccountTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Accounts/HooksTest.php b/tests/lib/Accounts/HooksTest.php index df9420140d3..3faa1b2b0fa 100644 --- a/tests/lib/Accounts/HooksTest.php +++ b/tests/lib/Accounts/HooksTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php index 48df3416df1..694646be9fc 100644 --- a/tests/lib/AllConfigTest.php +++ b/tests/lib/AllConfigTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -19,7 +20,7 @@ use OC\SystemConfig; use OCP\IDBConnection; class AllConfigTest extends \Test\TestCase { - /** @var \OCP\IDBConnection */ + /** @var \OCP\IDBConnection */ protected $connection; protected function getConfig($systemConfig = null, $connection = null) { diff --git a/tests/lib/App/AppStore/Bundles/BundleBase.php b/tests/lib/App/AppStore/Bundles/BundleBase.php index 4c31c49cdb1..58d2eb94426 100644 --- a/tests/lib/App/AppStore/Bundles/BundleBase.php +++ b/tests/lib/App/AppStore/Bundles/BundleBase.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php index 484b81b5197..fe0893ac229 100644 --- a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php +++ b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/App/AppStore/Bundles/EducationBundleTest.php b/tests/lib/App/AppStore/Bundles/EducationBundleTest.php index 50942d8df97..88a3b2d8d67 100644 --- a/tests/lib/App/AppStore/Bundles/EducationBundleTest.php +++ b/tests/lib/App/AppStore/Bundles/EducationBundleTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php b/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php index 464d48102b2..a02ee11d15c 100644 --- a/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php +++ b/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php b/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php index 5ba9ee4c4e1..be756dbc55e 100644 --- a/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php +++ b/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php b/tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php index a2681cb0238..f3437fb51e6 100644 --- a/tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php +++ b/tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php index 82f40043971..29963f6c4af 100644 --- a/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php index 9a04c11a1f3..07f33cabb45 100644 --- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php index b7dbf6eccd8..03514796a90 100644 --- a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php index f2bc981d4a6..43d8b8a0eae 100644 --- a/tests/lib/App/AppStore/Fetcher/FetcherBase.php +++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/App/AppStore/Version/VersionParserTest.php b/tests/lib/App/AppStore/Version/VersionParserTest.php index c461bf7c6cf..78b931d7ebf 100644 --- a/tests/lib/App/AppStore/Version/VersionParserTest.php +++ b/tests/lib/App/AppStore/Version/VersionParserTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/App/AppStore/Version/VersionTest.php b/tests/lib/App/AppStore/Version/VersionTest.php index 68da79fdc8d..09608ebb387 100644 --- a/tests/lib/App/AppStore/Version/VersionTest.php +++ b/tests/lib/App/AppStore/Version/VersionTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php index 1b9c977e737..19804bfc061 100644 --- a/tests/lib/App/DependencyAnalyzerTest.php +++ b/tests/lib/App/DependencyAnalyzerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2023 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc. @@ -46,7 +47,7 @@ class DependencyAnalyzerTest extends TestCase { ->method('getLibraryVersion') ->willReturnCallback(function ($lib) { if ($lib === 'curl') { - return "2.3.4"; + return '2.3.4'; } return null; }); diff --git a/tests/lib/App/InfoParserTest.php b/tests/lib/App/InfoParserTest.php index ddd0df25435..b039d40498e 100644 --- a/tests/lib/App/InfoParserTest.php +++ b/tests/lib/App/InfoParserTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2023 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc. diff --git a/tests/lib/App/PlatformRepositoryTest.php b/tests/lib/App/PlatformRepositoryTest.php index e1eb7b16b40..026442edaa0 100644 --- a/tests/lib/App/PlatformRepositoryTest.php +++ b/tests/lib/App/PlatformRepositoryTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020-2023 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc. diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php index f82f3b45b32..969cabb0927 100644 --- a/tests/lib/AppConfigTest.php +++ b/tests/lib/AppConfigTest.php @@ -32,7 +32,7 @@ class AppConfigTest extends TestCase { /** * @var array<string, array<array<string, string, int, bool, bool>>> - * [appId => [configKey, configValue, valueType, lazy, sensitive]] + * [appId => [configKey, configValue, valueType, lazy, sensitive]] */ private array $baseStruct = [ @@ -168,7 +168,7 @@ class AppConfigTest extends TestCase { /** * @param bool $preLoading TRUE will preload the 'fast' cache, which is the normal behavior of usual - * IAppConfig + * IAppConfig * * @return IAppConfig */ @@ -223,7 +223,7 @@ class AppConfigTest extends TestCase { foreach ($appData as $row) { $keys[] = $row[0]; } - $appKeys[] = [(string)$appId, $keys]; + $appKeys[] = [(string) $appId, $keys]; } return $appKeys; @@ -242,7 +242,7 @@ class AppConfigTest extends TestCase { foreach ($this->baseStruct as $appId => $appData) { foreach ($appData as $row) { $appKeys[] = [ - (string)$appId, $row[0], $row[1], $row[2] ?? IAppConfig::VALUE_MIXED, $row[3] ?? false, + (string) $appId, $row[0], $row[1], $row[2] ?? IAppConfig::VALUE_MIXED, $row[3] ?? false, $row[4] ?? false ]; } diff --git a/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php b/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php index ce07a628773..05e7a1b71c7 100644 --- a/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php +++ b/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php @@ -77,7 +77,7 @@ class CoordinatorTest extends TestCase { $this->serverContainer->expects($this->once()) ->method('query') ->with(\OCA\Settings\AppInfo\Application::class) - ->willThrowException(new QueryException("")); + ->willThrowException(new QueryException('')); $this->logger->expects($this->once()) ->method('error'); diff --git a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php index bec1b7a2a63..ec630d197ce 100644 --- a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php +++ b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php index 044b554d014..7a6b3460947 100644 --- a/tests/lib/AppFramework/Controller/ControllerTest.php +++ b/tests/lib/AppFramework/Controller/ControllerTest.php @@ -70,8 +70,8 @@ class ControllerTest extends \Test\TestCase { ->setConstructorArgs(['test']) ->getMock(); $this->app->expects($this->any()) - ->method('getAppName') - ->willReturn('apptemplate_advanced'); + ->method('getAppName') + ->willReturn('apptemplate_advanced'); $this->controller = new ChildController($this->app, $request); $this->overwriteService(IRequest::class, $request); diff --git a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php index be28843b03f..0fccb6f793d 100644 --- a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php +++ b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Db/QBMapperTest.php b/tests/lib/AppFramework/Db/QBMapperTest.php index f984d977df5..f230df3ff71 100644 --- a/tests/lib/AppFramework/Db/QBMapperTest.php +++ b/tests/lib/AppFramework/Db/QBMapperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -153,7 +154,7 @@ class QBMapperTest extends \Test\TestCase { $entity->setStringProp('string'); $entity->setIntegerProp(456); $entity->setBooleanProp(false); - $entity->setJsonProp(["hello" => "world"]); + $entity->setJsonProp(['hello' => 'world']); $idParam = $this->qb->createNamedParameter('id', IQueryBuilder::PARAM_INT); $intParam = $this->qb->createNamedParameter('int_prop', IQueryBuilder::PARAM_INT); @@ -171,7 +172,7 @@ class QBMapperTest extends \Test\TestCase { [$this->equalTo('string'), $this->equalTo(IQueryBuilder::PARAM_STR)], [$this->equalTo(456), $this->equalTo(IQueryBuilder::PARAM_INT)], [$this->equalTo(false), $this->equalTo(IQueryBuilder::PARAM_BOOL)], - [$this->equalTo(["hello" => "world"]), $this->equalTo(IQueryBuilder::PARAM_JSON)], + [$this->equalTo(['hello' => 'world']), $this->equalTo(IQueryBuilder::PARAM_JSON)], [$this->equalTo(789), $this->equalTo(IQueryBuilder::PARAM_INT)], ); diff --git a/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php b/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php index ad126ad99e2..1b28d006c91 100644 --- a/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php +++ b/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php index 465f9ee0a07..16d613113ec 100644 --- a/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php +++ b/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php index cb32302d4be..ef37a0b8942 100644 --- a/tests/lib/AppFramework/Http/DispatcherTest.php +++ b/tests/lib/AppFramework/Http/DispatcherTest.php @@ -77,19 +77,19 @@ class DispatcherTest extends \Test\TestCase { /** @var Dispatcher */ private $dispatcher; private $controllerMethod; - /** @var Controller|MockObject */ + /** @var Controller|MockObject */ private $controller; private $response; - /** @var IRequest|MockObject */ + /** @var IRequest|MockObject */ private $request; private $lastModified; private $etag; - /** @var Http|MockObject */ + /** @var Http|MockObject */ private $http; private $reflector; - /** @var IConfig|MockObject */ + /** @var IConfig|MockObject */ private $config; - /** @var LoggerInterface|MockObject */ + /** @var LoggerInterface|MockObject */ private $logger; /** @var IEventLogger|MockObject */ private $eventLogger; @@ -286,7 +286,7 @@ class DispatcherTest extends \Test\TestCase { private function dispatcherPassthrough() { $this->middlewareDispatcher->expects($this->once()) - ->method('beforeController'); + ->method('beforeController'); $this->middlewareDispatcher->expects($this->once()) ->method('afterController') ->willReturnCallback(function ($a, $b, $in) { diff --git a/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php index 9b126553dcd..6bf50cf2b6b 100644 --- a/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php +++ b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -483,15 +484,15 @@ class EmptyContentSecurityPolicyTest extends \Test\TestCase { public function testGetPolicyWithReportUri() { $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none';report-uri https://my-report-uri.com"; - $this->contentSecurityPolicy->addReportTo("https://my-report-uri.com"); + $this->contentSecurityPolicy->addReportTo('https://my-report-uri.com'); $this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy()); } public function testGetPolicyWithMultipleReportUri() { $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none';report-uri https://my-report-uri.com https://my-other-report-uri.com"; - $this->contentSecurityPolicy->addReportTo("https://my-report-uri.com"); - $this->contentSecurityPolicy->addReportTo("https://my-other-report-uri.com"); + $this->contentSecurityPolicy->addReportTo('https://my-report-uri.com'); + $this->contentSecurityPolicy->addReportTo('https://my-other-report-uri.com'); $this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy()); } } diff --git a/tests/lib/AppFramework/Http/FileDisplayResponseTest.php b/tests/lib/AppFramework/Http/FileDisplayResponseTest.php index a75c6fdd591..c55a8fec302 100644 --- a/tests/lib/AppFramework/Http/FileDisplayResponseTest.php +++ b/tests/lib/AppFramework/Http/FileDisplayResponseTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Http/OutputTest.php b/tests/lib/AppFramework/Http/OutputTest.php index cad49ae77ba..38a04ec5d65 100644 --- a/tests/lib/AppFramework/Http/OutputTest.php +++ b/tests/lib/AppFramework/Http/OutputTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Http/RequestStream.php b/tests/lib/AppFramework/Http/RequestStream.php index 99f664b48ac..7340391b2d5 100644 --- a/tests/lib/AppFramework/Http/RequestStream.php +++ b/tests/lib/AppFramework/Http/RequestStream.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -17,7 +18,7 @@ class RequestStream { public function stream_open(string $path, string $mode, int $options, ?string &$opened_path): bool { $url = parse_url($path); - $this->varname = $url["host"] ?? ''; + $this->varname = $url['host'] ?? ''; $this->position = 0; return true; @@ -104,7 +105,7 @@ class RequestStream { public function stream_metadata(string $path, int $option, $var): bool { if ($option == STREAM_META_TOUCH) { $url = parse_url($path); - $varname = $url["host"] ?? ''; + $varname = $url['host'] ?? ''; if (!isset($GLOBALS[$varname])) { $GLOBALS[$varname] = ''; } diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index 8144b44e842..a8f4a318d8e 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -496,7 +497,7 @@ class RequestTest extends \Test\TestCase { 'method' => 'PUT', 'server' => [ 'CONTENT_TYPE' => 'image/png', - 'CONTENT_LENGTH' => (string)strlen($data) + 'CONTENT_LENGTH' => (string) strlen($data) ], ]; diff --git a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php index fd3ed861405..cddec9bf256 100644 --- a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php +++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php @@ -135,14 +135,14 @@ class MiddlewareDispatcherTest extends \Test\TestCase { ->setMethods(['afterException', 'beforeController']) ->getMock(); $m1->expects($this->never()) - ->method('afterException'); + ->method('afterException'); $m2 = $this->getMockBuilder('OCP\AppFramework\Middleware') ->setMethods(['afterException', 'beforeController']) ->getMock(); $m2->expects($this->once()) - ->method('afterException') - ->willReturn($response); + ->method('afterException') + ->willReturn($response); $this->dispatcher->registerMiddleware($m1); $this->dispatcher->registerMiddleware($m2); @@ -260,11 +260,11 @@ class MiddlewareDispatcherTest extends \Test\TestCase { $m2 = $this->getMiddleware(true); $m3 = $this->createMock(Middleware::class); $m3->expects($this->never()) - ->method('afterException'); + ->method('afterException'); $m3->expects($this->never()) - ->method('beforeController'); + ->method('beforeController'); $m3->expects($this->never()) - ->method('afterController'); + ->method('afterController'); $m3->method('beforeOutput') ->willReturnArgument(2); diff --git a/tests/lib/AppFramework/Middleware/MiddlewareTest.php b/tests/lib/AppFramework/Middleware/MiddlewareTest.php index 0662f822103..c1e5c44c4db 100644 --- a/tests/lib/AppFramework/Middleware/MiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/MiddlewareTest.php @@ -37,8 +37,8 @@ class MiddlewareTest extends \Test\TestCase { $this->middleware = new ChildMiddleware(); $this->api = $this->getMockBuilder(DIContainer::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $this->controller = $this->getMockBuilder(Controller::class) ->setMethods([]) diff --git a/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php index 28b2ba34fca..016d1ee1457 100644 --- a/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php index 64a9efbfe60..050a6440383 100644 --- a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php index a224ebae949..edd0000e5e7 100644 --- a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php index 00538dda4b0..502c707b2e2 100644 --- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2023 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc. diff --git a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php index 140cdb14fd2..2ab373e1b7e 100644 --- a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php index b4d7ee10f7c..ea15e78d3e6 100644 --- a/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index fb457579fac..136118ac65a 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php index 00b586e6cc4..18692b69d64 100644 --- a/tests/lib/AppFramework/Routing/RoutingTest.php +++ b/tests/lib/AppFramework/Routing/RoutingTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/AppFramework/Services/AppConfigTest.php b/tests/lib/AppFramework/Services/AppConfigTest.php index 0ee4afe9bf6..46f73a8c088 100644 --- a/tests/lib/AppFramework/Services/AppConfigTest.php +++ b/tests/lib/AppFramework/Services/AppConfigTest.php @@ -35,9 +35,9 @@ class AppConfigTest extends TestCase { public function testGetAppKeys(): void { $expected = ['key1', 'key2', 'key3', 'key4', 'key5', 'key6', 'key7', 'test8']; $this->appConfigCore->expects($this->once()) - ->method('getKeys') - ->with(self::TEST_APPID) - ->willReturn($expected); + ->method('getKeys') + ->with(self::TEST_APPID) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->getAppKeys()); } @@ -65,9 +65,9 @@ class AppConfigTest extends TestCase { public function testHasAppKey(bool $lazy, bool $expected): void { $key = 'key'; $this->appConfigCore->expects($this->once()) - ->method('hasKey') - ->with(self::TEST_APPID, $key, $lazy) - ->willReturn($expected); + ->method('hasKey') + ->with(self::TEST_APPID, $key, $lazy) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->hasAppKey($key, $lazy)); } @@ -95,9 +95,9 @@ class AppConfigTest extends TestCase { public function testIsSensitive(bool $lazy, bool $expected): void { $key = 'key'; $this->appConfigCore->expects($this->once()) - ->method('isSensitive') - ->with(self::TEST_APPID, $key, $lazy) - ->willReturn($expected); + ->method('isSensitive') + ->with(self::TEST_APPID, $key, $lazy) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->isSensitive($key, $lazy)); } @@ -111,9 +111,9 @@ class AppConfigTest extends TestCase { public function testIsSensitiveException(bool $lazy, bool $expected): void { $key = 'unknown-key'; $this->appConfigCore->expects($this->once()) - ->method('isSensitive') - ->with(self::TEST_APPID, $key, $lazy) - ->willThrowException(new AppConfigUnknownKeyException()); + ->method('isSensitive') + ->with(self::TEST_APPID, $key, $lazy) + ->willThrowException(new AppConfigUnknownKeyException()); $this->expectException(AppConfigUnknownKeyException::class); $this->appConfig->isSensitive($key, $lazy); @@ -139,9 +139,9 @@ class AppConfigTest extends TestCase { public function testIsLazy(bool $expected): void { $key = 'key'; $this->appConfigCore->expects($this->once()) - ->method('isLazy') - ->with(self::TEST_APPID, $key) - ->willReturn($expected); + ->method('isLazy') + ->with(self::TEST_APPID, $key) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->isLazy($key)); } @@ -149,9 +149,9 @@ class AppConfigTest extends TestCase { public function testIsLazyException(): void { $key = 'unknown-key'; $this->appConfigCore->expects($this->once()) - ->method('isLazy') - ->with(self::TEST_APPID, $key) - ->willThrowException(new AppConfigUnknownKeyException()); + ->method('isLazy') + ->with(self::TEST_APPID, $key) + ->willThrowException(new AppConfigUnknownKeyException()); $this->expectException(AppConfigUnknownKeyException::class); $this->appConfig->isLazy($key); @@ -186,9 +186,9 @@ class AppConfigTest extends TestCase { ]; $this->appConfigCore->expects($this->once()) - ->method('getAllValues') - ->with(self::TEST_APPID, $key, $filtered) - ->willReturn($expected); + ->method('getAllValues') + ->with(self::TEST_APPID, $key, $filtered) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->getAllAppValues($key, $filtered)); } @@ -197,8 +197,8 @@ class AppConfigTest extends TestCase { $key = 'key'; $value = 'value'; $this->appConfigCore->expects($this->once()) - ->method('setValueMixed') - ->with(self::TEST_APPID, $key, $value); + ->method('setValueMixed') + ->with(self::TEST_APPID, $key, $value); $this->appConfig->setAppValue($key, $value); } @@ -239,9 +239,9 @@ class AppConfigTest extends TestCase { $key = 'key'; $value = 'valueString'; $this->appConfigCore->expects($this->once()) - ->method('setValueString') - ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) - ->willReturn($expected); + ->method('setValueString') + ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->setAppValueString($key, $value, $lazy, $sensitive)); } @@ -256,9 +256,9 @@ class AppConfigTest extends TestCase { $key = 'key'; $value = 'valueString'; $this->appConfigCore->expects($this->once()) - ->method('setValueString') - ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) - ->willThrowException(new AppConfigTypeConflictException()); + ->method('setValueString') + ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) + ->willThrowException(new AppConfigTypeConflictException()); $this->expectException(AppConfigTypeConflictException::class); $this->appConfig->setAppValueString($key, $value, $lazy, $sensitive); @@ -275,9 +275,9 @@ class AppConfigTest extends TestCase { $key = 'key'; $value = 42; $this->appConfigCore->expects($this->once()) - ->method('setValueInt') - ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) - ->willReturn($expected); + ->method('setValueInt') + ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->setAppValueInt($key, $value, $lazy, $sensitive)); } @@ -292,9 +292,9 @@ class AppConfigTest extends TestCase { $key = 'key'; $value = 42; $this->appConfigCore->expects($this->once()) - ->method('setValueInt') - ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) - ->willThrowException(new AppConfigTypeConflictException()); + ->method('setValueInt') + ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) + ->willThrowException(new AppConfigTypeConflictException()); $this->expectException(AppConfigTypeConflictException::class); $this->appConfig->setAppValueInt($key, $value, $lazy, $sensitive); @@ -311,9 +311,9 @@ class AppConfigTest extends TestCase { $key = 'key'; $value = 3.14; $this->appConfigCore->expects($this->once()) - ->method('setValueFloat') - ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) - ->willReturn($expected); + ->method('setValueFloat') + ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->setAppValueFloat($key, $value, $lazy, $sensitive)); } @@ -328,9 +328,9 @@ class AppConfigTest extends TestCase { $key = 'key'; $value = 3.14; $this->appConfigCore->expects($this->once()) - ->method('setValueFloat') - ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) - ->willThrowException(new AppConfigTypeConflictException()); + ->method('setValueFloat') + ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) + ->willThrowException(new AppConfigTypeConflictException()); $this->expectException(AppConfigTypeConflictException::class); $this->appConfig->setAppValueFloat($key, $value, $lazy, $sensitive); @@ -360,9 +360,9 @@ class AppConfigTest extends TestCase { $key = 'key'; $value = true; $this->appConfigCore->expects($this->once()) - ->method('setValueBool') - ->with(self::TEST_APPID, $key, $value, $lazy) - ->willReturn($expected); + ->method('setValueBool') + ->with(self::TEST_APPID, $key, $value, $lazy) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->setAppValueBool($key, $value, $lazy)); } @@ -376,9 +376,9 @@ class AppConfigTest extends TestCase { $key = 'key'; $value = true; $this->appConfigCore->expects($this->once()) - ->method('setValueBool') - ->with(self::TEST_APPID, $key, $value, $lazy) - ->willThrowException(new AppConfigTypeConflictException()); + ->method('setValueBool') + ->with(self::TEST_APPID, $key, $value, $lazy) + ->willThrowException(new AppConfigTypeConflictException()); $this->expectException(AppConfigTypeConflictException::class); $this->appConfig->setAppValueBool($key, $value, $lazy); @@ -395,9 +395,9 @@ class AppConfigTest extends TestCase { $key = 'key'; $value = ['item' => true]; $this->appConfigCore->expects($this->once()) - ->method('setValueArray') - ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) - ->willReturn($expected); + ->method('setValueArray') + ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->setAppValueArray($key, $value, $lazy, $sensitive)); } @@ -412,9 +412,9 @@ class AppConfigTest extends TestCase { $key = 'key'; $value = ['item' => true]; $this->appConfigCore->expects($this->once()) - ->method('setValueArray') - ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) - ->willThrowException(new AppConfigTypeConflictException()); + ->method('setValueArray') + ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive) + ->willThrowException(new AppConfigTypeConflictException()); $this->expectException(AppConfigTypeConflictException::class); $this->appConfig->setAppValueArray($key, $value, $lazy, $sensitive); @@ -425,9 +425,9 @@ class AppConfigTest extends TestCase { $value = 'value'; $default = 'default'; $this->appConfigCore->expects($this->once()) - ->method('getValueMixed') - ->with(self::TEST_APPID, $key, $default) - ->willReturn($value); + ->method('getValueMixed') + ->with(self::TEST_APPID, $key, $default) + ->willReturn($value); $this->assertSame($value, $this->appConfig->getAppValue($key, $default)); } @@ -436,9 +436,9 @@ class AppConfigTest extends TestCase { $key = 'key'; $default = 'default'; $this->appConfigCore->expects($this->once()) - ->method('getValueMixed') - ->with(self::TEST_APPID, $key, $default) - ->willReturn($default); + ->method('getValueMixed') + ->with(self::TEST_APPID, $key, $default) + ->willReturn($default); $this->assertSame($default, $this->appConfig->getAppValue($key, $default)); } @@ -479,9 +479,9 @@ class AppConfigTest extends TestCase { $expected = ($exist) ? $value : $default; $this->appConfigCore->expects($this->once()) - ->method('getValueString') - ->with(self::TEST_APPID, $key, $default, $lazy) - ->willReturn($expected); + ->method('getValueString') + ->with(self::TEST_APPID, $key, $default, $lazy) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->getAppValueString($key, $default, $lazy)); } @@ -496,9 +496,9 @@ class AppConfigTest extends TestCase { $default = 'default'; $this->appConfigCore->expects($this->once()) - ->method('getValueString') - ->with(self::TEST_APPID, $key, $default, $lazy) - ->willThrowException(new AppConfigTypeConflictException()); + ->method('getValueString') + ->with(self::TEST_APPID, $key, $default, $lazy) + ->willThrowException(new AppConfigTypeConflictException()); $this->expectException(AppConfigTypeConflictException::class); $this->appConfig->getAppValueString($key, $default, $lazy); @@ -517,9 +517,9 @@ class AppConfigTest extends TestCase { $expected = ($exist) ? $value : $default; $this->appConfigCore->expects($this->once()) - ->method('getValueInt') - ->with(self::TEST_APPID, $key, $default, $lazy) - ->willReturn($expected); + ->method('getValueInt') + ->with(self::TEST_APPID, $key, $default, $lazy) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->getAppValueInt($key, $default, $lazy)); } @@ -534,9 +534,9 @@ class AppConfigTest extends TestCase { $default = 17; $this->appConfigCore->expects($this->once()) - ->method('getValueInt') - ->with(self::TEST_APPID, $key, $default, $lazy) - ->willThrowException(new AppConfigTypeConflictException()); + ->method('getValueInt') + ->with(self::TEST_APPID, $key, $default, $lazy) + ->willThrowException(new AppConfigTypeConflictException()); $this->expectException(AppConfigTypeConflictException::class); $this->appConfig->getAppValueInt($key, $default, $lazy); @@ -555,9 +555,9 @@ class AppConfigTest extends TestCase { $expected = ($exist) ? $value : $default; $this->appConfigCore->expects($this->once()) - ->method('getValueFloat') - ->with(self::TEST_APPID, $key, $default, $lazy) - ->willReturn($expected); + ->method('getValueFloat') + ->with(self::TEST_APPID, $key, $default, $lazy) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->getAppValueFloat($key, $default, $lazy)); } @@ -572,9 +572,9 @@ class AppConfigTest extends TestCase { $default = 17.04; $this->appConfigCore->expects($this->once()) - ->method('getValueFloat') - ->with(self::TEST_APPID, $key, $default, $lazy) - ->willThrowException(new AppConfigTypeConflictException()); + ->method('getValueFloat') + ->with(self::TEST_APPID, $key, $default, $lazy) + ->willThrowException(new AppConfigTypeConflictException()); $this->expectException(AppConfigTypeConflictException::class); $this->appConfig->getAppValueFloat($key, $default, $lazy); @@ -593,9 +593,9 @@ class AppConfigTest extends TestCase { $expected = ($exist) ? $value : $default; // yes, it can be simplified $this->appConfigCore->expects($this->once()) - ->method('getValueBool') - ->with(self::TEST_APPID, $key, $default, $lazy) - ->willReturn($expected); + ->method('getValueBool') + ->with(self::TEST_APPID, $key, $default, $lazy) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->getAppValueBool($key, $default, $lazy)); } @@ -610,9 +610,9 @@ class AppConfigTest extends TestCase { $default = false; $this->appConfigCore->expects($this->once()) - ->method('getValueBool') - ->with(self::TEST_APPID, $key, $default, $lazy) - ->willThrowException(new AppConfigTypeConflictException()); + ->method('getValueBool') + ->with(self::TEST_APPID, $key, $default, $lazy) + ->willThrowException(new AppConfigTypeConflictException()); $this->expectException(AppConfigTypeConflictException::class); $this->appConfig->getAppValueBool($key, $default, $lazy); @@ -631,9 +631,9 @@ class AppConfigTest extends TestCase { $expected = ($exist) ? $value : $default; $this->appConfigCore->expects($this->once()) - ->method('getValueArray') - ->with(self::TEST_APPID, $key, $default, $lazy) - ->willReturn($expected); + ->method('getValueArray') + ->with(self::TEST_APPID, $key, $default, $lazy) + ->willReturn($expected); $this->assertSame($expected, $this->appConfig->getAppValueArray($key, $default, $lazy)); } @@ -648,9 +648,9 @@ class AppConfigTest extends TestCase { $default = []; $this->appConfigCore->expects($this->once()) - ->method('getValueArray') - ->with(self::TEST_APPID, $key, $default, $lazy) - ->willThrowException(new AppConfigTypeConflictException()); + ->method('getValueArray') + ->with(self::TEST_APPID, $key, $default, $lazy) + ->willThrowException(new AppConfigTypeConflictException()); $this->expectException(AppConfigTypeConflictException::class); $this->appConfig->getAppValueArray($key, $default, $lazy); @@ -659,16 +659,16 @@ class AppConfigTest extends TestCase { public function testDeleteAppValue(): void { $key = 'key'; $this->appConfigCore->expects($this->once()) - ->method('deleteKey') - ->with(self::TEST_APPID, $key); + ->method('deleteKey') + ->with(self::TEST_APPID, $key); $this->appConfig->deleteAppValue($key); } public function testDeleteAppValues(): void { $this->appConfigCore->expects($this->once()) - ->method('deleteApp') - ->with(self::TEST_APPID); + ->method('deleteApp') + ->with(self::TEST_APPID); $this->appConfig->deleteAppValues(); } diff --git a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php index 05ad6456904..b7d14cb6cba 100644 --- a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php +++ b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php @@ -165,7 +165,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { /** * @Annotation - * @param string $foo + * @param string $foo */ public function testReadTypeWhitespaceAnnotations() { $reader = new ControllerMethodReflector(); diff --git a/tests/lib/AppScriptSortTest.php b/tests/lib/AppScriptSortTest.php index ae7b5c326ec..7dc2bde1897 100644 --- a/tests/lib/AppScriptSortTest.php +++ b/tests/lib/AppScriptSortTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php index e04bfaee45e..2b831a69543 100644 --- a/tests/lib/AppTest.php +++ b/tests/lib/AppTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Archive/TARTest.php b/tests/lib/Archive/TARTest.php index 36629a0273f..7f8ea1bb00e 100644 --- a/tests/lib/Archive/TARTest.php +++ b/tests/lib/Archive/TARTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Archive/TestBase.php b/tests/lib/Archive/TestBase.php index 6475b49e549..c63bc689e0d 100644 --- a/tests/lib/Archive/TestBase.php +++ b/tests/lib/Archive/TestBase.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -80,7 +81,7 @@ abstract class TestBase extends \Test\TestCase { $dir = \OC::$SERVERROOT.'/tests/data'; $this->instance = $this->getExisting(); $fh = $this->instance->getStream('lorem.txt', 'r'); - $this->assertTrue((bool)$fh); + $this->assertTrue((bool) $fh); $content = fread($fh, $this->instance->filesize('lorem.txt')); fclose($fh); $this->assertEquals(file_get_contents($dir.'/lorem.txt'), $content); diff --git a/tests/lib/Archive/ZIPTest.php b/tests/lib/Archive/ZIPTest.php index 62467ca230e..f5cf08bc35d 100644 --- a/tests/lib/Archive/ZIPTest.php +++ b/tests/lib/Archive/ZIPTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Authentication/Login/ALoginCommandTest.php b/tests/lib/Authentication/Login/ALoginCommandTest.php index 2ab59835bfe..66922b4c36b 100644 --- a/tests/lib/Authentication/Login/ALoginCommandTest.php +++ b/tests/lib/Authentication/Login/ALoginCommandTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php index 4b87f7101b5..6d1cc4a7962 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php @@ -242,7 +242,7 @@ class PublicKeyTokenMapperTest extends TestCase { $result = $qb->execute(); $id = $result->fetch()['id']; - $token = $this->mapper->getTokenById((int)$id); + $token = $this->mapper->getTokenById((int) $id); $this->assertEquals('user1', $token->getUID()); } diff --git a/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php b/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php index bf09b3d8ca3..c7dcb42cf37 100644 --- a/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/AutoLoaderTest.php b/tests/lib/AutoLoaderTest.php index 22d66c6c4aa..4e9c143d49e 100644 --- a/tests/lib/AutoLoaderTest.php +++ b/tests/lib/AutoLoaderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Avatar/AvatarManagerTest.php b/tests/lib/Avatar/AvatarManagerTest.php index 16754f7125c..2036b6bb094 100644 --- a/tests/lib/Avatar/AvatarManagerTest.php +++ b/tests/lib/Avatar/AvatarManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -124,9 +125,9 @@ class AvatarManagerTest extends \Test\TestCase { ->willReturn(IAccountManager::SCOPE_PRIVATE); $this->knownUserService->expects($this->any()) - ->method('isKnownToUser') - ->with('valid-user', 'valid-user') - ->willReturn(true); + ->method('isKnownToUser') + ->with('valid-user', 'valid-user') + ->willReturn(true); $folder = $this->createMock(ISimpleFolder::class); $this->appData @@ -261,12 +262,12 @@ class AvatarManagerTest extends \Test\TestCase { if (!$isPublicCall) { $this->knownUserService->expects($this->any()) - ->method('isKnownToUser') - ->with('requesting-user', 'valid-user') - ->willReturn($isKnownUser); + ->method('isKnownToUser') + ->with('requesting-user', 'valid-user') + ->willReturn($isKnownUser); } else { $this->knownUserService->expects($this->never()) - ->method('isKnownToUser'); + ->method('isKnownToUser'); } if ($expectedPlaceholder) { diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php index 2687972b8f6..92e4767a500 100644 --- a/tests/lib/Avatar/UserAvatarTest.php +++ b/tests/lib/Avatar/UserAvatarTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/BackgroundJob/DummyJobList.php b/tests/lib/BackgroundJob/DummyJobList.php index 7b7fce7e9e8..f2d3e719fe8 100644 --- a/tests/lib/BackgroundJob/DummyJobList.php +++ b/tests/lib/BackgroundJob/DummyJobList.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/BackgroundJob/JobListTest.php b/tests/lib/BackgroundJob/JobListTest.php index 510d307eda8..b7f799aaf80 100644 --- a/tests/lib/BackgroundJob/JobListTest.php +++ b/tests/lib/BackgroundJob/JobListTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/BackgroundJob/JobTest.php b/tests/lib/BackgroundJob/JobTest.php index fa89a06c8f5..b021982365f 100644 --- a/tests/lib/BackgroundJob/JobTest.php +++ b/tests/lib/BackgroundJob/JobTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/BackgroundJob/QueuedJobTest.php b/tests/lib/BackgroundJob/QueuedJobTest.php index ab4bacb201e..0a6a90feb93 100644 --- a/tests/lib/BackgroundJob/QueuedJobTest.php +++ b/tests/lib/BackgroundJob/QueuedJobTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/BackgroundJob/TestJob.php b/tests/lib/BackgroundJob/TestJob.php index ea0634e63d9..62158109d28 100644 --- a/tests/lib/BackgroundJob/TestJob.php +++ b/tests/lib/BackgroundJob/TestJob.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/BackgroundJob/TestParallelAwareJob.php b/tests/lib/BackgroundJob/TestParallelAwareJob.php index f7a6cf5fa79..269694f0e6f 100644 --- a/tests/lib/BackgroundJob/TestParallelAwareJob.php +++ b/tests/lib/BackgroundJob/TestParallelAwareJob.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/BackgroundJob/TimedJobTest.php b/tests/lib/BackgroundJob/TimedJobTest.php index 0ae245d1ff8..931b1fb98e6 100644 --- a/tests/lib/BackgroundJob/TimedJobTest.php +++ b/tests/lib/BackgroundJob/TimedJobTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Cache/CappedMemoryCacheTest.php b/tests/lib/Cache/CappedMemoryCacheTest.php index 6d1c7e6e372..bb6fe924b46 100644 --- a/tests/lib/Cache/CappedMemoryCacheTest.php +++ b/tests/lib/Cache/CappedMemoryCacheTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php index ef738eaaacf..62d316e0978 100644 --- a/tests/lib/Cache/FileCacheTest.php +++ b/tests/lib/Cache/FileCacheTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Cache/TestCache.php b/tests/lib/Cache/TestCache.php index 1ed52ad5170..a247e91fa30 100644 --- a/tests/lib/Cache/TestCache.php +++ b/tests/lib/Cache/TestCache.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php index db98dfa1aed..3cdb5e07771 100644 --- a/tests/lib/Calendar/ManagerTest.php +++ b/tests/lib/Calendar/ManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -38,7 +39,7 @@ class ManagerTest extends TestCase { /** @var Manager */ private $manager; - /** @var ITimeFactory|ITimeFactory&MockObject|MockObject */ + /** @var ITimeFactory|ITimeFactory&MockObject|MockObject */ private $time; protected function setUp(): void { diff --git a/tests/lib/CapabilitiesManagerTest.php b/tests/lib/CapabilitiesManagerTest.php index 14b83e3dda3..a2b52b14244 100644 --- a/tests/lib/CapabilitiesManagerTest.php +++ b/tests/lib/CapabilitiesManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php index fa491661f5f..0d3a929aee4 100644 --- a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -18,19 +19,19 @@ use OCP\Share\IShare; use Test\TestCase; class GroupPluginTest extends TestCase { - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ protected $config; - /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */ protected $groupManager; - /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */ protected $session; - /** @var ISearchResult */ + /** @var ISearchResult */ protected $searchResult; - /** @var GroupPlugin */ + /** @var GroupPlugin */ protected $plugin; /** @var int */ @@ -39,7 +40,7 @@ class GroupPluginTest extends TestCase { /** @var int */ protected $offset = 0; - /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */ protected $user; protected function setUp(): void { diff --git a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php index 059e3c67117..e4798923d39 100644 --- a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -24,15 +25,15 @@ use Psr\Log\LoggerInterface; use Test\TestCase; class LookupPluginTest extends TestCase { - /** @var IConfig|MockObject */ + /** @var IConfig|MockObject */ protected $config; - /** @var IClientService|MockObject */ + /** @var IClientService|MockObject */ protected $clientService; /** @var IUserSession|MockObject */ protected $userSession; /** @var ICloudIdManager|MockObject */ protected $cloudIdManager; - /** @var LookupPlugin */ + /** @var LookupPlugin */ protected $plugin; /** @var LoggerInterface|MockObject */ protected $logger; diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php index e2d1928caac..f4a011fce93 100644 --- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -26,28 +27,28 @@ use OCP\Share\IShare; use Test\TestCase; class MailPluginTest extends TestCase { - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ protected $config; - /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ protected $contactsManager; - /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */ protected $cloudIdManager; - /** @var MailPlugin */ + /** @var MailPlugin */ protected $plugin; - /** @var SearchResult */ + /** @var SearchResult */ protected $searchResult; - /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */ protected $groupManager; - /** @var KnownUserService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var KnownUserService|\PHPUnit\Framework\MockObject\MockObject */ protected $knownUserService; - /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */ protected $userSession; /** @var IMailer|\PHPUnit\Framework\MockObject\MockObject */ @@ -654,8 +655,8 @@ class MailPluginTest extends TestCase { false, false, [ - "currentUser" => ["group1"], - "User" => ["group1"] + 'currentUser' => ['group1'], + 'User' => ['group1'] ], false, ], @@ -675,8 +676,8 @@ class MailPluginTest extends TestCase { false, false, [ - "currentUser" => ["group1"], - "User" => ["group2"] + 'currentUser' => ['group1'], + 'User' => ['group2'] ], false, ], @@ -696,8 +697,8 @@ class MailPluginTest extends TestCase { false, false, [ - "currentUser" => ["group1"], - "User" => ["group2"] + 'currentUser' => ['group1'], + 'User' => ['group2'] ], true, ] diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php index 73116ecad68..493ad62b3d4 100644 --- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php +++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -26,19 +27,19 @@ class RemotePluginTest extends TestCase { /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */ protected $userManager; - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ protected $config; - /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ protected $contactsManager; - /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */ protected $cloudIdManager; - /** @var RemotePlugin */ + /** @var RemotePlugin */ protected $plugin; - /** @var SearchResult */ + /** @var SearchResult */ protected $searchResult; protected function setUp(): void { diff --git a/tests/lib/Collaboration/Collaborators/SearchResultTest.php b/tests/lib/Collaboration/Collaborators/SearchResultTest.php index da879a7b7a4..f5de682e14f 100644 --- a/tests/lib/Collaboration/Collaborators/SearchResultTest.php +++ b/tests/lib/Collaboration/Collaborators/SearchResultTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -14,9 +15,9 @@ use OCP\IContainer; use Test\TestCase; class SearchResultTest extends TestCase { - /** @var IContainer|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IContainer|\PHPUnit\Framework\MockObject\MockObject */ protected $container; - /** @var ISearch */ + /** @var ISearch */ protected $search; protected function setUp(): void { diff --git a/tests/lib/Collaboration/Collaborators/SearchTest.php b/tests/lib/Collaboration/Collaborators/SearchTest.php index 91b01aac7ce..08a0eb6ee47 100644 --- a/tests/lib/Collaboration/Collaborators/SearchTest.php +++ b/tests/lib/Collaboration/Collaborators/SearchTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -16,9 +17,9 @@ use OCP\Share\IShare; use Test\TestCase; class SearchTest extends TestCase { - /** @var IContainer|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IContainer|\PHPUnit\Framework\MockObject\MockObject */ protected $container; - /** @var ISearch */ + /** @var ISearch */ protected $search; protected function setUp(): void { diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php index eac7eb1124b..b4d9b74ab34 100644 --- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -22,35 +23,35 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class UserPluginTest extends TestCase { - /** @var IConfig|MockObject */ + /** @var IConfig|MockObject */ protected $config; - /** @var IUserManager|MockObject */ + /** @var IUserManager|MockObject */ protected $userManager; - /** @var IGroupManager|MockObject */ + /** @var IGroupManager|MockObject */ protected $groupManager; - /** @var IUserSession|MockObject */ + /** @var IUserSession|MockObject */ protected $session; - /** @var KnownUserService|MockObject */ + /** @var KnownUserService|MockObject */ protected $knownUserService; /** @var IUserStatusManager|MockObject */ protected $userStatusManager; - /** @var UserPlugin */ + /** @var UserPlugin */ protected $plugin; - /** @var ISearchResult */ + /** @var ISearchResult */ protected $searchResult; protected int $limit = 2; protected int $offset = 0; - /** @var IUser|MockObject */ + /** @var IUser|MockObject */ protected $user; protected function setUp(): void { @@ -443,7 +444,7 @@ class UserPluginTest extends TestCase { array $users = [], $shareeEnumerationPhone = false ) { - $this->mockConfig(["core" => [ + $this->mockConfig(['core' => [ 'shareapi_only_share_with_group_members' => $shareWithGroupOnly ? 'yes' : 'no', 'shareapi_allow_share_dialog_user_enumeration' => $shareeEnumeration? 'yes' : 'no', 'shareapi_restrict_user_enumeration_to_group' => false ? 'yes' : 'no', @@ -762,16 +763,16 @@ class UserPluginTest extends TestCase { return null; }); $this->userManager - ->method('searchDisplayName') - ->willReturnCallback(function ($search) use ($matchingUsers) { - $users = array_filter( - $matchingUsers, - fn ($user) => str_contains(strtolower($user['displayName']), strtolower($search)) - ); - return array_map( - fn ($user) => $this->getUserMock($user['uid'], $user['displayName']), - $users); - }); + ->method('searchDisplayName') + ->willReturnCallback(function ($search) use ($matchingUsers) { + $users = array_filter( + $matchingUsers, + fn ($user) => str_contains(strtolower($user['displayName']), strtolower($search)) + ); + return array_map( + fn ($user) => $this->getUserMock($user['uid'], $user['displayName']), + $users); + }); $this->groupManager->method('displayNamesInGroup') ->willReturn($userResults); diff --git a/tests/lib/Command/CronBusTest.php b/tests/lib/Command/CronBusTest.php index 96190f717c6..a86328eff8d 100644 --- a/tests/lib/Command/CronBusTest.php +++ b/tests/lib/Command/CronBusTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Command/Integrity/SignAppTest.php b/tests/lib/Command/Integrity/SignAppTest.php index 41333863ad4..57c72f8f611 100644 --- a/tests/lib/Command/Integrity/SignAppTest.php +++ b/tests/lib/Command/Integrity/SignAppTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Command/Integrity/SignCoreTest.php b/tests/lib/Command/Integrity/SignCoreTest.php index 51bec55b774..72c97d5976d 100644 --- a/tests/lib/Command/Integrity/SignCoreTest.php +++ b/tests/lib/Command/Integrity/SignCoreTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Comments/CommentTest.php b/tests/lib/Comments/CommentTest.php index 2313c192297..493316d873d 100644 --- a/tests/lib/Comments/CommentTest.php +++ b/tests/lib/Comments/CommentTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Comments/FakeFactory.php b/tests/lib/Comments/FakeFactory.php index 04604ab2b44..8a482a930a9 100644 --- a/tests/lib/Comments/FakeFactory.php +++ b/tests/lib/Comments/FakeFactory.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Comments/FakeManager.php b/tests/lib/Comments/FakeManager.php index b22264cb216..659abdb45ad 100644 --- a/tests/lib/Comments/FakeManager.php +++ b/tests/lib/Comments/FakeManager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php index 359be2696c6..760f504fc60 100644 --- a/tests/lib/Comments/ManagerTest.php +++ b/tests/lib/Comments/ManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/ConfigTest.php b/tests/lib/ConfigTest.php index e5d0c94003b..c731cf3508c 100644 --- a/tests/lib/ConfigTest.php +++ b/tests/lib/ConfigTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/ContactsManagerTest.php b/tests/lib/ContactsManagerTest.php index 283b995d14d..6b48d77266d 100644 --- a/tests/lib/ContactsManagerTest.php +++ b/tests/lib/ContactsManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/DB/AdapterTest.php b/tests/lib/DB/AdapterTest.php index 99b7cf4e099..6a280103672 100644 --- a/tests/lib/DB/AdapterTest.php +++ b/tests/lib/DB/AdapterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/DB/ConnectionFactoryTest.php b/tests/lib/DB/ConnectionFactoryTest.php index d889021f2b4..989587cc7ae 100644 --- a/tests/lib/DB/ConnectionFactoryTest.php +++ b/tests/lib/DB/ConnectionFactoryTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php index d12b70725ed..929dc9aaf1b 100644 --- a/tests/lib/DB/MigratorTest.php +++ b/tests/lib/DB/MigratorTest.php @@ -248,7 +248,7 @@ class MigratorTest extends \Test\TestCase { $table->addColumn('name', 'string'); $table->setPrimaryKey(['id']); - $fkName = "fkc"; + $fkName = 'fkc'; $tableFk = $startSchema->createTable($this->tableNameTmp); $tableFk->addColumn('fk_id', 'integer'); $tableFk->addColumn('name', 'string'); diff --git a/tests/lib/DB/OCPostgreSqlPlatformTest.php b/tests/lib/DB/OCPostgreSqlPlatformTest.php index 3ed420df501..c728b9b8a2a 100644 --- a/tests/lib/DB/OCPostgreSqlPlatformTest.php +++ b/tests/lib/DB/OCPostgreSqlPlatformTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2017 ownCloud, Inc. @@ -48,7 +49,7 @@ class OCPostgreSqlPlatformTest extends \Test\TestCase { } protected function createTableAndColumn($schema, $type) { - $table = $schema->createTable("poor_yorick"); + $table = $schema->createTable('poor_yorick'); $table->addColumn('id', $type, [ 'autoincrement' => true, 'unsigned' => true, diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php index 671bcfc209e..f2c7cb9db46 100644 --- a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php +++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php index 5c9482419d9..e7ed7e15a11 100644 --- a/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php index d991c78f113..16010c2b580 100644 --- a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only @@ -81,7 +82,7 @@ class FunctionBuilderTest extends TestCase { }], '5 columns: string param with special chars used in the function' => [function ($q) { - return [false, [$q->createNamedParameter("b"), $q->createNamedParameter("'"), $q->createNamedParameter('||'), $q->createNamedParameter(','), $q->createNamedParameter('a')], "b'||,a"]; + return [false, [$q->createNamedParameter('b'), $q->createNamedParameter("'"), $q->createNamedParameter('||'), $q->createNamedParameter(','), $q->createNamedParameter('a')], "b'||,a"]; }], ]; } @@ -380,7 +381,7 @@ class FunctionBuilderTest extends TestCase { ->values([ 'appid' => $query->createNamedParameter('minmax'), 'configkey' => $query->createNamedParameter(uniqid()), - 'configvalue' => $query->createNamedParameter((string)$value), + 'configvalue' => $query->createNamedParameter((string) $value), ]); $query->execute(); } diff --git a/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php b/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php index 697b3ab92c9..f99adc73aa8 100644 --- a/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php index 335666b54fd..79c002c28fd 100644 --- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/DB/QueryBuilder/QuoteHelperTest.php b/tests/lib/DB/QueryBuilder/QuoteHelperTest.php index 12984bac3e0..cd78d2594b7 100644 --- a/tests/lib/DB/QueryBuilder/QuoteHelperTest.php +++ b/tests/lib/DB/QueryBuilder/QuoteHelperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/DateTimeFormatterTest.php b/tests/lib/DateTimeFormatterTest.php index fa8124ed35a..c75df402633 100644 --- a/tests/lib/DateTimeFormatterTest.php +++ b/tests/lib/DateTimeFormatterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Diagnostics/EventLoggerTest.php b/tests/lib/Diagnostics/EventLoggerTest.php index e69a27d70b3..5835b67b281 100644 --- a/tests/lib/Diagnostics/EventLoggerTest.php +++ b/tests/lib/Diagnostics/EventLoggerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2017 ownCloud, Inc. @@ -29,9 +30,9 @@ class EventLoggerTest extends TestCase { public function testQueryLogger() { // Module is not activated and this should not be logged - $this->logger->start("test1", "testevent1"); - $this->logger->end("test1"); - $this->logger->log("test2", "testevent2", microtime(true), microtime(true)); + $this->logger->start('test1', 'testevent1'); + $this->logger->end('test1'); + $this->logger->log('test2', 'testevent2', microtime(true), microtime(true)); $events = $this->logger->getEvents(); $this->assertSame(0, sizeof($events)); @@ -39,19 +40,19 @@ class EventLoggerTest extends TestCase { $this->logger->activate(); // start one event - $this->logger->start("test3", "testevent3"); + $this->logger->start('test3', 'testevent3'); // force log of another event - $this->logger->log("test4", "testevent4", microtime(true), microtime(true)); + $this->logger->log('test4', 'testevent4', microtime(true), microtime(true)); // log started event - $this->logger->end("test3"); + $this->logger->end('test3'); $events = $this->logger->getEvents(); - $this->assertSame("test4", $events['test4']->getId()); - $this->assertSame("testevent4", $events['test4']->getDescription()); - $this->assertSame("test3", $events['test3']->getId()); - $this->assertSame("testevent3", $events['test3']->getDescription()); + $this->assertSame('test4', $events['test4']->getId()); + $this->assertSame('testevent4', $events['test4']->getDescription()); + $this->assertSame('test3', $events['test3']->getId()); + $this->assertSame('testevent3', $events['test3']->getDescription()); $this->assertSame(2, sizeof($events)); } } diff --git a/tests/lib/Diagnostics/QueryLoggerTest.php b/tests/lib/Diagnostics/QueryLoggerTest.php index 4cc45cf47d4..52c7c6aeb68 100644 --- a/tests/lib/Diagnostics/QueryLoggerTest.php +++ b/tests/lib/Diagnostics/QueryLoggerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2017 ownCloud, Inc. @@ -22,14 +23,14 @@ class QueryLoggerTest extends TestCase { public function testQueryLogger() { // Module is not activated and this should not be logged - $this->logger->startQuery("SELECT", ["testuser", "count"], ["string", "int"]); + $this->logger->startQuery('SELECT', ['testuser', 'count'], ['string', 'int']); $this->logger->stopQuery(); $queries = $this->logger->getQueries(); $this->assertSame(0, sizeof($queries)); // Activate module and log some query $this->logger->activate(); - $this->logger->startQuery("SELECT", ["testuser", "count"], ["string", "int"]); + $this->logger->startQuery('SELECT', ['testuser', 'count'], ['string', 'int']); $this->logger->stopQuery(); $queries = $this->logger->getQueries(); diff --git a/tests/lib/DirectEditing/ManagerTest.php b/tests/lib/DirectEditing/ManagerTest.php index 3dc2e464c37..a6ce0ec765c 100644 --- a/tests/lib/DirectEditing/ManagerTest.php +++ b/tests/lib/DirectEditing/ManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/EmojiHelperTest.php b/tests/lib/EmojiHelperTest.php index 677cb03aae4..9ad56b32472 100644 --- a/tests/lib/EmojiHelperTest.php +++ b/tests/lib/EmojiHelperTest.php @@ -69,3080 +69,3080 @@ class EmojiHelperTest extends TestCase { ['$$', false], // Extracted from spreed/node_modules/emojis-list/index.js // https://github.com/Kikobeats/emojis-list/blob/master/index.js - ["🀄️", true], - ["🃏", true], - ["🅰️", true], - ["🅱️", true], - ["🅾️", true], - ["🅿️", true], - ["🆎", true], - ["🆑", true], - ["🆒", true], - ["🆓", true], - ["🆔", true], - ["🆕", true], - ["🆖", true], - ["🆗", true], - ["🆘", true], - ["🆙", true], - ["🆚", true], - ["🇦🇨", true], - ["🇦🇩", true], - ["🇦🇪", true], - ["🇦🇫", true], - ["🇦🇬", true], - ["🇦🇮", true], - ["🇦🇱", true], - ["🇦🇲", true], - ["🇦🇴", true], - ["🇦🇶", true], - ["🇦🇷", true], - ["🇦🇸", true], - ["🇦🇹", true], - ["🇦🇺", true], - ["🇦🇼", true], - ["🇦🇽", true], - ["🇦🇿", true], - ["🇦", true], - ["🇧🇦", true], - ["🇧🇧", true], - ["🇧🇩", true], - ["🇧🇪", true], - ["🇧🇫", true], - ["🇧🇬", true], - ["🇧🇭", true], - ["🇧🇮", true], - ["🇧🇯", true], - ["🇧🇱", true], - ["🇧🇲", true], - ["🇧🇳", true], - ["🇧🇴", true], - ["🇧🇶", true], - ["🇧🇷", true], - ["🇧🇸", true], - ["🇧🇹", true], - ["🇧🇻", true], - ["🇧🇼", true], - ["🇧🇾", true], - ["🇧🇿", true], - ["🇧", true], - ["🇨🇦", true], - ["🇨🇨", true], - ["🇨🇩", true], - ["🇨🇫", true], - ["🇨🇬", true], - ["🇨🇭", true], - ["🇨🇮", true], - ["🇨🇰", true], - ["🇨🇱", true], - ["🇨🇲", true], - ["🇨🇳", true], - ["🇨🇴", true], - ["🇨🇵", true], - ["🇨🇷", true], - ["🇨🇺", true], - ["🇨🇻", true], - ["🇨🇼", true], - ["🇨🇽", true], - ["🇨🇾", true], - ["🇨🇿", true], - ["🇨", true], - ["🇩🇪", true], - ["🇩🇬", true], - ["🇩🇯", true], - ["🇩🇰", true], - ["🇩🇲", true], - ["🇩🇴", true], - ["🇩🇿", true], - ["🇩", true], - ["🇪🇦", true], - ["🇪🇨", true], - ["🇪🇪", true], - ["🇪🇬", true], - ["🇪🇭", true], - ["🇪🇷", true], - ["🇪🇸", true], - ["🇪🇹", true], - ["🇪🇺", true], - ["🇪", true], - ["🇫🇮", true], - ["🇫🇯", true], - ["🇫🇰", true], - ["🇫🇲", true], - ["🇫🇴", true], - ["🇫🇷", true], - ["🇫", true], - ["🇬🇦", true], - ["🇬🇧", true], - ["🇬🇩", true], - ["🇬🇪", true], - ["🇬🇫", true], - ["🇬🇬", true], - ["🇬🇭", true], - ["🇬🇮", true], - ["🇬🇱", true], - ["🇬🇲", true], - ["🇬🇳", true], - ["🇬🇵", true], - ["🇬🇶", true], - ["🇬🇷", true], - ["🇬🇸", true], - ["🇬🇹", true], - ["🇬🇺", true], - ["🇬🇼", true], - ["🇬🇾", true], - ["🇬", true], - ["🇭🇰", true], - ["🇭🇲", true], - ["🇭🇳", true], - ["🇭🇷", true], - ["🇭🇹", true], - ["🇭🇺", true], - ["🇭", true], - ["🇮🇨", true], - ["🇮🇩", true], - ["🇮🇪", true], - ["🇮🇱", true], - ["🇮🇲", true], - ["🇮🇳", true], - ["🇮🇴", true], - ["🇮🇶", true], - ["🇮🇷", true], - ["🇮🇸", true], - ["🇮🇹", true], - ["🇮", true], - ["🇯🇪", true], - ["🇯🇲", true], - ["🇯🇴", true], - ["🇯🇵", true], - ["🇯", true], - ["🇰🇪", true], - ["🇰🇬", true], - ["🇰🇭", true], - ["🇰🇮", true], - ["🇰🇲", true], - ["🇰🇳", true], - ["🇰🇵", true], - ["🇰🇷", true], - ["🇰🇼", true], - ["🇰🇾", true], - ["🇰🇿", true], - ["🇰", true], - ["🇱🇦", true], - ["🇱🇧", true], - ["🇱🇨", true], - ["🇱🇮", true], - ["🇱🇰", true], - ["🇱🇷", true], - ["🇱🇸", true], - ["🇱🇹", true], - ["🇱🇺", true], - ["🇱🇻", true], - ["🇱🇾", true], - ["🇱", true], - ["🇲🇦", true], - ["🇲🇨", true], - ["🇲🇩", true], - ["🇲🇪", true], - ["🇲🇫", true], - ["🇲🇬", true], - ["🇲🇭", true], - ["🇲🇰", true], - ["🇲🇱", true], - ["🇲🇲", true], - ["🇲🇳", true], - ["🇲🇴", true], - ["🇲🇵", true], - ["🇲🇶", true], - ["🇲🇷", true], - ["🇲🇸", true], - ["🇲🇹", true], - ["🇲🇺", true], - ["🇲🇻", true], - ["🇲🇼", true], - ["🇲🇽", true], - ["🇲🇾", true], - ["🇲🇿", true], - ["🇲", true], - ["🇳🇦", true], - ["🇳🇨", true], - ["🇳🇪", true], - ["🇳🇫", true], - ["🇳🇬", true], - ["🇳🇮", true], - ["🇳🇱", true], - ["🇳🇴", true], - ["🇳🇵", true], - ["🇳🇷", true], - ["🇳🇺", true], - ["🇳🇿", true], - ["🇳", true], - ["🇴🇲", true], - ["🇴", true], - ["🇵🇦", true], - ["🇵🇪", true], - ["🇵🇫", true], - ["🇵🇬", true], - ["🇵🇭", true], - ["🇵🇰", true], - ["🇵🇱", true], - ["🇵🇲", true], - ["🇵🇳", true], - ["🇵🇷", true], - ["🇵🇸", true], - ["🇵🇹", true], - ["🇵🇼", true], - ["🇵🇾", true], - ["🇵", true], - ["🇶🇦", true], - ["🇶", true], - ["🇷🇪", true], - ["🇷🇴", true], - ["🇷🇸", true], - ["🇷🇺", true], - ["🇷🇼", true], - ["🇷", true], - ["🇸🇦", true], - ["🇸🇧", true], - ["🇸🇨", true], - ["🇸🇩", true], - ["🇸🇪", true], - ["🇸🇬", true], - ["🇸🇭", true], - ["🇸🇮", true], - ["🇸🇯", true], - ["🇸🇰", true], - ["🇸🇱", true], - ["🇸🇲", true], - ["🇸🇳", true], - ["🇸🇴", true], - ["🇸🇷", true], - ["🇸🇸", true], - ["🇸🇹", true], - ["🇸🇻", true], - ["🇸🇽", true], - ["🇸🇾", true], - ["🇸🇿", true], - ["🇸", true], - ["🇹🇦", true], - ["🇹🇨", true], - ["🇹🇩", true], - ["🇹🇫", true], - ["🇹🇬", true], - ["🇹🇭", true], - ["🇹🇯", true], - ["🇹🇰", true], - ["🇹🇱", true], - ["🇹🇲", true], - ["🇹🇳", true], - ["🇹🇴", true], - ["🇹🇷", true], - ["🇹🇹", true], - ["🇹🇻", true], - ["🇹🇼", true], - ["🇹🇿", true], - ["🇹", true], - ["🇺🇦", true], - ["🇺🇬", true], - ["🇺🇲", true], - ["🇺🇳", true], - ["🇺🇸", true], - ["🇺🇾", true], - ["🇺🇿", true], - ["🇺", true], - ["🇻🇦", true], - ["🇻🇨", true], - ["🇻🇪", true], - ["🇻🇬", true], - ["🇻🇮", true], - ["🇻🇳", true], - ["🇻🇺", true], - ["🇻", true], - ["🇼🇫", true], - ["🇼🇸", true], - ["🇼", true], - ["🇽🇰", true], - ["🇽", true], - ["🇾🇪", true], - ["🇾🇹", true], - ["🇾", true], - ["🇿🇦", true], - ["🇿🇲", true], - ["🇿🇼", true], - ["🇿", true], - ["🈁", true], - ["🈂️", true], - ["🈚️", true], - ["🈯️", true], - ["🈲", true], - ["🈳", true], - ["🈴", true], - ["🈵", true], - ["🈶", true], - ["🈷️", true], - ["🈸", true], - ["🈹", true], - ["🈺", true], - ["🉐", true], - ["🉑", true], - ["🌀", true], - ["🌁", true], - ["🌂", true], - ["🌃", true], - ["🌄", true], - ["🌅", true], - ["🌆", true], - ["🌇", true], - ["🌈", true], - ["🌉", true], - ["🌊", true], - ["🌋", true], - ["🌌", true], - ["🌍", true], - ["🌎", true], - ["🌏", true], - ["🌐", true], - ["🌑", true], - ["🌒", true], - ["🌓", true], - ["🌔", true], - ["🌕", true], - ["🌖", true], - ["🌗", true], - ["🌘", true], - ["🌙", true], - ["🌚", true], - ["🌛", true], - ["🌜", true], - ["🌝", true], - ["🌞", true], - ["🌟", true], - ["🌠", true], - ["🌡️", true], - ["🌤️", true], - ["🌥️", true], - ["🌦️", true], - ["🌧️", true], - ["🌨️", true], - ["🌩️", true], - ["🌪️", true], - ["🌫️", true], - ["🌬️", true], - ["🌭", true], - ["🌮", true], - ["🌯", true], - ["🌰", true], - ["🌱", true], - ["🌲", true], - ["🌳", true], - ["🌴", true], - ["🌵", true], - ["🌶️", true], - ["🌷", true], - ["🌸", true], - ["🌹", true], - ["🌺", true], - ["🌻", true], - ["🌼", true], - ["🌽", true], - ["🌾", true], - ["🌿", true], - ["🍀", true], - ["🍁", true], - ["🍂", true], - ["🍃", true], - ["🍄", true], - ["🍅", true], - ["🍆", true], - ["🍇", true], - ["🍈", true], - ["🍉", true], - ["🍊", true], - ["🍋", true], - ["🍌", true], - ["🍍", true], - ["🍎", true], - ["🍏", true], - ["🍐", true], - ["🍑", true], - ["🍒", true], - ["🍓", true], - ["🍔", true], - ["🍕", true], - ["🍖", true], - ["🍗", true], - ["🍘", true], - ["🍙", true], - ["🍚", true], - ["🍛", true], - ["🍜", true], - ["🍝", true], - ["🍞", true], - ["🍟", true], - ["🍠", true], - ["🍡", true], - ["🍢", true], - ["🍣", true], - ["🍤", true], - ["🍥", true], - ["🍦", true], - ["🍧", true], - ["🍨", true], - ["🍩", true], - ["🍪", true], - ["🍫", true], - ["🍬", true], - ["🍭", true], - ["🍮", true], - ["🍯", true], - ["🍰", true], - ["🍱", true], - ["🍲", true], - ["🍳", true], - ["🍴", true], - ["🍵", true], - ["🍶", true], - ["🍷", true], - ["🍸", true], - ["🍹", true], - ["🍺", true], - ["🍻", true], - ["🍼", true], - ["🍽️", true], - ["🍾", true], - ["🍿", true], - ["🎀", true], - ["🎁", true], - ["🎂", true], - ["🎃", true], - ["🎄", true], - ["🎅🏻", true], - ["🎅🏼", true], - ["🎅🏽", true], - ["🎅🏾", true], - ["🎅🏿", true], - ["🎅", true], - ["🎆", true], - ["🎇", true], - ["🎈", true], - ["🎉", true], - ["🎊", true], - ["🎋", true], - ["🎌", true], - ["🎍", true], - ["🎎", true], - ["🎏", true], - ["🎐", true], - ["🎑", true], - ["🎒", true], - ["🎓", true], - ["🎖️", true], - ["🎗️", true], - ["🎙️", true], - ["🎚️", true], - ["🎛️", true], - ["🎞️", true], - ["🎟️", true], - ["🎠", true], - ["🎡", true], - ["🎢", true], - ["🎣", true], - ["🎤", true], - ["🎥", true], - ["🎦", true], - ["🎧", true], - ["🎨", true], - ["🎩", true], - ["🎪", true], - ["🎫", true], - ["🎬", true], - ["🎭", true], - ["🎮", true], - ["🎯", true], - ["🎰", true], - ["🎱", true], - ["🎲", true], - ["🎳", true], - ["🎴", true], - ["🎵", true], - ["🎶", true], - ["🎷", true], - ["🎸", true], - ["🎹", true], - ["🎺", true], - ["🎻", true], - ["🎼", true], - ["🎽", true], - ["🎾", true], - ["🎿", true], - ["🏀", true], - ["🏁", true], - ["🏂🏻", true], - ["🏂🏼", true], - ["🏂🏽", true], - ["🏂🏾", true], - ["🏂🏿", true], - ["🏂", true], - ["🏃🏻♀️", true], - ["🏃🏻♂️", true], - ["🏃🏻", true], - ["🏃🏼♀️", true], - ["🏃🏼♂️", true], - ["🏃🏼", true], - ["🏃🏽♀️", true], - ["🏃🏽♂️", true], - ["🏃🏽", true], - ["🏃🏾♀️", true], - ["🏃🏾♂️", true], - ["🏃🏾", true], - ["🏃🏿♀️", true], - ["🏃🏿♂️", true], - ["🏃🏿", true], - ["🏃♀️", true], - ["🏃♂️", true], - ["🏃", true], - ["🏄🏻♀️", true], - ["🏄🏻♂️", true], - ["🏄🏻", true], - ["🏄🏼♀️", true], - ["🏄🏼♂️", true], - ["🏄🏼", true], - ["🏄🏽♀️", true], - ["🏄🏽♂️", true], - ["🏄🏽", true], - ["🏄🏾♀️", true], - ["🏄🏾♂️", true], - ["🏄🏾", true], - ["🏄🏿♀️", true], - ["🏄🏿♂️", true], - ["🏄🏿", true], - ["🏄♀️", true], - ["🏄♂️", true], - ["🏄", true], - ["🏅", true], - ["🏆", true], - ["🏇🏻", true], - ["🏇🏼", true], - ["🏇🏽", true], - ["🏇🏾", true], - ["🏇🏿", true], - ["🏇", true], - ["🏈", true], - ["🏉", true], - ["🏊🏻♀️", true], - ["🏊🏻♂️", true], - ["🏊🏻", true], - ["🏊🏼♀️", true], - ["🏊🏼♂️", true], - ["🏊🏼", true], - ["🏊🏽♀️", true], - ["🏊🏽♂️", true], - ["🏊🏽", true], - ["🏊🏾♀️", true], - ["🏊🏾♂️", true], - ["🏊🏾", true], - ["🏊🏿♀️", true], - ["🏊🏿♂️", true], - ["🏊🏿", true], - ["🏊♀️", true], - ["🏊♂️", true], - ["🏊", true], - ["🏋🏻♀️", true], - ["🏋🏻♂️", true], - ["🏋🏻", true], - ["🏋🏼♀️", true], - ["🏋🏼♂️", true], - ["🏋🏼", true], - ["🏋🏽♀️", true], - ["🏋🏽♂️", true], - ["🏋🏽", true], - ["🏋🏾♀️", true], - ["🏋🏾♂️", true], - ["🏋🏾", true], - ["🏋🏿♀️", true], - ["🏋🏿♂️", true], - ["🏋🏿", true], - ["🏋️♀️", true], - ["🏋️♂️", true], - ["🏋️", true], - ["🏌🏻♀️", true], - ["🏌🏻♂️", true], - ["🏌🏻", true], - ["🏌🏼♀️", true], - ["🏌🏼♂️", true], - ["🏌🏼", true], - ["🏌🏽♀️", true], - ["🏌🏽♂️", true], - ["🏌🏽", true], - ["🏌🏾♀️", true], - ["🏌🏾♂️", true], - ["🏌🏾", true], - ["🏌🏿♀️", true], - ["🏌🏿♂️", true], - ["🏌🏿", true], - ["🏌️♀️", true], - ["🏌️♂️", true], - ["🏌️", true], - ["🏍️", true], - ["🏎️", true], - ["🏏", true], - ["🏐", true], - ["🏑", true], - ["🏒", true], - ["🏓", true], - ["🏔️", true], - ["🏕️", true], - ["🏖️", true], - ["🏗️", true], - ["🏘️", true], - ["🏙️", true], - ["🏚️", true], - ["🏛️", true], - ["🏜️", true], - ["🏝️", true], - ["🏞️", true], - ["🏟️", true], - ["🏠", true], - ["🏡", true], - ["🏢", true], - ["🏣", true], - ["🏤", true], - ["🏥", true], - ["🏦", true], - ["🏧", true], - ["🏨", true], - ["🏩", true], - ["🏪", true], - ["🏫", true], - ["🏬", true], - ["🏭", true], - ["🏮", true], - ["🏯", true], - ["🏰", true], - ["🏳️🌈", true], - ["🏳️", true], - ["🏴☠️", true], - ["🏴", true], - ["🏴", true], - ["🏴", true], - ["🏴", true], - ["🏵️", true], - ["🏷️", true], - ["🏸", true], - ["🏹", true], - ["🏺", true], - ["🏻", true], - ["🏼", true], - ["🏽", true], - ["🏾", true], - ["🏿", true], - ["🐀", true], - ["🐁", true], - ["🐂", true], - ["🐃", true], - ["🐄", true], - ["🐅", true], - ["🐆", true], - ["🐇", true], - ["🐈", true], - ["🐉", true], - ["🐊", true], - ["🐋", true], - ["🐌", true], - ["🐍", true], - ["🐎", true], - ["🐏", true], - ["🐐", true], - ["🐑", true], - ["🐒", true], - ["🐓", true], - ["🐔", true], - ["🐕🦺", true], - ["🐕", true], - ["🐖", true], - ["🐗", true], - ["🐘", true], - ["🐙", true], - ["🐚", true], - ["🐛", true], - ["🐜", true], - ["🐝", true], - ["🐞", true], - ["🐟", true], - ["🐠", true], - ["🐡", true], - ["🐢", true], - ["🐣", true], - ["🐤", true], - ["🐥", true], - ["🐦", true], - ["🐧", true], - ["🐨", true], - ["🐩", true], - ["🐪", true], - ["🐫", true], - ["🐬", true], - ["🐭", true], - ["🐮", true], - ["🐯", true], - ["🐰", true], - ["🐱", true], - ["🐲", true], - ["🐳", true], - ["🐴", true], - ["🐵", true], - ["🐶", true], - ["🐷", true], - ["🐸", true], - ["🐹", true], - ["🐺", true], - ["🐻", true], - ["🐼", true], - ["🐽", true], - ["🐾", true], - ["🐿️", true], - ["👀", true], - ["👁🗨", true], - ["👁️", true], - ["👂🏻", true], - ["👂🏼", true], - ["👂🏽", true], - ["👂🏾", true], - ["👂🏿", true], - ["👂", true], - ["👃🏻", true], - ["👃🏼", true], - ["👃🏽", true], - ["👃🏾", true], - ["👃🏿", true], - ["👃", true], - ["👄", true], - ["👅", true], - ["👆🏻", true], - ["👆🏼", true], - ["👆🏽", true], - ["👆🏾", true], - ["👆🏿", true], - ["👆", true], - ["👇🏻", true], - ["👇🏼", true], - ["👇🏽", true], - ["👇🏾", true], - ["👇🏿", true], - ["👇", true], - ["👈🏻", true], - ["👈🏼", true], - ["👈🏽", true], - ["👈🏾", true], - ["👈🏿", true], - ["👈", true], - ["👉🏻", true], - ["👉🏼", true], - ["👉🏽", true], - ["👉🏾", true], - ["👉🏿", true], - ["👉", true], - ["👊🏻", true], - ["👊🏼", true], - ["👊🏽", true], - ["👊🏾", true], - ["👊🏿", true], - ["👊", true], - ["👋🏻", true], - ["👋🏼", true], - ["👋🏽", true], - ["👋🏾", true], - ["👋🏿", true], - ["👋", true], - ["👌🏻", true], - ["👌🏼", true], - ["👌🏽", true], - ["👌🏾", true], - ["👌🏿", true], - ["👌", true], - ["👍🏻", true], - ["👍🏼", true], - ["👍🏽", true], - ["👍🏾", true], - ["👍🏿", true], - ["👍", true], - ["👎🏻", true], - ["👎🏼", true], - ["👎🏽", true], - ["👎🏾", true], - ["👎🏿", true], - ["👎", true], - ["👏🏻", true], - ["👏🏼", true], - ["👏🏽", true], - ["👏🏾", true], - ["👏🏿", true], - ["👏", true], - ["👐🏻", true], - ["👐🏼", true], - ["👐🏽", true], - ["👐🏾", true], - ["👐🏿", true], - ["👐", true], - ["👑", true], - ["👒", true], - ["👓", true], - ["👔", true], - ["👕", true], - ["👖", true], - ["👗", true], - ["👘", true], - ["👙", true], - ["👚", true], - ["👛", true], - ["👜", true], - ["👝", true], - ["👞", true], - ["👟", true], - ["👠", true], - ["👡", true], - ["👢", true], - ["👣", true], - ["👤", true], - ["👥", true], - ["👦🏻", true], - ["👦🏼", true], - ["👦🏽", true], - ["👦🏾", true], - ["👦🏿", true], - ["👦", true], - ["👧🏻", true], - ["👧🏼", true], - ["👧🏽", true], - ["👧🏾", true], - ["👧🏿", true], - ["👧", true], - ["👨🏻🌾", true], - ["👨🏻🍳", true], - ["👨🏻🎓", true], - ["👨🏻🎤", true], - ["👨🏻🎨", true], - ["👨🏻🏫", true], - ["👨🏻🏭", true], - ["👨🏻💻", true], - ["👨🏻💼", true], - ["👨🏻🔧", true], - ["👨🏻🔬", true], - ["👨🏻🚀", true], - ["👨🏻🚒", true], - ["👨🏻🦯", true], - ["👨🏻🦰", true], - ["👨🏻🦱", true], - ["👨🏻🦲", true], - ["👨🏻🦳", true], - ["👨🏻🦼", true], - ["👨🏻🦽", true], - ["👨🏻⚕️", true], - ["👨🏻⚖️", true], - ["👨🏻✈️", true], - ["👨🏻", true], - ["👨🏼🌾", true], - ["👨🏼🍳", true], - ["👨🏼🎓", true], - ["👨🏼🎤", true], - ["👨🏼🎨", true], - ["👨🏼🏫", true], - ["👨🏼🏭", true], - ["👨🏼💻", true], - ["👨🏼💼", true], - ["👨🏼🔧", true], - ["👨🏼🔬", true], - ["👨🏼🚀", true], - ["👨🏼🚒", true], - ["👨🏼🤝👨🏻", true], - ["👨🏼🦯", true], - ["👨🏼🦰", true], - ["👨🏼🦱", true], - ["👨🏼🦲", true], - ["👨🏼🦳", true], - ["👨🏼🦼", true], - ["👨🏼🦽", true], - ["👨🏼⚕️", true], - ["👨🏼⚖️", true], - ["👨🏼✈️", true], - ["👨🏼", true], - ["👨🏽🌾", true], - ["👨🏽🍳", true], - ["👨🏽🎓", true], - ["👨🏽🎤", true], - ["👨🏽🎨", true], - ["👨🏽🏫", true], - ["👨🏽🏭", true], - ["👨🏽💻", true], - ["👨🏽💼", true], - ["👨🏽🔧", true], - ["👨🏽🔬", true], - ["👨🏽🚀", true], - ["👨🏽🚒", true], - ["👨🏽🤝👨🏻", true], - ["👨🏽🤝👨🏼", true], - ["👨🏽🦯", true], - ["👨🏽🦰", true], - ["👨🏽🦱", true], - ["👨🏽🦲", true], - ["👨🏽🦳", true], - ["👨🏽🦼", true], - ["👨🏽🦽", true], - ["👨🏽⚕️", true], - ["👨🏽⚖️", true], - ["👨🏽✈️", true], - ["👨🏽", true], - ["👨🏾🌾", true], - ["👨🏾🍳", true], - ["👨🏾🎓", true], - ["👨🏾🎤", true], - ["👨🏾🎨", true], - ["👨🏾🏫", true], - ["👨🏾🏭", true], - ["👨🏾💻", true], - ["👨🏾💼", true], - ["👨🏾🔧", true], - ["👨🏾🔬", true], - ["👨🏾🚀", true], - ["👨🏾🚒", true], - ["👨🏾🤝👨🏻", true], - ["👨🏾🤝👨🏼", true], - ["👨🏾🤝👨🏽", true], - ["👨🏾🦯", true], - ["👨🏾🦰", true], - ["👨🏾🦱", true], - ["👨🏾🦲", true], - ["👨🏾🦳", true], - ["👨🏾🦼", true], - ["👨🏾🦽", true], - ["👨🏾⚕️", true], - ["👨🏾⚖️", true], - ["👨🏾✈️", true], - ["👨🏾", true], - ["👨🏿🌾", true], - ["👨🏿🍳", true], - ["👨🏿🎓", true], - ["👨🏿🎤", true], - ["👨🏿🎨", true], - ["👨🏿🏫", true], - ["👨🏿🏭", true], - ["👨🏿💻", true], - ["👨🏿💼", true], - ["👨🏿🔧", true], - ["👨🏿🔬", true], - ["👨🏿🚀", true], - ["👨🏿🚒", true], - ["👨🏿🤝👨🏻", true], - ["👨🏿🤝👨🏼", true], - ["👨🏿🤝👨🏽", true], - ["👨🏿🤝👨🏾", true], - ["👨🏿🦯", true], - ["👨🏿🦰", true], - ["👨🏿🦱", true], - ["👨🏿🦲", true], - ["👨🏿🦳", true], - ["👨🏿🦼", true], - ["👨🏿🦽", true], - ["👨🏿⚕️", true], - ["👨🏿⚖️", true], - ["👨🏿✈️", true], - ["👨🏿", true], - ["👨🌾", true], - ["👨🍳", true], - ["👨🎓", true], - ["👨🎤", true], - ["👨🎨", true], - ["👨🏫", true], - ["👨🏭", true], - ["👨👦👦", true], - ["👨👦", true], - ["👨👧👦", true], - ["👨👧👧", true], - ["👨👧", true], - ["👨👨👦👦", true], - ["👨👨👦", true], - ["👨👨👧👦", true], - ["👨👨👧👧", true], - ["👨👨👧", true], - ["👨👩👦👦", true], - ["👨👩👦", true], - ["👨👩👧👦", true], - ["👨👩👧👧", true], - ["👨👩👧", true], - ["👨💻", true], - ["👨💼", true], - ["👨🔧", true], - ["👨🔬", true], - ["👨🚀", true], - ["👨🚒", true], - ["👨🦯", true], - ["👨🦰", true], - ["👨🦱", true], - ["👨🦲", true], - ["👨🦳", true], - ["👨🦼", true], - ["👨🦽", true], - ["👨⚕️", true], - ["👨⚖️", true], - ["👨✈️", true], - ["👨❤️👨", true], - ["👨❤️💋👨", true], - ["👨", true], - ["👩🏻🌾", true], - ["👩🏻🍳", true], - ["👩🏻🎓", true], - ["👩🏻🎤", true], - ["👩🏻🎨", true], - ["👩🏻🏫", true], - ["👩🏻🏭", true], - ["👩🏻💻", true], - ["👩🏻💼", true], - ["👩🏻🔧", true], - ["👩🏻🔬", true], - ["👩🏻🚀", true], - ["👩🏻🚒", true], - ["👩🏻🤝👨🏼", true], - ["👩🏻🤝👨🏽", true], - ["👩🏻🤝👨🏾", true], - ["👩🏻🤝👨🏿", true], - ["👩🏻🦯", true], - ["👩🏻🦰", true], - ["👩🏻🦱", true], - ["👩🏻🦲", true], - ["👩🏻🦳", true], - ["👩🏻🦼", true], - ["👩🏻🦽", true], - ["👩🏻⚕️", true], - ["👩🏻⚖️", true], - ["👩🏻✈️", true], - ["👩🏻", true], - ["👩🏼🌾", true], - ["👩🏼🍳", true], - ["👩🏼🎓", true], - ["👩🏼🎤", true], - ["👩🏼🎨", true], - ["👩🏼🏫", true], - ["👩🏼🏭", true], - ["👩🏼💻", true], - ["👩🏼💼", true], - ["👩🏼🔧", true], - ["👩🏼🔬", true], - ["👩🏼🚀", true], - ["👩🏼🚒", true], - ["👩🏼🤝👨🏻", true], - ["👩🏼🤝👨🏽", true], - ["👩🏼🤝👨🏾", true], - ["👩🏼🤝👨🏿", true], - ["👩🏼🤝👩🏻", true], - ["👩🏼🦯", true], - ["👩🏼🦰", true], - ["👩🏼🦱", true], - ["👩🏼🦲", true], - ["👩🏼🦳", true], - ["👩🏼🦼", true], - ["👩🏼🦽", true], - ["👩🏼⚕️", true], - ["👩🏼⚖️", true], - ["👩🏼✈️", true], - ["👩🏼", true], - ["👩🏽🌾", true], - ["👩🏽🍳", true], - ["👩🏽🎓", true], - ["👩🏽🎤", true], - ["👩🏽🎨", true], - ["👩🏽🏫", true], - ["👩🏽🏭", true], - ["👩🏽💻", true], - ["👩🏽💼", true], - ["👩🏽🔧", true], - ["👩🏽🔬", true], - ["👩🏽🚀", true], - ["👩🏽🚒", true], - ["👩🏽🤝👨🏻", true], - ["👩🏽🤝👨🏼", true], - ["👩🏽🤝👨🏾", true], - ["👩🏽🤝👨🏿", true], - ["👩🏽🤝👩🏻", true], - ["👩🏽🤝👩🏼", true], - ["👩🏽🦯", true], - ["👩🏽🦰", true], - ["👩🏽🦱", true], - ["👩🏽🦲", true], - ["👩🏽🦳", true], - ["👩🏽🦼", true], - ["👩🏽🦽", true], - ["👩🏽⚕️", true], - ["👩🏽⚖️", true], - ["👩🏽✈️", true], - ["👩🏽", true], - ["👩🏾🌾", true], - ["👩🏾🍳", true], - ["👩🏾🎓", true], - ["👩🏾🎤", true], - ["👩🏾🎨", true], - ["👩🏾🏫", true], - ["👩🏾🏭", true], - ["👩🏾💻", true], - ["👩🏾💼", true], - ["👩🏾🔧", true], - ["👩🏾🔬", true], - ["👩🏾🚀", true], - ["👩🏾🚒", true], - ["👩🏾🤝👨🏻", true], - ["👩🏾🤝👨🏼", true], - ["👩🏾🤝👨🏽", true], - ["👩🏾🤝👨🏿", true], - ["👩🏾🤝👩🏻", true], - ["👩🏾🤝👩🏼", true], - ["👩🏾🤝👩🏽", true], - ["👩🏾🦯", true], - ["👩🏾🦰", true], - ["👩🏾🦱", true], - ["👩🏾🦲", true], - ["👩🏾🦳", true], - ["👩🏾🦼", true], - ["👩🏾🦽", true], - ["👩🏾⚕️", true], - ["👩🏾⚖️", true], - ["👩🏾✈️", true], - ["👩🏾", true], - ["👩🏿🌾", true], - ["👩🏿🍳", true], - ["👩🏿🎓", true], - ["👩🏿🎤", true], - ["👩🏿🎨", true], - ["👩🏿🏫", true], - ["👩🏿🏭", true], - ["👩🏿💻", true], - ["👩🏿💼", true], - ["👩🏿🔧", true], - ["👩🏿🔬", true], - ["👩🏿🚀", true], - ["👩🏿🚒", true], - ["👩🏿🤝👨🏻", true], - ["👩🏿🤝👨🏼", true], - ["👩🏿🤝👨🏽", true], - ["👩🏿🤝👨🏾", true], - ["👩🏿🤝👩🏻", true], - ["👩🏿🤝👩🏼", true], - ["👩🏿🤝👩🏽", true], - ["👩🏿🤝👩🏾", true], - ["👩🏿🦯", true], - ["👩🏿🦰", true], - ["👩🏿🦱", true], - ["👩🏿🦲", true], - ["👩🏿🦳", true], - ["👩🏿🦼", true], - ["👩🏿🦽", true], - ["👩🏿⚕️", true], - ["👩🏿⚖️", true], - ["👩🏿✈️", true], - ["👩🏿", true], - ["👩🌾", true], - ["👩🍳", true], - ["👩🎓", true], - ["👩🎤", true], - ["👩🎨", true], - ["👩🏫", true], - ["👩🏭", true], - ["👩👦👦", true], - ["👩👦", true], - ["👩👧👦", true], - ["👩👧👧", true], - ["👩👧", true], - ["👩👩👦👦", true], - ["👩👩👦", true], - ["👩👩👧👦", true], - ["👩👩👧👧", true], - ["👩👩👧", true], - ["👩💻", true], - ["👩💼", true], - ["👩🔧", true], - ["👩🔬", true], - ["👩🚀", true], - ["👩🚒", true], - ["👩🦯", true], - ["👩🦰", true], - ["👩🦱", true], - ["👩🦲", true], - ["👩🦳", true], - ["👩🦼", true], - ["👩🦽", true], - ["👩⚕️", true], - ["👩⚖️", true], - ["👩✈️", true], - ["👩❤️👨", true], - ["👩❤️👩", true], - ["👩❤️💋👨", true], - ["👩❤️💋👩", true], - ["👩", true], - ["👪", true], - ["👫🏻", true], - ["👫🏼", true], - ["👫🏽", true], - ["👫🏾", true], - ["👫🏿", true], - ["👫", true], - ["👬🏻", true], - ["👬🏼", true], - ["👬🏽", true], - ["👬🏾", true], - ["👬🏿", true], - ["👬", true], - ["👭🏻", true], - ["👭🏼", true], - ["👭🏽", true], - ["👭🏾", true], - ["👭🏿", true], - ["👭", true], - ["👮🏻♀️", true], - ["👮🏻♂️", true], - ["👮🏻", true], - ["👮🏼♀️", true], - ["👮🏼♂️", true], - ["👮🏼", true], - ["👮🏽♀️", true], - ["👮🏽♂️", true], - ["👮🏽", true], - ["👮🏾♀️", true], - ["👮🏾♂️", true], - ["👮🏾", true], - ["👮🏿♀️", true], - ["👮🏿♂️", true], - ["👮🏿", true], - ["👮♀️", true], - ["👮♂️", true], - ["👮", true], - ["👯♀️", true], - ["👯♂️", true], - ["👯", true], - ["👰🏻", true], - ["👰🏼", true], - ["👰🏽", true], - ["👰🏾", true], - ["👰🏿", true], - ["👰", true], - ["👱🏻♀️", true], - ["👱🏻♂️", true], - ["👱🏻", true], - ["👱🏼♀️", true], - ["👱🏼♂️", true], - ["👱🏼", true], - ["👱🏽♀️", true], - ["👱🏽♂️", true], - ["👱🏽", true], - ["👱🏾♀️", true], - ["👱🏾♂️", true], - ["👱🏾", true], - ["👱🏿♀️", true], - ["👱🏿♂️", true], - ["👱🏿", true], - ["👱♀️", true], - ["👱♂️", true], - ["👱", true], - ["👲🏻", true], - ["👲🏼", true], - ["👲🏽", true], - ["👲🏾", true], - ["👲🏿", true], - ["👲", true], - ["👳🏻♀️", true], - ["👳🏻♂️", true], - ["👳🏻", true], - ["👳🏼♀️", true], - ["👳🏼♂️", true], - ["👳🏼", true], - ["👳🏽♀️", true], - ["👳🏽♂️", true], - ["👳🏽", true], - ["👳🏾♀️", true], - ["👳🏾♂️", true], - ["👳🏾", true], - ["👳🏿♀️", true], - ["👳🏿♂️", true], - ["👳🏿", true], - ["👳♀️", true], - ["👳♂️", true], - ["👳", true], - ["👴🏻", true], - ["👴🏼", true], - ["👴🏽", true], - ["👴🏾", true], - ["👴🏿", true], - ["👴", true], - ["👵🏻", true], - ["👵🏼", true], - ["👵🏽", true], - ["👵🏾", true], - ["👵🏿", true], - ["👵", true], - ["👶🏻", true], - ["👶🏼", true], - ["👶🏽", true], - ["👶🏾", true], - ["👶🏿", true], - ["👶", true], - ["👷🏻♀️", true], - ["👷🏻♂️", true], - ["👷🏻", true], - ["👷🏼♀️", true], - ["👷🏼♂️", true], - ["👷🏼", true], - ["👷🏽♀️", true], - ["👷🏽♂️", true], - ["👷🏽", true], - ["👷🏾♀️", true], - ["👷🏾♂️", true], - ["👷🏾", true], - ["👷🏿♀️", true], - ["👷🏿♂️", true], - ["👷🏿", true], - ["👷♀️", true], - ["👷♂️", true], - ["👷", true], - ["👸🏻", true], - ["👸🏼", true], - ["👸🏽", true], - ["👸🏾", true], - ["👸🏿", true], - ["👸", true], - ["👹", true], - ["👺", true], - ["👻", true], - ["👼🏻", true], - ["👼🏼", true], - ["👼🏽", true], - ["👼🏾", true], - ["👼🏿", true], - ["👼", true], - ["👽", true], - ["👾", true], - ["👿", true], - ["💀", true], - ["💁🏻♀️", true], - ["💁🏻♂️", true], - ["💁🏻", true], - ["💁🏼♀️", true], - ["💁🏼♂️", true], - ["💁🏼", true], - ["💁🏽♀️", true], - ["💁🏽♂️", true], - ["💁🏽", true], - ["💁🏾♀️", true], - ["💁🏾♂️", true], - ["💁🏾", true], - ["💁🏿♀️", true], - ["💁🏿♂️", true], - ["💁🏿", true], - ["💁♀️", true], - ["💁♂️", true], - ["💁", true], - ["💂🏻♀️", true], - ["💂🏻♂️", true], - ["💂🏻", true], - ["💂🏼♀️", true], - ["💂🏼♂️", true], - ["💂🏼", true], - ["💂🏽♀️", true], - ["💂🏽♂️", true], - ["💂🏽", true], - ["💂🏾♀️", true], - ["💂🏾♂️", true], - ["💂🏾", true], - ["💂🏿♀️", true], - ["💂🏿♂️", true], - ["💂🏿", true], - ["💂♀️", true], - ["💂♂️", true], - ["💂", true], - ["💃🏻", true], - ["💃🏼", true], - ["💃🏽", true], - ["💃🏾", true], - ["💃🏿", true], - ["💃", true], - ["💄", true], - ["💅🏻", true], - ["💅🏼", true], - ["💅🏽", true], - ["💅🏾", true], - ["💅🏿", true], - ["💅", true], - ["💆🏻♀️", true], - ["💆🏻♂️", true], - ["💆🏻", true], - ["💆🏼♀️", true], - ["💆🏼♂️", true], - ["💆🏼", true], - ["💆🏽♀️", true], - ["💆🏽♂️", true], - ["💆🏽", true], - ["💆🏾♀️", true], - ["💆🏾♂️", true], - ["💆🏾", true], - ["💆🏿♀️", true], - ["💆🏿♂️", true], - ["💆🏿", true], - ["💆♀️", true], - ["💆♂️", true], - ["💆", true], - ["💇🏻♀️", true], - ["💇🏻♂️", true], - ["💇🏻", true], - ["💇🏼♀️", true], - ["💇🏼♂️", true], - ["💇🏼", true], - ["💇🏽♀️", true], - ["💇🏽♂️", true], - ["💇🏽", true], - ["💇🏾♀️", true], - ["💇🏾♂️", true], - ["💇🏾", true], - ["💇🏿♀️", true], - ["💇🏿♂️", true], - ["💇🏿", true], - ["💇♀️", true], - ["💇♂️", true], - ["💇", true], - ["💈", true], - ["💉", true], - ["💊", true], - ["💋", true], - ["💌", true], - ["💍", true], - ["💎", true], - ["💏", true], - ["💐", true], - ["💑", true], - ["💒", true], - ["💓", true], - ["💔", true], - ["💕", true], - ["💖", true], - ["💗", true], - ["💘", true], - ["💙", true], - ["💚", true], - ["💛", true], - ["💜", true], - ["💝", true], - ["💞", true], - ["💟", true], - ["💠", true], - ["💡", true], - ["💢", true], - ["💣", true], - ["💤", true], - ["💥", true], - ["💦", true], - ["💧", true], - ["💨", true], - ["💩", true], - ["💪🏻", true], - ["💪🏼", true], - ["💪🏽", true], - ["💪🏾", true], - ["💪🏿", true], - ["💪", true], - ["💫", true], - ["💬", true], - ["💭", true], - ["💮", true], - ["💯", true], - ["💰", true], - ["💱", true], - ["💲", true], - ["💳", true], - ["💴", true], - ["💵", true], - ["💶", true], - ["💷", true], - ["💸", true], - ["💹", true], - ["💺", true], - ["💻", true], - ["💼", true], - ["💽", true], - ["💾", true], - ["💿", true], - ["📀", true], - ["📁", true], - ["📂", true], - ["📃", true], - ["📄", true], - ["📅", true], - ["📆", true], - ["📇", true], - ["📈", true], - ["📉", true], - ["📊", true], - ["📋", true], - ["📌", true], - ["📍", true], - ["📎", true], - ["📏", true], - ["📐", true], - ["📑", true], - ["📒", true], - ["📓", true], - ["📔", true], - ["📕", true], - ["📖", true], - ["📗", true], - ["📘", true], - ["📙", true], - ["📚", true], - ["📛", true], - ["📜", true], - ["📝", true], - ["📞", true], - ["📟", true], - ["📠", true], - ["📡", true], - ["📢", true], - ["📣", true], - ["📤", true], - ["📥", true], - ["📦", true], - ["📧", true], - ["📨", true], - ["📩", true], - ["📪", true], - ["📫", true], - ["📬", true], - ["📭", true], - ["📮", true], - ["📯", true], - ["📰", true], - ["📱", true], - ["📲", true], - ["📳", true], - ["📴", true], - ["📵", true], - ["📶", true], - ["📷", true], - ["📸", true], - ["📹", true], - ["📺", true], - ["📻", true], - ["📼", true], - ["📽️", true], - ["📿", true], - ["🔀", true], - ["🔁", true], - ["🔂", true], - ["🔃", true], - ["🔄", true], - ["🔅", true], - ["🔆", true], - ["🔇", true], - ["🔈", true], - ["🔉", true], - ["🔊", true], - ["🔋", true], - ["🔌", true], - ["🔍", true], - ["🔎", true], - ["🔏", true], - ["🔐", true], - ["🔑", true], - ["🔒", true], - ["🔓", true], - ["🔔", true], - ["🔕", true], - ["🔖", true], - ["🔗", true], - ["🔘", true], - ["🔙", true], - ["🔚", true], - ["🔛", true], - ["🔜", true], - ["🔝", true], - ["🔞", true], - ["🔟", true], - ["🔠", true], - ["🔡", true], - ["🔢", true], - ["🔣", true], - ["🔤", true], - ["🔥", true], - ["🔦", true], - ["🔧", true], - ["🔨", true], - ["🔩", true], - ["🔪", true], - ["🔫", true], - ["🔬", true], - ["🔭", true], - ["🔮", true], - ["🔯", true], - ["🔰", true], - ["🔱", true], - ["🔲", true], - ["🔳", true], - ["🔴", true], - ["🔵", true], - ["🔶", true], - ["🔷", true], - ["🔸", true], - ["🔹", true], - ["🔺", true], - ["🔻", true], - ["🔼", true], - ["🔽", true], - ["🕉️", true], - ["🕊️", true], - ["🕋", true], - ["🕌", true], - ["🕍", true], - ["🕎", true], - ["🕐", true], - ["🕑", true], - ["🕒", true], - ["🕓", true], - ["🕔", true], - ["🕕", true], - ["🕖", true], - ["🕗", true], - ["🕘", true], - ["🕙", true], - ["🕚", true], - ["🕛", true], - ["🕜", true], - ["🕝", true], - ["🕞", true], - ["🕟", true], - ["🕠", true], - ["🕡", true], - ["🕢", true], - ["🕣", true], - ["🕤", true], - ["🕥", true], - ["🕦", true], - ["🕧", true], - ["🕯️", true], - ["🕰️", true], - ["🕳️", true], - ["🕴🏻♀️", true], - ["🕴🏻♂️", true], - ["🕴🏻", true], - ["🕴🏼♀️", true], - ["🕴🏼♂️", true], - ["🕴🏼", true], - ["🕴🏽♀️", true], - ["🕴🏽♂️", true], - ["🕴🏽", true], - ["🕴🏾♀️", true], - ["🕴🏾♂️", true], - ["🕴🏾", true], - ["🕴🏿♀️", true], - ["🕴🏿♂️", true], - ["🕴🏿", true], - ["🕴️♀️", true], - ["🕴️♂️", true], - ["🕴️", true], - ["🕵🏻♀️", true], - ["🕵🏻♂️", true], - ["🕵🏻", true], - ["🕵🏼♀️", true], - ["🕵🏼♂️", true], - ["🕵🏼", true], - ["🕵🏽♀️", true], - ["🕵🏽♂️", true], - ["🕵🏽", true], - ["🕵🏾♀️", true], - ["🕵🏾♂️", true], - ["🕵🏾", true], - ["🕵🏿♀️", true], - ["🕵🏿♂️", true], - ["🕵🏿", true], - ["🕵️♀️", true], - ["🕵️♂️", true], - ["🕵️", true], - ["🕶️", true], - ["🕷️", true], - ["🕸️", true], - ["🕹️", true], - ["🕺🏻", true], - ["🕺🏼", true], - ["🕺🏽", true], - ["🕺🏾", true], - ["🕺🏿", true], - ["🕺", true], - ["🖇️", true], - ["🖊️", true], - ["🖋️", true], - ["🖌️", true], - ["🖍️", true], - ["🖐🏻", true], - ["🖐🏼", true], - ["🖐🏽", true], - ["🖐🏾", true], - ["🖐🏿", true], - ["🖐️", true], - ["🖕🏻", true], - ["🖕🏼", true], - ["🖕🏽", true], - ["🖕🏾", true], - ["🖕🏿", true], - ["🖕", true], - ["🖖🏻", true], - ["🖖🏼", true], - ["🖖🏽", true], - ["🖖🏾", true], - ["🖖🏿", true], - ["🖖", true], - ["🖤", true], - ["🖥️", true], - ["🖨️", true], - ["🖱️", true], - ["🖲️", true], - ["🖼️", true], - ["🗂️", true], - ["🗃️", true], - ["🗄️", true], - ["🗑️", true], - ["🗒️", true], - ["🗓️", true], - ["🗜️", true], - ["🗝️", true], - ["🗞️", true], - ["🗡️", true], - ["🗣️", true], - ["🗨️", true], - ["🗯️", true], - ["🗳️", true], - ["🗺️", true], - ["🗻", true], - ["🗼", true], - ["🗽", true], - ["🗾", true], - ["🗿", true], - ["😀", true], - ["😁", true], - ["😂", true], - ["😃", true], - ["😄", true], - ["😅", true], - ["😆", true], - ["😇", true], - ["😈", true], - ["😉", true], - ["😊", true], - ["😋", true], - ["😌", true], - ["😍", true], - ["😎", true], - ["😏", true], - ["😐", true], - ["😑", true], - ["😒", true], - ["😓", true], - ["😔", true], - ["😕", true], - ["😖", true], - ["😗", true], - ["😘", true], - ["😙", true], - ["😚", true], - ["😛", true], - ["😜", true], - ["😝", true], - ["😞", true], - ["😟", true], - ["😠", true], - ["😡", true], - ["😢", true], - ["😣", true], - ["😤", true], - ["😥", true], - ["😦", true], - ["😧", true], - ["😨", true], - ["😩", true], - ["😪", true], - ["😫", true], - ["😬", true], - ["😭", true], - ["😮", true], - ["😯", true], - ["😰", true], - ["😱", true], - ["😲", true], - ["😳", true], - ["😴", true], - ["😵", true], - ["😶", true], - ["😷", true], - ["😸", true], - ["😹", true], - ["😺", true], - ["😻", true], - ["😼", true], - ["😽", true], - ["😾", true], - ["😿", true], - ["🙀", true], - ["🙁", true], - ["🙂", true], - ["🙃", true], - ["🙄", true], - ["🙅🏻♀️", true], - ["🙅🏻♂️", true], - ["🙅🏻", true], - ["🙅🏼♀️", true], - ["🙅🏼♂️", true], - ["🙅🏼", true], - ["🙅🏽♀️", true], - ["🙅🏽♂️", true], - ["🙅🏽", true], - ["🙅🏾♀️", true], - ["🙅🏾♂️", true], - ["🙅🏾", true], - ["🙅🏿♀️", true], - ["🙅🏿♂️", true], - ["🙅🏿", true], - ["🙅♀️", true], - ["🙅♂️", true], - ["🙅", true], - ["🙆🏻♀️", true], - ["🙆🏻♂️", true], - ["🙆🏻", true], - ["🙆🏼♀️", true], - ["🙆🏼♂️", true], - ["🙆🏼", true], - ["🙆🏽♀️", true], - ["🙆🏽♂️", true], - ["🙆🏽", true], - ["🙆🏾♀️", true], - ["🙆🏾♂️", true], - ["🙆🏾", true], - ["🙆🏿♀️", true], - ["🙆🏿♂️", true], - ["🙆🏿", true], - ["🙆♀️", true], - ["🙆♂️", true], - ["🙆", true], - ["🙇🏻♀️", true], - ["🙇🏻♂️", true], - ["🙇🏻", true], - ["🙇🏼♀️", true], - ["🙇🏼♂️", true], - ["🙇🏼", true], - ["🙇🏽♀️", true], - ["🙇🏽♂️", true], - ["🙇🏽", true], - ["🙇🏾♀️", true], - ["🙇🏾♂️", true], - ["🙇🏾", true], - ["🙇🏿♀️", true], - ["🙇🏿♂️", true], - ["🙇🏿", true], - ["🙇♀️", true], - ["🙇♂️", true], - ["🙇", true], - ["🙈", true], - ["🙉", true], - ["🙊", true], - ["🙋🏻♀️", true], - ["🙋🏻♂️", true], - ["🙋🏻", true], - ["🙋🏼♀️", true], - ["🙋🏼♂️", true], - ["🙋🏼", true], - ["🙋🏽♀️", true], - ["🙋🏽♂️", true], - ["🙋🏽", true], - ["🙋🏾♀️", true], - ["🙋🏾♂️", true], - ["🙋🏾", true], - ["🙋🏿♀️", true], - ["🙋🏿♂️", true], - ["🙋🏿", true], - ["🙋♀️", true], - ["🙋♂️", true], - ["🙋", true], - ["🙌🏻", true], - ["🙌🏼", true], - ["🙌🏽", true], - ["🙌🏾", true], - ["🙌🏿", true], - ["🙌", true], - ["🙍🏻♀️", true], - ["🙍🏻♂️", true], - ["🙍🏻", true], - ["🙍🏼♀️", true], - ["🙍🏼♂️", true], - ["🙍🏼", true], - ["🙍🏽♀️", true], - ["🙍🏽♂️", true], - ["🙍🏽", true], - ["🙍🏾♀️", true], - ["🙍🏾♂️", true], - ["🙍🏾", true], - ["🙍🏿♀️", true], - ["🙍🏿♂️", true], - ["🙍🏿", true], - ["🙍♀️", true], - ["🙍♂️", true], - ["🙍", true], - ["🙎🏻♀️", true], - ["🙎🏻♂️", true], - ["🙎🏻", true], - ["🙎🏼♀️", true], - ["🙎🏼♂️", true], - ["🙎🏼", true], - ["🙎🏽♀️", true], - ["🙎🏽♂️", true], - ["🙎🏽", true], - ["🙎🏾♀️", true], - ["🙎🏾♂️", true], - ["🙎🏾", true], - ["🙎🏿♀️", true], - ["🙎🏿♂️", true], - ["🙎🏿", true], - ["🙎♀️", true], - ["🙎♂️", true], - ["🙎", true], - ["🙏🏻", true], - ["🙏🏼", true], - ["🙏🏽", true], - ["🙏🏾", true], - ["🙏🏿", true], - ["🙏", true], - ["🚀", true], - ["🚁", true], - ["🚂", true], - ["🚃", true], - ["🚄", true], - ["🚅", true], - ["🚆", true], - ["🚇", true], - ["🚈", true], - ["🚉", true], - ["🚊", true], - ["🚋", true], - ["🚌", true], - ["🚍", true], - ["🚎", true], - ["🚏", true], - ["🚐", true], - ["🚑", true], - ["🚒", true], - ["🚓", true], - ["🚔", true], - ["🚕", true], - ["🚖", true], - ["🚗", true], - ["🚘", true], - ["🚙", true], - ["🚚", true], - ["🚛", true], - ["🚜", true], - ["🚝", true], - ["🚞", true], - ["🚟", true], - ["🚠", true], - ["🚡", true], - ["🚢", true], - ["🚣🏻♀️", true], - ["🚣🏻♂️", true], - ["🚣🏻", true], - ["🚣🏼♀️", true], - ["🚣🏼♂️", true], - ["🚣🏼", true], - ["🚣🏽♀️", true], - ["🚣🏽♂️", true], - ["🚣🏽", true], - ["🚣🏾♀️", true], - ["🚣🏾♂️", true], - ["🚣🏾", true], - ["🚣🏿♀️", true], - ["🚣🏿♂️", true], - ["🚣🏿", true], - ["🚣♀️", true], - ["🚣♂️", true], - ["🚣", true], - ["🚤", true], - ["🚥", true], - ["🚦", true], - ["🚧", true], - ["🚨", true], - ["🚩", true], - ["🚪", true], - ["🚫", true], - ["🚬", true], - ["🚭", true], - ["🚮", true], - ["🚯", true], - ["🚰", true], - ["🚱", true], - ["🚲", true], - ["🚳", true], - ["🚴🏻♀️", true], - ["🚴🏻♂️", true], - ["🚴🏻", true], - ["🚴🏼♀️", true], - ["🚴🏼♂️", true], - ["🚴🏼", true], - ["🚴🏽♀️", true], - ["🚴🏽♂️", true], - ["🚴🏽", true], - ["🚴🏾♀️", true], - ["🚴🏾♂️", true], - ["🚴🏾", true], - ["🚴🏿♀️", true], - ["🚴🏿♂️", true], - ["🚴🏿", true], - ["🚴♀️", true], - ["🚴♂️", true], - ["🚴", true], - ["🚵🏻♀️", true], - ["🚵🏻♂️", true], - ["🚵🏻", true], - ["🚵🏼♀️", true], - ["🚵🏼♂️", true], - ["🚵🏼", true], - ["🚵🏽♀️", true], - ["🚵🏽♂️", true], - ["🚵🏽", true], - ["🚵🏾♀️", true], - ["🚵🏾♂️", true], - ["🚵🏾", true], - ["🚵🏿♀️", true], - ["🚵🏿♂️", true], - ["🚵🏿", true], - ["🚵♀️", true], - ["🚵♂️", true], - ["🚵", true], - ["🚶🏻♀️", true], - ["🚶🏻♂️", true], - ["🚶🏻", true], - ["🚶🏼♀️", true], - ["🚶🏼♂️", true], - ["🚶🏼", true], - ["🚶🏽♀️", true], - ["🚶🏽♂️", true], - ["🚶🏽", true], - ["🚶🏾♀️", true], - ["🚶🏾♂️", true], - ["🚶🏾", true], - ["🚶🏿♀️", true], - ["🚶🏿♂️", true], - ["🚶🏿", true], - ["🚶♀️", true], - ["🚶♂️", true], - ["🚶", true], - ["🚷", true], - ["🚸", true], - ["🚹", true], - ["🚺", true], - ["🚻", true], - ["🚼", true], - ["🚽", true], - ["🚾", true], - ["🚿", true], - ["🛀🏻", true], - ["🛀🏼", true], - ["🛀🏽", true], - ["🛀🏾", true], - ["🛀🏿", true], - ["🛀", true], - ["🛁", true], - ["🛂", true], - ["🛃", true], - ["🛄", true], - ["🛅", true], - ["🛋️", true], - ["🛌🏻", true], - ["🛌🏼", true], - ["🛌🏽", true], - ["🛌🏾", true], - ["🛌🏿", true], - ["🛌", true], - ["🛍️", true], - ["🛎️", true], - ["🛏️", true], - ["🛐", true], - ["🛑", true], - ["🛒", true], - ["🛕", true], - ["🛠️", true], - ["🛡️", true], - ["🛢️", true], - ["🛣️", true], - ["🛤️", true], - ["🛥️", true], - ["🛩️", true], - ["🛫", true], - ["🛬", true], - ["🛰️", true], - ["🛳️", true], - ["🛴", true], - ["🛵", true], - ["🛶", true], - ["🛷", true], - ["🛸", true], - ["🛹", true], - ["🛺", true], - ["🟠", true], - ["🟡", true], - ["🟢", true], - ["🟣", true], - ["🟤", true], - ["🟥", true], - ["🟦", true], - ["🟧", true], - ["🟨", true], - ["🟩", true], - ["🟪", true], - ["🟫", true], - ["🤍", true], - ["🤎", true], - ["🤏🏻", true], - ["🤏🏼", true], - ["🤏🏽", true], - ["🤏🏾", true], - ["🤏🏿", true], - ["🤏", true], - ["🤐", true], - ["🤑", true], - ["🤒", true], - ["🤓", true], - ["🤔", true], - ["🤕", true], - ["🤖", true], - ["🤗", true], - ["🤘🏻", true], - ["🤘🏼", true], - ["🤘🏽", true], - ["🤘🏾", true], - ["🤘🏿", true], - ["🤘", true], - ["🤙🏻", true], - ["🤙🏼", true], - ["🤙🏽", true], - ["🤙🏾", true], - ["🤙🏿", true], - ["🤙", true], - ["🤚🏻", true], - ["🤚🏼", true], - ["🤚🏽", true], - ["🤚🏾", true], - ["🤚🏿", true], - ["🤚", true], - ["🤛🏻", true], - ["🤛🏼", true], - ["🤛🏽", true], - ["🤛🏾", true], - ["🤛🏿", true], - ["🤛", true], - ["🤜🏻", true], - ["🤜🏼", true], - ["🤜🏽", true], - ["🤜🏾", true], - ["🤜🏿", true], - ["🤜", true], - ["🤝", true], - ["🤞🏻", true], - ["🤞🏼", true], - ["🤞🏽", true], - ["🤞🏾", true], - ["🤞🏿", true], - ["🤞", true], - ["🤟🏻", true], - ["🤟🏼", true], - ["🤟🏽", true], - ["🤟🏾", true], - ["🤟🏿", true], - ["🤟", true], - ["🤠", true], - ["🤡", true], - ["🤢", true], - ["🤣", true], - ["🤤", true], - ["🤥", true], - ["🤦🏻♀️", true], - ["🤦🏻♂️", true], - ["🤦🏻", true], - ["🤦🏼♀️", true], - ["🤦🏼♂️", true], - ["🤦🏼", true], - ["🤦🏽♀️", true], - ["🤦🏽♂️", true], - ["🤦🏽", true], - ["🤦🏾♀️", true], - ["🤦🏾♂️", true], - ["🤦🏾", true], - ["🤦🏿♀️", true], - ["🤦🏿♂️", true], - ["🤦🏿", true], - ["🤦♀️", true], - ["🤦♂️", true], - ["🤦", true], - ["🤧", true], - ["🤨", true], - ["🤩", true], - ["🤪", true], - ["🤫", true], - ["🤬", true], - ["🤭", true], - ["🤮", true], - ["🤯", true], - ["🤰🏻", true], - ["🤰🏼", true], - ["🤰🏽", true], - ["🤰🏾", true], - ["🤰🏿", true], - ["🤰", true], - ["🤱🏻", true], - ["🤱🏼", true], - ["🤱🏽", true], - ["🤱🏾", true], - ["🤱🏿", true], - ["🤱", true], - ["🤲🏻", true], - ["🤲🏼", true], - ["🤲🏽", true], - ["🤲🏾", true], - ["🤲🏿", true], - ["🤲", true], - ["🤳🏻", true], - ["🤳🏼", true], - ["🤳🏽", true], - ["🤳🏾", true], - ["🤳🏿", true], - ["🤳", true], - ["🤴🏻", true], - ["🤴🏼", true], - ["🤴🏽", true], - ["🤴🏾", true], - ["🤴🏿", true], - ["🤴", true], - ["🤵🏻♀️", true], - ["🤵🏻♂️", true], - ["🤵🏻", true], - ["🤵🏼♀️", true], - ["🤵🏼♂️", true], - ["🤵🏼", true], - ["🤵🏽♀️", true], - ["🤵🏽♂️", true], - ["🤵🏽", true], - ["🤵🏾♀️", true], - ["🤵🏾♂️", true], - ["🤵🏾", true], - ["🤵🏿♀️", true], - ["🤵🏿♂️", true], - ["🤵🏿", true], - ["🤵♀️", true], - ["🤵♂️", true], - ["🤵", true], - ["🤶🏻", true], - ["🤶🏼", true], - ["🤶🏽", true], - ["🤶🏾", true], - ["🤶🏿", true], - ["🤶", true], - ["🤷🏻♀️", true], - ["🤷🏻♂️", true], - ["🤷🏻", true], - ["🤷🏼♀️", true], - ["🤷🏼♂️", true], - ["🤷🏼", true], - ["🤷🏽♀️", true], - ["🤷🏽♂️", true], - ["🤷🏽", true], - ["🤷🏾♀️", true], - ["🤷🏾♂️", true], - ["🤷🏾", true], - ["🤷🏿♀️", true], - ["🤷🏿♂️", true], - ["🤷🏿", true], - ["🤷♀️", true], - ["🤷♂️", true], - ["🤷", true], - ["🤸🏻♀️", true], - ["🤸🏻♂️", true], - ["🤸🏻", true], - ["🤸🏼♀️", true], - ["🤸🏼♂️", true], - ["🤸🏼", true], - ["🤸🏽♀️", true], - ["🤸🏽♂️", true], - ["🤸🏽", true], - ["🤸🏾♀️", true], - ["🤸🏾♂️", true], - ["🤸🏾", true], - ["🤸🏿♀️", true], - ["🤸🏿♂️", true], - ["🤸🏿", true], - ["🤸♀️", true], - ["🤸♂️", true], - ["🤸", true], - ["🤹🏻♀️", true], - ["🤹🏻♂️", true], - ["🤹🏻", true], - ["🤹🏼♀️", true], - ["🤹🏼♂️", true], - ["🤹🏼", true], - ["🤹🏽♀️", true], - ["🤹🏽♂️", true], - ["🤹🏽", true], - ["🤹🏾♀️", true], - ["🤹🏾♂️", true], - ["🤹🏾", true], - ["🤹🏿♀️", true], - ["🤹🏿♂️", true], - ["🤹🏿", true], - ["🤹♀️", true], - ["🤹♂️", true], - ["🤹", true], - ["🤺", true], - ["🤼♀️", true], - ["🤼♂️", true], - ["🤼", true], - ["🤽🏻♀️", true], - ["🤽🏻♂️", true], - ["🤽🏻", true], - ["🤽🏼♀️", true], - ["🤽🏼♂️", true], - ["🤽🏼", true], - ["🤽🏽♀️", true], - ["🤽🏽♂️", true], - ["🤽🏽", true], - ["🤽🏾♀️", true], - ["🤽🏾♂️", true], - ["🤽🏾", true], - ["🤽🏿♀️", true], - ["🤽🏿♂️", true], - ["🤽🏿", true], - ["🤽♀️", true], - ["🤽♂️", true], - ["🤽", true], - ["🤾🏻♀️", true], - ["🤾🏻♂️", true], - ["🤾🏻", true], - ["🤾🏼♀️", true], - ["🤾🏼♂️", true], - ["🤾🏼", true], - ["🤾🏽♀️", true], - ["🤾🏽♂️", true], - ["🤾🏽", true], - ["🤾🏾♀️", true], - ["🤾🏾♂️", true], - ["🤾🏾", true], - ["🤾🏿♀️", true], - ["🤾🏿♂️", true], - ["🤾🏿", true], - ["🤾♀️", true], - ["🤾♂️", true], - ["🤾", true], - ["🤿", true], - ["🥀", true], - ["🥁", true], - ["🥂", true], - ["🥃", true], - ["🥄", true], - ["🥅", true], - ["🥇", true], - ["🥈", true], - ["🥉", true], - ["🥊", true], - ["🥋", true], - ["🥌", true], - ["🥍", true], - ["🥎", true], - ["🥏", true], - ["🥐", true], - ["🥑", true], - ["🥒", true], - ["🥓", true], - ["🥔", true], - ["🥕", true], - ["🥖", true], - ["🥗", true], - ["🥘", true], - ["🥙", true], - ["🥚", true], - ["🥛", true], - ["🥜", true], - ["🥝", true], - ["🥞", true], - ["🥟", true], - ["🥠", true], - ["🥡", true], - ["🥢", true], - ["🥣", true], - ["🥤", true], - ["🥥", true], - ["🥦", true], - ["🥧", true], - ["🥨", true], - ["🥩", true], - ["🥪", true], - ["🥫", true], - ["🥬", true], - ["🥭", true], - ["🥮", true], - ["🥯", true], - ["🥰", true], - ["🥱", true], - ["🥳", true], - ["🥴", true], - ["🥵", true], - ["🥶", true], - ["🥺", true], - ["🥻", true], - ["🥼", true], - ["🥽", true], - ["🥾", true], - ["🥿", true], - ["🦀", true], - ["🦁", true], - ["🦂", true], - ["🦃", true], - ["🦄", true], - ["🦅", true], - ["🦆", true], - ["🦇", true], - ["🦈", true], - ["🦉", true], - ["🦊", true], - ["🦋", true], - ["🦌", true], - ["🦍", true], - ["🦎", true], - ["🦏", true], - ["🦐", true], - ["🦑", true], - ["🦒", true], - ["🦓", true], - ["🦔", true], - ["🦕", true], - ["🦖", true], - ["🦗", true], - ["🦘", true], - ["🦙", true], - ["🦚", true], - ["🦛", true], - ["🦜", true], - ["🦝", true], - ["🦞", true], - ["🦟", true], - ["🦠", true], - ["🦡", true], - ["🦢", true], - ["🦥", true], - ["🦦", true], - ["🦧", true], - ["🦨", true], - ["🦩", true], - ["🦪", true], - ["🦮", true], - ["🦯", true], - ["🦰", true], - ["🦱", true], - ["🦲", true], - ["🦳", true], - ["🦴", true], - ["🦵🏻", true], - ["🦵🏼", true], - ["🦵🏽", true], - ["🦵🏾", true], - ["🦵🏿", true], - ["🦵", true], - ["🦶🏻", true], - ["🦶🏼", true], - ["🦶🏽", true], - ["🦶🏾", true], - ["🦶🏿", true], - ["🦶", true], - ["🦷", true], - ["🦸🏻♀️", true], - ["🦸🏻♂️", true], - ["🦸🏻", true], - ["🦸🏼♀️", true], - ["🦸🏼♂️", true], - ["🦸🏼", true], - ["🦸🏽♀️", true], - ["🦸🏽♂️", true], - ["🦸🏽", true], - ["🦸🏾♀️", true], - ["🦸🏾♂️", true], - ["🦸🏾", true], - ["🦸🏿♀️", true], - ["🦸🏿♂️", true], - ["🦸🏿", true], - ["🦸♀️", true], - ["🦸♂️", true], - ["🦸", true], - ["🦹🏻♀️", true], - ["🦹🏻♂️", true], - ["🦹🏻", true], - ["🦹🏼♀️", true], - ["🦹🏼♂️", true], - ["🦹🏼", true], - ["🦹🏽♀️", true], - ["🦹🏽♂️", true], - ["🦹🏽", true], - ["🦹🏾♀️", true], - ["🦹🏾♂️", true], - ["🦹🏾", true], - ["🦹🏿♀️", true], - ["🦹🏿♂️", true], - ["🦹🏿", true], - ["🦹♀️", true], - ["🦹♂️", true], - ["🦹", true], - ["🦺", true], - ["🦻🏻", true], - ["🦻🏼", true], - ["🦻🏽", true], - ["🦻🏾", true], - ["🦻🏿", true], - ["🦻", true], - ["🦼", true], - ["🦽", true], - ["🦾", true], - ["🦿", true], - ["🧀", true], - ["🧁", true], - ["🧂", true], - ["🧃", true], - ["🧄", true], - ["🧅", true], - ["🧆", true], - ["🧇", true], - ["🧈", true], - ["🧉", true], - ["🧊", true], - ["🧍🏻♀️", true], - ["🧍🏻♂️", true], - ["🧍🏻", true], - ["🧍🏼♀️", true], - ["🧍🏼♂️", true], - ["🧍🏼", true], - ["🧍🏽♀️", true], - ["🧍🏽♂️", true], - ["🧍🏽", true], - ["🧍🏾♀️", true], - ["🧍🏾♂️", true], - ["🧍🏾", true], - ["🧍🏿♀️", true], - ["🧍🏿♂️", true], - ["🧍🏿", true], - ["🧍♀️", true], - ["🧍♂️", true], - ["🧍", true], - ["🧎🏻♀️", true], - ["🧎🏻♂️", true], - ["🧎🏻", true], - ["🧎🏼♀️", true], - ["🧎🏼♂️", true], - ["🧎🏼", true], - ["🧎🏽♀️", true], - ["🧎🏽♂️", true], - ["🧎🏽", true], - ["🧎🏾♀️", true], - ["🧎🏾♂️", true], - ["🧎🏾", true], - ["🧎🏿♀️", true], - ["🧎🏿♂️", true], - ["🧎🏿", true], - ["🧎♀️", true], - ["🧎♂️", true], - ["🧎", true], - ["🧏🏻♀️", true], - ["🧏🏻♂️", true], - ["🧏🏻", true], - ["🧏🏼♀️", true], - ["🧏🏼♂️", true], - ["🧏🏼", true], - ["🧏🏽♀️", true], - ["🧏🏽♂️", true], - ["🧏🏽", true], - ["🧏🏾♀️", true], - ["🧏🏾♂️", true], - ["🧏🏾", true], - ["🧏🏿♀️", true], - ["🧏🏿♂️", true], - ["🧏🏿", true], - ["🧏♀️", true], - ["🧏♂️", true], - ["🧏", true], - ["🧐", true], - ["🧑🏻🤝🧑🏻", true], - ["🧑🏻", true], - ["🧑🏼🤝🧑🏻", true], - ["🧑🏼🤝🧑🏼", true], - ["🧑🏼", true], - ["🧑🏽🤝🧑🏻", true], - ["🧑🏽🤝🧑🏼", true], - ["🧑🏽🤝🧑🏽", true], - ["🧑🏽", true], - ["🧑🏾🤝🧑🏻", true], - ["🧑🏾🤝🧑🏼", true], - ["🧑🏾🤝🧑🏽", true], - ["🧑🏾🤝🧑🏾", true], - ["🧑🏾", true], - ["🧑🏿🤝🧑🏻", true], - ["🧑🏿🤝🧑🏼", true], - ["🧑🏿🤝🧑🏽", true], - ["🧑🏿🤝🧑🏾", true], - ["🧑🏿🤝🧑🏿", true], - ["🧑🏿", true], - ["🧑🤝🧑", true], - ["🧑", true], - ["🧒🏻", true], - ["🧒🏼", true], - ["🧒🏽", true], - ["🧒🏾", true], - ["🧒🏿", true], - ["🧒", true], - ["🧓🏻", true], - ["🧓🏼", true], - ["🧓🏽", true], - ["🧓🏾", true], - ["🧓🏿", true], - ["🧓", true], - ["🧔🏻", true], - ["🧔🏼", true], - ["🧔🏽", true], - ["🧔🏾", true], - ["🧔🏿", true], - ["🧔", true], - ["🧕🏻", true], - ["🧕🏼", true], - ["🧕🏽", true], - ["🧕🏾", true], - ["🧕🏿", true], - ["🧕", true], - ["🧖🏻♀️", true], - ["🧖🏻♂️", true], - ["🧖🏻", true], - ["🧖🏼♀️", true], - ["🧖🏼♂️", true], - ["🧖🏼", true], - ["🧖🏽♀️", true], - ["🧖🏽♂️", true], - ["🧖🏽", true], - ["🧖🏾♀️", true], - ["🧖🏾♂️", true], - ["🧖🏾", true], - ["🧖🏿♀️", true], - ["🧖🏿♂️", true], - ["🧖🏿", true], - ["🧖♀️", true], - ["🧖♂️", true], - ["🧖", true], - ["🧗🏻♀️", true], - ["🧗🏻♂️", true], - ["🧗🏻", true], - ["🧗🏼♀️", true], - ["🧗🏼♂️", true], - ["🧗🏼", true], - ["🧗🏽♀️", true], - ["🧗🏽♂️", true], - ["🧗🏽", true], - ["🧗🏾♀️", true], - ["🧗🏾♂️", true], - ["🧗🏾", true], - ["🧗🏿♀️", true], - ["🧗🏿♂️", true], - ["🧗🏿", true], - ["🧗♀️", true], - ["🧗♂️", true], - ["🧗", true], - ["🧘🏻♀️", true], - ["🧘🏻♂️", true], - ["🧘🏻", true], - ["🧘🏼♀️", true], - ["🧘🏼♂️", true], - ["🧘🏼", true], - ["🧘🏽♀️", true], - ["🧘🏽♂️", true], - ["🧘🏽", true], - ["🧘🏾♀️", true], - ["🧘🏾♂️", true], - ["🧘🏾", true], - ["🧘🏿♀️", true], - ["🧘🏿♂️", true], - ["🧘🏿", true], - ["🧘♀️", true], - ["🧘♂️", true], - ["🧘", true], - ["🧙🏻♀️", true], - ["🧙🏻♂️", true], - ["🧙🏻", true], - ["🧙🏼♀️", true], - ["🧙🏼♂️", true], - ["🧙🏼", true], - ["🧙🏽♀️", true], - ["🧙🏽♂️", true], - ["🧙🏽", true], - ["🧙🏾♀️", true], - ["🧙🏾♂️", true], - ["🧙🏾", true], - ["🧙🏿♀️", true], - ["🧙🏿♂️", true], - ["🧙🏿", true], - ["🧙♀️", true], - ["🧙♂️", true], - ["🧙", true], - ["🧚🏻♀️", true], - ["🧚🏻♂️", true], - ["🧚🏻", true], - ["🧚🏼♀️", true], - ["🧚🏼♂️", true], - ["🧚🏼", true], - ["🧚🏽♀️", true], - ["🧚🏽♂️", true], - ["🧚🏽", true], - ["🧚🏾♀️", true], - ["🧚🏾♂️", true], - ["🧚🏾", true], - ["🧚🏿♀️", true], - ["🧚🏿♂️", true], - ["🧚🏿", true], - ["🧚♀️", true], - ["🧚♂️", true], - ["🧚", true], - ["🧛🏻♀️", true], - ["🧛🏻♂️", true], - ["🧛🏻", true], - ["🧛🏼♀️", true], - ["🧛🏼♂️", true], - ["🧛🏼", true], - ["🧛🏽♀️", true], - ["🧛🏽♂️", true], - ["🧛🏽", true], - ["🧛🏾♀️", true], - ["🧛🏾♂️", true], - ["🧛🏾", true], - ["🧛🏿♀️", true], - ["🧛🏿♂️", true], - ["🧛🏿", true], - ["🧛♀️", true], - ["🧛♂️", true], - ["🧛", true], - ["🧜🏻♀️", true], - ["🧜🏻♂️", true], - ["🧜🏻", true], - ["🧜🏼♀️", true], - ["🧜🏼♂️", true], - ["🧜🏼", true], - ["🧜🏽♀️", true], - ["🧜🏽♂️", true], - ["🧜🏽", true], - ["🧜🏾♀️", true], - ["🧜🏾♂️", true], - ["🧜🏾", true], - ["🧜🏿♀️", true], - ["🧜🏿♂️", true], - ["🧜🏿", true], - ["🧜♀️", true], - ["🧜♂️", true], - ["🧜", true], - ["🧝🏻♀️", true], - ["🧝🏻♂️", true], - ["🧝🏻", true], - ["🧝🏼♀️", true], - ["🧝🏼♂️", true], - ["🧝🏼", true], - ["🧝🏽♀️", true], - ["🧝🏽♂️", true], - ["🧝🏽", true], - ["🧝🏾♀️", true], - ["🧝🏾♂️", true], - ["🧝🏾", true], - ["🧝🏿♀️", true], - ["🧝🏿♂️", true], - ["🧝🏿", true], - ["🧝♀️", true], - ["🧝♂️", true], - ["🧝", true], - ["🧞♀️", true], - ["🧞♂️", true], - ["🧞", true], - ["🧟♀️", true], - ["🧟♂️", true], - ["🧟", true], - ["🧠", true], - ["🧡", true], - ["🧢", true], - ["🧣", true], - ["🧤", true], - ["🧥", true], - ["🧦", true], - ["🧧", true], - ["🧨", true], - ["🧩", true], - ["🧪", true], - ["🧫", true], - ["🧬", true], - ["🧭", true], - ["🧮", true], - ["🧯", true], - ["🧰", true], - ["🧱", true], - ["🧲", true], - ["🧳", true], - ["🧴", true], - ["🧵", true], - ["🧶", true], - ["🧷", true], - ["🧸", true], - ["🧹", true], - ["🧺", true], - ["🧻", true], - ["🧼", true], - ["🧽", true], - ["🧾", true], - ["🧿", true], - ["🩰", true], - ["🩱", true], - ["🩲", true], - ["🩳", true], - ["🩸", true], - ["🩹", true], - ["🩺", true], - ["🪀", true], - ["🪁", true], - ["🪂", true], - ["🪐", true], - ["🪑", true], - ["🪒", true], - ["🪓", true], - ["🪔", true], - ["🪕", true], - ["‼️", true], - ["⁉️", true], - ["™️", true], - ["ℹ️", true], - ["↔️", true], - ["↕️", true], - ["↖️", true], - ["↗️", true], - ["↘️", true], - ["↙️", true], - ["↩️", true], - ["↪️", true], - ["#⃣", true], - ["⌚️", true], - ["⌛️", true], - ["⌨️", true], - ["⏏️", true], - ["⏩", true], - ["⏪", true], - ["⏫", true], - ["⏬", true], - ["⏭️", true], - ["⏮️", true], - ["⏯️", true], - ["⏰", true], - ["⏱️", true], - ["⏲️", true], - ["⏳", true], - ["⏸️", true], - ["⏹️", true], - ["⏺️", true], - ["Ⓜ️", true], - ["▪️", true], - ["▫️", true], - ["▶️", true], - ["◀️", true], - ["◻️", true], - ["◼️", true], - ["◽️", true], - ["◾️", true], - ["☀️", true], - ["☁️", true], - ["☂️", true], - ["☃️", true], - ["☄️", true], - ["☎️", true], - ["☑️", true], - ["☔️", true], - ["☕️", true], - ["☘️", true], - ["☝🏻", true], - ["☝🏼", true], - ["☝🏽", true], - ["☝🏾", true], - ["☝🏿", true], - ["☝️", true], - ["☠️", true], - ["☢️", true], - ["☣️", true], - ["☦️", true], - ["☪️", true], - ["☮️", true], - ["☯️", true], - ["☸️", true], - ["☹️", true], - ["☺️", true], - ["♀️", true], - ["♂️", true], - ["♈️", true], - ["♉️", true], - ["♊️", true], - ["♋️", true], - ["♌️", true], - ["♍️", true], - ["♎️", true], - ["♏️", true], - ["♐️", true], - ["♑️", true], - ["♒️", true], - ["♓️", true], - ["♟️", true], - ["♠️", true], - ["♣️", true], - ["♥️", true], - ["♦️", true], - ["♨️", true], - ["♻️", true], - ["♾", true], - ["♿️", true], - ["⚒️", true], - ["⚓️", true], - ["⚔️", true], - ["⚕️", true], - ["⚖️", true], - ["⚗️", true], - ["⚙️", true], - ["⚛️", true], - ["⚜️", true], - ["⚠️", true], - ["⚡️", true], - ["⚪️", true], - ["⚫️", true], - ["⚰️", true], - ["⚱️", true], - ["⚽️", true], - ["⚾️", true], - ["⛄️", true], - ["⛅️", true], - ["⛈️", true], - ["⛎", true], - ["⛏️", true], - ["⛑️", true], - ["⛓️", true], - ["⛔️", true], - ["⛩️", true], - ["⛪️", true], - ["⛰️", true], - ["⛱️", true], - ["⛲️", true], - ["⛳️", true], - ["⛴️", true], - ["⛵️", true], - ["⛷🏻", true], - ["⛷🏼", true], - ["⛷🏽", true], - ["⛷🏾", true], - ["⛷🏿", true], - ["⛷️", true], - ["⛸️", true], - ["⛹🏻♀️", true], - ["⛹🏻♂️", true], - ["⛹🏻", true], - ["⛹🏼♀️", true], - ["⛹🏼♂️", true], - ["⛹🏼", true], - ["⛹🏽♀️", true], - ["⛹🏽♂️", true], - ["⛹🏽", true], - ["⛹🏾♀️", true], - ["⛹🏾♂️", true], - ["⛹🏾", true], - ["⛹🏿♀️", true], - ["⛹🏿♂️", true], - ["⛹🏿", true], - ["⛹️♀️", true], - ["⛹️♂️", true], - ["⛹️", true], - ["⛺️", true], - ["⛽️", true], - ["✂️", true], - ["✅", true], - ["✈️", true], - ["✉️", true], - ["✊🏻", true], - ["✊🏼", true], - ["✊🏽", true], - ["✊🏾", true], - ["✊🏿", true], - ["✊", true], - ["✋🏻", true], - ["✋🏼", true], - ["✋🏽", true], - ["✋🏾", true], - ["✋🏿", true], - ["✋", true], - ["✌🏻", true], - ["✌🏼", true], - ["✌🏽", true], - ["✌🏾", true], - ["✌🏿", true], - ["✌️", true], - ["✍🏻", true], - ["✍🏼", true], - ["✍🏽", true], - ["✍🏾", true], - ["✍🏿", true], - ["✍️", true], - ["✏️", true], - ["✒️", true], - ["✔️", true], - ["✖️", true], - ["✝️", true], - ["✡️", true], - ["✨", true], - ["✳️", true], - ["✴️", true], - ["❄️", true], - ["❇️", true], - ["❌", true], - ["❎", true], - ["❓", true], - ["❔", true], - ["❕", true], - ["❗️", true], - ["❣️", true], - ["❤️", true], - ["➕", true], - ["➖", true], - ["➗", true], - ["➡️", true], - ["➰", true], - ["➿", true], - ["⤴️", true], - ["⤵️", true], - ["*⃣", true], - ["⬅️", true], - ["⬆️", true], - ["⬇️", true], - ["⬛️", true], - ["⬜️", true], - ["⭐️", true], - ["⭕️", true], - ["0⃣", true], - ["〰️", true], - ["〽️", true], - ["1⃣", true], - ["2⃣", true], - ["㊗️", true], - ["㊙️", true], - ["3⃣", true], - ["4⃣", true], - ["5⃣", true], - ["6⃣", true], - ["7⃣", true], - ["8⃣", true], - ["9⃣", true], - ["©️", true], - ["®️", true], + ['🀄️', true], + ['🃏', true], + ['🅰️', true], + ['🅱️', true], + ['🅾️', true], + ['🅿️', true], + ['🆎', true], + ['🆑', true], + ['🆒', true], + ['🆓', true], + ['🆔', true], + ['🆕', true], + ['🆖', true], + ['🆗', true], + ['🆘', true], + ['🆙', true], + ['🆚', true], + ['🇦🇨', true], + ['🇦🇩', true], + ['🇦🇪', true], + ['🇦🇫', true], + ['🇦🇬', true], + ['🇦🇮', true], + ['🇦🇱', true], + ['🇦🇲', true], + ['🇦🇴', true], + ['🇦🇶', true], + ['🇦🇷', true], + ['🇦🇸', true], + ['🇦🇹', true], + ['🇦🇺', true], + ['🇦🇼', true], + ['🇦🇽', true], + ['🇦🇿', true], + ['🇦', true], + ['🇧🇦', true], + ['🇧🇧', true], + ['🇧🇩', true], + ['🇧🇪', true], + ['🇧🇫', true], + ['🇧🇬', true], + ['🇧🇭', true], + ['🇧🇮', true], + ['🇧🇯', true], + ['🇧🇱', true], + ['🇧🇲', true], + ['🇧🇳', true], + ['🇧🇴', true], + ['🇧🇶', true], + ['🇧🇷', true], + ['🇧🇸', true], + ['🇧🇹', true], + ['🇧🇻', true], + ['🇧🇼', true], + ['🇧🇾', true], + ['🇧🇿', true], + ['🇧', true], + ['🇨🇦', true], + ['🇨🇨', true], + ['🇨🇩', true], + ['🇨🇫', true], + ['🇨🇬', true], + ['🇨🇭', true], + ['🇨🇮', true], + ['🇨🇰', true], + ['🇨🇱', true], + ['🇨🇲', true], + ['🇨🇳', true], + ['🇨🇴', true], + ['🇨🇵', true], + ['🇨🇷', true], + ['🇨🇺', true], + ['🇨🇻', true], + ['🇨🇼', true], + ['🇨🇽', true], + ['🇨🇾', true], + ['🇨🇿', true], + ['🇨', true], + ['🇩🇪', true], + ['🇩🇬', true], + ['🇩🇯', true], + ['🇩🇰', true], + ['🇩🇲', true], + ['🇩🇴', true], + ['🇩🇿', true], + ['🇩', true], + ['🇪🇦', true], + ['🇪🇨', true], + ['🇪🇪', true], + ['🇪🇬', true], + ['🇪🇭', true], + ['🇪🇷', true], + ['🇪🇸', true], + ['🇪🇹', true], + ['🇪🇺', true], + ['🇪', true], + ['🇫🇮', true], + ['🇫🇯', true], + ['🇫🇰', true], + ['🇫🇲', true], + ['🇫🇴', true], + ['🇫🇷', true], + ['🇫', true], + ['🇬🇦', true], + ['🇬🇧', true], + ['🇬🇩', true], + ['🇬🇪', true], + ['🇬🇫', true], + ['🇬🇬', true], + ['🇬🇭', true], + ['🇬🇮', true], + ['🇬🇱', true], + ['🇬🇲', true], + ['🇬🇳', true], + ['🇬🇵', true], + ['🇬🇶', true], + ['🇬🇷', true], + ['🇬🇸', true], + ['🇬🇹', true], + ['🇬🇺', true], + ['🇬🇼', true], + ['🇬🇾', true], + ['🇬', true], + ['🇭🇰', true], + ['🇭🇲', true], + ['🇭🇳', true], + ['🇭🇷', true], + ['🇭🇹', true], + ['🇭🇺', true], + ['🇭', true], + ['🇮🇨', true], + ['🇮🇩', true], + ['🇮🇪', true], + ['🇮🇱', true], + ['🇮🇲', true], + ['🇮🇳', true], + ['🇮🇴', true], + ['🇮🇶', true], + ['🇮🇷', true], + ['🇮🇸', true], + ['🇮🇹', true], + ['🇮', true], + ['🇯🇪', true], + ['🇯🇲', true], + ['🇯🇴', true], + ['🇯🇵', true], + ['🇯', true], + ['🇰🇪', true], + ['🇰🇬', true], + ['🇰🇭', true], + ['🇰🇮', true], + ['🇰🇲', true], + ['🇰🇳', true], + ['🇰🇵', true], + ['🇰🇷', true], + ['🇰🇼', true], + ['🇰🇾', true], + ['🇰🇿', true], + ['🇰', true], + ['🇱🇦', true], + ['🇱🇧', true], + ['🇱🇨', true], + ['🇱🇮', true], + ['🇱🇰', true], + ['🇱🇷', true], + ['🇱🇸', true], + ['🇱🇹', true], + ['🇱🇺', true], + ['🇱🇻', true], + ['🇱🇾', true], + ['🇱', true], + ['🇲🇦', true], + ['🇲🇨', true], + ['🇲🇩', true], + ['🇲🇪', true], + ['🇲🇫', true], + ['🇲🇬', true], + ['🇲🇭', true], + ['🇲🇰', true], + ['🇲🇱', true], + ['🇲🇲', true], + ['🇲🇳', true], + ['🇲🇴', true], + ['🇲🇵', true], + ['🇲🇶', true], + ['🇲🇷', true], + ['🇲🇸', true], + ['🇲🇹', true], + ['🇲🇺', true], + ['🇲🇻', true], + ['🇲🇼', true], + ['🇲🇽', true], + ['🇲🇾', true], + ['🇲🇿', true], + ['🇲', true], + ['🇳🇦', true], + ['🇳🇨', true], + ['🇳🇪', true], + ['🇳🇫', true], + ['🇳🇬', true], + ['🇳🇮', true], + ['🇳🇱', true], + ['🇳🇴', true], + ['🇳🇵', true], + ['🇳🇷', true], + ['🇳🇺', true], + ['🇳🇿', true], + ['🇳', true], + ['🇴🇲', true], + ['🇴', true], + ['🇵🇦', true], + ['🇵🇪', true], + ['🇵🇫', true], + ['🇵🇬', true], + ['🇵🇭', true], + ['🇵🇰', true], + ['🇵🇱', true], + ['🇵🇲', true], + ['🇵🇳', true], + ['🇵🇷', true], + ['🇵🇸', true], + ['🇵🇹', true], + ['🇵🇼', true], + ['🇵🇾', true], + ['🇵', true], + ['🇶🇦', true], + ['🇶', true], + ['🇷🇪', true], + ['🇷🇴', true], + ['🇷🇸', true], + ['🇷🇺', true], + ['🇷🇼', true], + ['🇷', true], + ['🇸🇦', true], + ['🇸🇧', true], + ['🇸🇨', true], + ['🇸🇩', true], + ['🇸🇪', true], + ['🇸🇬', true], + ['🇸🇭', true], + ['🇸🇮', true], + ['🇸🇯', true], + ['🇸🇰', true], + ['🇸🇱', true], + ['🇸🇲', true], + ['🇸🇳', true], + ['🇸🇴', true], + ['🇸🇷', true], + ['🇸🇸', true], + ['🇸🇹', true], + ['🇸🇻', true], + ['🇸🇽', true], + ['🇸🇾', true], + ['🇸🇿', true], + ['🇸', true], + ['🇹🇦', true], + ['🇹🇨', true], + ['🇹🇩', true], + ['🇹🇫', true], + ['🇹🇬', true], + ['🇹🇭', true], + ['🇹🇯', true], + ['🇹🇰', true], + ['🇹🇱', true], + ['🇹🇲', true], + ['🇹🇳', true], + ['🇹🇴', true], + ['🇹🇷', true], + ['🇹🇹', true], + ['🇹🇻', true], + ['🇹🇼', true], + ['🇹🇿', true], + ['🇹', true], + ['🇺🇦', true], + ['🇺🇬', true], + ['🇺🇲', true], + ['🇺🇳', true], + ['🇺🇸', true], + ['🇺🇾', true], + ['🇺🇿', true], + ['🇺', true], + ['🇻🇦', true], + ['🇻🇨', true], + ['🇻🇪', true], + ['🇻🇬', true], + ['🇻🇮', true], + ['🇻🇳', true], + ['🇻🇺', true], + ['🇻', true], + ['🇼🇫', true], + ['🇼🇸', true], + ['🇼', true], + ['🇽🇰', true], + ['🇽', true], + ['🇾🇪', true], + ['🇾🇹', true], + ['🇾', true], + ['🇿🇦', true], + ['🇿🇲', true], + ['🇿🇼', true], + ['🇿', true], + ['🈁', true], + ['🈂️', true], + ['🈚️', true], + ['🈯️', true], + ['🈲', true], + ['🈳', true], + ['🈴', true], + ['🈵', true], + ['🈶', true], + ['🈷️', true], + ['🈸', true], + ['🈹', true], + ['🈺', true], + ['🉐', true], + ['🉑', true], + ['🌀', true], + ['🌁', true], + ['🌂', true], + ['🌃', true], + ['🌄', true], + ['🌅', true], + ['🌆', true], + ['🌇', true], + ['🌈', true], + ['🌉', true], + ['🌊', true], + ['🌋', true], + ['🌌', true], + ['🌍', true], + ['🌎', true], + ['🌏', true], + ['🌐', true], + ['🌑', true], + ['🌒', true], + ['🌓', true], + ['🌔', true], + ['🌕', true], + ['🌖', true], + ['🌗', true], + ['🌘', true], + ['🌙', true], + ['🌚', true], + ['🌛', true], + ['🌜', true], + ['🌝', true], + ['🌞', true], + ['🌟', true], + ['🌠', true], + ['🌡️', true], + ['🌤️', true], + ['🌥️', true], + ['🌦️', true], + ['🌧️', true], + ['🌨️', true], + ['🌩️', true], + ['🌪️', true], + ['🌫️', true], + ['🌬️', true], + ['🌭', true], + ['🌮', true], + ['🌯', true], + ['🌰', true], + ['🌱', true], + ['🌲', true], + ['🌳', true], + ['🌴', true], + ['🌵', true], + ['🌶️', true], + ['🌷', true], + ['🌸', true], + ['🌹', true], + ['🌺', true], + ['🌻', true], + ['🌼', true], + ['🌽', true], + ['🌾', true], + ['🌿', true], + ['🍀', true], + ['🍁', true], + ['🍂', true], + ['🍃', true], + ['🍄', true], + ['🍅', true], + ['🍆', true], + ['🍇', true], + ['🍈', true], + ['🍉', true], + ['🍊', true], + ['🍋', true], + ['🍌', true], + ['🍍', true], + ['🍎', true], + ['🍏', true], + ['🍐', true], + ['🍑', true], + ['🍒', true], + ['🍓', true], + ['🍔', true], + ['🍕', true], + ['🍖', true], + ['🍗', true], + ['🍘', true], + ['🍙', true], + ['🍚', true], + ['🍛', true], + ['🍜', true], + ['🍝', true], + ['🍞', true], + ['🍟', true], + ['🍠', true], + ['🍡', true], + ['🍢', true], + ['🍣', true], + ['🍤', true], + ['🍥', true], + ['🍦', true], + ['🍧', true], + ['🍨', true], + ['🍩', true], + ['🍪', true], + ['🍫', true], + ['🍬', true], + ['🍭', true], + ['🍮', true], + ['🍯', true], + ['🍰', true], + ['🍱', true], + ['🍲', true], + ['🍳', true], + ['🍴', true], + ['🍵', true], + ['🍶', true], + ['🍷', true], + ['🍸', true], + ['🍹', true], + ['🍺', true], + ['🍻', true], + ['🍼', true], + ['🍽️', true], + ['🍾', true], + ['🍿', true], + ['🎀', true], + ['🎁', true], + ['🎂', true], + ['🎃', true], + ['🎄', true], + ['🎅🏻', true], + ['🎅🏼', true], + ['🎅🏽', true], + ['🎅🏾', true], + ['🎅🏿', true], + ['🎅', true], + ['🎆', true], + ['🎇', true], + ['🎈', true], + ['🎉', true], + ['🎊', true], + ['🎋', true], + ['🎌', true], + ['🎍', true], + ['🎎', true], + ['🎏', true], + ['🎐', true], + ['🎑', true], + ['🎒', true], + ['🎓', true], + ['🎖️', true], + ['🎗️', true], + ['🎙️', true], + ['🎚️', true], + ['🎛️', true], + ['🎞️', true], + ['🎟️', true], + ['🎠', true], + ['🎡', true], + ['🎢', true], + ['🎣', true], + ['🎤', true], + ['🎥', true], + ['🎦', true], + ['🎧', true], + ['🎨', true], + ['🎩', true], + ['🎪', true], + ['🎫', true], + ['🎬', true], + ['🎭', true], + ['🎮', true], + ['🎯', true], + ['🎰', true], + ['🎱', true], + ['🎲', true], + ['🎳', true], + ['🎴', true], + ['🎵', true], + ['🎶', true], + ['🎷', true], + ['🎸', true], + ['🎹', true], + ['🎺', true], + ['🎻', true], + ['🎼', true], + ['🎽', true], + ['🎾', true], + ['🎿', true], + ['🏀', true], + ['🏁', true], + ['🏂🏻', true], + ['🏂🏼', true], + ['🏂🏽', true], + ['🏂🏾', true], + ['🏂🏿', true], + ['🏂', true], + ['🏃🏻♀️', true], + ['🏃🏻♂️', true], + ['🏃🏻', true], + ['🏃🏼♀️', true], + ['🏃🏼♂️', true], + ['🏃🏼', true], + ['🏃🏽♀️', true], + ['🏃🏽♂️', true], + ['🏃🏽', true], + ['🏃🏾♀️', true], + ['🏃🏾♂️', true], + ['🏃🏾', true], + ['🏃🏿♀️', true], + ['🏃🏿♂️', true], + ['🏃🏿', true], + ['🏃♀️', true], + ['🏃♂️', true], + ['🏃', true], + ['🏄🏻♀️', true], + ['🏄🏻♂️', true], + ['🏄🏻', true], + ['🏄🏼♀️', true], + ['🏄🏼♂️', true], + ['🏄🏼', true], + ['🏄🏽♀️', true], + ['🏄🏽♂️', true], + ['🏄🏽', true], + ['🏄🏾♀️', true], + ['🏄🏾♂️', true], + ['🏄🏾', true], + ['🏄🏿♀️', true], + ['🏄🏿♂️', true], + ['🏄🏿', true], + ['🏄♀️', true], + ['🏄♂️', true], + ['🏄', true], + ['🏅', true], + ['🏆', true], + ['🏇🏻', true], + ['🏇🏼', true], + ['🏇🏽', true], + ['🏇🏾', true], + ['🏇🏿', true], + ['🏇', true], + ['🏈', true], + ['🏉', true], + ['🏊🏻♀️', true], + ['🏊🏻♂️', true], + ['🏊🏻', true], + ['🏊🏼♀️', true], + ['🏊🏼♂️', true], + ['🏊🏼', true], + ['🏊🏽♀️', true], + ['🏊🏽♂️', true], + ['🏊🏽', true], + ['🏊🏾♀️', true], + ['🏊🏾♂️', true], + ['🏊🏾', true], + ['🏊🏿♀️', true], + ['🏊🏿♂️', true], + ['🏊🏿', true], + ['🏊♀️', true], + ['🏊♂️', true], + ['🏊', true], + ['🏋🏻♀️', true], + ['🏋🏻♂️', true], + ['🏋🏻', true], + ['🏋🏼♀️', true], + ['🏋🏼♂️', true], + ['🏋🏼', true], + ['🏋🏽♀️', true], + ['🏋🏽♂️', true], + ['🏋🏽', true], + ['🏋🏾♀️', true], + ['🏋🏾♂️', true], + ['🏋🏾', true], + ['🏋🏿♀️', true], + ['🏋🏿♂️', true], + ['🏋🏿', true], + ['🏋️♀️', true], + ['🏋️♂️', true], + ['🏋️', true], + ['🏌🏻♀️', true], + ['🏌🏻♂️', true], + ['🏌🏻', true], + ['🏌🏼♀️', true], + ['🏌🏼♂️', true], + ['🏌🏼', true], + ['🏌🏽♀️', true], + ['🏌🏽♂️', true], + ['🏌🏽', true], + ['🏌🏾♀️', true], + ['🏌🏾♂️', true], + ['🏌🏾', true], + ['🏌🏿♀️', true], + ['🏌🏿♂️', true], + ['🏌🏿', true], + ['🏌️♀️', true], + ['🏌️♂️', true], + ['🏌️', true], + ['🏍️', true], + ['🏎️', true], + ['🏏', true], + ['🏐', true], + ['🏑', true], + ['🏒', true], + ['🏓', true], + ['🏔️', true], + ['🏕️', true], + ['🏖️', true], + ['🏗️', true], + ['🏘️', true], + ['🏙️', true], + ['🏚️', true], + ['🏛️', true], + ['🏜️', true], + ['🏝️', true], + ['🏞️', true], + ['🏟️', true], + ['🏠', true], + ['🏡', true], + ['🏢', true], + ['🏣', true], + ['🏤', true], + ['🏥', true], + ['🏦', true], + ['🏧', true], + ['🏨', true], + ['🏩', true], + ['🏪', true], + ['🏫', true], + ['🏬', true], + ['🏭', true], + ['🏮', true], + ['🏯', true], + ['🏰', true], + ['🏳️🌈', true], + ['🏳️', true], + ['🏴☠️', true], + ['🏴', true], + ['🏴', true], + ['🏴', true], + ['🏴', true], + ['🏵️', true], + ['🏷️', true], + ['🏸', true], + ['🏹', true], + ['🏺', true], + ['🏻', true], + ['🏼', true], + ['🏽', true], + ['🏾', true], + ['🏿', true], + ['🐀', true], + ['🐁', true], + ['🐂', true], + ['🐃', true], + ['🐄', true], + ['🐅', true], + ['🐆', true], + ['🐇', true], + ['🐈', true], + ['🐉', true], + ['🐊', true], + ['🐋', true], + ['🐌', true], + ['🐍', true], + ['🐎', true], + ['🐏', true], + ['🐐', true], + ['🐑', true], + ['🐒', true], + ['🐓', true], + ['🐔', true], + ['🐕🦺', true], + ['🐕', true], + ['🐖', true], + ['🐗', true], + ['🐘', true], + ['🐙', true], + ['🐚', true], + ['🐛', true], + ['🐜', true], + ['🐝', true], + ['🐞', true], + ['🐟', true], + ['🐠', true], + ['🐡', true], + ['🐢', true], + ['🐣', true], + ['🐤', true], + ['🐥', true], + ['🐦', true], + ['🐧', true], + ['🐨', true], + ['🐩', true], + ['🐪', true], + ['🐫', true], + ['🐬', true], + ['🐭', true], + ['🐮', true], + ['🐯', true], + ['🐰', true], + ['🐱', true], + ['🐲', true], + ['🐳', true], + ['🐴', true], + ['🐵', true], + ['🐶', true], + ['🐷', true], + ['🐸', true], + ['🐹', true], + ['🐺', true], + ['🐻', true], + ['🐼', true], + ['🐽', true], + ['🐾', true], + ['🐿️', true], + ['👀', true], + ['👁🗨', true], + ['👁️', true], + ['👂🏻', true], + ['👂🏼', true], + ['👂🏽', true], + ['👂🏾', true], + ['👂🏿', true], + ['👂', true], + ['👃🏻', true], + ['👃🏼', true], + ['👃🏽', true], + ['👃🏾', true], + ['👃🏿', true], + ['👃', true], + ['👄', true], + ['👅', true], + ['👆🏻', true], + ['👆🏼', true], + ['👆🏽', true], + ['👆🏾', true], + ['👆🏿', true], + ['👆', true], + ['👇🏻', true], + ['👇🏼', true], + ['👇🏽', true], + ['👇🏾', true], + ['👇🏿', true], + ['👇', true], + ['👈🏻', true], + ['👈🏼', true], + ['👈🏽', true], + ['👈🏾', true], + ['👈🏿', true], + ['👈', true], + ['👉🏻', true], + ['👉🏼', true], + ['👉🏽', true], + ['👉🏾', true], + ['👉🏿', true], + ['👉', true], + ['👊🏻', true], + ['👊🏼', true], + ['👊🏽', true], + ['👊🏾', true], + ['👊🏿', true], + ['👊', true], + ['👋🏻', true], + ['👋🏼', true], + ['👋🏽', true], + ['👋🏾', true], + ['👋🏿', true], + ['👋', true], + ['👌🏻', true], + ['👌🏼', true], + ['👌🏽', true], + ['👌🏾', true], + ['👌🏿', true], + ['👌', true], + ['👍🏻', true], + ['👍🏼', true], + ['👍🏽', true], + ['👍🏾', true], + ['👍🏿', true], + ['👍', true], + ['👎🏻', true], + ['👎🏼', true], + ['👎🏽', true], + ['👎🏾', true], + ['👎🏿', true], + ['👎', true], + ['👏🏻', true], + ['👏🏼', true], + ['👏🏽', true], + ['👏🏾', true], + ['👏🏿', true], + ['👏', true], + ['👐🏻', true], + ['👐🏼', true], + ['👐🏽', true], + ['👐🏾', true], + ['👐🏿', true], + ['👐', true], + ['👑', true], + ['👒', true], + ['👓', true], + ['👔', true], + ['👕', true], + ['👖', true], + ['👗', true], + ['👘', true], + ['👙', true], + ['👚', true], + ['👛', true], + ['👜', true], + ['👝', true], + ['👞', true], + ['👟', true], + ['👠', true], + ['👡', true], + ['👢', true], + ['👣', true], + ['👤', true], + ['👥', true], + ['👦🏻', true], + ['👦🏼', true], + ['👦🏽', true], + ['👦🏾', true], + ['👦🏿', true], + ['👦', true], + ['👧🏻', true], + ['👧🏼', true], + ['👧🏽', true], + ['👧🏾', true], + ['👧🏿', true], + ['👧', true], + ['👨🏻🌾', true], + ['👨🏻🍳', true], + ['👨🏻🎓', true], + ['👨🏻🎤', true], + ['👨🏻🎨', true], + ['👨🏻🏫', true], + ['👨🏻🏭', true], + ['👨🏻💻', true], + ['👨🏻💼', true], + ['👨🏻🔧', true], + ['👨🏻🔬', true], + ['👨🏻🚀', true], + ['👨🏻🚒', true], + ['👨🏻🦯', true], + ['👨🏻🦰', true], + ['👨🏻🦱', true], + ['👨🏻🦲', true], + ['👨🏻🦳', true], + ['👨🏻🦼', true], + ['👨🏻🦽', true], + ['👨🏻⚕️', true], + ['👨🏻⚖️', true], + ['👨🏻✈️', true], + ['👨🏻', true], + ['👨🏼🌾', true], + ['👨🏼🍳', true], + ['👨🏼🎓', true], + ['👨🏼🎤', true], + ['👨🏼🎨', true], + ['👨🏼🏫', true], + ['👨🏼🏭', true], + ['👨🏼💻', true], + ['👨🏼💼', true], + ['👨🏼🔧', true], + ['👨🏼🔬', true], + ['👨🏼🚀', true], + ['👨🏼🚒', true], + ['👨🏼🤝👨🏻', true], + ['👨🏼🦯', true], + ['👨🏼🦰', true], + ['👨🏼🦱', true], + ['👨🏼🦲', true], + ['👨🏼🦳', true], + ['👨🏼🦼', true], + ['👨🏼🦽', true], + ['👨🏼⚕️', true], + ['👨🏼⚖️', true], + ['👨🏼✈️', true], + ['👨🏼', true], + ['👨🏽🌾', true], + ['👨🏽🍳', true], + ['👨🏽🎓', true], + ['👨🏽🎤', true], + ['👨🏽🎨', true], + ['👨🏽🏫', true], + ['👨🏽🏭', true], + ['👨🏽💻', true], + ['👨🏽💼', true], + ['👨🏽🔧', true], + ['👨🏽🔬', true], + ['👨🏽🚀', true], + ['👨🏽🚒', true], + ['👨🏽🤝👨🏻', true], + ['👨🏽🤝👨🏼', true], + ['👨🏽🦯', true], + ['👨🏽🦰', true], + ['👨🏽🦱', true], + ['👨🏽🦲', true], + ['👨🏽🦳', true], + ['👨🏽🦼', true], + ['👨🏽🦽', true], + ['👨🏽⚕️', true], + ['👨🏽⚖️', true], + ['👨🏽✈️', true], + ['👨🏽', true], + ['👨🏾🌾', true], + ['👨🏾🍳', true], + ['👨🏾🎓', true], + ['👨🏾🎤', true], + ['👨🏾🎨', true], + ['👨🏾🏫', true], + ['👨🏾🏭', true], + ['👨🏾💻', true], + ['👨🏾💼', true], + ['👨🏾🔧', true], + ['👨🏾🔬', true], + ['👨🏾🚀', true], + ['👨🏾🚒', true], + ['👨🏾🤝👨🏻', true], + ['👨🏾🤝👨🏼', true], + ['👨🏾🤝👨🏽', true], + ['👨🏾🦯', true], + ['👨🏾🦰', true], + ['👨🏾🦱', true], + ['👨🏾🦲', true], + ['👨🏾🦳', true], + ['👨🏾🦼', true], + ['👨🏾🦽', true], + ['👨🏾⚕️', true], + ['👨🏾⚖️', true], + ['👨🏾✈️', true], + ['👨🏾', true], + ['👨🏿🌾', true], + ['👨🏿🍳', true], + ['👨🏿🎓', true], + ['👨🏿🎤', true], + ['👨🏿🎨', true], + ['👨🏿🏫', true], + ['👨🏿🏭', true], + ['👨🏿💻', true], + ['👨🏿💼', true], + ['👨🏿🔧', true], + ['👨🏿🔬', true], + ['👨🏿🚀', true], + ['👨🏿🚒', true], + ['👨🏿🤝👨🏻', true], + ['👨🏿🤝👨🏼', true], + ['👨🏿🤝👨🏽', true], + ['👨🏿🤝👨🏾', true], + ['👨🏿🦯', true], + ['👨🏿🦰', true], + ['👨🏿🦱', true], + ['👨🏿🦲', true], + ['👨🏿🦳', true], + ['👨🏿🦼', true], + ['👨🏿🦽', true], + ['👨🏿⚕️', true], + ['👨🏿⚖️', true], + ['👨🏿✈️', true], + ['👨🏿', true], + ['👨🌾', true], + ['👨🍳', true], + ['👨🎓', true], + ['👨🎤', true], + ['👨🎨', true], + ['👨🏫', true], + ['👨🏭', true], + ['👨👦👦', true], + ['👨👦', true], + ['👨👧👦', true], + ['👨👧👧', true], + ['👨👧', true], + ['👨👨👦👦', true], + ['👨👨👦', true], + ['👨👨👧👦', true], + ['👨👨👧👧', true], + ['👨👨👧', true], + ['👨👩👦👦', true], + ['👨👩👦', true], + ['👨👩👧👦', true], + ['👨👩👧👧', true], + ['👨👩👧', true], + ['👨💻', true], + ['👨💼', true], + ['👨🔧', true], + ['👨🔬', true], + ['👨🚀', true], + ['👨🚒', true], + ['👨🦯', true], + ['👨🦰', true], + ['👨🦱', true], + ['👨🦲', true], + ['👨🦳', true], + ['👨🦼', true], + ['👨🦽', true], + ['👨⚕️', true], + ['👨⚖️', true], + ['👨✈️', true], + ['👨❤️👨', true], + ['👨❤️💋👨', true], + ['👨', true], + ['👩🏻🌾', true], + ['👩🏻🍳', true], + ['👩🏻🎓', true], + ['👩🏻🎤', true], + ['👩🏻🎨', true], + ['👩🏻🏫', true], + ['👩🏻🏭', true], + ['👩🏻💻', true], + ['👩🏻💼', true], + ['👩🏻🔧', true], + ['👩🏻🔬', true], + ['👩🏻🚀', true], + ['👩🏻🚒', true], + ['👩🏻🤝👨🏼', true], + ['👩🏻🤝👨🏽', true], + ['👩🏻🤝👨🏾', true], + ['👩🏻🤝👨🏿', true], + ['👩🏻🦯', true], + ['👩🏻🦰', true], + ['👩🏻🦱', true], + ['👩🏻🦲', true], + ['👩🏻🦳', true], + ['👩🏻🦼', true], + ['👩🏻🦽', true], + ['👩🏻⚕️', true], + ['👩🏻⚖️', true], + ['👩🏻✈️', true], + ['👩🏻', true], + ['👩🏼🌾', true], + ['👩🏼🍳', true], + ['👩🏼🎓', true], + ['👩🏼🎤', true], + ['👩🏼🎨', true], + ['👩🏼🏫', true], + ['👩🏼🏭', true], + ['👩🏼💻', true], + ['👩🏼💼', true], + ['👩🏼🔧', true], + ['👩🏼🔬', true], + ['👩🏼🚀', true], + ['👩🏼🚒', true], + ['👩🏼🤝👨🏻', true], + ['👩🏼🤝👨🏽', true], + ['👩🏼🤝👨🏾', true], + ['👩🏼🤝👨🏿', true], + ['👩🏼🤝👩🏻', true], + ['👩🏼🦯', true], + ['👩🏼🦰', true], + ['👩🏼🦱', true], + ['👩🏼🦲', true], + ['👩🏼🦳', true], + ['👩🏼🦼', true], + ['👩🏼🦽', true], + ['👩🏼⚕️', true], + ['👩🏼⚖️', true], + ['👩🏼✈️', true], + ['👩🏼', true], + ['👩🏽🌾', true], + ['👩🏽🍳', true], + ['👩🏽🎓', true], + ['👩🏽🎤', true], + ['👩🏽🎨', true], + ['👩🏽🏫', true], + ['👩🏽🏭', true], + ['👩🏽💻', true], + ['👩🏽💼', true], + ['👩🏽🔧', true], + ['👩🏽🔬', true], + ['👩🏽🚀', true], + ['👩🏽🚒', true], + ['👩🏽🤝👨🏻', true], + ['👩🏽🤝👨🏼', true], + ['👩🏽🤝👨🏾', true], + ['👩🏽🤝👨🏿', true], + ['👩🏽🤝👩🏻', true], + ['👩🏽🤝👩🏼', true], + ['👩🏽🦯', true], + ['👩🏽🦰', true], + ['👩🏽🦱', true], + ['👩🏽🦲', true], + ['👩🏽🦳', true], + ['👩🏽🦼', true], + ['👩🏽🦽', true], + ['👩🏽⚕️', true], + ['👩🏽⚖️', true], + ['👩🏽✈️', true], + ['👩🏽', true], + ['👩🏾🌾', true], + ['👩🏾🍳', true], + ['👩🏾🎓', true], + ['👩🏾🎤', true], + ['👩🏾🎨', true], + ['👩🏾🏫', true], + ['👩🏾🏭', true], + ['👩🏾💻', true], + ['👩🏾💼', true], + ['👩🏾🔧', true], + ['👩🏾🔬', true], + ['👩🏾🚀', true], + ['👩🏾🚒', true], + ['👩🏾🤝👨🏻', true], + ['👩🏾🤝👨🏼', true], + ['👩🏾🤝👨🏽', true], + ['👩🏾🤝👨🏿', true], + ['👩🏾🤝👩🏻', true], + ['👩🏾🤝👩🏼', true], + ['👩🏾🤝👩🏽', true], + ['👩🏾🦯', true], + ['👩🏾🦰', true], + ['👩🏾🦱', true], + ['👩🏾🦲', true], + ['👩🏾🦳', true], + ['👩🏾🦼', true], + ['👩🏾🦽', true], + ['👩🏾⚕️', true], + ['👩🏾⚖️', true], + ['👩🏾✈️', true], + ['👩🏾', true], + ['👩🏿🌾', true], + ['👩🏿🍳', true], + ['👩🏿🎓', true], + ['👩🏿🎤', true], + ['👩🏿🎨', true], + ['👩🏿🏫', true], + ['👩🏿🏭', true], + ['👩🏿💻', true], + ['👩🏿💼', true], + ['👩🏿🔧', true], + ['👩🏿🔬', true], + ['👩🏿🚀', true], + ['👩🏿🚒', true], + ['👩🏿🤝👨🏻', true], + ['👩🏿🤝👨🏼', true], + ['👩🏿🤝👨🏽', true], + ['👩🏿🤝👨🏾', true], + ['👩🏿🤝👩🏻', true], + ['👩🏿🤝👩🏼', true], + ['👩🏿🤝👩🏽', true], + ['👩🏿🤝👩🏾', true], + ['👩🏿🦯', true], + ['👩🏿🦰', true], + ['👩🏿🦱', true], + ['👩🏿🦲', true], + ['👩🏿🦳', true], + ['👩🏿🦼', true], + ['👩🏿🦽', true], + ['👩🏿⚕️', true], + ['👩🏿⚖️', true], + ['👩🏿✈️', true], + ['👩🏿', true], + ['👩🌾', true], + ['👩🍳', true], + ['👩🎓', true], + ['👩🎤', true], + ['👩🎨', true], + ['👩🏫', true], + ['👩🏭', true], + ['👩👦👦', true], + ['👩👦', true], + ['👩👧👦', true], + ['👩👧👧', true], + ['👩👧', true], + ['👩👩👦👦', true], + ['👩👩👦', true], + ['👩👩👧👦', true], + ['👩👩👧👧', true], + ['👩👩👧', true], + ['👩💻', true], + ['👩💼', true], + ['👩🔧', true], + ['👩🔬', true], + ['👩🚀', true], + ['👩🚒', true], + ['👩🦯', true], + ['👩🦰', true], + ['👩🦱', true], + ['👩🦲', true], + ['👩🦳', true], + ['👩🦼', true], + ['👩🦽', true], + ['👩⚕️', true], + ['👩⚖️', true], + ['👩✈️', true], + ['👩❤️👨', true], + ['👩❤️👩', true], + ['👩❤️💋👨', true], + ['👩❤️💋👩', true], + ['👩', true], + ['👪', true], + ['👫🏻', true], + ['👫🏼', true], + ['👫🏽', true], + ['👫🏾', true], + ['👫🏿', true], + ['👫', true], + ['👬🏻', true], + ['👬🏼', true], + ['👬🏽', true], + ['👬🏾', true], + ['👬🏿', true], + ['👬', true], + ['👭🏻', true], + ['👭🏼', true], + ['👭🏽', true], + ['👭🏾', true], + ['👭🏿', true], + ['👭', true], + ['👮🏻♀️', true], + ['👮🏻♂️', true], + ['👮🏻', true], + ['👮🏼♀️', true], + ['👮🏼♂️', true], + ['👮🏼', true], + ['👮🏽♀️', true], + ['👮🏽♂️', true], + ['👮🏽', true], + ['👮🏾♀️', true], + ['👮🏾♂️', true], + ['👮🏾', true], + ['👮🏿♀️', true], + ['👮🏿♂️', true], + ['👮🏿', true], + ['👮♀️', true], + ['👮♂️', true], + ['👮', true], + ['👯♀️', true], + ['👯♂️', true], + ['👯', true], + ['👰🏻', true], + ['👰🏼', true], + ['👰🏽', true], + ['👰🏾', true], + ['👰🏿', true], + ['👰', true], + ['👱🏻♀️', true], + ['👱🏻♂️', true], + ['👱🏻', true], + ['👱🏼♀️', true], + ['👱🏼♂️', true], + ['👱🏼', true], + ['👱🏽♀️', true], + ['👱🏽♂️', true], + ['👱🏽', true], + ['👱🏾♀️', true], + ['👱🏾♂️', true], + ['👱🏾', true], + ['👱🏿♀️', true], + ['👱🏿♂️', true], + ['👱🏿', true], + ['👱♀️', true], + ['👱♂️', true], + ['👱', true], + ['👲🏻', true], + ['👲🏼', true], + ['👲🏽', true], + ['👲🏾', true], + ['👲🏿', true], + ['👲', true], + ['👳🏻♀️', true], + ['👳🏻♂️', true], + ['👳🏻', true], + ['👳🏼♀️', true], + ['👳🏼♂️', true], + ['👳🏼', true], + ['👳🏽♀️', true], + ['👳🏽♂️', true], + ['👳🏽', true], + ['👳🏾♀️', true], + ['👳🏾♂️', true], + ['👳🏾', true], + ['👳🏿♀️', true], + ['👳🏿♂️', true], + ['👳🏿', true], + ['👳♀️', true], + ['👳♂️', true], + ['👳', true], + ['👴🏻', true], + ['👴🏼', true], + ['👴🏽', true], + ['👴🏾', true], + ['👴🏿', true], + ['👴', true], + ['👵🏻', true], + ['👵🏼', true], + ['👵🏽', true], + ['👵🏾', true], + ['👵🏿', true], + ['👵', true], + ['👶🏻', true], + ['👶🏼', true], + ['👶🏽', true], + ['👶🏾', true], + ['👶🏿', true], + ['👶', true], + ['👷🏻♀️', true], + ['👷🏻♂️', true], + ['👷🏻', true], + ['👷🏼♀️', true], + ['👷🏼♂️', true], + ['👷🏼', true], + ['👷🏽♀️', true], + ['👷🏽♂️', true], + ['👷🏽', true], + ['👷🏾♀️', true], + ['👷🏾♂️', true], + ['👷🏾', true], + ['👷🏿♀️', true], + ['👷🏿♂️', true], + ['👷🏿', true], + ['👷♀️', true], + ['👷♂️', true], + ['👷', true], + ['👸🏻', true], + ['👸🏼', true], + ['👸🏽', true], + ['👸🏾', true], + ['👸🏿', true], + ['👸', true], + ['👹', true], + ['👺', true], + ['👻', true], + ['👼🏻', true], + ['👼🏼', true], + ['👼🏽', true], + ['👼🏾', true], + ['👼🏿', true], + ['👼', true], + ['👽', true], + ['👾', true], + ['👿', true], + ['💀', true], + ['💁🏻♀️', true], + ['💁🏻♂️', true], + ['💁🏻', true], + ['💁🏼♀️', true], + ['💁🏼♂️', true], + ['💁🏼', true], + ['💁🏽♀️', true], + ['💁🏽♂️', true], + ['💁🏽', true], + ['💁🏾♀️', true], + ['💁🏾♂️', true], + ['💁🏾', true], + ['💁🏿♀️', true], + ['💁🏿♂️', true], + ['💁🏿', true], + ['💁♀️', true], + ['💁♂️', true], + ['💁', true], + ['💂🏻♀️', true], + ['💂🏻♂️', true], + ['💂🏻', true], + ['💂🏼♀️', true], + ['💂🏼♂️', true], + ['💂🏼', true], + ['💂🏽♀️', true], + ['💂🏽♂️', true], + ['💂🏽', true], + ['💂🏾♀️', true], + ['💂🏾♂️', true], + ['💂🏾', true], + ['💂🏿♀️', true], + ['💂🏿♂️', true], + ['💂🏿', true], + ['💂♀️', true], + ['💂♂️', true], + ['💂', true], + ['💃🏻', true], + ['💃🏼', true], + ['💃🏽', true], + ['💃🏾', true], + ['💃🏿', true], + ['💃', true], + ['💄', true], + ['💅🏻', true], + ['💅🏼', true], + ['💅🏽', true], + ['💅🏾', true], + ['💅🏿', true], + ['💅', true], + ['💆🏻♀️', true], + ['💆🏻♂️', true], + ['💆🏻', true], + ['💆🏼♀️', true], + ['💆🏼♂️', true], + ['💆🏼', true], + ['💆🏽♀️', true], + ['💆🏽♂️', true], + ['💆🏽', true], + ['💆🏾♀️', true], + ['💆🏾♂️', true], + ['💆🏾', true], + ['💆🏿♀️', true], + ['💆🏿♂️', true], + ['💆🏿', true], + ['💆♀️', true], + ['💆♂️', true], + ['💆', true], + ['💇🏻♀️', true], + ['💇🏻♂️', true], + ['💇🏻', true], + ['💇🏼♀️', true], + ['💇🏼♂️', true], + ['💇🏼', true], + ['💇🏽♀️', true], + ['💇🏽♂️', true], + ['💇🏽', true], + ['💇🏾♀️', true], + ['💇🏾♂️', true], + ['💇🏾', true], + ['💇🏿♀️', true], + ['💇🏿♂️', true], + ['💇🏿', true], + ['💇♀️', true], + ['💇♂️', true], + ['💇', true], + ['💈', true], + ['💉', true], + ['💊', true], + ['💋', true], + ['💌', true], + ['💍', true], + ['💎', true], + ['💏', true], + ['💐', true], + ['💑', true], + ['💒', true], + ['💓', true], + ['💔', true], + ['💕', true], + ['💖', true], + ['💗', true], + ['💘', true], + ['💙', true], + ['💚', true], + ['💛', true], + ['💜', true], + ['💝', true], + ['💞', true], + ['💟', true], + ['💠', true], + ['💡', true], + ['💢', true], + ['💣', true], + ['💤', true], + ['💥', true], + ['💦', true], + ['💧', true], + ['💨', true], + ['💩', true], + ['💪🏻', true], + ['💪🏼', true], + ['💪🏽', true], + ['💪🏾', true], + ['💪🏿', true], + ['💪', true], + ['💫', true], + ['💬', true], + ['💭', true], + ['💮', true], + ['💯', true], + ['💰', true], + ['💱', true], + ['💲', true], + ['💳', true], + ['💴', true], + ['💵', true], + ['💶', true], + ['💷', true], + ['💸', true], + ['💹', true], + ['💺', true], + ['💻', true], + ['💼', true], + ['💽', true], + ['💾', true], + ['💿', true], + ['📀', true], + ['📁', true], + ['📂', true], + ['📃', true], + ['📄', true], + ['📅', true], + ['📆', true], + ['📇', true], + ['📈', true], + ['📉', true], + ['📊', true], + ['📋', true], + ['📌', true], + ['📍', true], + ['📎', true], + ['📏', true], + ['📐', true], + ['📑', true], + ['📒', true], + ['📓', true], + ['📔', true], + ['📕', true], + ['📖', true], + ['📗', true], + ['📘', true], + ['📙', true], + ['📚', true], + ['📛', true], + ['📜', true], + ['📝', true], + ['📞', true], + ['📟', true], + ['📠', true], + ['📡', true], + ['📢', true], + ['📣', true], + ['📤', true], + ['📥', true], + ['📦', true], + ['📧', true], + ['📨', true], + ['📩', true], + ['📪', true], + ['📫', true], + ['📬', true], + ['📭', true], + ['📮', true], + ['📯', true], + ['📰', true], + ['📱', true], + ['📲', true], + ['📳', true], + ['📴', true], + ['📵', true], + ['📶', true], + ['📷', true], + ['📸', true], + ['📹', true], + ['📺', true], + ['📻', true], + ['📼', true], + ['📽️', true], + ['📿', true], + ['🔀', true], + ['🔁', true], + ['🔂', true], + ['🔃', true], + ['🔄', true], + ['🔅', true], + ['🔆', true], + ['🔇', true], + ['🔈', true], + ['🔉', true], + ['🔊', true], + ['🔋', true], + ['🔌', true], + ['🔍', true], + ['🔎', true], + ['🔏', true], + ['🔐', true], + ['🔑', true], + ['🔒', true], + ['🔓', true], + ['🔔', true], + ['🔕', true], + ['🔖', true], + ['🔗', true], + ['🔘', true], + ['🔙', true], + ['🔚', true], + ['🔛', true], + ['🔜', true], + ['🔝', true], + ['🔞', true], + ['🔟', true], + ['🔠', true], + ['🔡', true], + ['🔢', true], + ['🔣', true], + ['🔤', true], + ['🔥', true], + ['🔦', true], + ['🔧', true], + ['🔨', true], + ['🔩', true], + ['🔪', true], + ['🔫', true], + ['🔬', true], + ['🔭', true], + ['🔮', true], + ['🔯', true], + ['🔰', true], + ['🔱', true], + ['🔲', true], + ['🔳', true], + ['🔴', true], + ['🔵', true], + ['🔶', true], + ['🔷', true], + ['🔸', true], + ['🔹', true], + ['🔺', true], + ['🔻', true], + ['🔼', true], + ['🔽', true], + ['🕉️', true], + ['🕊️', true], + ['🕋', true], + ['🕌', true], + ['🕍', true], + ['🕎', true], + ['🕐', true], + ['🕑', true], + ['🕒', true], + ['🕓', true], + ['🕔', true], + ['🕕', true], + ['🕖', true], + ['🕗', true], + ['🕘', true], + ['🕙', true], + ['🕚', true], + ['🕛', true], + ['🕜', true], + ['🕝', true], + ['🕞', true], + ['🕟', true], + ['🕠', true], + ['🕡', true], + ['🕢', true], + ['🕣', true], + ['🕤', true], + ['🕥', true], + ['🕦', true], + ['🕧', true], + ['🕯️', true], + ['🕰️', true], + ['🕳️', true], + ['🕴🏻♀️', true], + ['🕴🏻♂️', true], + ['🕴🏻', true], + ['🕴🏼♀️', true], + ['🕴🏼♂️', true], + ['🕴🏼', true], + ['🕴🏽♀️', true], + ['🕴🏽♂️', true], + ['🕴🏽', true], + ['🕴🏾♀️', true], + ['🕴🏾♂️', true], + ['🕴🏾', true], + ['🕴🏿♀️', true], + ['🕴🏿♂️', true], + ['🕴🏿', true], + ['🕴️♀️', true], + ['🕴️♂️', true], + ['🕴️', true], + ['🕵🏻♀️', true], + ['🕵🏻♂️', true], + ['🕵🏻', true], + ['🕵🏼♀️', true], + ['🕵🏼♂️', true], + ['🕵🏼', true], + ['🕵🏽♀️', true], + ['🕵🏽♂️', true], + ['🕵🏽', true], + ['🕵🏾♀️', true], + ['🕵🏾♂️', true], + ['🕵🏾', true], + ['🕵🏿♀️', true], + ['🕵🏿♂️', true], + ['🕵🏿', true], + ['🕵️♀️', true], + ['🕵️♂️', true], + ['🕵️', true], + ['🕶️', true], + ['🕷️', true], + ['🕸️', true], + ['🕹️', true], + ['🕺🏻', true], + ['🕺🏼', true], + ['🕺🏽', true], + ['🕺🏾', true], + ['🕺🏿', true], + ['🕺', true], + ['🖇️', true], + ['🖊️', true], + ['🖋️', true], + ['🖌️', true], + ['🖍️', true], + ['🖐🏻', true], + ['🖐🏼', true], + ['🖐🏽', true], + ['🖐🏾', true], + ['🖐🏿', true], + ['🖐️', true], + ['🖕🏻', true], + ['🖕🏼', true], + ['🖕🏽', true], + ['🖕🏾', true], + ['🖕🏿', true], + ['🖕', true], + ['🖖🏻', true], + ['🖖🏼', true], + ['🖖🏽', true], + ['🖖🏾', true], + ['🖖🏿', true], + ['🖖', true], + ['🖤', true], + ['🖥️', true], + ['🖨️', true], + ['🖱️', true], + ['🖲️', true], + ['🖼️', true], + ['🗂️', true], + ['🗃️', true], + ['🗄️', true], + ['🗑️', true], + ['🗒️', true], + ['🗓️', true], + ['🗜️', true], + ['🗝️', true], + ['🗞️', true], + ['🗡️', true], + ['🗣️', true], + ['🗨️', true], + ['🗯️', true], + ['🗳️', true], + ['🗺️', true], + ['🗻', true], + ['🗼', true], + ['🗽', true], + ['🗾', true], + ['🗿', true], + ['😀', true], + ['😁', true], + ['😂', true], + ['😃', true], + ['😄', true], + ['😅', true], + ['😆', true], + ['😇', true], + ['😈', true], + ['😉', true], + ['😊', true], + ['😋', true], + ['😌', true], + ['😍', true], + ['😎', true], + ['😏', true], + ['😐', true], + ['😑', true], + ['😒', true], + ['😓', true], + ['😔', true], + ['😕', true], + ['😖', true], + ['😗', true], + ['😘', true], + ['😙', true], + ['😚', true], + ['😛', true], + ['😜', true], + ['😝', true], + ['😞', true], + ['😟', true], + ['😠', true], + ['😡', true], + ['😢', true], + ['😣', true], + ['😤', true], + ['😥', true], + ['😦', true], + ['😧', true], + ['😨', true], + ['😩', true], + ['😪', true], + ['😫', true], + ['😬', true], + ['😭', true], + ['😮', true], + ['😯', true], + ['😰', true], + ['😱', true], + ['😲', true], + ['😳', true], + ['😴', true], + ['😵', true], + ['😶', true], + ['😷', true], + ['😸', true], + ['😹', true], + ['😺', true], + ['😻', true], + ['😼', true], + ['😽', true], + ['😾', true], + ['😿', true], + ['🙀', true], + ['🙁', true], + ['🙂', true], + ['🙃', true], + ['🙄', true], + ['🙅🏻♀️', true], + ['🙅🏻♂️', true], + ['🙅🏻', true], + ['🙅🏼♀️', true], + ['🙅🏼♂️', true], + ['🙅🏼', true], + ['🙅🏽♀️', true], + ['🙅🏽♂️', true], + ['🙅🏽', true], + ['🙅🏾♀️', true], + ['🙅🏾♂️', true], + ['🙅🏾', true], + ['🙅🏿♀️', true], + ['🙅🏿♂️', true], + ['🙅🏿', true], + ['🙅♀️', true], + ['🙅♂️', true], + ['🙅', true], + ['🙆🏻♀️', true], + ['🙆🏻♂️', true], + ['🙆🏻', true], + ['🙆🏼♀️', true], + ['🙆🏼♂️', true], + ['🙆🏼', true], + ['🙆🏽♀️', true], + ['🙆🏽♂️', true], + ['🙆🏽', true], + ['🙆🏾♀️', true], + ['🙆🏾♂️', true], + ['🙆🏾', true], + ['🙆🏿♀️', true], + ['🙆🏿♂️', true], + ['🙆🏿', true], + ['🙆♀️', true], + ['🙆♂️', true], + ['🙆', true], + ['🙇🏻♀️', true], + ['🙇🏻♂️', true], + ['🙇🏻', true], + ['🙇🏼♀️', true], + ['🙇🏼♂️', true], + ['🙇🏼', true], + ['🙇🏽♀️', true], + ['🙇🏽♂️', true], + ['🙇🏽', true], + ['🙇🏾♀️', true], + ['🙇🏾♂️', true], + ['🙇🏾', true], + ['🙇🏿♀️', true], + ['🙇🏿♂️', true], + ['🙇🏿', true], + ['🙇♀️', true], + ['🙇♂️', true], + ['🙇', true], + ['🙈', true], + ['🙉', true], + ['🙊', true], + ['🙋🏻♀️', true], + ['🙋🏻♂️', true], + ['🙋🏻', true], + ['🙋🏼♀️', true], + ['🙋🏼♂️', true], + ['🙋🏼', true], + ['🙋🏽♀️', true], + ['🙋🏽♂️', true], + ['🙋🏽', true], + ['🙋🏾♀️', true], + ['🙋🏾♂️', true], + ['🙋🏾', true], + ['🙋🏿♀️', true], + ['🙋🏿♂️', true], + ['🙋🏿', true], + ['🙋♀️', true], + ['🙋♂️', true], + ['🙋', true], + ['🙌🏻', true], + ['🙌🏼', true], + ['🙌🏽', true], + ['🙌🏾', true], + ['🙌🏿', true], + ['🙌', true], + ['🙍🏻♀️', true], + ['🙍🏻♂️', true], + ['🙍🏻', true], + ['🙍🏼♀️', true], + ['🙍🏼♂️', true], + ['🙍🏼', true], + ['🙍🏽♀️', true], + ['🙍🏽♂️', true], + ['🙍🏽', true], + ['🙍🏾♀️', true], + ['🙍🏾♂️', true], + ['🙍🏾', true], + ['🙍🏿♀️', true], + ['🙍🏿♂️', true], + ['🙍🏿', true], + ['🙍♀️', true], + ['🙍♂️', true], + ['🙍', true], + ['🙎🏻♀️', true], + ['🙎🏻♂️', true], + ['🙎🏻', true], + ['🙎🏼♀️', true], + ['🙎🏼♂️', true], + ['🙎🏼', true], + ['🙎🏽♀️', true], + ['🙎🏽♂️', true], + ['🙎🏽', true], + ['🙎🏾♀️', true], + ['🙎🏾♂️', true], + ['🙎🏾', true], + ['🙎🏿♀️', true], + ['🙎🏿♂️', true], + ['🙎🏿', true], + ['🙎♀️', true], + ['🙎♂️', true], + ['🙎', true], + ['🙏🏻', true], + ['🙏🏼', true], + ['🙏🏽', true], + ['🙏🏾', true], + ['🙏🏿', true], + ['🙏', true], + ['🚀', true], + ['🚁', true], + ['🚂', true], + ['🚃', true], + ['🚄', true], + ['🚅', true], + ['🚆', true], + ['🚇', true], + ['🚈', true], + ['🚉', true], + ['🚊', true], + ['🚋', true], + ['🚌', true], + ['🚍', true], + ['🚎', true], + ['🚏', true], + ['🚐', true], + ['🚑', true], + ['🚒', true], + ['🚓', true], + ['🚔', true], + ['🚕', true], + ['🚖', true], + ['🚗', true], + ['🚘', true], + ['🚙', true], + ['🚚', true], + ['🚛', true], + ['🚜', true], + ['🚝', true], + ['🚞', true], + ['🚟', true], + ['🚠', true], + ['🚡', true], + ['🚢', true], + ['🚣🏻♀️', true], + ['🚣🏻♂️', true], + ['🚣🏻', true], + ['🚣🏼♀️', true], + ['🚣🏼♂️', true], + ['🚣🏼', true], + ['🚣🏽♀️', true], + ['🚣🏽♂️', true], + ['🚣🏽', true], + ['🚣🏾♀️', true], + ['🚣🏾♂️', true], + ['🚣🏾', true], + ['🚣🏿♀️', true], + ['🚣🏿♂️', true], + ['🚣🏿', true], + ['🚣♀️', true], + ['🚣♂️', true], + ['🚣', true], + ['🚤', true], + ['🚥', true], + ['🚦', true], + ['🚧', true], + ['🚨', true], + ['🚩', true], + ['🚪', true], + ['🚫', true], + ['🚬', true], + ['🚭', true], + ['🚮', true], + ['🚯', true], + ['🚰', true], + ['🚱', true], + ['🚲', true], + ['🚳', true], + ['🚴🏻♀️', true], + ['🚴🏻♂️', true], + ['🚴🏻', true], + ['🚴🏼♀️', true], + ['🚴🏼♂️', true], + ['🚴🏼', true], + ['🚴🏽♀️', true], + ['🚴🏽♂️', true], + ['🚴🏽', true], + ['🚴🏾♀️', true], + ['🚴🏾♂️', true], + ['🚴🏾', true], + ['🚴🏿♀️', true], + ['🚴🏿♂️', true], + ['🚴🏿', true], + ['🚴♀️', true], + ['🚴♂️', true], + ['🚴', true], + ['🚵🏻♀️', true], + ['🚵🏻♂️', true], + ['🚵🏻', true], + ['🚵🏼♀️', true], + ['🚵🏼♂️', true], + ['🚵🏼', true], + ['🚵🏽♀️', true], + ['🚵🏽♂️', true], + ['🚵🏽', true], + ['🚵🏾♀️', true], + ['🚵🏾♂️', true], + ['🚵🏾', true], + ['🚵🏿♀️', true], + ['🚵🏿♂️', true], + ['🚵🏿', true], + ['🚵♀️', true], + ['🚵♂️', true], + ['🚵', true], + ['🚶🏻♀️', true], + ['🚶🏻♂️', true], + ['🚶🏻', true], + ['🚶🏼♀️', true], + ['🚶🏼♂️', true], + ['🚶🏼', true], + ['🚶🏽♀️', true], + ['🚶🏽♂️', true], + ['🚶🏽', true], + ['🚶🏾♀️', true], + ['🚶🏾♂️', true], + ['🚶🏾', true], + ['🚶🏿♀️', true], + ['🚶🏿♂️', true], + ['🚶🏿', true], + ['🚶♀️', true], + ['🚶♂️', true], + ['🚶', true], + ['🚷', true], + ['🚸', true], + ['🚹', true], + ['🚺', true], + ['🚻', true], + ['🚼', true], + ['🚽', true], + ['🚾', true], + ['🚿', true], + ['🛀🏻', true], + ['🛀🏼', true], + ['🛀🏽', true], + ['🛀🏾', true], + ['🛀🏿', true], + ['🛀', true], + ['🛁', true], + ['🛂', true], + ['🛃', true], + ['🛄', true], + ['🛅', true], + ['🛋️', true], + ['🛌🏻', true], + ['🛌🏼', true], + ['🛌🏽', true], + ['🛌🏾', true], + ['🛌🏿', true], + ['🛌', true], + ['🛍️', true], + ['🛎️', true], + ['🛏️', true], + ['🛐', true], + ['🛑', true], + ['🛒', true], + ['🛕', true], + ['🛠️', true], + ['🛡️', true], + ['🛢️', true], + ['🛣️', true], + ['🛤️', true], + ['🛥️', true], + ['🛩️', true], + ['🛫', true], + ['🛬', true], + ['🛰️', true], + ['🛳️', true], + ['🛴', true], + ['🛵', true], + ['🛶', true], + ['🛷', true], + ['🛸', true], + ['🛹', true], + ['🛺', true], + ['🟠', true], + ['🟡', true], + ['🟢', true], + ['🟣', true], + ['🟤', true], + ['🟥', true], + ['🟦', true], + ['🟧', true], + ['🟨', true], + ['🟩', true], + ['🟪', true], + ['🟫', true], + ['🤍', true], + ['🤎', true], + ['🤏🏻', true], + ['🤏🏼', true], + ['🤏🏽', true], + ['🤏🏾', true], + ['🤏🏿', true], + ['🤏', true], + ['🤐', true], + ['🤑', true], + ['🤒', true], + ['🤓', true], + ['🤔', true], + ['🤕', true], + ['🤖', true], + ['🤗', true], + ['🤘🏻', true], + ['🤘🏼', true], + ['🤘🏽', true], + ['🤘🏾', true], + ['🤘🏿', true], + ['🤘', true], + ['🤙🏻', true], + ['🤙🏼', true], + ['🤙🏽', true], + ['🤙🏾', true], + ['🤙🏿', true], + ['🤙', true], + ['🤚🏻', true], + ['🤚🏼', true], + ['🤚🏽', true], + ['🤚🏾', true], + ['🤚🏿', true], + ['🤚', true], + ['🤛🏻', true], + ['🤛🏼', true], + ['🤛🏽', true], + ['🤛🏾', true], + ['🤛🏿', true], + ['🤛', true], + ['🤜🏻', true], + ['🤜🏼', true], + ['🤜🏽', true], + ['🤜🏾', true], + ['🤜🏿', true], + ['🤜', true], + ['🤝', true], + ['🤞🏻', true], + ['🤞🏼', true], + ['🤞🏽', true], + ['🤞🏾', true], + ['🤞🏿', true], + ['🤞', true], + ['🤟🏻', true], + ['🤟🏼', true], + ['🤟🏽', true], + ['🤟🏾', true], + ['🤟🏿', true], + ['🤟', true], + ['🤠', true], + ['🤡', true], + ['🤢', true], + ['🤣', true], + ['🤤', true], + ['🤥', true], + ['🤦🏻♀️', true], + ['🤦🏻♂️', true], + ['🤦🏻', true], + ['🤦🏼♀️', true], + ['🤦🏼♂️', true], + ['🤦🏼', true], + ['🤦🏽♀️', true], + ['🤦🏽♂️', true], + ['🤦🏽', true], + ['🤦🏾♀️', true], + ['🤦🏾♂️', true], + ['🤦🏾', true], + ['🤦🏿♀️', true], + ['🤦🏿♂️', true], + ['🤦🏿', true], + ['🤦♀️', true], + ['🤦♂️', true], + ['🤦', true], + ['🤧', true], + ['🤨', true], + ['🤩', true], + ['🤪', true], + ['🤫', true], + ['🤬', true], + ['🤭', true], + ['🤮', true], + ['🤯', true], + ['🤰🏻', true], + ['🤰🏼', true], + ['🤰🏽', true], + ['🤰🏾', true], + ['🤰🏿', true], + ['🤰', true], + ['🤱🏻', true], + ['🤱🏼', true], + ['🤱🏽', true], + ['🤱🏾', true], + ['🤱🏿', true], + ['🤱', true], + ['🤲🏻', true], + ['🤲🏼', true], + ['🤲🏽', true], + ['🤲🏾', true], + ['🤲🏿', true], + ['🤲', true], + ['🤳🏻', true], + ['🤳🏼', true], + ['🤳🏽', true], + ['🤳🏾', true], + ['🤳🏿', true], + ['🤳', true], + ['🤴🏻', true], + ['🤴🏼', true], + ['🤴🏽', true], + ['🤴🏾', true], + ['🤴🏿', true], + ['🤴', true], + ['🤵🏻♀️', true], + ['🤵🏻♂️', true], + ['🤵🏻', true], + ['🤵🏼♀️', true], + ['🤵🏼♂️', true], + ['🤵🏼', true], + ['🤵🏽♀️', true], + ['🤵🏽♂️', true], + ['🤵🏽', true], + ['🤵🏾♀️', true], + ['🤵🏾♂️', true], + ['🤵🏾', true], + ['🤵🏿♀️', true], + ['🤵🏿♂️', true], + ['🤵🏿', true], + ['🤵♀️', true], + ['🤵♂️', true], + ['🤵', true], + ['🤶🏻', true], + ['🤶🏼', true], + ['🤶🏽', true], + ['🤶🏾', true], + ['🤶🏿', true], + ['🤶', true], + ['🤷🏻♀️', true], + ['🤷🏻♂️', true], + ['🤷🏻', true], + ['🤷🏼♀️', true], + ['🤷🏼♂️', true], + ['🤷🏼', true], + ['🤷🏽♀️', true], + ['🤷🏽♂️', true], + ['🤷🏽', true], + ['🤷🏾♀️', true], + ['🤷🏾♂️', true], + ['🤷🏾', true], + ['🤷🏿♀️', true], + ['🤷🏿♂️', true], + ['🤷🏿', true], + ['🤷♀️', true], + ['🤷♂️', true], + ['🤷', true], + ['🤸🏻♀️', true], + ['🤸🏻♂️', true], + ['🤸🏻', true], + ['🤸🏼♀️', true], + ['🤸🏼♂️', true], + ['🤸🏼', true], + ['🤸🏽♀️', true], + ['🤸🏽♂️', true], + ['🤸🏽', true], + ['🤸🏾♀️', true], + ['🤸🏾♂️', true], + ['🤸🏾', true], + ['🤸🏿♀️', true], + ['🤸🏿♂️', true], + ['🤸🏿', true], + ['🤸♀️', true], + ['🤸♂️', true], + ['🤸', true], + ['🤹🏻♀️', true], + ['🤹🏻♂️', true], + ['🤹🏻', true], + ['🤹🏼♀️', true], + ['🤹🏼♂️', true], + ['🤹🏼', true], + ['🤹🏽♀️', true], + ['🤹🏽♂️', true], + ['🤹🏽', true], + ['🤹🏾♀️', true], + ['🤹🏾♂️', true], + ['🤹🏾', true], + ['🤹🏿♀️', true], + ['🤹🏿♂️', true], + ['🤹🏿', true], + ['🤹♀️', true], + ['🤹♂️', true], + ['🤹', true], + ['🤺', true], + ['🤼♀️', true], + ['🤼♂️', true], + ['🤼', true], + ['🤽🏻♀️', true], + ['🤽🏻♂️', true], + ['🤽🏻', true], + ['🤽🏼♀️', true], + ['🤽🏼♂️', true], + ['🤽🏼', true], + ['🤽🏽♀️', true], + ['🤽🏽♂️', true], + ['🤽🏽', true], + ['🤽🏾♀️', true], + ['🤽🏾♂️', true], + ['🤽🏾', true], + ['🤽🏿♀️', true], + ['🤽🏿♂️', true], + ['🤽🏿', true], + ['🤽♀️', true], + ['🤽♂️', true], + ['🤽', true], + ['🤾🏻♀️', true], + ['🤾🏻♂️', true], + ['🤾🏻', true], + ['🤾🏼♀️', true], + ['🤾🏼♂️', true], + ['🤾🏼', true], + ['🤾🏽♀️', true], + ['🤾🏽♂️', true], + ['🤾🏽', true], + ['🤾🏾♀️', true], + ['🤾🏾♂️', true], + ['🤾🏾', true], + ['🤾🏿♀️', true], + ['🤾🏿♂️', true], + ['🤾🏿', true], + ['🤾♀️', true], + ['🤾♂️', true], + ['🤾', true], + ['🤿', true], + ['🥀', true], + ['🥁', true], + ['🥂', true], + ['🥃', true], + ['🥄', true], + ['🥅', true], + ['🥇', true], + ['🥈', true], + ['🥉', true], + ['🥊', true], + ['🥋', true], + ['🥌', true], + ['🥍', true], + ['🥎', true], + ['🥏', true], + ['🥐', true], + ['🥑', true], + ['🥒', true], + ['🥓', true], + ['🥔', true], + ['🥕', true], + ['🥖', true], + ['🥗', true], + ['🥘', true], + ['🥙', true], + ['🥚', true], + ['🥛', true], + ['🥜', true], + ['🥝', true], + ['🥞', true], + ['🥟', true], + ['🥠', true], + ['🥡', true], + ['🥢', true], + ['🥣', true], + ['🥤', true], + ['🥥', true], + ['🥦', true], + ['🥧', true], + ['🥨', true], + ['🥩', true], + ['🥪', true], + ['🥫', true], + ['🥬', true], + ['🥭', true], + ['🥮', true], + ['🥯', true], + ['🥰', true], + ['🥱', true], + ['🥳', true], + ['🥴', true], + ['🥵', true], + ['🥶', true], + ['🥺', true], + ['🥻', true], + ['🥼', true], + ['🥽', true], + ['🥾', true], + ['🥿', true], + ['🦀', true], + ['🦁', true], + ['🦂', true], + ['🦃', true], + ['🦄', true], + ['🦅', true], + ['🦆', true], + ['🦇', true], + ['🦈', true], + ['🦉', true], + ['🦊', true], + ['🦋', true], + ['🦌', true], + ['🦍', true], + ['🦎', true], + ['🦏', true], + ['🦐', true], + ['🦑', true], + ['🦒', true], + ['🦓', true], + ['🦔', true], + ['🦕', true], + ['🦖', true], + ['🦗', true], + ['🦘', true], + ['🦙', true], + ['🦚', true], + ['🦛', true], + ['🦜', true], + ['🦝', true], + ['🦞', true], + ['🦟', true], + ['🦠', true], + ['🦡', true], + ['🦢', true], + ['🦥', true], + ['🦦', true], + ['🦧', true], + ['🦨', true], + ['🦩', true], + ['🦪', true], + ['🦮', true], + ['🦯', true], + ['🦰', true], + ['🦱', true], + ['🦲', true], + ['🦳', true], + ['🦴', true], + ['🦵🏻', true], + ['🦵🏼', true], + ['🦵🏽', true], + ['🦵🏾', true], + ['🦵🏿', true], + ['🦵', true], + ['🦶🏻', true], + ['🦶🏼', true], + ['🦶🏽', true], + ['🦶🏾', true], + ['🦶🏿', true], + ['🦶', true], + ['🦷', true], + ['🦸🏻♀️', true], + ['🦸🏻♂️', true], + ['🦸🏻', true], + ['🦸🏼♀️', true], + ['🦸🏼♂️', true], + ['🦸🏼', true], + ['🦸🏽♀️', true], + ['🦸🏽♂️', true], + ['🦸🏽', true], + ['🦸🏾♀️', true], + ['🦸🏾♂️', true], + ['🦸🏾', true], + ['🦸🏿♀️', true], + ['🦸🏿♂️', true], + ['🦸🏿', true], + ['🦸♀️', true], + ['🦸♂️', true], + ['🦸', true], + ['🦹🏻♀️', true], + ['🦹🏻♂️', true], + ['🦹🏻', true], + ['🦹🏼♀️', true], + ['🦹🏼♂️', true], + ['🦹🏼', true], + ['🦹🏽♀️', true], + ['🦹🏽♂️', true], + ['🦹🏽', true], + ['🦹🏾♀️', true], + ['🦹🏾♂️', true], + ['🦹🏾', true], + ['🦹🏿♀️', true], + ['🦹🏿♂️', true], + ['🦹🏿', true], + ['🦹♀️', true], + ['🦹♂️', true], + ['🦹', true], + ['🦺', true], + ['🦻🏻', true], + ['🦻🏼', true], + ['🦻🏽', true], + ['🦻🏾', true], + ['🦻🏿', true], + ['🦻', true], + ['🦼', true], + ['🦽', true], + ['🦾', true], + ['🦿', true], + ['🧀', true], + ['🧁', true], + ['🧂', true], + ['🧃', true], + ['🧄', true], + ['🧅', true], + ['🧆', true], + ['🧇', true], + ['🧈', true], + ['🧉', true], + ['🧊', true], + ['🧍🏻♀️', true], + ['🧍🏻♂️', true], + ['🧍🏻', true], + ['🧍🏼♀️', true], + ['🧍🏼♂️', true], + ['🧍🏼', true], + ['🧍🏽♀️', true], + ['🧍🏽♂️', true], + ['🧍🏽', true], + ['🧍🏾♀️', true], + ['🧍🏾♂️', true], + ['🧍🏾', true], + ['🧍🏿♀️', true], + ['🧍🏿♂️', true], + ['🧍🏿', true], + ['🧍♀️', true], + ['🧍♂️', true], + ['🧍', true], + ['🧎🏻♀️', true], + ['🧎🏻♂️', true], + ['🧎🏻', true], + ['🧎🏼♀️', true], + ['🧎🏼♂️', true], + ['🧎🏼', true], + ['🧎🏽♀️', true], + ['🧎🏽♂️', true], + ['🧎🏽', true], + ['🧎🏾♀️', true], + ['🧎🏾♂️', true], + ['🧎🏾', true], + ['🧎🏿♀️', true], + ['🧎🏿♂️', true], + ['🧎🏿', true], + ['🧎♀️', true], + ['🧎♂️', true], + ['🧎', true], + ['🧏🏻♀️', true], + ['🧏🏻♂️', true], + ['🧏🏻', true], + ['🧏🏼♀️', true], + ['🧏🏼♂️', true], + ['🧏🏼', true], + ['🧏🏽♀️', true], + ['🧏🏽♂️', true], + ['🧏🏽', true], + ['🧏🏾♀️', true], + ['🧏🏾♂️', true], + ['🧏🏾', true], + ['🧏🏿♀️', true], + ['🧏🏿♂️', true], + ['🧏🏿', true], + ['🧏♀️', true], + ['🧏♂️', true], + ['🧏', true], + ['🧐', true], + ['🧑🏻🤝🧑🏻', true], + ['🧑🏻', true], + ['🧑🏼🤝🧑🏻', true], + ['🧑🏼🤝🧑🏼', true], + ['🧑🏼', true], + ['🧑🏽🤝🧑🏻', true], + ['🧑🏽🤝🧑🏼', true], + ['🧑🏽🤝🧑🏽', true], + ['🧑🏽', true], + ['🧑🏾🤝🧑🏻', true], + ['🧑🏾🤝🧑🏼', true], + ['🧑🏾🤝🧑🏽', true], + ['🧑🏾🤝🧑🏾', true], + ['🧑🏾', true], + ['🧑🏿🤝🧑🏻', true], + ['🧑🏿🤝🧑🏼', true], + ['🧑🏿🤝🧑🏽', true], + ['🧑🏿🤝🧑🏾', true], + ['🧑🏿🤝🧑🏿', true], + ['🧑🏿', true], + ['🧑🤝🧑', true], + ['🧑', true], + ['🧒🏻', true], + ['🧒🏼', true], + ['🧒🏽', true], + ['🧒🏾', true], + ['🧒🏿', true], + ['🧒', true], + ['🧓🏻', true], + ['🧓🏼', true], + ['🧓🏽', true], + ['🧓🏾', true], + ['🧓🏿', true], + ['🧓', true], + ['🧔🏻', true], + ['🧔🏼', true], + ['🧔🏽', true], + ['🧔🏾', true], + ['🧔🏿', true], + ['🧔', true], + ['🧕🏻', true], + ['🧕🏼', true], + ['🧕🏽', true], + ['🧕🏾', true], + ['🧕🏿', true], + ['🧕', true], + ['🧖🏻♀️', true], + ['🧖🏻♂️', true], + ['🧖🏻', true], + ['🧖🏼♀️', true], + ['🧖🏼♂️', true], + ['🧖🏼', true], + ['🧖🏽♀️', true], + ['🧖🏽♂️', true], + ['🧖🏽', true], + ['🧖🏾♀️', true], + ['🧖🏾♂️', true], + ['🧖🏾', true], + ['🧖🏿♀️', true], + ['🧖🏿♂️', true], + ['🧖🏿', true], + ['🧖♀️', true], + ['🧖♂️', true], + ['🧖', true], + ['🧗🏻♀️', true], + ['🧗🏻♂️', true], + ['🧗🏻', true], + ['🧗🏼♀️', true], + ['🧗🏼♂️', true], + ['🧗🏼', true], + ['🧗🏽♀️', true], + ['🧗🏽♂️', true], + ['🧗🏽', true], + ['🧗🏾♀️', true], + ['🧗🏾♂️', true], + ['🧗🏾', true], + ['🧗🏿♀️', true], + ['🧗🏿♂️', true], + ['🧗🏿', true], + ['🧗♀️', true], + ['🧗♂️', true], + ['🧗', true], + ['🧘🏻♀️', true], + ['🧘🏻♂️', true], + ['🧘🏻', true], + ['🧘🏼♀️', true], + ['🧘🏼♂️', true], + ['🧘🏼', true], + ['🧘🏽♀️', true], + ['🧘🏽♂️', true], + ['🧘🏽', true], + ['🧘🏾♀️', true], + ['🧘🏾♂️', true], + ['🧘🏾', true], + ['🧘🏿♀️', true], + ['🧘🏿♂️', true], + ['🧘🏿', true], + ['🧘♀️', true], + ['🧘♂️', true], + ['🧘', true], + ['🧙🏻♀️', true], + ['🧙🏻♂️', true], + ['🧙🏻', true], + ['🧙🏼♀️', true], + ['🧙🏼♂️', true], + ['🧙🏼', true], + ['🧙🏽♀️', true], + ['🧙🏽♂️', true], + ['🧙🏽', true], + ['🧙🏾♀️', true], + ['🧙🏾♂️', true], + ['🧙🏾', true], + ['🧙🏿♀️', true], + ['🧙🏿♂️', true], + ['🧙🏿', true], + ['🧙♀️', true], + ['🧙♂️', true], + ['🧙', true], + ['🧚🏻♀️', true], + ['🧚🏻♂️', true], + ['🧚🏻', true], + ['🧚🏼♀️', true], + ['🧚🏼♂️', true], + ['🧚🏼', true], + ['🧚🏽♀️', true], + ['🧚🏽♂️', true], + ['🧚🏽', true], + ['🧚🏾♀️', true], + ['🧚🏾♂️', true], + ['🧚🏾', true], + ['🧚🏿♀️', true], + ['🧚🏿♂️', true], + ['🧚🏿', true], + ['🧚♀️', true], + ['🧚♂️', true], + ['🧚', true], + ['🧛🏻♀️', true], + ['🧛🏻♂️', true], + ['🧛🏻', true], + ['🧛🏼♀️', true], + ['🧛🏼♂️', true], + ['🧛🏼', true], + ['🧛🏽♀️', true], + ['🧛🏽♂️', true], + ['🧛🏽', true], + ['🧛🏾♀️', true], + ['🧛🏾♂️', true], + ['🧛🏾', true], + ['🧛🏿♀️', true], + ['🧛🏿♂️', true], + ['🧛🏿', true], + ['🧛♀️', true], + ['🧛♂️', true], + ['🧛', true], + ['🧜🏻♀️', true], + ['🧜🏻♂️', true], + ['🧜🏻', true], + ['🧜🏼♀️', true], + ['🧜🏼♂️', true], + ['🧜🏼', true], + ['🧜🏽♀️', true], + ['🧜🏽♂️', true], + ['🧜🏽', true], + ['🧜🏾♀️', true], + ['🧜🏾♂️', true], + ['🧜🏾', true], + ['🧜🏿♀️', true], + ['🧜🏿♂️', true], + ['🧜🏿', true], + ['🧜♀️', true], + ['🧜♂️', true], + ['🧜', true], + ['🧝🏻♀️', true], + ['🧝🏻♂️', true], + ['🧝🏻', true], + ['🧝🏼♀️', true], + ['🧝🏼♂️', true], + ['🧝🏼', true], + ['🧝🏽♀️', true], + ['🧝🏽♂️', true], + ['🧝🏽', true], + ['🧝🏾♀️', true], + ['🧝🏾♂️', true], + ['🧝🏾', true], + ['🧝🏿♀️', true], + ['🧝🏿♂️', true], + ['🧝🏿', true], + ['🧝♀️', true], + ['🧝♂️', true], + ['🧝', true], + ['🧞♀️', true], + ['🧞♂️', true], + ['🧞', true], + ['🧟♀️', true], + ['🧟♂️', true], + ['🧟', true], + ['🧠', true], + ['🧡', true], + ['🧢', true], + ['🧣', true], + ['🧤', true], + ['🧥', true], + ['🧦', true], + ['🧧', true], + ['🧨', true], + ['🧩', true], + ['🧪', true], + ['🧫', true], + ['🧬', true], + ['🧭', true], + ['🧮', true], + ['🧯', true], + ['🧰', true], + ['🧱', true], + ['🧲', true], + ['🧳', true], + ['🧴', true], + ['🧵', true], + ['🧶', true], + ['🧷', true], + ['🧸', true], + ['🧹', true], + ['🧺', true], + ['🧻', true], + ['🧼', true], + ['🧽', true], + ['🧾', true], + ['🧿', true], + ['🩰', true], + ['🩱', true], + ['🩲', true], + ['🩳', true], + ['🩸', true], + ['🩹', true], + ['🩺', true], + ['🪀', true], + ['🪁', true], + ['🪂', true], + ['🪐', true], + ['🪑', true], + ['🪒', true], + ['🪓', true], + ['🪔', true], + ['🪕', true], + ['‼️', true], + ['⁉️', true], + ['™️', true], + ['ℹ️', true], + ['↔️', true], + ['↕️', true], + ['↖️', true], + ['↗️', true], + ['↘️', true], + ['↙️', true], + ['↩️', true], + ['↪️', true], + ['#⃣', true], + ['⌚️', true], + ['⌛️', true], + ['⌨️', true], + ['⏏️', true], + ['⏩', true], + ['⏪', true], + ['⏫', true], + ['⏬', true], + ['⏭️', true], + ['⏮️', true], + ['⏯️', true], + ['⏰', true], + ['⏱️', true], + ['⏲️', true], + ['⏳', true], + ['⏸️', true], + ['⏹️', true], + ['⏺️', true], + ['Ⓜ️', true], + ['▪️', true], + ['▫️', true], + ['▶️', true], + ['◀️', true], + ['◻️', true], + ['◼️', true], + ['◽️', true], + ['◾️', true], + ['☀️', true], + ['☁️', true], + ['☂️', true], + ['☃️', true], + ['☄️', true], + ['☎️', true], + ['☑️', true], + ['☔️', true], + ['☕️', true], + ['☘️', true], + ['☝🏻', true], + ['☝🏼', true], + ['☝🏽', true], + ['☝🏾', true], + ['☝🏿', true], + ['☝️', true], + ['☠️', true], + ['☢️', true], + ['☣️', true], + ['☦️', true], + ['☪️', true], + ['☮️', true], + ['☯️', true], + ['☸️', true], + ['☹️', true], + ['☺️', true], + ['♀️', true], + ['♂️', true], + ['♈️', true], + ['♉️', true], + ['♊️', true], + ['♋️', true], + ['♌️', true], + ['♍️', true], + ['♎️', true], + ['♏️', true], + ['♐️', true], + ['♑️', true], + ['♒️', true], + ['♓️', true], + ['♟️', true], + ['♠️', true], + ['♣️', true], + ['♥️', true], + ['♦️', true], + ['♨️', true], + ['♻️', true], + ['♾', true], + ['♿️', true], + ['⚒️', true], + ['⚓️', true], + ['⚔️', true], + ['⚕️', true], + ['⚖️', true], + ['⚗️', true], + ['⚙️', true], + ['⚛️', true], + ['⚜️', true], + ['⚠️', true], + ['⚡️', true], + ['⚪️', true], + ['⚫️', true], + ['⚰️', true], + ['⚱️', true], + ['⚽️', true], + ['⚾️', true], + ['⛄️', true], + ['⛅️', true], + ['⛈️', true], + ['⛎', true], + ['⛏️', true], + ['⛑️', true], + ['⛓️', true], + ['⛔️', true], + ['⛩️', true], + ['⛪️', true], + ['⛰️', true], + ['⛱️', true], + ['⛲️', true], + ['⛳️', true], + ['⛴️', true], + ['⛵️', true], + ['⛷🏻', true], + ['⛷🏼', true], + ['⛷🏽', true], + ['⛷🏾', true], + ['⛷🏿', true], + ['⛷️', true], + ['⛸️', true], + ['⛹🏻♀️', true], + ['⛹🏻♂️', true], + ['⛹🏻', true], + ['⛹🏼♀️', true], + ['⛹🏼♂️', true], + ['⛹🏼', true], + ['⛹🏽♀️', true], + ['⛹🏽♂️', true], + ['⛹🏽', true], + ['⛹🏾♀️', true], + ['⛹🏾♂️', true], + ['⛹🏾', true], + ['⛹🏿♀️', true], + ['⛹🏿♂️', true], + ['⛹🏿', true], + ['⛹️♀️', true], + ['⛹️♂️', true], + ['⛹️', true], + ['⛺️', true], + ['⛽️', true], + ['✂️', true], + ['✅', true], + ['✈️', true], + ['✉️', true], + ['✊🏻', true], + ['✊🏼', true], + ['✊🏽', true], + ['✊🏾', true], + ['✊🏿', true], + ['✊', true], + ['✋🏻', true], + ['✋🏼', true], + ['✋🏽', true], + ['✋🏾', true], + ['✋🏿', true], + ['✋', true], + ['✌🏻', true], + ['✌🏼', true], + ['✌🏽', true], + ['✌🏾', true], + ['✌🏿', true], + ['✌️', true], + ['✍🏻', true], + ['✍🏼', true], + ['✍🏽', true], + ['✍🏾', true], + ['✍🏿', true], + ['✍️', true], + ['✏️', true], + ['✒️', true], + ['✔️', true], + ['✖️', true], + ['✝️', true], + ['✡️', true], + ['✨', true], + ['✳️', true], + ['✴️', true], + ['❄️', true], + ['❇️', true], + ['❌', true], + ['❎', true], + ['❓', true], + ['❔', true], + ['❕', true], + ['❗️', true], + ['❣️', true], + ['❤️', true], + ['➕', true], + ['➖', true], + ['➗', true], + ['➡️', true], + ['➰', true], + ['➿', true], + ['⤴️', true], + ['⤵️', true], + ['*⃣', true], + ['⬅️', true], + ['⬆️', true], + ['⬇️', true], + ['⬛️', true], + ['⬜️', true], + ['⭐️', true], + ['⭕️', true], + ['0⃣', true], + ['〰️', true], + ['〽️', true], + ['1⃣', true], + ['2⃣', true], + ['㊗️', true], + ['㊙️', true], + ['3⃣', true], + ['4⃣', true], + ['5⃣', true], + ['6⃣', true], + ['7⃣', true], + ['8⃣', true], + ['9⃣', true], + ['©️', true], + ['®️', true], ]; } } diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php index 81655e2be11..d3cae0ee1fd 100644 --- a/tests/lib/Encryption/DecryptAllTest.php +++ b/tests/lib/Encryption/DecryptAllTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -38,16 +39,16 @@ class DecryptAllTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject | View */ protected $view; - /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ protected $inputInterface; - /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */ protected $outputInterface; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\UserInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\UserInterface */ protected $userInterface; - /** @var DecryptAll */ + /** @var DecryptAll */ protected $instance; protected function setUp(): void { diff --git a/tests/lib/Encryption/EncryptionWrapperTest.php b/tests/lib/Encryption/EncryptionWrapperTest.php index 69bf297e21b..02b5d3038bc 100644 --- a/tests/lib/Encryption/EncryptionWrapperTest.php +++ b/tests/lib/Encryption/EncryptionWrapperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -15,16 +16,16 @@ use Psr\Log\LoggerInterface; use Test\TestCase; class EncryptionWrapperTest extends TestCase { - /** @var EncryptionWrapper */ + /** @var EncryptionWrapper */ private $instance; - /** @var \PHPUnit\Framework\MockObject\MockObject | LoggerInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | LoggerInterface */ private $logger; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Encryption\Manager */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Encryption\Manager */ private $manager; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Memcache\ArrayCache */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Memcache\ArrayCache */ private $arrayCache; protected function setUp(): void { diff --git a/tests/lib/Encryption/ManagerTest.php b/tests/lib/Encryption/ManagerTest.php index d092068f6c6..3eff45939a0 100644 --- a/tests/lib/Encryption/ManagerTest.php +++ b/tests/lib/Encryption/ManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Encryption/UpdateTest.php b/tests/lib/Encryption/UpdateTest.php index 9f431b53d3e..3883e2f8236 100644 --- a/tests/lib/Encryption/UpdateTest.php +++ b/tests/lib/Encryption/UpdateTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -199,7 +200,7 @@ class UpdateTest extends TestCase { /** * create mock of the update method * - * @param array$methods methods which should be set + * @param array $methods methods which should be set * @return \OC\Encryption\Update | \PHPUnit\Framework\MockObject\MockObject */ protected function getUpdateMock($methods) { diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php index 813a288a470..59ca8b1fd86 100644 --- a/tests/lib/Encryption/UtilTest.php +++ b/tests/lib/Encryption/UtilTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/EventSourceFactoryTest.php b/tests/lib/EventSourceFactoryTest.php index c5e22a8fe34..96d6e6e770a 100644 --- a/tests/lib/EventSourceFactoryTest.php +++ b/tests/lib/EventSourceFactoryTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Files/AppData/AppDataTest.php b/tests/lib/Files/AppData/AppDataTest.php index 241e49a026f..6ac5cb4c5b7 100644 --- a/tests/lib/Files/AppData/AppDataTest.php +++ b/tests/lib/Files/AppData/AppDataTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Files/AppData/FactoryTest.php b/tests/lib/Files/AppData/FactoryTest.php index 1aad461e633..6d0700827e9 100644 --- a/tests/lib/Files/AppData/FactoryTest.php +++ b/tests/lib/Files/AppData/FactoryTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php index 622df0c1d86..821b371294a 100644 --- a/tests/lib/Files/Cache/CacheTest.php +++ b/tests/lib/Files/Cache/CacheTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -742,26 +743,26 @@ class CacheTest extends \Test\TestCase { $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => ICacheEntry::DIRECTORY_MIMETYPE]; $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'creation_time' => 20]; - $id1 = $this->cache->put("foo1", $data); + $id1 = $this->cache->put('foo1', $data); $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'upload_time' => 30]; - $this->cache->put("foo2", $data); + $this->cache->put('foo2', $data); $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'metadata_etag' => 'foo']; - $this->cache->put("foo3", $data); + $this->cache->put('foo3', $data); $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain']; - $id4 = $this->cache->put("foo4", $data); + $id4 = $this->cache->put('foo4', $data); $entry = $this->cache->get($id1); $this->assertEquals(20, $entry->getCreationTime()); $this->assertEquals(0, $entry->getUploadTime()); $this->assertEquals(null, $entry->getMetadataEtag()); - $entries = $this->cache->getFolderContents(""); + $entries = $this->cache->getFolderContents(''); $this->assertCount(4, $entries); - $this->assertEquals("foo1", $entries[0]->getName()); - $this->assertEquals("foo2", $entries[1]->getName()); - $this->assertEquals("foo3", $entries[2]->getName()); - $this->assertEquals("foo4", $entries[3]->getName()); + $this->assertEquals('foo1', $entries[0]->getName()); + $this->assertEquals('foo2', $entries[1]->getName()); + $this->assertEquals('foo3', $entries[2]->getName()); + $this->assertEquals('foo4', $entries[3]->getName()); $this->assertEquals(20, $entries[0]->getCreationTime()); $this->assertEquals(0, $entries[0]->getUploadTime()); @@ -786,11 +787,11 @@ class CacheTest extends \Test\TestCase { $this->assertEquals(25, $entry->getUploadTime()); $this->assertEquals(null, $entry->getMetadataEtag()); - $this->cache->put("sub", $folderData); + $this->cache->put('sub', $folderData); - $this->cache->move("foo1", "sub/foo1"); + $this->cache->move('foo1', 'sub/foo1'); - $entries = $this->cache->getFolderContents("sub"); + $entries = $this->cache->getFolderContents('sub'); $this->assertCount(1, $entries); $this->assertEquals(20, $entries[0]->getCreationTime()); @@ -804,7 +805,7 @@ class CacheTest extends \Test\TestCase { $this->assertEquals(25, $entry->getUploadTime()); $this->assertEquals(null, $entry->getMetadataEtag()); - $this->cache->remove("sub"); + $this->cache->remove('sub'); } protected function tearDown(): void { diff --git a/tests/lib/Files/Cache/HomeCacheTest.php b/tests/lib/Files/Cache/HomeCacheTest.php index 986d6df4c17..a0d49aa044f 100644 --- a/tests/lib/Files/Cache/HomeCacheTest.php +++ b/tests/lib/Files/Cache/HomeCacheTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Cache/MoveFromCacheTraitTest.php b/tests/lib/Files/Cache/MoveFromCacheTraitTest.php index e8a6c8acf32..2780a9da36b 100644 --- a/tests/lib/Files/Cache/MoveFromCacheTraitTest.php +++ b/tests/lib/Files/Cache/MoveFromCacheTraitTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Cache/PropagatorTest.php b/tests/lib/Files/Cache/PropagatorTest.php index c0374f22233..dd33434e4ad 100644 --- a/tests/lib/Files/Cache/PropagatorTest.php +++ b/tests/lib/Files/Cache/PropagatorTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -16,7 +17,7 @@ use Test\TestCase; * @group DB */ class PropagatorTest extends TestCase { - /** @var IStorage */ + /** @var IStorage */ private $storage; protected function setUp(): void { diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php index bc911baba0c..e2ab518978d 100644 --- a/tests/lib/Files/Cache/ScannerTest.php +++ b/tests/lib/Files/Cache/ScannerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Cache/SearchBuilderTest.php b/tests/lib/Files/Cache/SearchBuilderTest.php index f22962dc05b..bca962d9a02 100644 --- a/tests/lib/Files/Cache/SearchBuilderTest.php +++ b/tests/lib/Files/Cache/SearchBuilderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Files/Cache/UpdaterLegacyTest.php b/tests/lib/Files/Cache/UpdaterLegacyTest.php index cb51afe7d6a..455b613738f 100644 --- a/tests/lib/Files/Cache/UpdaterLegacyTest.php +++ b/tests/lib/Files/Cache/UpdaterLegacyTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Cache/UpdaterTest.php b/tests/lib/Files/Cache/UpdaterTest.php index 4b8f5b3c79c..673ad66e484 100644 --- a/tests/lib/Files/Cache/UpdaterTest.php +++ b/tests/lib/Files/Cache/UpdaterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Cache/WatcherTest.php b/tests/lib/Files/Cache/WatcherTest.php index d4a44ca6aa0..3b0518b5a77 100644 --- a/tests/lib/Files/Cache/WatcherTest.php +++ b/tests/lib/Files/Cache/WatcherTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php index 44869ccfd55..2d46145e121 100644 --- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php +++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php index d3eb8be7af9..2710b269f34 100644 --- a/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php +++ b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Config/UserMountCacheTest.php b/tests/lib/Files/Config/UserMountCacheTest.php index 946203100d2..cb6fe756681 100644 --- a/tests/lib/Files/Config/UserMountCacheTest.php +++ b/tests/lib/Files/Config/UserMountCacheTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -365,7 +366,7 @@ class UserMountCacheTest extends TestCase { ->from('filecache') ->where($query->expr()->eq('storage', $query->createNamedParameter($storageId))) ->andWhere($query->expr()->eq('path_hash', $query->createNamedParameter(md5($internalPath)))); - $id = (int)$query->execute()->fetchColumn(); + $id = (int) $query->execute()->fetchColumn(); } else { throw $e; } diff --git a/tests/lib/Files/EtagTest.php b/tests/lib/Files/EtagTest.php index a109a17d250..13d896f43d8 100644 --- a/tests/lib/Files/EtagTest.php +++ b/tests/lib/Files/EtagTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/FileInfoTest.php b/tests/lib/Files/FileInfoTest.php index bc4a25ef622..bb4988c4bb4 100644 --- a/tests/lib/Files/FileInfoTest.php +++ b/tests/lib/Files/FileInfoTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php index 4ab0456a810..73c683c264a 100644 --- a/tests/lib/Files/FilesystemTest.php +++ b/tests/lib/Files/FilesystemTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -44,8 +45,8 @@ class DummyMountProvider implements IMountProvider { * @package Test\Files */ class FilesystemTest extends \Test\TestCase { - public const TEST_FILESYSTEM_USER1 = "test-filesystem-user1"; - public const TEST_FILESYSTEM_USER2 = "test-filesystem-user1"; + public const TEST_FILESYSTEM_USER1 = 'test-filesystem-user1'; + public const TEST_FILESYSTEM_USER2 = 'test-filesystem-user1'; /** * @var array tmpDirs diff --git a/tests/lib/Files/Mount/ManagerTest.php b/tests/lib/Files/Mount/ManagerTest.php index f8adb2bf1cf..101dac0f5ce 100644 --- a/tests/lib/Files/Mount/ManagerTest.php +++ b/tests/lib/Files/Mount/ManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php index 189667df276..68f7843a04a 100644 --- a/tests/lib/Files/Mount/MountPointTest.php +++ b/tests/lib/Files/Mount/MountPointTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Mount/MountTest.php b/tests/lib/Files/Mount/MountTest.php index 0b4c6a214f3..b84c56320bf 100644 --- a/tests/lib/Files/Mount/MountTest.php +++ b/tests/lib/Files/Mount/MountTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php index 9b6aaeccfeb..fa16edfaf70 100644 --- a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php +++ b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Mount/RootMountProviderTest.php b/tests/lib/Files/Mount/RootMountProviderTest.php index 4a5048d2863..f3f43a8457c 100644 --- a/tests/lib/Files/Mount/RootMountProviderTest.php +++ b/tests/lib/Files/Mount/RootMountProviderTest.php @@ -61,17 +61,17 @@ class RootMountProviderTest extends TestCase { public function testObjectStore() { $provider = $this->getProvider([ 'objectstore' => [ - "class" => "OC\Files\ObjectStore\S3", - "arguments" => [ - "bucket" => "nextcloud", - "autocreate" => true, - "key" => "minio", - "secret" => "minio123", - "hostname" => "localhost", - "port" => 9000, - "use_ssl" => false, - "use_path_style" => true, - "uploadPartSize" => 52428800, + 'class' => "OC\Files\ObjectStore\S3", + 'arguments' => [ + 'bucket' => 'nextcloud', + 'autocreate' => true, + 'key' => 'minio', + 'secret' => 'minio123', + 'hostname' => 'localhost', + 'port' => 9000, + 'use_ssl' => false, + 'use_path_style' => true, + 'uploadPartSize' => 52428800, ], ], ]); @@ -94,17 +94,17 @@ class RootMountProviderTest extends TestCase { public function testObjectStoreMultiBucket() { $provider = $this->getProvider([ 'objectstore_multibucket' => [ - "class" => "OC\Files\ObjectStore\S3", - "arguments" => [ - "bucket" => "nextcloud", - "autocreate" => true, - "key" => "minio", - "secret" => "minio123", - "hostname" => "localhost", - "port" => 9000, - "use_ssl" => false, - "use_path_style" => true, - "uploadPartSize" => 52428800, + 'class' => "OC\Files\ObjectStore\S3", + 'arguments' => [ + 'bucket' => 'nextcloud', + 'autocreate' => true, + 'key' => 'minio', + 'secret' => 'minio123', + 'hostname' => 'localhost', + 'port' => 9000, + 'use_ssl' => false, + 'use_path_style' => true, + 'uploadPartSize' => 52428800, ], ], ]); diff --git a/tests/lib/Files/Node/FileTest.php b/tests/lib/Files/Node/FileTest.php index 35c2443aeff..49a72b5f323 100644 --- a/tests/lib/Files/Node/FileTest.php +++ b/tests/lib/Files/Node/FileTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php index 9a3433c020e..5005842440d 100644 --- a/tests/lib/Files/Node/FolderTest.php +++ b/tests/lib/Files/Node/FolderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -781,7 +782,7 @@ class FolderTest extends NodeTest { $nodes = $node->getRecent(5); $ids = array_map(function (Node $node) { - return (int)$node->getId(); + return (int) $node->getId(); }, $nodes); $this->assertEquals([$id1, $id2, $id3], $ids); } @@ -846,7 +847,7 @@ class FolderTest extends NodeTest { $nodes = $node->getRecent(5); $ids = array_map(function (Node $node) { - return (int)$node->getId(); + return (int) $node->getId(); }, $nodes); $this->assertEquals([$id2, $id3], $ids); $this->assertEquals($baseTime, $nodes[0]->getMTime()); @@ -905,7 +906,7 @@ class FolderTest extends NodeTest { $nodes = $node->getRecent(5); $ids = array_map(function (Node $node) { - return (int)$node->getId(); + return (int) $node->getId(); }, $nodes); $this->assertEquals([$id1], $ids); } diff --git a/tests/lib/Files/Node/HookConnectorTest.php b/tests/lib/Files/Node/HookConnectorTest.php index 7cc2da516bb..9baf0c3a753 100644 --- a/tests/lib/Files/Node/HookConnectorTest.php +++ b/tests/lib/Files/Node/HookConnectorTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -49,7 +50,7 @@ class HookConnectorTest extends TestCase { use UserTrait; use MountProviderTrait; - /** @var IEventDispatcher */ + /** @var IEventDispatcher */ protected $eventDispatcher; private LoggerInterface $logger; diff --git a/tests/lib/Files/Node/IntegrationTest.php b/tests/lib/Files/Node/IntegrationTest.php index fe6fe779ad0..2f2b5975a74 100644 --- a/tests/lib/Files/Node/IntegrationTest.php +++ b/tests/lib/Files/Node/IntegrationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php index b00d9e1b4de..95b2655b6a5 100644 --- a/tests/lib/Files/Node/NodeTest.php +++ b/tests/lib/Files/Node/NodeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php index 9b3139cf78b..e4a56904412 100644 --- a/tests/lib/Files/Node/RootTest.php +++ b/tests/lib/Files/Node/RootTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/ObjectStore/AzureTest.php b/tests/lib/Files/ObjectStore/AzureTest.php index 5d4234532a6..9a3bc257ee5 100644 --- a/tests/lib/Files/ObjectStore/AzureTest.php +++ b/tests/lib/Files/ObjectStore/AzureTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Files/ObjectStore/LocalTest.php b/tests/lib/Files/ObjectStore/LocalTest.php index 99c5b61534f..516a316c9f6 100644 --- a/tests/lib/Files/ObjectStore/LocalTest.php +++ b/tests/lib/Files/ObjectStore/LocalTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Files/ObjectStore/MapperTest.php b/tests/lib/Files/ObjectStore/MapperTest.php index 19269f13355..1833743d9d2 100644 --- a/tests/lib/Files/ObjectStore/MapperTest.php +++ b/tests/lib/Files/ObjectStore/MapperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php b/tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php index 425dc8c2581..937c1cb7d5a 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php index 95cae5f8b25..6b64fa8ca62 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php index a0e18a5557b..edd59fe0fdd 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php index 19a1f4b7bc5..2d36c0738a9 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php index c35298fe408..fe0320e29e2 100644 --- a/tests/lib/Files/ObjectStore/S3Test.php +++ b/tests/lib/Files/ObjectStore/S3Test.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -104,7 +105,7 @@ class S3Test extends ObjectStoreTest { public function testEmptyUpload() { $s3 = $this->getInstance(); - $emptyStream = fopen("php://memory", "r"); + $emptyStream = fopen('php://memory', 'r'); fwrite($emptyStream, ''); $s3->writeObject('emptystream', $emptyStream); diff --git a/tests/lib/Files/ObjectStore/SwiftTest.php b/tests/lib/Files/ObjectStore/SwiftTest.php index 8c9a0d524ed..b8e00826b27 100644 --- a/tests/lib/Files/ObjectStore/SwiftTest.php +++ b/tests/lib/Files/ObjectStore/SwiftTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/PathVerificationTest.php b/tests/lib/Files/PathVerificationTest.php index f256a954f9f..1d0d2084e9f 100644 --- a/tests/lib/Files/PathVerificationTest.php +++ b/tests/lib/Files/PathVerificationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Search/QueryOptimizer/CombinedTests.php b/tests/lib/Files/Search/QueryOptimizer/CombinedTests.php index 5c7c01da926..63f5fed9c78 100644 --- a/tests/lib/Files/Search/QueryOptimizer/CombinedTests.php +++ b/tests/lib/Files/Search/QueryOptimizer/CombinedTests.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -26,16 +27,16 @@ class CombinedTests extends TestCase { ISearchBinaryOperator::OPERATOR_OR, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'), ]) ] ); @@ -51,30 +52,30 @@ class CombinedTests extends TestCase { ISearchBinaryOperator::OPERATOR_OR, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 2), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 2), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "201"), - new SearchComparison(ISearchComparison::COMPARE_LIKE, "path", "201/%"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '201'), + new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', '201/%'), ]), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "301"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '301'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 4), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "401"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 4), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '401'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "302"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '302'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 4), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "402"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 4), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '402'), ]), ] ); @@ -89,29 +90,29 @@ class CombinedTests extends TestCase { $operator = new SearchBinaryOperator( ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 2), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 2), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "201"), - new SearchComparison(ISearchComparison::COMPARE_LIKE, "path", "201/%"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '201'), + new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', '201/%'), ]), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "301"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '301'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 4), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "401"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 4), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '401'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "302"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '302'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 4), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "402"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 4), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '402'), ]), ] ); @@ -126,26 +127,26 @@ class CombinedTests extends TestCase { $operator = new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "image/png"), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "image/jpeg"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'image/png'), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'image/jpeg'), ]), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "files"), - new SearchComparison(ISearchComparison::COMPARE_LIKE, "path", "files/%"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'files'), + new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', 'files/%'), ]), ]), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 2), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 2), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "files/301"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'files/301'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "files/302"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'files/302'), ]), ]), ]); @@ -160,28 +161,28 @@ class CombinedTests extends TestCase { $operator = new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "image/png"), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "image/jpeg"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'image/png'), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'image/jpeg'), ]), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "files"), - new SearchComparison(ISearchComparison::COMPARE_LIKE, "path", "files/%"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'files'), + new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', 'files/%'), ]), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 2), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 2), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "files/301"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'files/301'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "files/302"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'files/302'), ]), ]), ]); diff --git a/tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php b/tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php index 538ffc65f02..24d53470c99 100644 --- a/tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php +++ b/tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -28,10 +29,10 @@ class FlattenNestedBoolTest extends TestCase { $operator = new SearchBinaryOperator( ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'), ]) ] ); diff --git a/tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php b/tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php index abc9eca9a54..bf3a8a4e29c 100644 --- a/tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php +++ b/tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -29,16 +30,16 @@ class MergeDistributiveOperationsTest extends TestCase { ISearchBinaryOperator::OPERATOR_OR, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'), ]) ] ); @@ -55,16 +56,16 @@ class MergeDistributiveOperationsTest extends TestCase { ISearchBinaryOperator::OPERATOR_OR, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 2), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 2), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'), ]) ] ); @@ -81,16 +82,16 @@ class MergeDistributiveOperationsTest extends TestCase { ISearchBinaryOperator::OPERATOR_OR, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 2), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 2), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'), ]) ] ); @@ -110,20 +111,20 @@ class MergeDistributiveOperationsTest extends TestCase { ISearchBinaryOperator::OPERATOR_OR, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'), ]) ] ), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "text") + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'text') ] ); $this->assertEquals('(((storage eq 1 and path eq "foo") or (storage eq 1 and path eq "bar") or (storage eq 1 and path eq "asd")) and mimetype eq "text")', $operator->__toString()); @@ -139,17 +140,17 @@ class MergeDistributiveOperationsTest extends TestCase { ISearchBinaryOperator::OPERATOR_OR, [ new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'), ]), new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"), - new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, "size", "100"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'), + new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, 'size', '100'), ]) ] ); diff --git a/tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php b/tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php index 5ea27eb88b9..f4eb10771fd 100644 --- a/tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php +++ b/tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -28,9 +29,9 @@ class OrEqualsToInTest extends TestCase { $operator = new SearchBinaryOperator( ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'), ] ); $this->assertEquals('(path eq "foo" or path eq "bar" or path eq "asd")', $operator->__toString()); @@ -45,11 +46,11 @@ class OrEqualsToInTest extends TestCase { $operator = new SearchBinaryOperator( ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "fileid", 1), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "fileid", 2), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "asd"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'fileid', 1), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'fileid', 2), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'asd'), ] ); $this->assertEquals('(path eq "foo" or path eq "bar" or fileid eq 1 or fileid eq 2 or mimetype eq "asd")', $operator->__toString()); @@ -64,9 +65,9 @@ class OrEqualsToInTest extends TestCase { $operator = new SearchBinaryOperator( ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'), ] ); foreach ($operator->getArguments() as $argument) { @@ -85,9 +86,9 @@ class OrEqualsToInTest extends TestCase { $operator = new SearchBinaryOperator( ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"), - new SearchComparison(ISearchComparison::COMPARE_LIKE, "path", "foo%"), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'), + new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', 'foo%'), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'), ] ); $this->assertEquals('(path eq "foo" or path like "foo%" or path eq "bar")', $operator->__toString()); @@ -102,13 +103,13 @@ class OrEqualsToInTest extends TestCase { $operator = new SearchBinaryOperator( ISearchBinaryOperator::OPERATOR_AND, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "text"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'text'), new SearchBinaryOperator( ISearchBinaryOperator::OPERATOR_OR, [ - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"), - new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'), + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'), ] ) ] diff --git a/tests/lib/Files/Search/SearchIntegrationTest.php b/tests/lib/Files/Search/SearchIntegrationTest.php index b24f927219e..cd8ee4f60b0 100644 --- a/tests/lib/Files/Search/SearchIntegrationTest.php +++ b/tests/lib/Files/Search/SearchIntegrationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -30,11 +31,11 @@ class SearchIntegrationTest extends TestCase { public function testThousandAndOneFilters() { - $id = $this->cache->put("file10", ['size' => 1, 'mtime' => 50, 'mimetype' => 'foo/folder']); + $id = $this->cache->put('file10', ['size' => 1, 'mtime' => 50, 'mimetype' => 'foo/folder']); $comparisons = []; - for($i = 1; $i <= 1001; $i++) { - $comparisons[] = new SearchComparison(ISearchComparison::COMPARE_EQUAL, "name", "file$i"); + for ($i = 1; $i <= 1001; $i++) { + $comparisons[] = new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'name', "file$i"); } $operator = new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, $comparisons); $query = new SearchQuery($operator, 10, 0, []); diff --git a/tests/lib/Files/SimpleFS/SimpleFileTest.php b/tests/lib/Files/SimpleFS/SimpleFileTest.php index 6dbd663068e..5a05ab2adc6 100644 --- a/tests/lib/Files/SimpleFS/SimpleFileTest.php +++ b/tests/lib/Files/SimpleFS/SimpleFileTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Files/SimpleFS/SimpleFolderTest.php b/tests/lib/Files/SimpleFS/SimpleFolderTest.php index 139a6cb703c..3a5401be077 100644 --- a/tests/lib/Files/SimpleFS/SimpleFolderTest.php +++ b/tests/lib/Files/SimpleFS/SimpleFolderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Files/Storage/CommonTest.php b/tests/lib/Files/Storage/CommonTest.php index 321894cc23b..020ab711379 100644 --- a/tests/lib/Files/Storage/CommonTest.php +++ b/tests/lib/Files/Storage/CommonTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Storage/CopyDirectoryTest.php b/tests/lib/Files/Storage/CopyDirectoryTest.php index 6133361c626..14637424790 100644 --- a/tests/lib/Files/Storage/CopyDirectoryTest.php +++ b/tests/lib/Files/Storage/CopyDirectoryTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Storage/HomeTest.php b/tests/lib/Files/Storage/HomeTest.php index c3111e74259..52a00a5a889 100644 --- a/tests/lib/Files/Storage/HomeTest.php +++ b/tests/lib/Files/Storage/HomeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Storage/LocalTest.php b/tests/lib/Files/Storage/LocalTest.php index de71d81c7b4..69f3a45d0ee 100644 --- a/tests/lib/Files/Storage/LocalTest.php +++ b/tests/lib/Files/Storage/LocalTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php index 747cb4b6f43..8767b2cdfee 100644 --- a/tests/lib/Files/Storage/Storage.php +++ b/tests/lib/Files/Storage/Storage.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Storage/StorageFactoryTest.php b/tests/lib/Files/Storage/StorageFactoryTest.php index ee23f6199c9..c64b837f98b 100644 --- a/tests/lib/Files/Storage/StorageFactoryTest.php +++ b/tests/lib/Files/Storage/StorageFactoryTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Storage/StoragesTest.php b/tests/lib/Files/Storage/StoragesTest.php index 43587517479..006a114cc66 100644 --- a/tests/lib/Files/Storage/StoragesTest.php +++ b/tests/lib/Files/Storage/StoragesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php index ef7b457636c..deca7e52145 100644 --- a/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php +++ b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -17,7 +18,7 @@ class AvailabilityTest extends \Test\TestCase { protected $storageCache; /** @var \PHPUnit\Framework\MockObject\MockObject|Temporary */ protected $storage; - /** @var Availability */ + /** @var Availability */ protected $wrapper; protected function setUp(): void { diff --git a/tests/lib/Files/Storage/Wrapper/EncodingTest.php b/tests/lib/Files/Storage/Wrapper/EncodingTest.php index b50d6f985f1..6700638d0a7 100644 --- a/tests/lib/Files/Storage/Wrapper/EncodingTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncodingTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index 088ff139b3c..6866b30fbe9 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -105,11 +106,11 @@ class EncryptionTest extends Storage { */ private $config; - /** @var \OC\Memcache\ArrayCache | \PHPUnit\Framework\MockObject\MockObject */ + /** @var \OC\Memcache\ArrayCache | \PHPUnit\Framework\MockObject\MockObject */ private $arrayCache; - /** @var integer dummy unencrypted size */ + /** @var integer dummy unencrypted size */ private $dummySize = -1; protected function setUp(): void { @@ -307,7 +308,7 @@ class EncryptionTest extends Storage { $result = $this->instance->getMetaData($path); if (isset($expected['encrypted'])) { - $this->assertSame($expected['encrypted'], (bool)$result['encrypted']); + $this->assertSame($expected['encrypted'], (bool) $result['encrypted']); if (isset($expected['encryptedVersion'])) { $this->assertSame($expected['encryptedVersion'], $result['encryptedVersion']); diff --git a/tests/lib/Files/Storage/Wrapper/JailTest.php b/tests/lib/Files/Storage/Wrapper/JailTest.php index fb2d05d0691..8ef770427d3 100644 --- a/tests/lib/Files/Storage/Wrapper/JailTest.php +++ b/tests/lib/Files/Storage/Wrapper/JailTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php b/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php index ccc95de1002..639c809a7ce 100644 --- a/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php +++ b/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php index 0b2d444700a..4ff50fe86b1 100644 --- a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php +++ b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php index b24b44c6a56..6c7083b670d 100644 --- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php +++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Storage/Wrapper/WrapperTest.php b/tests/lib/Files/Storage/Wrapper/WrapperTest.php index 0244c78da8b..d9b526912af 100644 --- a/tests/lib/Files/Storage/Wrapper/WrapperTest.php +++ b/tests/lib/Files/Storage/Wrapper/WrapperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Stream/DummyEncryptionWrapper.php b/tests/lib/Files/Stream/DummyEncryptionWrapper.php index 211050905bd..a69d812d637 100644 --- a/tests/lib/Files/Stream/DummyEncryptionWrapper.php +++ b/tests/lib/Files/Stream/DummyEncryptionWrapper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php index 1326baf75fa..cf55d8de17c 100644 --- a/tests/lib/Files/Stream/EncryptionTest.php +++ b/tests/lib/Files/Stream/EncryptionTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -18,7 +19,7 @@ use Psr\Log\LoggerInterface; class EncryptionTest extends \Test\TestCase { public const DEFAULT_WRAPPER = '\OC\Files\Stream\Encryption'; - /** @var \OCP\Encryption\IEncryptionModule | \PHPUnit\Framework\MockObject\MockObject */ + /** @var \OCP\Encryption\IEncryptionModule | \PHPUnit\Framework\MockObject\MockObject */ private $encryptionModule; /** @@ -93,7 +94,7 @@ class EncryptionTest extends \Test\TestCase { $expectedReadOnly) { // build mocks $encryptionModuleMock = $this->getMockBuilder('\OCP\Encryption\IEncryptionModule') - ->disableOriginalConstructor()->getMock(); + ->disableOriginalConstructor()->getMock(); $encryptionModuleMock->expects($this->any())->method('needDetailedAccessList')->willReturn(!$isMasterKeyUsed); $encryptionModuleMock->expects($this->once()) ->method('getUnencryptedBlockSize')->willReturn(99); @@ -192,7 +193,7 @@ class EncryptionTest extends \Test\TestCase { } public function testWriteRead() { - $fileName = tempnam("/tmp", "FOO"); + $fileName = tempnam('/tmp', 'FOO'); $stream = $this->getStream($fileName, 'w+', 0, self::DEFAULT_WRAPPER, 6); $this->assertEquals(6, fwrite($stream, 'foobar')); fclose($stream); @@ -213,7 +214,7 @@ class EncryptionTest extends \Test\TestCase { } public function testRewind() { - $fileName = tempnam("/tmp", "FOO"); + $fileName = tempnam('/tmp', 'FOO'); $stream = $this->getStream($fileName, 'w+', 0, self::DEFAULT_WRAPPER, 6); $this->assertEquals(6, fwrite($stream, 'foobar')); $this->assertEquals(true, rewind($stream)); @@ -230,7 +231,7 @@ class EncryptionTest extends \Test\TestCase { } public function testSeek() { - $fileName = tempnam("/tmp", "FOO"); + $fileName = tempnam('/tmp', 'FOO'); $stream = $this->getStream($fileName, 'w+', 0, self::DEFAULT_WRAPPER, 9); $this->assertEquals(6, fwrite($stream, 'foobar')); @@ -265,7 +266,7 @@ class EncryptionTest extends \Test\TestCase { public function testWriteReadBigFile($testFile) { $expectedData = file_get_contents(\OC::$SERVERROOT . '/tests/data/' . $testFile); // write it - $fileName = tempnam("/tmp", "FOO"); + $fileName = tempnam('/tmp', 'FOO'); $stream = $this->getStream($fileName, 'w+', 0, self::DEFAULT_WRAPPER, strlen($expectedData)); // while writing the file from the beginning to the end we should never try // to read parts of the file. This should only happen for write operations @@ -306,7 +307,7 @@ class EncryptionTest extends \Test\TestCase { $expectedData = file_get_contents(\OC::$SERVERROOT . '/tests/data/' . $testFile); // write it - $fileName = tempnam("/tmp", "FOO"); + $fileName = tempnam('/tmp', 'FOO'); $stream = $this->getStream($fileName, 'w+', 0, '\Test\Files\Stream\DummyEncryptionWrapper', strlen($expectedData)); // while writing the file from the beginning to the end we should never try // to read parts of the file. This should only happen for write operations diff --git a/tests/lib/Files/Stream/QuotaTest.php b/tests/lib/Files/Stream/QuotaTest.php index 17ad14b7e44..94b70712e55 100644 --- a/tests/lib/Files/Stream/QuotaTest.php +++ b/tests/lib/Files/Stream/QuotaTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php index 6a50467a57f..08ad0c4c596 100644 --- a/tests/lib/Files/Type/DetectionTest.php +++ b/tests/lib/Files/Type/DetectionTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Type/LoaderTest.php b/tests/lib/Files/Type/LoaderTest.php index cd2788bd208..fbf9ea727cd 100644 --- a/tests/lib/Files/Type/LoaderTest.php +++ b/tests/lib/Files/Type/LoaderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/Utils/ScannerTest.php b/tests/lib/Files/Utils/ScannerTest.php index c3ba696ac5c..f64587a037c 100644 --- a/tests/lib/Files/Utils/ScannerTest.php +++ b/tests/lib/Files/Utils/ScannerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index b233fc90966..edda380b549 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -1180,7 +1181,7 @@ class ViewTest extends \Test\TestCase { ->getMock(); $storage2->method('writeStream') - ->willThrowException(new GenericFileException("Failed to copy stream")); + ->willThrowException(new GenericFileException('Failed to copy stream')); $storage1->mkdir('sub'); $storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH'); @@ -1877,7 +1878,7 @@ class ViewTest extends \Test\TestCase { * @param int $expectedLockDuring expected lock during operation * @param int $expectedLockAfter expected lock during post hooks * @param int $expectedStrayLock expected lock after returning, should - * be null (unlock) for most operations + * be null (unlock) for most operations */ public function testLockBasicOperation( $operation, @@ -2032,7 +2033,7 @@ class ViewTest extends \Test\TestCase { $path ) { if ($operation === 'touch') { - $this->markTestSkipped("touch handles storage exceptions internally"); + $this->markTestSkipped('touch handles storage exceptions internally'); } $view = new View('/' . $this->user . '/files/'); @@ -2152,7 +2153,7 @@ class ViewTest extends \Test\TestCase { * * @param string $operation operation to be done on the view * @param int $expectedLockTypeSourceDuring expected lock type on source file during - * the operation + * the operation */ public function testLockFileRename($operation, $expectedLockTypeSourceDuring) { $view = new View('/' . $this->user . '/files/'); @@ -2337,7 +2338,7 @@ class ViewTest extends \Test\TestCase { * @param string $viewOperation operation to be done on the view * @param string $storageOperation operation to be mocked on the storage * @param int $expectedLockTypeSourceDuring expected lock type on source file during - * the operation + * the operation */ public function testLockFileRenameCrossStorage($viewOperation, $storageOperation, $expectedLockTypeSourceDuring) { $view = new View('/' . $this->user . '/files/'); @@ -2476,7 +2477,7 @@ class ViewTest extends \Test\TestCase { * @param int $lockTypePre variable to receive lock type that was active in the pre-hook * @param int $lockTypePost variable to receive lock type that was active in the post-hook * @param bool $onMountPoint true to check the mount point instead of the - * mounted storage + * mounted storage */ private function connectMockHooks($hookType, $view, $path, &$lockTypePre, &$lockTypePost, $onMountPoint = false) { if ($hookType === null) { @@ -2524,7 +2525,7 @@ class ViewTest extends \Test\TestCase { * @param View $view view * @param string $path path * @param bool $onMountPoint true to check the mount point instead of the - * mounted storage + * mounted storage * * @return int lock type or null if file was not locked */ diff --git a/tests/lib/GlobalScale/ConfigTest.php b/tests/lib/GlobalScale/ConfigTest.php index b64a3bf2224..1c45d827314 100644 --- a/tests/lib/GlobalScale/ConfigTest.php +++ b/tests/lib/GlobalScale/ConfigTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -11,7 +12,7 @@ use OCP\IConfig; use Test\TestCase; class ConfigTest extends TestCase { - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ private $config; protected function setUp(): void { diff --git a/tests/lib/Group/Backend.php b/tests/lib/Group/Backend.php index 3b071bb1906..44ac3aaafb5 100644 --- a/tests/lib/Group/Backend.php +++ b/tests/lib/Group/Backend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Group/DatabaseTest.php b/tests/lib/Group/DatabaseTest.php index 593fbe60bf9..f41bf5afa20 100644 --- a/tests/lib/Group/DatabaseTest.php +++ b/tests/lib/Group/DatabaseTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Group/Dummy.php b/tests/lib/Group/Dummy.php index 4ba885c6cdd..5f2a81cf0aa 100644 --- a/tests/lib/Group/Dummy.php +++ b/tests/lib/Group/Dummy.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php index 4f42e10537d..e14836d3f6d 100644 --- a/tests/lib/Group/ManagerTest.php +++ b/tests/lib/Group/ManagerTest.php @@ -94,7 +94,7 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') ->willReturnCallback(function ($actions) use ($implementedActions) { - return (bool)($actions & $implementedActions); + return (bool) ($actions & $implementedActions); }); return $backend; } @@ -180,7 +180,7 @@ class ManagerTest extends TestCase { } public function testCreate() { - /**@var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */ + /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */ $backendGroupCreated = false; $backend = $this->getTestBackend(); $backend->expects($this->any()) @@ -204,7 +204,7 @@ class ManagerTest extends TestCase { } public function testCreateFailure() { - /**@var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */ + /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */ $backendGroupCreated = false; $backend = $this->getTestBackend( GroupInterface::ADD_TO_GROUP | @@ -233,7 +233,7 @@ class ManagerTest extends TestCase { } public function testCreateTooLong() { - /**@var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */ + /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */ $backendGroupCreated = false; $backend = $this->getTestBackend( GroupInterface::ADD_TO_GROUP | diff --git a/tests/lib/Group/MetaDataTest.php b/tests/lib/Group/MetaDataTest.php index 0c9029aaf56..faa4390cdfd 100644 --- a/tests/lib/Group/MetaDataTest.php +++ b/tests/lib/Group/MetaDataTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/HelperStorageTest.php b/tests/lib/HelperStorageTest.php index ddf32d94724..15cf98271d7 100644 --- a/tests/lib/HelperStorageTest.php +++ b/tests/lib/HelperStorageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/HookHelper.php b/tests/lib/HookHelper.php index 8b7d17a6766..779fe3abf95 100644 --- a/tests/lib/HookHelper.php +++ b/tests/lib/HookHelper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Hooks/BasicEmitterTest.php b/tests/lib/Hooks/BasicEmitterTest.php index 82e5a64ecae..661e5354b3c 100644 --- a/tests/lib/Hooks/BasicEmitterTest.php +++ b/tests/lib/Hooks/BasicEmitterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Http/Client/ClientServiceTest.php b/tests/lib/Http/Client/ClientServiceTest.php index a50428e514a..7c9cd55a6cc 100644 --- a/tests/lib/Http/Client/ClientServiceTest.php +++ b/tests/lib/Http/Client/ClientServiceTest.php @@ -59,7 +59,7 @@ class ClientServiceTest extends \Test\TestCase { $stack = HandlerStack::create($handler); $stack->push($dnsPinMiddleware->addDnsPinning()); $stack->push(Middleware::tap(function (RequestInterface $request) use ($eventLogger) { - $eventLogger->start('http:request', $request->getMethod() . " request to " . $request->getRequestTarget()); + $eventLogger->start('http:request', $request->getMethod() . ' request to ' . $request->getRequestTarget()); }, function () use ($eventLogger) { $eventLogger->end('http:request'); }), 'event logger'); @@ -107,7 +107,7 @@ class ClientServiceTest extends \Test\TestCase { $handler = new CurlHandler(); $stack = HandlerStack::create($handler); $stack->push(Middleware::tap(function (RequestInterface $request) use ($eventLogger) { - $eventLogger->start('http:request', $request->getMethod() . " request to " . $request->getRequestTarget()); + $eventLogger->start('http:request', $request->getMethod() . ' request to ' . $request->getRequestTarget()); }, function () use ($eventLogger) { $eventLogger->end('http:request'); }), 'event logger'); diff --git a/tests/lib/Http/Client/NegativeDnsCacheTest.php b/tests/lib/Http/Client/NegativeDnsCacheTest.php index af0575b0cd7..bcde25ddf85 100644 --- a/tests/lib/Http/Client/NegativeDnsCacheTest.php +++ b/tests/lib/Http/Client/NegativeDnsCacheTest.php @@ -40,7 +40,7 @@ class NegativeDnsCacheTest extends \Test\TestCase { ->method('set') ->with('www.example.com-1', 'true', 3600); - $this->negativeDnsCache->setNegativeCacheForDnsType("www.example.com", DNS_A, 3600); + $this->negativeDnsCache->setNegativeCacheForDnsType('www.example.com', DNS_A, 3600); } public function testIsNegativeCached() { @@ -50,6 +50,6 @@ class NegativeDnsCacheTest extends \Test\TestCase { ->with('www.example.com-1') ->willReturn(true); - $this->assertTrue($this->negativeDnsCache->isNegativeCached("www.example.com", DNS_A)); + $this->assertTrue($this->negativeDnsCache->isNegativeCached('www.example.com', DNS_A)); } } diff --git a/tests/lib/Http/Client/ResponseTest.php b/tests/lib/Http/Client/ResponseTest.php index c0d9770e2fb..229f780526d 100644 --- a/tests/lib/Http/Client/ResponseTest.php +++ b/tests/lib/Http/Client/ResponseTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Http/WellKnown/JrdResponseTest.php b/tests/lib/Http/WellKnown/JrdResponseTest.php index 0f500f96eef..375f244d618 100644 --- a/tests/lib/Http/WellKnown/JrdResponseTest.php +++ b/tests/lib/Http/WellKnown/JrdResponseTest.php @@ -15,7 +15,7 @@ use Test\TestCase; class JrdResponseTest extends TestCase { public function testEmptyToHttpResponse(): void { - $response = new JrdResponse("subject"); + $response = new JrdResponse('subject'); $httpResponse = $response->toHttpResponse(); self::assertTrue($response->isEmpty()); @@ -30,7 +30,7 @@ class JrdResponseTest extends TestCase { } public function testComplexToHttpResponse(): void { - $response = new JrdResponse("subject"); + $response = new JrdResponse('subject'); $response->addAlias('alias'); $response->addAlias('blias'); $response->addProperty('propa', 'a'); diff --git a/tests/lib/Http/WellKnown/RequestManagerTest.php b/tests/lib/Http/WellKnown/RequestManagerTest.php index 1ee2fa1139d..3ab6cb190b2 100644 --- a/tests/lib/Http/WellKnown/RequestManagerTest.php +++ b/tests/lib/Http/WellKnown/RequestManagerTest.php @@ -57,7 +57,7 @@ class RequestManagerTest extends TestCase { $request = $this->createMock(IRequest::class); $this->expectException(RuntimeException::class); - $this->manager->process("webfinger", $request); + $this->manager->process('webfinger', $request); } public function testProcessNoHandlersRegistered(): void { @@ -70,7 +70,7 @@ class RequestManagerTest extends TestCase { ->method('getWellKnownHandlers') ->willReturn([]); - $response = $this->manager->process("webfinger", $request); + $response = $this->manager->process('webfinger', $request); self::assertNull($response); } @@ -91,11 +91,11 @@ class RequestManagerTest extends TestCase { $this->container->expects(self::once()) ->method('get') ->with(get_class($handler)) - ->willThrowException(new QueryException("")); + ->willThrowException(new QueryException('')); $this->logger->expects(self::once()) ->method('error'); - $response = $this->manager->process("webfinger", $request); + $response = $this->manager->process('webfinger', $request); self::assertNull($response); } @@ -120,7 +120,7 @@ class RequestManagerTest extends TestCase { $this->logger->expects(self::once()) ->method('error'); - $response = $this->manager->process("webfinger", $request); + $response = $this->manager->process('webfinger', $request); self::assertNull($response); } @@ -146,7 +146,7 @@ class RequestManagerTest extends TestCase { ->with(get_class($handler)) ->willReturn($handler); - $response = $this->manager->process("webfinger", $request); + $response = $this->manager->process('webfinger', $request); self::assertNotNull($response); self::assertInstanceOf(JrdResponse::class, $response); diff --git a/tests/lib/ImageTest.php b/tests/lib/ImageTest.php index 6028f1b89fa..5a065c00213 100644 --- a/tests/lib/ImageTest.php +++ b/tests/lib/ImageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -50,7 +51,7 @@ class ImageTest extends \Test\TestCase { $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $this->assertTrue($img->valid()); - $text = base64_encode("Lorem ipsum dolor sir amet …"); + $text = base64_encode('Lorem ipsum dolor sir amet …'); $img = new \OC_Image(); $img->loadFromBase64($text); $this->assertFalse($img->valid()); @@ -175,17 +176,17 @@ class ImageTest extends \Test\TestCase { $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $expected = base64_encode($img->data()); - $this->assertEquals($expected, (string)$img); + $this->assertEquals($expected, (string) $img); $img = new \OC_Image(); $img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); $expected = base64_encode($img->data()); - $this->assertEquals($expected, (string)$img); + $this->assertEquals($expected, (string) $img); $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.gif'); $expected = base64_encode($img->data()); - $this->assertEquals($expected, (string)$img); + $this->assertEquals($expected, (string) $img); } public function testResize() { diff --git a/tests/lib/InfoXmlTest.php b/tests/lib/InfoXmlTest.php index 702eca4c0ce..a531a054b65 100644 --- a/tests/lib/InfoXmlTest.php +++ b/tests/lib/InfoXmlTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/InitialStateServiceTest.php b/tests/lib/InitialStateServiceTest.php index a919832d3e4..f58d54cb26b 100644 --- a/tests/lib/InitialStateServiceTest.php +++ b/tests/lib/InitialStateServiceTest.php @@ -21,7 +21,7 @@ use function json_encode; class InitialStateServiceTest extends TestCase { /** @var InitialStateService */ private $service; - /** @var MockObject|LoggerInterface|(LoggerInterface&MockObject) */ + /** @var MockObject|LoggerInterface|(LoggerInterface&MockObject) */ protected $logger; protected function setUp(): void { diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php index 1fd48ea4fc9..4dae9bd1f87 100644 --- a/tests/lib/InstallerTest.php +++ b/tests/lib/InstallerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php index 21714e96f01..01a218d4113 100644 --- a/tests/lib/IntegrityCheck/CheckerTest.php +++ b/tests/lib/IntegrityCheck/CheckerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -150,14 +151,14 @@ class CheckerTest extends TestCase { public function testVerifyAppSignatureWithoutSignatureData() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $expected = [ 'EXCEPTION' => [ @@ -170,20 +171,20 @@ class CheckerTest extends TestCase { public function testVerifyAppSignatureWithValidSignatureData() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $this->appLocator - ->expects($this->once()) - ->method('getAppPath') - ->with('SomeApp') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); + ->expects($this->once()) + ->method('getAppPath') + ->with('SomeApp') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -209,20 +210,20 @@ class CheckerTest extends TestCase { public function testVerifyAppSignatureWithTamperedSignatureData() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $this->appLocator - ->expects($this->once()) - ->method('getAppPath') - ->with('SomeApp') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); + ->expects($this->once()) + ->method('getAppPath') + ->with('SomeApp') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "tampered", @@ -254,20 +255,20 @@ class CheckerTest extends TestCase { public function testVerifyAppSignatureWithTamperedFiles() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $this->appLocator - ->expects($this->once()) - ->method('getAppPath') - ->with('SomeApp') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); + ->expects($this->once()) + ->method('getAppPath') + ->with('SomeApp') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -315,19 +316,19 @@ class CheckerTest extends TestCase { public function testVerifyAppSignatureWithTamperedFilesAndAlternatePath() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $this->appLocator - ->expects($this->never()) - ->method('getAppPath') - ->with('SomeApp'); + ->expects($this->never()) + ->method('getAppPath') + ->with('SomeApp'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -375,20 +376,20 @@ class CheckerTest extends TestCase { public function testVerifyAppWithDifferentScope() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $this->appLocator - ->expects($this->once()) - ->method('getAppPath') - ->with('SomeApp') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); + ->expects($this->once()) + ->method('getAppPath') + ->with('SomeApp') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -419,20 +420,20 @@ class CheckerTest extends TestCase { public function testVerifyAppWithDifferentScopeAndAlwaysTrustedCore() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $this->appLocator - ->expects($this->once()) - ->method('getAppPath') - ->with('SomeApp') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); + ->expects($this->once()) + ->method('getAppPath') + ->with('SomeApp') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -513,21 +514,21 @@ class CheckerTest extends TestCase { "certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO0D77\r\nH87KFhYW8tKFFvF1V3AHl\/sFQ9tDHaxM9Y0pZ2jPp\/ccdiqnmdkBxBDqsiRvHvVB\r\nCn6qpb4vWGFC7vHOBfYspmEL1zLlKXZv3ezMZEZw7O9ZvUP3VO\/wAtd2vUW8UFiq\r\ns2v1QnNLN6jNh51obcwmrBvWhJy9vQIdtIjQbDxqWTHh1zUSrw9wrlklCBZ\/zrM0\r\ni8nfCFwTxWRxp3H9KoECzO\/zS5R5KIS7s3\/wq\/w9T2Ie4rcecgXwDizwnn0C\/aKc\r\nbDIjujpL1s9HO05pcD\/V3wKcPZ1izymBkmMyIbL52iRVN5FTVHeZdXPpFuq+CTQJ\r\nQ238lC+A\/KOVAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAGoKTnh8RfJV4sQItVC2\r\nAvfJagkrIqZ3iiQTUBQGTKBsTnAqE1H7QgUSV9vSd+8rgvHkyZsRjmtyR1e3A6Ji\r\noNCXUbExC\/0iCPUqdHZIVb+Lc\/vWuv4ByFMybGPydgtLoEUX2ZrKFWmcgZFDUSRd\r\n9Uj26vtUhCC4bU4jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----" }'; $this->environmentHelper - ->expects($this->any()) - ->method('getServerRoot') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); + ->expects($this->any()) + ->method('getServerRoot') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $this->fileAccessHelper - ->expects($this->once()) - ->method('file_put_contents') - ->with( - \OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', - $this->callback(function ($signature) use ($expectedSignatureFileData) { - $expectedArray = json_decode($expectedSignatureFileData, true); - $actualArray = json_decode($signature, true); - $this->assertEquals($expectedArray, $actualArray); - return true; - }) - ); + ->expects($this->once()) + ->method('file_put_contents') + ->with( + \OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', + $this->callback(function ($signature) use ($expectedSignatureFileData) { + $expectedArray = json_decode($expectedSignatureFileData, true); + $actualArray = json_decode($signature, true); + $this->assertEquals($expectedArray, $actualArray); + return true; + }) + ); $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt'); $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/core.key'); @@ -548,21 +549,21 @@ class CheckerTest extends TestCase { "certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO0D77\r\nH87KFhYW8tKFFvF1V3AHl\/sFQ9tDHaxM9Y0pZ2jPp\/ccdiqnmdkBxBDqsiRvHvVB\r\nCn6qpb4vWGFC7vHOBfYspmEL1zLlKXZv3ezMZEZw7O9ZvUP3VO\/wAtd2vUW8UFiq\r\ns2v1QnNLN6jNh51obcwmrBvWhJy9vQIdtIjQbDxqWTHh1zUSrw9wrlklCBZ\/zrM0\r\ni8nfCFwTxWRxp3H9KoECzO\/zS5R5KIS7s3\/wq\/w9T2Ie4rcecgXwDizwnn0C\/aKc\r\nbDIjujpL1s9HO05pcD\/V3wKcPZ1izymBkmMyIbL52iRVN5FTVHeZdXPpFuq+CTQJ\r\nQ238lC+A\/KOVAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAGoKTnh8RfJV4sQItVC2\r\nAvfJagkrIqZ3iiQTUBQGTKBsTnAqE1H7QgUSV9vSd+8rgvHkyZsRjmtyR1e3A6Ji\r\noNCXUbExC\/0iCPUqdHZIVb+Lc\/vWuv4ByFMybGPydgtLoEUX2ZrKFWmcgZFDUSRd\r\n9Uj26vtUhCC4bU4jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----" }'; $this->environmentHelper - ->expects($this->any()) - ->method('getServerRoot') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/'); + ->expects($this->any()) + ->method('getServerRoot') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/'); $this->fileAccessHelper - ->expects($this->once()) - ->method('file_put_contents') - ->with( - \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified//core/signature.json', - $this->callback(function ($signature) use ($expectedSignatureFileData) { - $expectedArray = json_decode($expectedSignatureFileData, true); - $actualArray = json_decode($signature, true); - $this->assertEquals($expectedArray, $actualArray); - return true; - }) - ); + ->expects($this->once()) + ->method('file_put_contents') + ->with( + \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified//core/signature.json', + $this->callback(function ($signature) use ($expectedSignatureFileData) { + $expectedArray = json_decode($expectedSignatureFileData, true); + $actualArray = json_decode($signature, true); + $this->assertEquals($expectedArray, $actualArray); + return true; + }) + ); $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt'); $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/core.key'); @@ -582,17 +583,17 @@ class CheckerTest extends TestCase { "certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO0D77\r\nH87KFhYW8tKFFvF1V3AHl\/sFQ9tDHaxM9Y0pZ2jPp\/ccdiqnmdkBxBDqsiRvHvVB\r\nCn6qpb4vWGFC7vHOBfYspmEL1zLlKXZv3ezMZEZw7O9ZvUP3VO\/wAtd2vUW8UFiq\r\ns2v1QnNLN6jNh51obcwmrBvWhJy9vQIdtIjQbDxqWTHh1zUSrw9wrlklCBZ\/zrM0\r\ni8nfCFwTxWRxp3H9KoECzO\/zS5R5KIS7s3\/wq\/w9T2Ie4rcecgXwDizwnn0C\/aKc\r\nbDIjujpL1s9HO05pcD\/V3wKcPZ1izymBkmMyIbL52iRVN5FTVHeZdXPpFuq+CTQJ\r\nQ238lC+A\/KOVAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAGoKTnh8RfJV4sQItVC2\r\nAvfJagkrIqZ3iiQTUBQGTKBsTnAqE1H7QgUSV9vSd+8rgvHkyZsRjmtyR1e3A6Ji\r\noNCXUbExC\/0iCPUqdHZIVb+Lc\/vWuv4ByFMybGPydgtLoEUX2ZrKFWmcgZFDUSRd\r\n9Uj26vtUhCC4bU4jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----" }'; $this->fileAccessHelper - ->expects($this->once()) - ->method('file_put_contents') - ->with( - \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json', - $this->callback(function ($signature) use ($expectedSignatureFileData) { - $expectedArray = json_decode($expectedSignatureFileData, true); - $actualArray = json_decode($signature, true); - $this->assertEquals($expectedArray, $actualArray); - return true; - }) - ); + ->expects($this->once()) + ->method('file_put_contents') + ->with( + \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json', + $this->callback(function ($signature) use ($expectedSignatureFileData) { + $expectedArray = json_decode($expectedSignatureFileData, true); + $actualArray = json_decode($signature, true); + $this->assertEquals($expectedArray, $actualArray); + return true; + }) + ); $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt'); $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/core.key'); @@ -613,21 +614,21 @@ class CheckerTest extends TestCase { "certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO0D77\r\nH87KFhYW8tKFFvF1V3AHl\/sFQ9tDHaxM9Y0pZ2jPp\/ccdiqnmdkBxBDqsiRvHvVB\r\nCn6qpb4vWGFC7vHOBfYspmEL1zLlKXZv3ezMZEZw7O9ZvUP3VO\/wAtd2vUW8UFiq\r\ns2v1QnNLN6jNh51obcwmrBvWhJy9vQIdtIjQbDxqWTHh1zUSrw9wrlklCBZ\/zrM0\r\ni8nfCFwTxWRxp3H9KoECzO\/zS5R5KIS7s3\/wq\/w9T2Ie4rcecgXwDizwnn0C\/aKc\r\nbDIjujpL1s9HO05pcD\/V3wKcPZ1izymBkmMyIbL52iRVN5FTVHeZdXPpFuq+CTQJ\r\nQ238lC+A\/KOVAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAGoKTnh8RfJV4sQItVC2\r\nAvfJagkrIqZ3iiQTUBQGTKBsTnAqE1H7QgUSV9vSd+8rgvHkyZsRjmtyR1e3A6Ji\r\noNCXUbExC\/0iCPUqdHZIVb+Lc\/vWuv4ByFMybGPydgtLoEUX2ZrKFWmcgZFDUSRd\r\n9Uj26vtUhCC4bU4jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----" }'; $this->environmentHelper - ->expects($this->any()) - ->method('getServerRoot') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'); + ->expects($this->any()) + ->method('getServerRoot') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'); $this->fileAccessHelper - ->expects($this->once()) - ->method('file_put_contents') - ->with( - \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json', - $this->callback(function ($signature) use ($expectedSignatureFileData) { - $expectedArray = json_decode($expectedSignatureFileData, true); - $actualArray = json_decode($signature, true); - $this->assertEquals($expectedArray, $actualArray); - return true; - }) - ); + ->expects($this->once()) + ->method('file_put_contents') + ->with( + \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json', + $this->callback(function ($signature) use ($expectedSignatureFileData) { + $expectedArray = json_decode($expectedSignatureFileData, true); + $actualArray = json_decode($signature, true); + $this->assertEquals($expectedArray, $actualArray); + return true; + }) + ); $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt'); $rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/core.key'); @@ -640,14 +641,14 @@ class CheckerTest extends TestCase { public function testVerifyCoreSignatureWithoutSignatureData() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $expected = [ 'EXCEPTION' => [ @@ -660,19 +661,19 @@ class CheckerTest extends TestCase { public function testVerifyCoreSignatureWithValidSignatureData() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $this->environmentHelper - ->expects($this->any()) - ->method('getServerRoot') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); + ->expects($this->any()) + ->method('getServerRoot') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -737,7 +738,7 @@ class CheckerTest extends TestCase { * See inline instruction on how to update the test assets when changing mimetypealiases.dist.json */ public function testVerifyCoreSignatureWithModifiedMimetypelistSignatureData() { - $shippedMimetypeAliases = (array)json_decode(file_get_contents(\OC::$SERVERROOT . '/resources/config/mimetypealiases.dist.json')); + $shippedMimetypeAliases = (array) json_decode(file_get_contents(\OC::$SERVERROOT . '/resources/config/mimetypealiases.dist.json')); $allAliases = array_merge($shippedMimetypeAliases, ['my-custom/mimetype' => 'custom']); $this->mimeTypeDetector @@ -787,19 +788,19 @@ class CheckerTest extends TestCase { public function testVerifyCoreSignatureWithValidSignatureDataAndNotAlphabeticOrder() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $this->environmentHelper - ->expects($this->any()) - ->method('getServerRoot') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); + ->expects($this->any()) + ->method('getServerRoot') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -824,19 +825,19 @@ class CheckerTest extends TestCase { public function testVerifyCoreSignatureWithTamperedSignatureData() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $this->environmentHelper - ->expects($this->any()) - ->method('getServerRoot') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); + ->expects($this->any()) + ->method('getServerRoot') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "tampered", @@ -867,19 +868,19 @@ class CheckerTest extends TestCase { public function testVerifyCoreSignatureWithTamperedFiles() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $this->environmentHelper - ->expects($this->any()) - ->method('getServerRoot') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); + ->expects($this->any()) + ->method('getServerRoot') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -925,19 +926,19 @@ class CheckerTest extends TestCase { public function testVerifyCoreWithInvalidCertificate() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $this->environmentHelper - ->expects($this->any()) - ->method('getServerRoot') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); + ->expects($this->any()) + ->method('getServerRoot') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -968,19 +969,19 @@ class CheckerTest extends TestCase { public function testVerifyCoreWithDifferentScope() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(false); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(false); $this->environmentHelper - ->expects($this->any()) - ->method('getServerRoot') - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); + ->expects($this->any()) + ->method('getServerRoot') + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -1091,14 +1092,14 @@ class CheckerTest extends TestCase { public function testVerifyAppSignatureWithoutSignatureDataAndCodeCheckerDisabled() { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn('stable'); + ->expects($this->once()) + ->method('getChannel') + ->willReturn('stable'); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(true); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(true); $expected = []; $this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp')); @@ -1139,14 +1140,14 @@ class CheckerTest extends TestCase { */ public function testIsCodeCheckEnforcedWithDisabledConfigSwitch($channel) { $this->environmentHelper - ->expects($this->once()) - ->method('getChannel') - ->willReturn($channel); + ->expects($this->once()) + ->method('getChannel') + ->willReturn($channel); $this->config - ->expects($this->any()) - ->method('getSystemValueBool') - ->with('integrity.check.disabled', false) - ->willReturn(true); + ->expects($this->any()) + ->method('getSystemValueBool') + ->with('integrity.check.disabled', false) + ->willReturn(true); $this->assertFalse(self::invokePrivate($this->checker, 'isCodeCheckEnforced')); } diff --git a/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php b/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php index a86507f6bb2..a584a7646b6 100644 --- a/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php +++ b/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php b/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php index 001733309a3..17c034f67cb 100644 --- a/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php +++ b/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php index ea90b611f5e..2891c6c4263 100644 --- a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php +++ b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php b/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php index 14cc8851178..ccf67c97302 100644 --- a/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php +++ b/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2015 ownCloud, Inc. diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php index 16113c0972f..0f243c124ca 100644 --- a/tests/lib/L10N/FactoryTest.php +++ b/tests/lib/L10N/FactoryTest.php @@ -112,9 +112,9 @@ class FactoryTest extends TestCase { $factory = $this->getFactory(['languageExists']); $this->invokePrivate($factory, 'requestLanguage', ['de']); $factory->expects(self::once()) - ->method('languageExists') - ->with('MyApp', 'de') - ->willReturn(true); + ->method('languageExists') + ->with('MyApp', 'de') + ->willReturn(true); self::assertSame('de', $factory->findLanguage('MyApp')); } @@ -123,15 +123,15 @@ class FactoryTest extends TestCase { $factory = $this->getFactory(['languageExists']); $this->invokePrivate($factory, 'requestLanguage', ['de']); $factory->expects($this->exactly(2)) - ->method('languageExists') - ->withConsecutive( - ['MyApp', 'de'], - ['MyApp', 'jp'], - ) - ->willReturnOnConsecutiveCalls( - false, - true, - ); + ->method('languageExists') + ->withConsecutive( + ['MyApp', 'de'], + ['MyApp', 'jp'], + ) + ->willReturnOnConsecutiveCalls( + false, + true, + ); $this->config ->expects($this->exactly(1)) ->method('getSystemValue') @@ -150,10 +150,10 @@ class FactoryTest extends TestCase { ->method('getUser') ->willReturn($user); $this->config - ->expects(self::once()) - ->method('getUserValue') - ->with('MyUserUid', 'core', 'lang', null) - ->willReturn('jp'); + ->expects(self::once()) + ->method('getUserValue') + ->with('MyUserUid', 'core', 'lang', null) + ->willReturn('jp'); self::assertSame('jp', $factory->findLanguage('MyApp')); } @@ -178,17 +178,17 @@ class FactoryTest extends TestCase { $user = $this->getMockBuilder(IUser::class) ->getMock(); $user->expects(self::once()) - ->method('getUID') - ->willReturn('MyUserUid'); + ->method('getUID') + ->willReturn('MyUserUid'); $this->userSession - ->expects(self::exactly(2)) - ->method('getUser') - ->willReturn($user); + ->expects(self::exactly(2)) + ->method('getUser') + ->willReturn($user); $this->config - ->expects(self::once()) - ->method('getUserValue') - ->with('MyUserUid', 'core', 'lang', null) - ->willReturn('jp'); + ->expects(self::once()) + ->method('getUserValue') + ->with('MyUserUid', 'core', 'lang', null) + ->willReturn('jp'); self::assertSame('es', $factory->findLanguage('MyApp')); } @@ -213,17 +213,17 @@ class FactoryTest extends TestCase { $user = $this->getMockBuilder(IUser::class) ->getMock(); $user->expects(self::once()) - ->method('getUID') - ->willReturn('MyUserUid'); + ->method('getUID') + ->willReturn('MyUserUid'); $this->userSession - ->expects(self::exactly(2)) - ->method('getUser') - ->willReturn($user); + ->expects(self::exactly(2)) + ->method('getUser') + ->willReturn($user); $this->config - ->expects(self::once()) - ->method('getUserValue') - ->with('MyUserUid', 'core', 'lang', null) - ->willReturn('jp'); + ->expects(self::once()) + ->method('getUserValue') + ->with('MyUserUid', 'core', 'lang', null) + ->willReturn('jp'); $this->config ->expects(self::never()) ->method('setUserValue'); @@ -251,21 +251,21 @@ class FactoryTest extends TestCase { $user = $this->getMockBuilder(IUser::class) ->getMock(); $user->expects(self::once()) - ->method('getUID') - ->willReturn('MyUserUid'); + ->method('getUID') + ->willReturn('MyUserUid'); $this->userSession - ->expects(self::exactly(2)) - ->method('getUser') - ->willReturn($user); + ->expects(self::exactly(2)) + ->method('getUser') + ->willReturn($user); $this->config - ->expects(self::once()) - ->method('getUserValue') - ->with('MyUserUid', 'core', 'lang', null) - ->willReturn('jp'); + ->expects(self::once()) + ->method('getUserValue') + ->with('MyUserUid', 'core', 'lang', null) + ->willReturn('jp'); $this->config - ->expects(self::never()) - ->method('setUserValue') - ->with('MyUserUid', 'core', 'lang', 'en'); + ->expects(self::never()) + ->method('setUserValue') + ->with('MyUserUid', 'core', 'lang', 'en'); self::assertSame('en', $factory->findLanguage('MyApp')); diff --git a/tests/lib/L10N/L10nTest.php b/tests/lib/L10N/L10nTest.php index 38d0a5626b0..5add0374975 100644 --- a/tests/lib/L10N/L10nTest.php +++ b/tests/lib/L10N/L10nTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -58,12 +59,12 @@ class L10nTest extends TestCase { $transFile = \OC::$SERVERROOT.'/tests/data/l10n/ru.json'; $l = new L10N($this->getFactory(), 'test', 'ru', 'ru_UA', [$transFile]); - $this->assertEquals('1 файл', (string)$l->n('%n file', '%n files', 1)); - $this->assertEquals('2 файла', (string)$l->n('%n file', '%n files', 2)); - $this->assertEquals('6 файлов', (string)$l->n('%n file', '%n files', 6)); - $this->assertEquals('21 файл', (string)$l->n('%n file', '%n files', 21)); - $this->assertEquals('22 файла', (string)$l->n('%n file', '%n files', 22)); - $this->assertEquals('26 файлов', (string)$l->n('%n file', '%n files', 26)); + $this->assertEquals('1 файл', (string) $l->n('%n file', '%n files', 1)); + $this->assertEquals('2 файла', (string) $l->n('%n file', '%n files', 2)); + $this->assertEquals('6 файлов', (string) $l->n('%n file', '%n files', 6)); + $this->assertEquals('21 файл', (string) $l->n('%n file', '%n files', 21)); + $this->assertEquals('22 файла', (string) $l->n('%n file', '%n files', 22)); + $this->assertEquals('26 файлов', (string) $l->n('%n file', '%n files', 26)); /* 1 file 1 файл 1 папка @@ -82,9 +83,9 @@ class L10nTest extends TestCase { $transFile = \OC::$SERVERROOT.'/tests/data/l10n/cs.json'; $l = new L10N($this->getFactory(), 'test', 'cs', 'cs_CZ', [$transFile]); - $this->assertEquals('1 okno', (string)$l->n('%n window', '%n windows', 1)); - $this->assertEquals('2 okna', (string)$l->n('%n window', '%n windows', 2)); - $this->assertEquals('5 oken', (string)$l->n('%n window', '%n windows', 5)); + $this->assertEquals('1 okno', (string) $l->n('%n window', '%n windows', 1)); + $this->assertEquals('2 okna', (string) $l->n('%n window', '%n windows', 2)); + $this->assertEquals('5 oken', (string) $l->n('%n window', '%n windows', 5)); } public function testGermanPluralWithCzechLocaleTranslations() { diff --git a/tests/lib/L10N/LanguageIteratorTest.php b/tests/lib/L10N/LanguageIteratorTest.php index 02c17a842d3..9dbfc991856 100644 --- a/tests/lib/L10N/LanguageIteratorTest.php +++ b/tests/lib/L10N/LanguageIteratorTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/LargeFileHelperGetFileSizeTest.php b/tests/lib/LargeFileHelperGetFileSizeTest.php index b239c10e20a..1d0ef41ebee 100644 --- a/tests/lib/LargeFileHelperGetFileSizeTest.php +++ b/tests/lib/LargeFileHelperGetFileSizeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/LargeFileHelperTest.php b/tests/lib/LargeFileHelperTest.php index 9008a42f77e..a0a92bad8c7 100644 --- a/tests/lib/LargeFileHelperTest.php +++ b/tests/lib/LargeFileHelperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/LegacyHelperTest.php b/tests/lib/LegacyHelperTest.php index 7d6be9dea7e..86cce3ff125 100644 --- a/tests/lib/LegacyHelperTest.php +++ b/tests/lib/LegacyHelperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -53,35 +54,35 @@ class LegacyHelperTest extends \Test\TestCase { public function providesComputerFileSize() { return [ - [0.0, "0 B"], - [1024.0, "1 KB"], + [0.0, '0 B'], + [1024.0, '1 KB'], [1395864371.0, '1.3 GB'], - [9961472.0, "9.5 MB"], - [500041567437.0, "465.7 GB"], - [false, "12 GB etfrhzui"] + [9961472.0, '9.5 MB'], + [500041567437.0, '465.7 GB'], + [false, '12 GB etfrhzui'] ]; } public function testMb_array_change_key_case() { $arrayStart = [ - "Foo" => "bar", - "Bar" => "foo", + 'Foo' => 'bar', + 'Bar' => 'foo', ]; $arrayResult = [ - "foo" => "bar", - "bar" => "foo", + 'foo' => 'bar', + 'bar' => 'foo', ]; $result = OC_Helper::mb_array_change_key_case($arrayStart); $expected = $arrayResult; $this->assertEquals($result, $expected); $arrayStart = [ - "foo" => "bar", - "bar" => "foo", + 'foo' => 'bar', + 'bar' => 'foo', ]; $arrayResult = [ - "FOO" => "bar", - "BAR" => "foo", + 'FOO' => 'bar', + 'BAR' => 'foo', ]; $result = OC_Helper::mb_array_change_key_case($arrayStart, MB_CASE_UPPER); $expected = $arrayResult; @@ -90,15 +91,15 @@ class LegacyHelperTest extends \Test\TestCase { public function testRecursiveArraySearch() { $haystack = [ - "Foo" => "own", - "Bar" => "Cloud", + 'Foo' => 'own', + 'Bar' => 'Cloud', ]; - $result = OC_Helper::recursiveArraySearch($haystack, "own"); - $expected = "Foo"; + $result = OC_Helper::recursiveArraySearch($haystack, 'own'); + $expected = 'Foo'; $this->assertEquals($result, $expected); - $result = OC_Helper::recursiveArraySearch($haystack, "NotFound"); + $result = OC_Helper::recursiveArraySearch($haystack, 'NotFound'); $this->assertFalse($result); } @@ -109,96 +110,96 @@ class LegacyHelperTest extends \Test\TestCase { $viewMock = $this->createMock(View::class); $viewMock->expects($this->exactly(2)) - ->method('file_exists') - ->withConsecutive( - // Conflict on filename.ext - ['dir/filename.ext'], - ['dir/filename (2).ext'], - ) - ->will($this->onConsecutiveCalls(true, false)); + ->method('file_exists') + ->withConsecutive( + // Conflict on filename.ext + ['dir/filename.ext'], + ['dir/filename (2).ext'], + ) + ->will($this->onConsecutiveCalls(true, false)); $this->assertEquals('dir/filename (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename.ext', $viewMock)); $viewMock = $this->createMock(View::class); $viewMock->expects($this->exactly(3)) - ->method('file_exists') - ->withConsecutive( - ['dir/filename.ext'], - ['dir/filename (2).ext'], - ['dir/filename (3).ext'], - ) - ->will($this->onConsecutiveCalls(true, true, false)); + ->method('file_exists') + ->withConsecutive( + ['dir/filename.ext'], + ['dir/filename (2).ext'], + ['dir/filename (3).ext'], + ) + ->will($this->onConsecutiveCalls(true, true, false)); $this->assertEquals('dir/filename (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename.ext', $viewMock)); $viewMock = $this->createMock(View::class); $viewMock->expects($this->exactly(2)) - ->method('file_exists') - ->withConsecutive( - ['dir/filename (1).ext'], - ['dir/filename (2).ext'], - ) - ->will($this->onConsecutiveCalls(true, false)); + ->method('file_exists') + ->withConsecutive( + ['dir/filename (1).ext'], + ['dir/filename (2).ext'], + ) + ->will($this->onConsecutiveCalls(true, false)); $this->assertEquals('dir/filename (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (1).ext', $viewMock)); $viewMock = $this->createMock(View::class); $viewMock->expects($this->exactly(2)) - ->method('file_exists') - ->withConsecutive( - ['dir/filename (2).ext'], - ['dir/filename (3).ext'], - ) - ->will($this->onConsecutiveCalls(true, false)); + ->method('file_exists') + ->withConsecutive( + ['dir/filename (2).ext'], + ['dir/filename (3).ext'], + ) + ->will($this->onConsecutiveCalls(true, false)); $this->assertEquals('dir/filename (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (2).ext', $viewMock)); $viewMock = $this->createMock(View::class); $viewMock->expects($this->exactly(3)) - ->method('file_exists') - ->withConsecutive( - ['dir/filename (2).ext'], - ['dir/filename (3).ext'], - ['dir/filename (4).ext'], - ) - ->will($this->onConsecutiveCalls(true, true, false)); + ->method('file_exists') + ->withConsecutive( + ['dir/filename (2).ext'], + ['dir/filename (3).ext'], + ['dir/filename (4).ext'], + ) + ->will($this->onConsecutiveCalls(true, true, false)); $this->assertEquals('dir/filename (4).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (2).ext', $viewMock)); $viewMock = $this->createMock(View::class); $viewMock->expects($this->exactly(2)) - ->method('file_exists') - ->withConsecutive( - ['dir/filename(1).ext'], - ['dir/filename(2).ext'], - ) - ->will($this->onConsecutiveCalls(true, false)); + ->method('file_exists') + ->withConsecutive( + ['dir/filename(1).ext'], + ['dir/filename(2).ext'], + ) + ->will($this->onConsecutiveCalls(true, false)); $this->assertEquals('dir/filename(2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1).ext', $viewMock)); $viewMock = $this->createMock(View::class); $viewMock->expects($this->exactly(2)) - ->method('file_exists') - ->withConsecutive( - ['dir/filename(1) (1).ext'], - ['dir/filename(1) (2).ext'], - ) - ->will($this->onConsecutiveCalls(true, false)); + ->method('file_exists') + ->withConsecutive( + ['dir/filename(1) (1).ext'], + ['dir/filename(1) (2).ext'], + ) + ->will($this->onConsecutiveCalls(true, false)); $this->assertEquals('dir/filename(1) (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (1).ext', $viewMock)); $viewMock = $this->createMock(View::class); $viewMock->expects($this->exactly(3)) - ->method('file_exists') - ->withConsecutive( - ['dir/filename(1) (1).ext'], - ['dir/filename(1) (2).ext'], - ['dir/filename(1) (3).ext'], - ) - ->will($this->onConsecutiveCalls(true, true, false)); + ->method('file_exists') + ->withConsecutive( + ['dir/filename(1) (1).ext'], + ['dir/filename(1) (2).ext'], + ['dir/filename(1) (3).ext'], + ) + ->will($this->onConsecutiveCalls(true, true, false)); $this->assertEquals('dir/filename(1) (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (1).ext', $viewMock)); $viewMock = $this->createMock(View::class); $viewMock->expects($this->exactly(2)) - ->method('file_exists') - ->withConsecutive( - ['dir/filename(1) (2) (3).ext'], - ['dir/filename(1) (2) (4).ext'], - ) - ->will($this->onConsecutiveCalls(true, false)); + ->method('file_exists') + ->withConsecutive( + ['dir/filename(1) (2) (3).ext'], + ['dir/filename(1) (2) (4).ext'], + ) + ->will($this->onConsecutiveCalls(true, false)); $this->assertEquals('dir/filename(1) (2) (4).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (2) (3).ext', $viewMock)); } diff --git a/tests/lib/Lock/DBLockingProviderTest.php b/tests/lib/Lock/DBLockingProviderTest.php index 356b55f577e..68352082df2 100644 --- a/tests/lib/Lock/DBLockingProviderTest.php +++ b/tests/lib/Lock/DBLockingProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Lock/LockingProvider.php b/tests/lib/Lock/LockingProvider.php index 2aa3980542b..9daf4ecd2dd 100644 --- a/tests/lib/Lock/LockingProvider.php +++ b/tests/lib/Lock/LockingProvider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Lock/MemcacheLockingProviderTest.php b/tests/lib/Lock/MemcacheLockingProviderTest.php index a698be65aaf..8dd01b67582 100644 --- a/tests/lib/Lock/MemcacheLockingProviderTest.php +++ b/tests/lib/Lock/MemcacheLockingProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Lock/NonCachingDBLockingProviderTest.php b/tests/lib/Lock/NonCachingDBLockingProviderTest.php index 5750d02fc4e..b63758278c1 100644 --- a/tests/lib/Lock/NonCachingDBLockingProviderTest.php +++ b/tests/lib/Lock/NonCachingDBLockingProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Lockdown/Filesystem/NoFSTest.php b/tests/lib/Lockdown/Filesystem/NoFSTest.php index 7a636fbaaaa..dda0566cb28 100644 --- a/tests/lib/Lockdown/Filesystem/NoFSTest.php +++ b/tests/lib/Lockdown/Filesystem/NoFSTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Lockdown/Filesystem/NullCacheTest.php b/tests/lib/Lockdown/Filesystem/NullCacheTest.php index eda4e10b1a6..e4aa7c2511b 100644 --- a/tests/lib/Lockdown/Filesystem/NullCacheTest.php +++ b/tests/lib/Lockdown/Filesystem/NullCacheTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Lockdown/Filesystem/NullStorageTest.php b/tests/lib/Lockdown/Filesystem/NullStorageTest.php index 727ccb83e21..719b3774d11 100644 --- a/tests/lib/Lockdown/Filesystem/NullStorageTest.php +++ b/tests/lib/Lockdown/Filesystem/NullStorageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Lockdown/LockdownManagerTest.php b/tests/lib/Lockdown/LockdownManagerTest.php index bb71a6e63de..1bba371a2ea 100644 --- a/tests/lib/Lockdown/LockdownManagerTest.php +++ b/tests/lib/Lockdown/LockdownManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Log/FileTest.php b/tests/lib/Log/FileTest.php index 37219b5c2b1..800ca93bdaa 100644 --- a/tests/lib/Log/FileTest.php +++ b/tests/lib/Log/FileTest.php @@ -1,4 +1,5 @@ <?php + /** * * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors @@ -25,23 +26,23 @@ class FileTest extends TestCase { protected function setUp(): void { parent::setUp(); $config = \OC::$server->getSystemConfig(); - $this->restore_logfile = $config->getValue("logfile"); + $this->restore_logfile = $config->getValue('logfile'); $this->restore_logdateformat = $config->getValue('logdateformat'); - $config->setValue("logfile", $config->getValue('datadirectory') . "/logtest.log"); + $config->setValue('logfile', $config->getValue('datadirectory') . '/logtest.log'); $this->logFile = new File($config->getValue('datadirectory') . '/logtest.log', '', $config); } protected function tearDown(): void { $config = \OC::$server->getSystemConfig(); if (isset($this->restore_logfile)) { - $config->getValue("logfile", $this->restore_logfile); + $config->getValue('logfile', $this->restore_logfile); } else { - $config->deleteValue("logfile"); + $config->deleteValue('logfile'); } if (isset($this->restore_logdateformat)) { - $config->getValue("logdateformat", $this->restore_logdateformat); + $config->getValue('logdateformat', $this->restore_logdateformat); } else { - $config->deleteValue("logdateformat"); + $config->deleteValue('logdateformat'); } $this->logFile = new File($this->restore_logfile, '', $config); parent::tearDown(); diff --git a/tests/lib/Log/LogFactoryTest.php b/tests/lib/Log/LogFactoryTest.php index c1232f7b28d..e4bc805a38b 100644 --- a/tests/lib/Log/LogFactoryTest.php +++ b/tests/lib/Log/LogFactoryTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php index 6343ce62065..060e4066806 100644 --- a/tests/lib/LoggerTest.php +++ b/tests/lib/LoggerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -180,7 +181,7 @@ class LoggerTest extends TestCase implements IWriter { if (is_array($message)) { $textMessage = $message['message']; } - $this->logs[] = $level . " " . $textMessage; + $this->logs[] = $level . ' ' . $textMessage; } public function userAndPasswordData(): array { diff --git a/tests/lib/Mail/EMailTemplateTest.php b/tests/lib/Mail/EMailTemplateTest.php index 45ccf543848..666782a2c16 100644 --- a/tests/lib/Mail/EMailTemplateTest.php +++ b/tests/lib/Mail/EMailTemplateTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php index b3af888eec7..d68e13b31c2 100644 --- a/tests/lib/Mail/MailerTest.php +++ b/tests/lib/Mail/MailerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php index 23898e9d7aa..3029ffc1398 100644 --- a/tests/lib/Mail/MessageTest.php +++ b/tests/lib/Mail/MessageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -256,7 +257,7 @@ class MessageTest extends TestCase { public function testSetAutoSubmitted1() { $headers = new Headers($this->createMock(HeaderInterface::class)); - $headers->addTextHeader(AutoSubmitted::HEADER, "yes"); + $headers->addTextHeader(AutoSubmitted::HEADER, 'yes'); $symfonyEmail = $this->createMock(Email::class); $symfonyEmail->method('getHeaders') @@ -289,6 +290,6 @@ class MessageTest extends TestCase { ->willReturn($headers); $message = new Message($symfonyEmail, false); - $this->assertSame("no", $message->getAutoSubmitted()); + $this->assertSame('no', $message->getAutoSubmitted()); } } diff --git a/tests/lib/Mail/Provider/ManagerTest.php b/tests/lib/Mail/Provider/ManagerTest.php index 2658c324521..d3dabc0ea75 100644 --- a/tests/lib/Mail/Provider/ManagerTest.php +++ b/tests/lib/Mail/Provider/ManagerTest.php @@ -40,63 +40,63 @@ class ManagerTest extends TestCase { // construct service registration $registration = $this->createMock(ServiceRegistration::class); $registration - ->method('getService') - ->willReturn('Mock\Provider\MailProvider'); + ->method('getService') + ->willReturn('Mock\Provider\MailProvider'); // construct registration context $context = $this->createMock(RegistrationContext::class); $context - ->method('getMailProviders') - ->willReturn([$registration]); + ->method('getMailProviders') + ->willReturn([$registration]); // construct coordinator $this->coordinator = $this->createMock(Coordinator::class); $this->coordinator - ->method('getRegistrationContext') - ->willReturn($context); + ->method('getRegistrationContext') + ->willReturn($context); // construct mail service $this->service = $this->createMock(IService::class); $this->service - ->method('id') - ->willReturn('100'); + ->method('id') + ->willReturn('100'); $this->service - ->method('getLabel') - ->willReturn('Mock Mail Service'); + ->method('getLabel') + ->willReturn('Mock Mail Service'); $this->service - ->method('getPrimaryAddress') - ->willReturn((new Address('user1@testing.com', 'User One'))); + ->method('getPrimaryAddress') + ->willReturn((new Address('user1@testing.com', 'User One'))); // construct mail provider $this->provider = $this->createMock(IProvider::class); $this->provider - ->method('id') - ->willReturn('mock-provider'); + ->method('id') + ->willReturn('mock-provider'); $this->provider - ->method('label') - ->willReturn('Mock Provider'); + ->method('label') + ->willReturn('Mock Provider'); $this->provider - ->method('listServices') - ->willReturnMap([ - ['user0', []], - ['user1', [$this->service->id() => $this->service]] - ]); + ->method('listServices') + ->willReturnMap([ + ['user0', []], + ['user1', [$this->service->id() => $this->service]] + ]); $this->provider - ->method('findServiceById') - ->willReturnMap([ - ['user0', '100', null], - ['user1', '100', $this->service] - ]); + ->method('findServiceById') + ->willReturnMap([ + ['user0', '100', null], + ['user1', '100', $this->service] + ]); $this->provider - ->method('findServiceByAddress') - ->willReturnMap([ - ['user0', 'user0@testing.com', null], - ['user1', 'user1@testing.com', $this->service] - ]); + ->method('findServiceByAddress') + ->willReturnMap([ + ['user0', 'user0@testing.com', null], + ['user1', 'user1@testing.com', $this->service] + ]); // construct container interface $this->container = $this->createMock(ContainerInterface::class); $this->container - ->method('get') - ->willReturnMap([ - ['Mock\Provider\MailProvider', $this->provider] - ]); + ->method('get') + ->willReturnMap([ + ['Mock\Provider\MailProvider', $this->provider] + ]); } diff --git a/tests/lib/Memcache/CasTraitTest.php b/tests/lib/Memcache/CasTraitTest.php index 1c09a0e08f8..4a18613eb31 100644 --- a/tests/lib/Memcache/CasTraitTest.php +++ b/tests/lib/Memcache/CasTraitTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Memcache/FactoryTest.php b/tests/lib/Memcache/FactoryTest.php index b973b5065ea..faba157a432 100644 --- a/tests/lib/Memcache/FactoryTest.php +++ b/tests/lib/Memcache/FactoryTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Migration/BackgroundRepairTest.php b/tests/lib/Migration/BackgroundRepairTest.php index 2744ac5cefb..69c206b61f6 100644 --- a/tests/lib/Migration/BackgroundRepairTest.php +++ b/tests/lib/Migration/BackgroundRepairTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/NaturalSortTest.php b/tests/lib/NaturalSortTest.php index a053687eaf9..e846a691ae0 100644 --- a/tests/lib/NaturalSortTest.php +++ b/tests/lib/NaturalSortTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/NavigationManagerTest.php b/tests/lib/NavigationManagerTest.php index 1899fdd9443..d842e382c26 100644 --- a/tests/lib/NavigationManagerTest.php +++ b/tests/lib/NavigationManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -216,9 +217,9 @@ class NavigationManagerTest extends TestCase { ->willReturnArgument(3); $this->appManager->expects($this->any()) - ->method('isEnabledForUser') - ->with('theming') - ->willReturn(true); + ->method('isEnabledForUser') + ->with('theming') + ->willReturn(true); $this->appManager->expects($this->once()) ->method('getAppInfo') ->with('test') @@ -243,9 +244,9 @@ class NavigationManagerTest extends TestCase { $this->userSession->expects($this->any())->method('getUser')->willReturn($user); $this->userSession->expects($this->any())->method('isLoggedIn')->willReturn(true); $this->appManager->expects($this->any()) - ->method('getEnabledAppsForUser') - ->with($user) - ->willReturn(['test']); + ->method('getEnabledAppsForUser') + ->with($user) + ->willReturn(['test']); $this->groupManager->expects($this->any())->method('isAdmin')->willReturn($isAdmin); $subadmin = $this->createMock(SubAdmin::class); $subadmin->expects($this->any())->method('isSubAdmin')->with($user)->willReturn(false); @@ -525,9 +526,9 @@ class NavigationManagerTest extends TestCase { ); $this->appManager->expects($this->any()) - ->method('isEnabledForUser') - ->with('theming') - ->willReturn(true); + ->method('isEnabledForUser') + ->with('theming') + ->willReturn(true); $this->appManager->expects($this->once())->method('getAppInfo')->with('test')->willReturn($navigation); $this->appManager->expects($this->once())->method('getAppIcon')->with('test')->willReturn('/apps/test/img/app.svg'); $this->l10nFac->expects($this->any())->method('get')->willReturn($l); @@ -545,9 +546,9 @@ class NavigationManagerTest extends TestCase { $this->userSession->expects($this->any())->method('getUser')->willReturn($user); $this->userSession->expects($this->any())->method('isLoggedIn')->willReturn(true); $this->appManager->expects($this->any()) - ->method('getEnabledAppsForUser') - ->with($user) - ->willReturn(['test']); + ->method('getEnabledAppsForUser') + ->with($user) + ->willReturn(['test']); $this->groupManager->expects($this->any())->method('isAdmin')->willReturn(false); $subadmin = $this->createMock(SubAdmin::class); $subadmin->expects($this->any())->method('isSubAdmin')->with($user)->willReturn(false); diff --git a/tests/lib/Notification/ActionTest.php b/tests/lib/Notification/ActionTest.php index bfcfbbe75db..956b7a43fff 100644 --- a/tests/lib/Notification/ActionTest.php +++ b/tests/lib/Notification/ActionTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/OCS/DiscoveryServiceTest.php b/tests/lib/OCS/DiscoveryServiceTest.php index 1c71ee4c7a5..a1766847fb0 100644 --- a/tests/lib/OCS/DiscoveryServiceTest.php +++ b/tests/lib/OCS/DiscoveryServiceTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -13,13 +14,13 @@ use OCP\OCS\IDiscoveryService; use Test\TestCase; class DiscoveryServiceTest extends TestCase { - /** @var \PHPUnit\Framework\MockObject\MockObject | ICacheFactory */ + /** @var \PHPUnit\Framework\MockObject\MockObject | ICacheFactory */ private $cacheFactory; - /** @var \PHPUnit\Framework\MockObject\MockObject | IClientService */ + /** @var \PHPUnit\Framework\MockObject\MockObject | IClientService */ private $clientService; - /** @var IDiscoveryService */ + /** @var IDiscoveryService */ private $discoveryService; protected function setUp(): void { diff --git a/tests/lib/OCS/MapStatusCodeTest.php b/tests/lib/OCS/MapStatusCodeTest.php index c6d6d5edd06..37804974f42 100644 --- a/tests/lib/OCS/MapStatusCodeTest.php +++ b/tests/lib/OCS/MapStatusCodeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/OCS/ProviderTest.php b/tests/lib/OCS/ProviderTest.php index c1efa7d873e..4fc160b4b41 100644 --- a/tests/lib/OCS/ProviderTest.php +++ b/tests/lib/OCS/ProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Preview/BackgroundCleanupJobTest.php b/tests/lib/Preview/BackgroundCleanupJobTest.php index 0aad3121a7b..3552c96ff08 100644 --- a/tests/lib/Preview/BackgroundCleanupJobTest.php +++ b/tests/lib/Preview/BackgroundCleanupJobTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only @@ -110,7 +111,7 @@ class BackgroundCleanupJobTest extends \Test\TestCase { foreach ($fileIds as $fileId) { try { - $previewRoot->getFolder((string)$fileId); + $previewRoot->getFolder((string) $fileId); } catch (NotFoundException $e) { continue; } @@ -188,7 +189,7 @@ class BackgroundCleanupJobTest extends \Test\TestCase { $f1->newFile('foo.jpg', 'foo'); $f2 = $appdata->newFolder('123456782'); $f2->newFile('foo.jpg', 'foo'); - $f2 = $appdata->newFolder((string)PHP_INT_MAX - 1); + $f2 = $appdata->newFolder((string) PHP_INT_MAX - 1); $f2->newFile('foo.jpg', 'foo'); /* diff --git a/tests/lib/Preview/BitmapTest.php b/tests/lib/Preview/BitmapTest.php index c4f3f8d3cf5..c6bd3f3637a 100644 --- a/tests/lib/Preview/BitmapTest.php +++ b/tests/lib/Preview/BitmapTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php index 9116fee7e2f..34843dcbc57 100644 --- a/tests/lib/Preview/GeneratorTest.php +++ b/tests/lib/Preview/GeneratorTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Preview/HEICTest.php b/tests/lib/Preview/HEICTest.php index cfd2adac912..4853ac9b879 100644 --- a/tests/lib/Preview/HEICTest.php +++ b/tests/lib/Preview/HEICTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -15,7 +16,7 @@ namespace Test\Preview; */ class HEICTest extends Provider { protected function setUp(): void { - if (!in_array("HEIC", \Imagick::queryFormats("HEI*"))) { + if (!in_array('HEIC', \Imagick::queryFormats('HEI*'))) { $this->markTestSkipped('ImageMagick is not HEIC aware. Skipping tests'); } else { parent::setUp(); diff --git a/tests/lib/Preview/ImageTest.php b/tests/lib/Preview/ImageTest.php index f4b8e7e1dd4..fbc5eb540cd 100644 --- a/tests/lib/Preview/ImageTest.php +++ b/tests/lib/Preview/ImageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Preview/MP3Test.php b/tests/lib/Preview/MP3Test.php index 6f40b862b7b..21e1e3a2681 100644 --- a/tests/lib/Preview/MP3Test.php +++ b/tests/lib/Preview/MP3Test.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Preview/MovieTest.php b/tests/lib/Preview/MovieTest.php index d41b242945b..5acd951a644 100644 --- a/tests/lib/Preview/MovieTest.php +++ b/tests/lib/Preview/MovieTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Preview/OfficeTest.php b/tests/lib/Preview/OfficeTest.php index c9019d017a3..0eb387da9a3 100644 --- a/tests/lib/Preview/OfficeTest.php +++ b/tests/lib/Preview/OfficeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Preview/Provider.php b/tests/lib/Preview/Provider.php index 6cecd8a0762..77659ad0fc6 100644 --- a/tests/lib/Preview/Provider.php +++ b/tests/lib/Preview/Provider.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Preview/SVGTest.php b/tests/lib/Preview/SVGTest.php index 6a0e93e5f79..ca3c918bb0f 100644 --- a/tests/lib/Preview/SVGTest.php +++ b/tests/lib/Preview/SVGTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Preview/TXTTest.php b/tests/lib/Preview/TXTTest.php index 7f5510eb60f..e5b2ffdde75 100644 --- a/tests/lib/Preview/TXTTest.php +++ b/tests/lib/Preview/TXTTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/PublicNamespace/UtilTest.php b/tests/lib/PublicNamespace/UtilTest.php index 6931b191a4d..c16eb0fd1a6 100644 --- a/tests/lib/PublicNamespace/UtilTest.php +++ b/tests/lib/PublicNamespace/UtilTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Remote/Api/OCSTest.php b/tests/lib/Remote/Api/OCSTest.php index d47bb50cc35..f85d034ee7e 100644 --- a/tests/lib/Remote/Api/OCSTest.php +++ b/tests/lib/Remote/Api/OCSTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Remote/InstanceTest.php b/tests/lib/Remote/InstanceTest.php index 3e4ffda15b7..682395c6e6d 100644 --- a/tests/lib/Remote/InstanceTest.php +++ b/tests/lib/Remote/InstanceTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Repair/CleanTagsTest.php b/tests/lib/Repair/CleanTagsTest.php index 11430cc1215..6fe7c6be9de 100644 --- a/tests/lib/Repair/CleanTagsTest.php +++ b/tests/lib/Repair/CleanTagsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Repair/ClearFrontendCachesTest.php b/tests/lib/Repair/ClearFrontendCachesTest.php index 640e272f3b7..7a2849624c7 100644 --- a/tests/lib/Repair/ClearFrontendCachesTest.php +++ b/tests/lib/Repair/ClearFrontendCachesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php b/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php index 1545085f977..a77944871fe 100644 --- a/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php +++ b/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -59,9 +60,9 @@ class ClearGeneratedAvatarCacheTest extends \Test\TestCase { */ public function testShouldRun($from, $expected) { $this->config->expects($this->any()) - ->method('getSystemValueString') - ->with('version', '0.0.0.0') - ->willReturn($from); + ->method('getSystemValueString') + ->with('version', '0.0.0.0') + ->willReturn($from); $this->assertEquals($expected, $this->invokePrivate($this->repair, 'shouldRun')); } diff --git a/tests/lib/Repair/OldGroupMembershipSharesTest.php b/tests/lib/Repair/OldGroupMembershipSharesTest.php index 4678bd174eb..ba46ee504b8 100644 --- a/tests/lib/Repair/OldGroupMembershipSharesTest.php +++ b/tests/lib/Repair/OldGroupMembershipSharesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Repair/RepairCollationTest.php b/tests/lib/Repair/RepairCollationTest.php index 6d3946b2a85..173754a5611 100644 --- a/tests/lib/Repair/RepairCollationTest.php +++ b/tests/lib/Repair/RepairCollationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -61,11 +62,11 @@ class RepairCollationTest extends TestCase { $this->logger = $this->createMock(LoggerInterface::class); $this->config = \OC::$server->getConfig(); if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_MYSQL) { - $this->markTestSkipped("Test only relevant on MySql"); + $this->markTestSkipped('Test only relevant on MySql'); } - $dbPrefix = $this->config->getSystemValueString("dbtableprefix"); - $this->tableName = $this->getUniqueID($dbPrefix . "_collation_test"); + $dbPrefix = $this->config->getSystemValueString('dbtableprefix'); + $this->tableName = $this->getUniqueID($dbPrefix . '_collation_test'); $this->connection->prepare("CREATE TABLE $this->tableName(text VARCHAR(16)) COLLATE utf8_unicode_ci")->execute(); $this->repair = new TestCollationRepair($this->config, $this->logger, $this->connection, false); diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php index eb0e46c61db..36ae22512a8 100644 --- a/tests/lib/Repair/RepairInvalidSharesTest.php +++ b/tests/lib/Repair/RepairInvalidSharesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php index f040a7aa1b2..1bbb0549296 100644 --- a/tests/lib/Repair/RepairMimeTypesTest.php +++ b/tests/lib/Repair/RepairMimeTypesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/RepairTest.php b/tests/lib/RepairTest.php index ab60b14d47e..f4f736ba8fe 100644 --- a/tests/lib/RepairTest.php +++ b/tests/lib/RepairTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/RichObjectStrings/DefinitionsTest.php b/tests/lib/RichObjectStrings/DefinitionsTest.php index efe372a25e8..1a6774bea58 100644 --- a/tests/lib/RichObjectStrings/DefinitionsTest.php +++ b/tests/lib/RichObjectStrings/DefinitionsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/RichObjectStrings/ValidatorTest.php b/tests/lib/RichObjectStrings/ValidatorTest.php index 3604dcba4f7..7d9052fa82e 100644 --- a/tests/lib/RichObjectStrings/ValidatorTest.php +++ b/tests/lib/RichObjectStrings/ValidatorTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Route/RouterTest.php b/tests/lib/Route/RouterTest.php index 713d90d3c20..36188e2cfe5 100644 --- a/tests/lib/Route/RouterTest.php +++ b/tests/lib/Route/RouterTest.php @@ -33,7 +33,7 @@ class RouterTest extends TestCase { $logger->method('info') ->willReturnCallback( function (string $message, array $data) { - $this->fail('Unexpected info log: '.(string)($data['exception'] ?? $message)); + $this->fail('Unexpected info log: '.(string) ($data['exception'] ?? $message)); } ); $this->router = new Router( diff --git a/tests/lib/Security/CSRF/CsrfTokenManagerTest.php b/tests/lib/Security/CSRF/CsrfTokenManagerTest.php index c4fd480654d..8c19bc6e82d 100644 --- a/tests/lib/Security/CSRF/CsrfTokenManagerTest.php +++ b/tests/lib/Security/CSRF/CsrfTokenManagerTest.php @@ -131,14 +131,14 @@ class CsrfTokenManagerTest extends \Test\TestCase { $xorB64 = 'BQcF'; $tokenVal = sprintf('%s:%s', $xorB64, base64_encode($a)); $this->storageInterface - ->expects($this->once()) - ->method('hasToken') - ->willReturn(true); + ->expects($this->once()) + ->method('hasToken') + ->willReturn(true); $token = new \OC\Security\CSRF\CsrfToken($tokenVal); $this->storageInterface - ->expects($this->once()) - ->method('getToken') - ->willReturn($b); + ->expects($this->once()) + ->method('getToken') + ->willReturn($b); $this->assertSame(true, $this->csrfTokenManager->isTokenValid($token)); } diff --git a/tests/lib/Security/Ip/RemoteAddressTest.php b/tests/lib/Security/Ip/RemoteAddressTest.php index 1f200805de7..d1f621796fe 100644 --- a/tests/lib/Security/Ip/RemoteAddressTest.php +++ b/tests/lib/Security/Ip/RemoteAddressTest.php @@ -32,9 +32,9 @@ class RemoteAddressTest extends \Test\TestCase { ->method('getRemoteAddress') ->willReturn($remoteIp); $this->config - ->method('getSystemValue') - ->with('allowed_admin_ranges', false) - ->willReturn($allowedRanges); + ->method('getSystemValue') + ->with('allowed_admin_ranges', false) + ->willReturn($allowedRanges); $remoteAddress = new RemoteAddress($this->config, $this->request); diff --git a/tests/lib/Security/Normalizer/IpAddressTest.php b/tests/lib/Security/Normalizer/IpAddressTest.php index df398005e8d..4c9222fd381 100644 --- a/tests/lib/Security/Normalizer/IpAddressTest.php +++ b/tests/lib/Security/Normalizer/IpAddressTest.php @@ -65,6 +65,6 @@ class IpAddressTest extends TestCase { } public function testToString() { - $this->assertSame('127.0.0.1', (string)(new IpAddress('127.0.0.1'))); + $this->assertSame('127.0.0.1', (string) (new IpAddress('127.0.0.1'))); } } diff --git a/tests/lib/ServerTest.php b/tests/lib/ServerTest.php index 609f19c6f7e..5ef4e69c876 100644 --- a/tests/lib/ServerTest.php +++ b/tests/lib/ServerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Session/CryptoSessionDataTest.php b/tests/lib/Session/CryptoSessionDataTest.php index 6c1536f4769..fa115294a18 100644 --- a/tests/lib/Session/CryptoSessionDataTest.php +++ b/tests/lib/Session/CryptoSessionDataTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Session/CryptoWrappingTest.php b/tests/lib/Session/CryptoWrappingTest.php index 093f2214929..ed211455701 100644 --- a/tests/lib/Session/CryptoWrappingTest.php +++ b/tests/lib/Session/CryptoWrappingTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php index 6ed8ed74359..f868e945682 100644 --- a/tests/lib/Settings/ManagerTest.php +++ b/tests/lib/Settings/ManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Settings/SectionTest.php b/tests/lib/Settings/SectionTest.php index 964256f303c..d3b364f17d7 100644 --- a/tests/lib/Settings/SectionTest.php +++ b/tests/lib/Settings/SectionTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php index 5216d2a730a..13b03c9b335 100644 --- a/tests/lib/SetupTest.php +++ b/tests/lib/SetupTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Share/Backend.php b/tests/lib/Share/Backend.php index 91493d599dc..d476a714e50 100644 --- a/tests/lib/Share/Backend.php +++ b/tests/lib/Share/Backend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -30,7 +31,7 @@ class Backend implements \OCP\Share_Backend { // Always make target be test.txt to cause conflicts if (substr($itemSource, 0, strlen('test')) !== 'test') { - $target = "test.txt"; + $target = 'test.txt'; } else { $target = $itemSource; } diff --git a/tests/lib/Share/HelperTest.php b/tests/lib/Share/HelperTest.php index f92effebd5d..217a239fd68 100644 --- a/tests/lib/Share/HelperTest.php +++ b/tests/lib/Share/HelperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php index d6ed54f06da..25585456e04 100644 --- a/tests/lib/Share/ShareTest.php +++ b/tests/lib/Share/ShareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index 309348bb598..42e1dcfbf0a 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -89,7 +90,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->shareManager = $this->createMock(IShareManager::class); $this->userManager->expects($this->any())->method('userExists')->willReturn(true); - $this->timeFactory->expects($this->any())->method('now')->willReturn(new \DateTimeImmutable("2023-05-04 00:00 Europe/Berlin")); + $this->timeFactory->expects($this->any())->method('now')->willReturn(new \DateTimeImmutable('2023-05-04 00:00 Europe/Berlin')); //Empty share table $this->dbConn->getQueryBuilder()->delete('share')->execute(); @@ -331,10 +332,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $shareOwnerFolder->method('getFirstNodeById')->with(42)->willReturn($ownerPath); $this->rootFolder - ->method('getUserFolder') - ->willReturnMap([ - ['shareOwner', $shareOwnerFolder], - ]); + ->method('getUserFolder') + ->willReturnMap([ + ['shareOwner', $shareOwnerFolder], + ]); $share = $this->provider->getShareById($id); @@ -416,10 +417,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $shareOwnerFolder->method('getFirstNodeById')->with(42)->willReturn($ownerPath); $this->rootFolder - ->method('getUserFolder') - ->willReturnMap([ - ['shareOwner', $shareOwnerFolder], - ]); + ->method('getUserFolder') + ->willReturnMap([ + ['shareOwner', $shareOwnerFolder], + ]); $share = $this->provider->getShareById($id); @@ -827,18 +828,18 @@ class DefaultShareProviderTest extends \Test\TestCase { $ownerFolder = $this->createMock(Folder::class); $userFolder = $this->createMock(Folder::class); $this->rootFolder - ->method('getUserFolder') - ->willReturnMap([ - ['sharedBy', $userFolder], - ['shareOwner', $ownerFolder], - ]); + ->method('getUserFolder') + ->willReturnMap([ + ['sharedBy', $userFolder], + ['shareOwner', $ownerFolder], + ]); $userFolder->method('getFirstNodeById') - ->with(100) - ->willReturn($path); + ->with(100) + ->willReturn($path); $ownerFolder->method('getFirstNodeById') - ->with(100) - ->willReturn($path); + ->with(100) + ->willReturn($path); $share->setShareType(IShare::TYPE_LINK); $share->setSharedBy('sharedBy'); @@ -1186,7 +1187,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertCount(1, $share); $share = $share[0]; - $this->assertSame((string)$id, $share->getId()); + $this->assertSame((string) $id, $share->getId()); $this->assertSame('sharedWith', $share->getSharedWith()); $this->assertSame('shareOwner', $share->getShareOwner()); $this->assertSame('sharedBy', $share->getSharedBy()); @@ -2191,12 +2192,12 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertSame('user0', $shares[0]['share_with']); $this->assertSame('user4', $shares[0]['uid_initiator']); $this->assertSame('user5', $shares[0]['uid_owner']); - $this->assertSame(1, (int)$shares[0]['permissions']); + $this->assertSame(1, (int) $shares[0]['permissions']); $this->assertSame('user3', $shares[1]['share_with']); $this->assertSame('user4', $shares[1]['uid_initiator']); $this->assertSame('user5', $shares[1]['uid_owner']); - $this->assertSame(0, (int)$shares[1]['permissions']); + $this->assertSame(0, (int) $shares[1]['permissions']); $stmt->closeCursor(); diff --git a/tests/lib/Share20/LegacyHooksTest.php b/tests/lib/Share20/LegacyHooksTest.php index 87643614f74..9e4f9515722 100644 --- a/tests/lib/Share20/LegacyHooksTest.php +++ b/tests/lib/Share20/LegacyHooksTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index ebe9eb86363..561e7e52bce 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -76,9 +77,9 @@ class ManagerTest extends \Test\TestCase { protected $hasher; /** @var IShareProvider|MockObject */ protected $defaultProvider; - /** @var IMountManager|MockObject */ + /** @var IMountManager|MockObject */ protected $mountManager; - /** @var IGroupManager|MockObject */ + /** @var IGroupManager|MockObject */ protected $groupManager; /** @var IL10N|MockObject */ protected $l; @@ -92,20 +93,20 @@ class ManagerTest extends \Test\TestCase { protected $rootFolder; /** @var IEventDispatcher|MockObject */ protected $dispatcher; - /** @var IMailer|MockObject */ + /** @var IMailer|MockObject */ protected $mailer; - /** @var IURLGenerator|MockObject */ + /** @var IURLGenerator|MockObject */ protected $urlGenerator; - /** @var \OC_Defaults|MockObject */ + /** @var \OC_Defaults|MockObject */ protected $defaults; - /** @var IUserSession|MockObject */ + /** @var IUserSession|MockObject */ protected $userSession; - /** @var KnownUserService|MockObject */ + /** @var KnownUserService|MockObject */ protected $knownUserService; - /** @var ShareDisableChecker|MockObject */ + /** @var ShareDisableChecker|MockObject */ protected $shareDisabledChecker; private DateTimeZone $timezone; - /** @var IDateTimeZone|MockObject */ + /** @var IDateTimeZone|MockObject */ protected $dateTimeZone; protected function setUp(): void { @@ -4790,7 +4791,7 @@ class ManagerTest extends \Test\TestCase { 'limitEnumerationToPhone', 'limitEnumerationToGroups', ]) - ->getMock(); + ->getMock(); $manager->method('allowEnumerationFullMatch') ->willReturn($allowEnumerationFullMatch); diff --git a/tests/lib/Share20/ShareHelperTest.php b/tests/lib/Share20/ShareHelperTest.php index 04a079db0e9..88ad69a86ae 100644 --- a/tests/lib/Share20/ShareHelperTest.php +++ b/tests/lib/Share20/ShareHelperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Share20/ShareTest.php b/tests/lib/Share20/ShareTest.php index 6769683aafe..41f06cbf3dc 100644 --- a/tests/lib/Share20/ShareTest.php +++ b/tests/lib/Share20/ShareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/SubAdminTest.php b/tests/lib/SubAdminTest.php index a4138fa922b..ab636de4800 100644 --- a/tests/lib/SubAdminTest.php +++ b/tests/lib/SubAdminTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/TagsTest.php b/tests/lib/TagsTest.php index a3e0c8f750f..5d82a431546 100644 --- a/tests/lib/TagsTest.php +++ b/tests/lib/TagsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -85,7 +86,7 @@ class TagsTest extends \Test\TestCase { foreach ($tags as $tag) { $result = $tagger->add($tag); $this->assertGreaterThan(0, $result, 'add() returned an ID <= 0'); - $this->assertTrue((bool)$result); + $this->assertTrue((bool) $result); } $this->assertFalse($tagger->add('Family')); @@ -104,7 +105,7 @@ class TagsTest extends \Test\TestCase { } $result = $tagger->addMultiple($tags); - $this->assertTrue((bool)$result); + $this->assertTrue((bool) $result); foreach ($tags as $tag) { $this->assertTrue($tagger->hasTag($tag)); @@ -125,7 +126,7 @@ class TagsTest extends \Test\TestCase { // Now, we call addMultiple() with $sync=true so the tags will be // be saved to the database. $result = $tagger->addMultiple($tags, true); - $this->assertTrue((bool)$result); + $this->assertTrue((bool) $result); $tagMaps = $tagger->getTags(); foreach ($tagMaps as $tagMap) { diff --git a/tests/lib/TaskProcessing/TaskProcessingTest.php b/tests/lib/TaskProcessing/TaskProcessingTest.php index 91baa562476..672090014c3 100644 --- a/tests/lib/TaskProcessing/TaskProcessingTest.php +++ b/tests/lib/TaskProcessing/TaskProcessingTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -352,7 +353,7 @@ class SuccessfulTextToImageProvider implements \OCP\TextToImage\IProvider { public function generate(string $prompt, array $resources): void { $this->ran = true; - foreach($resources as $resource) { + foreach ($resources as $resource) { fwrite($resource, 'test'); } } diff --git a/tests/lib/TempManagerTest.php b/tests/lib/TempManagerTest.php index 5a7cb6757a1..213b4a41cd1 100644 --- a/tests/lib/TempManagerTest.php +++ b/tests/lib/TempManagerTest.php @@ -33,8 +33,8 @@ class TempManagerTest extends \Test\TestCase { } /** - * @param ?LoggerInterface $logger - * @param ?IConfig $config + * @param ?LoggerInterface $logger + * @param ?IConfig $config * @return \OC\TempManager */ protected function getManager($logger = null, $config = null) { diff --git a/tests/lib/Template/CSSResourceLocatorTest.php b/tests/lib/Template/CSSResourceLocatorTest.php index 64c31d9c94c..84f84c69bbc 100644 --- a/tests/lib/Template/CSSResourceLocatorTest.php +++ b/tests/lib/Template/CSSResourceLocatorTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Template/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php index d9de4b088d1..2bcfc428a19 100644 --- a/tests/lib/Template/JSCombinerTest.php +++ b/tests/lib/Template/JSCombinerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Template/JSResourceLocatorTest.php b/tests/lib/Template/JSResourceLocatorTest.php index 354f23fac19..2c74b07eab5 100644 --- a/tests/lib/Template/JSResourceLocatorTest.php +++ b/tests/lib/Template/JSResourceLocatorTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -138,7 +139,7 @@ class JSResourceLocatorTest extends \Test\TestCase { // Run the tests $locator = $this->jsResourceLocator(); - $locator->find(["core/l10n/en.js"]); + $locator->find(['core/l10n/en.js']); $resources = $locator->getResources(); $this->assertCount(0, $resources); diff --git a/tests/lib/Template/ResourceLocatorTest.php b/tests/lib/Template/ResourceLocatorTest.php index e74e72014c5..c0d43e1fba8 100644 --- a/tests/lib/Template/ResourceLocatorTest.php +++ b/tests/lib/Template/ResourceLocatorTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/TemplateFunctionsTest.php b/tests/lib/TemplateFunctionsTest.php index 754551a415b..2b35bec7a61 100644 --- a/tests/lib/TemplateFunctionsTest.php +++ b/tests/lib/TemplateFunctionsTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -89,13 +90,13 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeDateToday() { $currentTime = 1380703592; $elementTime = $currentTime; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('today', $result); // 2 hours ago is still today $elementTime = $currentTime - 2 * 3600; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('today', $result); } @@ -103,13 +104,13 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeDateYesterday() { $currentTime = 1380703592; $elementTime = $currentTime - 24 * 3600; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('yesterday', $result); // yesterday - 2 hours is still yesterday $elementTime = $currentTime - 26 * 3600; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('yesterday', $result); } @@ -117,13 +118,13 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeDate2DaysAgo() { $currentTime = 1380703592; $elementTime = $currentTime - 48 * 3600; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('2 days ago', $result); // 2 days ago minus 4 hours is still 2 days ago $elementTime = $currentTime - 52 * 3600; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('2 days ago', $result); } @@ -131,12 +132,12 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeDateLastMonth() { $currentTime = 1380703592; $elementTime = $currentTime - 86400 * 31; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('last month', $result); $elementTime = $currentTime - 86400 * 35; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('last month', $result); } @@ -144,12 +145,12 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeDateMonthsAgo() { $currentTime = 1380703592; $elementTime = $currentTime - 86400 * 65; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('2 months ago', $result); $elementTime = $currentTime - 86400 * 130; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('4 months ago', $result); } @@ -157,12 +158,12 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeDateLastYear() { $currentTime = 1380703592; $elementTime = $currentTime - 86400 * 365; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('last year', $result); $elementTime = $currentTime - 86400 * 450; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('last year', $result); } @@ -170,12 +171,12 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeDateYearsAgo() { $currentTime = 1380703592; $elementTime = $currentTime - 86400 * 365.25 * 2; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('2 years ago', $result); $elementTime = $currentTime - 86400 * 365.25 * 3; - $result = (string)relative_modified_date($elementTime, $currentTime, true); + $result = (string) relative_modified_date($elementTime, $currentTime, true); $this->assertEquals('3 years ago', $result); } @@ -187,7 +188,7 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeTimeSecondsAgo() { $currentTime = 1380703592; $elementTime = $currentTime - 5; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('seconds ago', $result); } @@ -195,7 +196,7 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeTimeMinutesAgo() { $currentTime = 1380703592; $elementTime = $currentTime - 190; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('3 minutes ago', $result); } @@ -203,7 +204,7 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeTimeHoursAgo() { $currentTime = 1380703592; $elementTime = $currentTime - 7500; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('2 hours ago', $result); } @@ -211,13 +212,13 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeTime2DaysAgo() { $currentTime = 1380703592; $elementTime = $currentTime - 48 * 3600; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('2 days ago', $result); // 2 days ago minus 4 hours is still 2 days ago $elementTime = $currentTime - 52 * 3600; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('2 days ago', $result); } @@ -225,12 +226,12 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeTimeLastMonth() { $currentTime = 1380703592; $elementTime = $currentTime - 86400 * 31; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('last month', $result); $elementTime = $currentTime - 86400 * 35; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('last month', $result); } @@ -238,12 +239,12 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeTimeMonthsAgo() { $currentTime = 1380703592; $elementTime = $currentTime - 86400 * 65; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('2 months ago', $result); $elementTime = $currentTime - 86400 * 130; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('4 months ago', $result); } @@ -251,12 +252,12 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeTimeLastYear() { $currentTime = 1380703592; $elementTime = $currentTime - 86400 * 365; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('last year', $result); $elementTime = $currentTime - 86400 * 450; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('last year', $result); } @@ -264,12 +265,12 @@ class TemplateFunctionsTest extends \Test\TestCase { public function testRelativeTimeYearsAgo() { $currentTime = 1380703592; $elementTime = $currentTime - 86400 * 365.25 * 2; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('2 years ago', $result); $elementTime = $currentTime - 86400 * 365.25 * 3; - $result = (string)relative_modified_date($elementTime, $currentTime, false); + $result = (string) relative_modified_date($elementTime, $currentTime, false); $this->assertEquals('3 years ago', $result); } diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index 1dbe69ab6c4..e9f24b89773 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -192,7 +193,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { $errors = libxml_get_errors(); libxml_clear_errors(); if (!empty($errors)) { - self::assertEquals([], $errors, "There have been xml parsing errors"); + self::assertEquals([], $errors, 'There have been xml parsing errors'); } if ($this->IsDatabaseAccessAllowed()) { @@ -466,10 +467,10 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * @param string $path path to check * @param int $type lock type * @param bool $onMountPoint true to check the mount point instead of the - * mounted storage + * mounted storage * * @return boolean true if the file is locked with the - * given type, false otherwise + * given type, false otherwise */ protected function isFileLocked($view, $path, $type, $onMountPoint = false) { // Note: this seems convoluted but is necessary because diff --git a/tests/lib/TestMoveableMountPoint.php b/tests/lib/TestMoveableMountPoint.php index 4f3feccdbe2..ac1aeaf217f 100644 --- a/tests/lib/TestMoveableMountPoint.php +++ b/tests/lib/TestMoveableMountPoint.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/TextProcessing/TextProcessingTest.php b/tests/lib/TextProcessing/TextProcessingTest.php index 9c759e52458..4744c3d8066 100644 --- a/tests/lib/TextProcessing/TextProcessingTest.php +++ b/tests/lib/TextProcessing/TextProcessingTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Traits/ClientServiceTrait.php b/tests/lib/Traits/ClientServiceTrait.php index 3f0d71aeb28..5a091544889 100644 --- a/tests/lib/Traits/ClientServiceTrait.php +++ b/tests/lib/Traits/ClientServiceTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/lib/Traits/EncryptionTrait.php b/tests/lib/Traits/EncryptionTrait.php index e435a286685..4d6e0eedb6b 100644 --- a/tests/lib/Traits/EncryptionTrait.php +++ b/tests/lib/Traits/EncryptionTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Traits/MountProviderTrait.php b/tests/lib/Traits/MountProviderTrait.php index 6d947d645dd..dafab3a7468 100644 --- a/tests/lib/Traits/MountProviderTrait.php +++ b/tests/lib/Traits/MountProviderTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Traits/UserTrait.php b/tests/lib/Traits/UserTrait.php index 05fb0caa8ca..4a00b4512db 100644 --- a/tests/lib/Traits/UserTrait.php +++ b/tests/lib/Traits/UserTrait.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Updater/ReleaseMetadataTest.php b/tests/lib/Updater/ReleaseMetadataTest.php index 25fe3949152..5191d1f6c3c 100644 --- a/tests/lib/Updater/ReleaseMetadataTest.php +++ b/tests/lib/Updater/ReleaseMetadataTest.php @@ -13,29 +13,29 @@ use OCP\Http\Client\IResponse; use PHPUnit\Framework\MockObject\MockObject; class ReleaseMetadataTest extends \Test\TestCase { - private IClientService| MockObject $clientService; + private IClientService|MockObject $clientService; protected function setUp(): void { parent::setUp(); $this->clientService = $this->getMockBuilder(IClientService::class) - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); } public function testDownloadMetadata() { $client = $this->createMock(IClient::class); $response = $this->createMock(IResponse::class); $this->clientService->expects($this->once()) - ->method('newClient') - ->with() - ->willReturn($client); + ->method('newClient') + ->with() + ->willReturn($client); $client->expects($this->once()) - ->method('get') - ->willReturn($response); + ->method('get') + ->willReturn($response); $response->expects($this->once()) - ->method('getBody') - ->with() - ->willReturn($this->resultRequest()); + ->method('getBody') + ->with() + ->willReturn($this->resultRequest()); $releaseMetadata = new ReleaseMetadata($this->clientService); @@ -52,18 +52,18 @@ class ReleaseMetadataTest extends \Test\TestCase { $client = $this->createMock(IClient::class); $response = $this->createMock(IResponse::class); $this->clientService->expects($this->once()) - ->method('newClient') - ->with() - ->willReturn($client); + ->method('newClient') + ->with() + ->willReturn($client); $client->expects($this->once()) - ->method('get') - ->with($url) - ->willReturn($response); + ->method('get') + ->with($url) + ->willReturn($response); $response->expects($this->once()) - ->method('getBody') - ->with() - ->willReturn('{}'); + ->method('getBody') + ->with() + ->willReturn('{}'); $releaseMetadata = new ReleaseMetadata($this->clientService); $releaseMetadata->getMetadata($version); diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php index 7aa04ad2ab6..06df4483b06 100644 --- a/tests/lib/Updater/VersionCheckTest.php +++ b/tests/lib/Updater/VersionCheckTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -21,11 +22,11 @@ class VersionCheckTest extends \Test\TestCase { private $config; /** @var IAppConfig| \PHPUnit\Framework\MockObject\MockObject */ private $appConfig; - /** @var VersionCheck | \PHPUnit\Framework\MockObject\MockObject*/ + /** @var VersionCheck | \PHPUnit\Framework\MockObject\MockObject */ private $updater; - /** @var IRegistry | \PHPUnit\Framework\Mo2ckObject\MockObject*/ + /** @var IRegistry | \PHPUnit\Framework\Mo2ckObject\MockObject */ private $registry; - /** @var LoggerInterface | \PHPUnit\Framework\Mo2ckObject\MockObject*/ + /** @var LoggerInterface | \PHPUnit\Framework\Mo2ckObject\MockObject */ private $logger; protected function setUp(): void { diff --git a/tests/lib/UpdaterTest.php b/tests/lib/UpdaterTest.php index 118cb1b6d41..75747d182ce 100644 --- a/tests/lib/UpdaterTest.php +++ b/tests/lib/UpdaterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php index d54698b7a0a..7b538cb3def 100644 --- a/tests/lib/UrlGeneratorTest.php +++ b/tests/lib/UrlGeneratorTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/User/AvatarUserDummy.php b/tests/lib/User/AvatarUserDummy.php index d443a31e3f0..001dabd24c6 100644 --- a/tests/lib/User/AvatarUserDummy.php +++ b/tests/lib/User/AvatarUserDummy.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/User/Backend.php b/tests/lib/User/Backend.php index 7efba2eaeb6..3b7e8c59e68 100644 --- a/tests/lib/User/Backend.php +++ b/tests/lib/User/Backend.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/User/DatabaseTest.php b/tests/lib/User/DatabaseTest.php index 16b223aaaba..327724ba22f 100644 --- a/tests/lib/User/DatabaseTest.php +++ b/tests/lib/User/DatabaseTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/User/Dummy.php b/tests/lib/User/Dummy.php index ffc5d343200..ec5be8ec60a 100644 --- a/tests/lib/User/Dummy.php +++ b/tests/lib/User/Dummy.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php index 5f8ca6e37f7..bab32e2be89 100644 --- a/tests/lib/User/ManagerTest.php +++ b/tests/lib/User/ManagerTest.php @@ -673,7 +673,7 @@ class ManagerTest extends TestCase { $manager = \OCP\Server::get(IUserManager::class); // Create some users - $now = (string)time(); + $now = (string) time(); $user1 = $manager->createUser('test_active_1', 'test_active_1'); $config->setUserValue('test_active_1', 'login', 'lastLogin', $now); $user1->setDisplayName('test active 1'); diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php index c57306e578f..301531b037c 100644 --- a/tests/lib/User/SessionTest.php +++ b/tests/lib/User/SessionTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php index fbbf4366c05..dd29f49ee42 100644 --- a/tests/lib/User/UserTest.php +++ b/tests/lib/User/UserTest.php @@ -222,7 +222,7 @@ class UserTest extends TestCase { $user->method('getUID') ->willReturn('foo'); if ($homeProvider->getHomeMountForUser($user, $this->createMock(IStorageFactory::class)) !== null) { - $this->markTestSkipped("Skipping test for non local home storage"); + $this->markTestSkipped('Skipping test for non local home storage'); } /** diff --git a/tests/lib/Util/Group/Dummy.php b/tests/lib/Util/Group/Dummy.php index 50edc15c845..fab94cdc645 100644 --- a/tests/lib/Util/Group/Dummy.php +++ b/tests/lib/Util/Group/Dummy.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/Util/User/Dummy.php b/tests/lib/Util/User/Dummy.php index d44b9d85d72..201c094dda9 100644 --- a/tests/lib/Util/User/Dummy.php +++ b/tests/lib/Util/User/Dummy.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php index 23da44b6e84..d18ef05ad5b 100644 --- a/tests/lib/UtilCheckServerTest.php +++ b/tests/lib/UtilCheckServerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index cef3f4c063d..31f408108a0 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -70,7 +71,7 @@ class UtilTest extends \Test\TestCase { public function testEncodePath() { $component = '/§#@test%&^ä/-child'; $result = OC_Util::encodePath($component); - $this->assertEquals("/%C2%A7%23%40test%25%26%5E%C3%A4/-child", $result); + $this->assertEquals('/%C2%A7%23%40test%25%26%5E%C3%A4/-child', $result); } public function testIsNonUTF8Locale() { @@ -96,7 +97,7 @@ class UtilTest extends \Test\TestCase { * So we check that with strict email verification we fallback to the default */ public function testGetDefaultEmailAddressStrict() { - $email = \OCP\Util::getDefaultEmailAddress("no-reply"); + $email = \OCP\Util::getDefaultEmailAddress('no-reply'); $this->assertEquals('no-reply@localhost.localdomain', $email); } @@ -106,7 +107,7 @@ class UtilTest extends \Test\TestCase { public function testGetDefaultEmailAddress() { $config = \OC::$server->getConfig(); $config->setAppValue('core', 'enforce_strict_email_check', 'no'); - $email = \OCP\Util::getDefaultEmailAddress("no-reply"); + $email = \OCP\Util::getDefaultEmailAddress('no-reply'); $this->assertEquals('no-reply@localhost', $email); $config->deleteAppValue('core', 'enforce_strict_email_check'); } @@ -114,7 +115,7 @@ class UtilTest extends \Test\TestCase { public function testGetDefaultEmailAddressFromConfig() { $config = \OC::$server->getConfig(); $config->setSystemValue('mail_domain', 'example.com'); - $email = \OCP\Util::getDefaultEmailAddress("no-reply"); + $email = \OCP\Util::getDefaultEmailAddress('no-reply'); $this->assertEquals('no-reply@example.com', $email); $config->deleteSystemValue('mail_domain'); } @@ -123,7 +124,7 @@ class UtilTest extends \Test\TestCase { $config = \OC::$server->getConfig(); $config->setSystemValue('mail_domain', 'example.com'); $config->setSystemValue('mail_from_address', 'owncloud'); - $email = \OCP\Util::getDefaultEmailAddress("no-reply"); + $email = \OCP\Util::getDefaultEmailAddress('no-reply'); $this->assertEquals('owncloud@example.com', $email); $config->deleteSystemValue('mail_domain'); $config->deleteSystemValue('mail_from_address'); @@ -262,25 +263,25 @@ class UtilTest extends \Test\TestCase { // All scripts still there $scripts = [ - "core/js/common", - "core/js/main", - "core/js/myFancyJSFile1", - "core/js/myFancyJSFile4", - "core/js/myFancyJSFile5", - "first/l10n/en", - "first/js/myFirstJSFile", - "files/l10n/en", - "files/js/myFancyJSFile2", - "myApp/l10n/en", - "myApp/js/myFancyJSFile3", - "myApp2/l10n/en", - "myApp2/js/myApp2JSFile", - "myApp5/l10n/en", - "myApp5/js/myApp5JSFile", - "myApp3/l10n/en", - "myApp3/js/myApp3JSFile", - "myApp4/l10n/en", - "myApp4/js/myApp4JSFile", + 'core/js/common', + 'core/js/main', + 'core/js/myFancyJSFile1', + 'core/js/myFancyJSFile4', + 'core/js/myFancyJSFile5', + 'first/l10n/en', + 'first/js/myFirstJSFile', + 'files/l10n/en', + 'files/js/myFancyJSFile2', + 'myApp/l10n/en', + 'myApp/js/myFancyJSFile3', + 'myApp2/l10n/en', + 'myApp2/js/myApp2JSFile', + 'myApp5/l10n/en', + 'myApp5/js/myApp5JSFile', + 'myApp3/l10n/en', + 'myApp3/js/myApp3JSFile', + 'myApp4/l10n/en', + 'myApp4/js/myApp4JSFile', ]; foreach ($scripts as $script) { $this->assertContains($script, $scripts); diff --git a/tests/preseed-config.php b/tests/preseed-config.php index d10efe7a225..12b5df7b47b 100644 --- a/tests/preseed-config.php +++ b/tests/preseed-config.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2012-2016 ownCloud, Inc. diff --git a/tests/redis-cluster.config.php b/tests/redis-cluster.config.php index d9951218384..f749ebc81dc 100644 --- a/tests/redis-cluster.config.php +++ b/tests/redis-cluster.config.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/redis.config.php b/tests/redis.config.php index 9068d1ad3d5..dd135345abd 100644 --- a/tests/redis.config.php +++ b/tests/redis.config.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/startsessionlistener.php b/tests/startsessionlistener.php index c0ea9a1cb45..5e8005d5c80 100644 --- a/tests/startsessionlistener.php +++ b/tests/startsessionlistener.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2015 ownCloud, Inc. @@ -19,7 +20,7 @@ class StartSessionListener implements TestListener { public function endTest(Test $test, float $time): void { // reopen the session - only allowed for memory session if (\OC::$server->getSession() instanceof Memory) { - /** @var $session Memory */ + /** @var Memory $session */ $session = \OC::$server->getSession(); $session->reopen(); } diff --git a/themes/example/defaults.php b/themes/example/defaults.php index 37bce6c3ee6..773f91a5d62 100644 --- a/themes/example/defaults.php +++ b/themes/example/defaults.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. |