Skip to content

Commit

Permalink
style: update codestyle for coding-standard 1.2.2
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kesselberg <[email protected]>
  • Loading branch information
kesselb committed Aug 23, 2024
1 parent 0cab17b commit f8a202a
Show file tree
Hide file tree
Showing 966 changed files with 8,527 additions and 8,527 deletions.
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,9 +71,9 @@ 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
* 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]
Expand Down Expand Up @@ -196,10 +196,10 @@ 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
* 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]
Expand Down
6 changes: 3 additions & 3 deletions apps/comments/lib/Activity/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function commentEvent(CommentsEvent $event): void {

// 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;
}
Expand All @@ -47,7 +47,7 @@ public function commentEvent(CommentsEvent $event): void {
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);
Expand Down Expand Up @@ -75,7 +75,7 @@ public function commentEvent(CommentsEvent $event): void {
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,
Expand Down
2 changes: 1 addition & 1 deletion apps/comments/lib/Controller/NotificationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function view(string $id): RedirectResponse|NotFoundResponse {
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);

Expand Down
2 changes: 1 addition & 1 deletion apps/comments/lib/Listener/CommentsEntityEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function handle(Event $event): void {
}

$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);
});
}
Expand Down
2 changes: 1 addition & 1 deletion apps/comments/lib/MaxAutoCompleteResultsInitialState.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public function getKey(): string {
}

public function getData(): int {
return (int)$this->config->getAppValue('comments', 'maxAutoCompleteResults', '10');
return (int) $this->config->getAppValue('comments', 'maxAutoCompleteResults', '10');
}
}
2 changes: 1 addition & 1 deletion apps/comments/lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function prepare(INotification $notification, string $languageCode): INot
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();
}
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
12 changes: 6 additions & 6 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 @@ -59,13 +59,13 @@ public function getChild($name): Card {
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);
}
}

Expand All @@ -92,7 +92,7 @@ public function childExists($name): bool {
try {
$this->mapper->find(
$this->getUid(),
(int)$name
(int) $name
);
return true;
} catch (DoesNotExistException $e) {
Expand All @@ -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
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
2 changes: 1 addition & 1 deletion apps/contactsinteraction/lib/Db/RecentContactMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function findLastUpdatedForUserId(string $uid): ?int {
return null;
}

return (int)$row['last_contact'];
return (int) $row['last_contact'];
}

public function cleanUp(int $olderThan): void {
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
2 changes: 1 addition & 1 deletion apps/dav/lib/Avatars/AvatarHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function createDirectory($name) {
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');
}
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Avatars/AvatarNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getETag() {
public function getLastModified() {
$timestamp = $this->avatar->getFile($this->size)->getMTime();
if (!empty($timestamp)) {
return (int)$timestamp;
return (int) $timestamp;
}
return $timestamp;
}
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/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
2 changes: 1 addition & 1 deletion apps/dav/lib/BackgroundJob/UserStatusAutomation.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function processAvailability(string $property, string $userId, bool $has
$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();
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 f8a202a

Please sign in to comment.