Skip to content

Commit

Permalink
Merge pull request #47449 from nextcloud/debt/noid/update-codestyle
Browse files Browse the repository at this point in the history
Update to coding-standard 1.2.3
  • Loading branch information
kesselb authored Aug 25, 2024
2 parents 1cc6b35 + dd165cf commit 5d63215
Show file tree
Hide file tree
Showing 875 changed files with 7,888 additions and 7,876 deletions.
7 changes: 7 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# .git-blame-ignore-revs

# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later

# Update to coding-standard 1.2.3
af6de04e9e141466dc229e444ff3f146f4a34765
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ Otherwise, git checkouts can be handled the same as release archives, by using t

- Comment on a pull request with `/update-3rdparty` to update the 3rd party submodule. It will update to the last commit of the 3rd party branch named like the PR target.

#### Ignore code style updates in git blame

`git config blame.ignoreRevsFile .git-blame-ignore-revs`

## Contribution guidelines 📜

All contributions to this repository from June 16, 2016, and onward are considered to be
Expand Down
18 changes: 9 additions & 9 deletions apps/admin_audit/lib/Actions/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function read(BeforeNodeReadEvent $event): void {
];
} 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;
}
Expand All @@ -65,7 +65,7 @@ public function beforeRename(BeforeNodeRenamedEvent $event): void {
$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;
}
Expand All @@ -87,7 +87,7 @@ public function afterRename(NodeRenamedEvent $event): void {
];
} 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;
}
Expand All @@ -113,7 +113,7 @@ public function create(NodeCreatedEvent $event): void {
];
} 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;
}
Expand Down Expand Up @@ -142,7 +142,7 @@ public function copy(NodeCopiedEvent $event): void {
];
} 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;
}
Expand All @@ -167,7 +167,7 @@ public function write(BeforeNodeWrittenEvent $event): void {
];
} 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;
}
Expand Down Expand Up @@ -195,7 +195,7 @@ public function update(NodeWrittenEvent $event): void {
];
} catch (InvalidPathException|NotFoundException $e) {
\OCP\Server::get(LoggerInterface::class)->error(
"Exception thrown in file update: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
'Exception thrown in file update: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
);
return;
}
Expand All @@ -219,7 +219,7 @@ public function delete(NodeDeletedEvent $event): void {
];
} 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;
}
Expand Down Expand Up @@ -248,7 +248,7 @@ public function preview(BeforePreviewFetchedEvent $event): void {
];
} 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;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/cloud_federation_api/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public function getCapabilities() {

$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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function __construct(
* @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
Expand Down Expand Up @@ -196,6 +197,7 @@ public function addShare($shareWith, $name, $description, $providerId, $owner, $
* @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
Expand Down
4 changes: 2 additions & 2 deletions apps/comments/lib/Activity/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function commentEvent(CommentsEvent $event): void {
$activity->setApp('comments')
->setType('comments')
->setAuthor($actor)
->setObject($event->getComment()->getObjectType(), (int) $event->getComment()->getObjectId())
->setObject($event->getComment()->getObjectType(), (int)$event->getComment()->getObjectId())
->setMessage('add_comment_message', [
'commentId' => $event->getComment()->getId(),
]);
Expand All @@ -79,7 +79,7 @@ public function commentEvent(CommentsEvent $event): void {

$activity->setSubject('add_comment_subject', [
'actor' => $actor,
'fileId' => (int) $event->getComment()->getObjectId(),
'fileId' => (int)$event->getComment()->getObjectId(),
'filePath' => trim($path, '/'),
]);
$this->activityManager->publish($activity);
Expand Down
2 changes: 1 addition & 1 deletion apps/comments/lib/Activity/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected function parseMessage(IEvent $event): void {
$commentId = $messageParameters['commentId'] ?? $messageParameters[0];

try {
$comment = $this->commentsManager->get((string) $commentId);
$comment = $this->commentsManager->get((string)$commentId);
$message = $comment->getMessage();

$mentionCount = 1;
Expand Down
2 changes: 1 addition & 1 deletion apps/comments/lib/Search/LegacyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function search($query): array {
* @throws NotFoundException
*/
protected function getFileForComment(Folder $userFolder, IComment $comment): Node {
$nodes = $userFolder->getById((int) $comment->getObjectId());
$nodes = $userFolder->getById((int)$comment->getObjectId());
if (empty($nodes)) {
throw new NotFoundException('File not found');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
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 {
Expand Down
2 changes: 1 addition & 1 deletion apps/comments/tests/Unit/EventHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Test\TestCase;

class EventHandlerTest extends TestCase {
/** @var CommentsEventListener */
/** @var CommentsEventListener */
protected $eventHandler;

/** @var ActivityListener|\PHPUnit\Framework\MockObject\MockObject */
Expand Down
2 changes: 1 addition & 1 deletion apps/comments/tests/Unit/Notification/ListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions apps/contactsinteraction/lib/AddressBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public function __construct(
* @throws Exception
*/
public function delete(): void {
throw new Exception("This addressbook is immutable");
throw new Exception('This addressbook is immutable');
}

/**
* @inheritDoc
* @throws Exception
*/
public function createFile($name, $data = null) {
throw new Exception("This addressbook is immutable");
throw new Exception('This addressbook is immutable');
}

/**
Expand All @@ -65,7 +65,7 @@ public function getChild($name): Card {
$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);
}
}

Expand Down Expand Up @@ -112,7 +112,7 @@ public function getLastModified(): ?int {
* @throws Exception
*/
public function propPatch(PropPatch $propPatch) {
throw new Exception("This addressbook is immutable");
throw new Exception('This addressbook is immutable');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions apps/contactsinteraction/lib/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getContentType(): ?string {
* @inheritDoc
*/
public function getETag(): ?string {
return '"' . md5((string) $this->getLastModified()) . '"';
return '"' . md5((string)$this->getLastModified()) . '"';
}

/**
Expand All @@ -91,7 +91,7 @@ public function delete(): void {
* @inheritDoc
*/
public function getName(): string {
return (string) $this->contact->getId();
return (string)$this->contact->getId();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/contactsinteraction/lib/Db/CardSearchDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function findExisting(IUser $user,
}
$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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public function handle(Event $event): void {
}

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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public function __construct(IDBConnection $db,
}

public function run($argument) {
$offset = (int) $argument['offset'];
$stopAt = (int) $argument['stopAt'];
$offset = (int)$argument['offset'];
$stopAt = (int)$argument['stopAt'];

$this->logger->info('Building calendar reminder index (' . $offset .'/' . $stopAt . ')');

Expand Down Expand Up @@ -88,7 +88,7 @@ private function buildIndex(int $offset, int $stopAt):int {

$result = $query->executeQuery();
while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
$offset = (int) $row['id'];
$offset = (int)$row['id'];
if (is_resource($row['calendardata'])) {
$row['calendardata'] = stream_get_contents($row['calendardata']);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class CleanupInvitationTokenJob extends TimedJob {

/** @var IDBConnection */
/** @var IDBConnection */
private $db;

public function __construct(IDBConnection $db, ITimeFactory $time) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function __construct(
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');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function run($argument): void {

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,
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/BackgroundJob/PruneOutdatedSyncTokensJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function __construct(ITimeFactory $timeFactory, CalDavBackend $calDavBack
}

public function run($argument) {
$limit = max(1, (int) $this->config->getAppValue(Application::APP_ID, 'totalNumberOfSyncTokensToKeep', '10000'));
$retention = max(7, (int) $this->config->getAppValue(Application::APP_ID, 'syncTokensRetentionDays', '60')) * 24 * 3600;
$limit = max(1, (int)$this->config->getAppValue(Application::APP_ID, 'totalNumberOfSyncTokensToKeep', '10000'));
$retention = max(7, (int)$this->config->getAppValue(Application::APP_ID, 'syncTokensRetentionDays', '60')) * 24 * 3600;

$prunedCalendarSyncTokens = $this->calDavBackend->pruneOutdatedSyncTokens($limit, $retention);
$prunedAddressBookSyncTokens = $this->cardDavBackend->pruneOutdatedSyncTokens($limit, $retention);
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/BackgroundJob/RefreshWebcalJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private function fixSubscriptionRowTyping(array &$row):void {

foreach ($forceInt as $column) {
if (isset($row[$column])) {
$row[$column] = (int) $row[$column];
$row[$column] = (int)$row[$column];
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/BackgroundJob/UploadCleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function run($argument) {
/** @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;
}
Expand All @@ -54,7 +54,7 @@ protected function run($argument) {
$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();
}
Expand Down
14 changes: 7 additions & 7 deletions apps/dav/lib/BulkUpload/BulkUploadPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function initialize(Server $server): void {
*/
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;
}

Expand Down Expand Up @@ -77,16 +77,16 @@ public function httpPost(RequestInterface $request, ResponseInterface $response)
$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(),
];
}
}
Expand Down
Loading

0 comments on commit 5d63215

Please sign in to comment.