Skip to content

Commit

Permalink
Merge pull request #48181 from nextcloud/chore/deps/nextcloud-coding-…
Browse files Browse the repository at this point in the history
…standard
  • Loading branch information
provokateurin committed Sep 19, 2024
2 parents 8c60ffa + 6285f55 commit 74c38b8
Show file tree
Hide file tree
Showing 596 changed files with 1,657 additions and 1,524 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ aa5f037af71c915424c6dcfd5ad2dc82797dc0d6
af6de04e9e141466dc229e444ff3f146f4a34765
0bd284cb81b6866338aaaa67aa1d81ef9bfbb2ab
8af7ecb2576071f170ecbb0aa2311b26581e40e2
# Update to coding-standard 1.3.1
9836e9b16484582d309c8437ab46d82e34956941
# Automated refactorings
49dd79eabb2b8902559a7a4e8f8fcad54f46b604
4 changes: 2 additions & 2 deletions apps/admin_audit/lib/Actions/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public function log(string $text,
if (!isset($params[$element])) {
if ($obfuscateParameters) {
$this->logger->critical(
'$params["'.$element.'"] was missing.',
'$params["' . $element . '"] was missing.',
['app' => 'admin_audit']
);
} else {
$this->logger->critical(
sprintf(
'$params["'.$element.'"] was missing. Transferred value: %s',
'$params["' . $element . '"] was missing. Transferred value: %s',
print_r($params, true)
),
['app' => 'admin_audit']
Expand Down
16 changes: 8 additions & 8 deletions apps/admin_audit/lib/Actions/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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 @@ -64,7 +64,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 @@ -86,7 +86,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 @@ -112,7 +112,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 @@ -141,7 +141,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 @@ -166,7 +166,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 @@ -194,7 +194,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 @@ -218,7 +218,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
2 changes: 1 addition & 1 deletion apps/admin_audit/lib/Listener/FileEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private function beforePreviewFetched(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
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(
private ICloudFederationProviderManager $cloudFederationProviderManager,
private Config $config,
private ICloudFederationFactory $factory,
private ICloudIdManager $cloudIdManager
private ICloudIdManager $cloudIdManager,
) {
parent::__construct($appName, $request);
}
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 @@ -33,7 +33,7 @@ public function __construct(
protected IRootFolder $rootFolder,
protected IURLGenerator $urlGenerator,
protected IManager $notificationManager,
protected IUserSession $userSession
protected IUserSession $userSession,
) {
parent::__construct($appName, $request);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/comments/lib/Notification/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class Listener {
public function __construct(
protected IManager $notificationManager,
protected IUserManager $userManager
protected IUserManager $userManager,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion apps/comments/lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(
protected IRootFolder $rootFolder,
protected ICommentsManager $commentsManager,
protected IURLGenerator $url,
protected IUserManager $userManager
protected IUserManager $userManager,
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function run($argument) {
$offset = (int)$argument['offset'];
$stopAt = (int)$argument['stopAt'];

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

$offset = $this->buildIndex($offset, $stopAt);

Expand Down
6 changes: 4 additions & 2 deletions apps/dav/lib/BackgroundJob/UserStatusAutomation.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@
use Sabre\VObject\Recur\RRuleIterator;

class UserStatusAutomation extends TimedJob {
public function __construct(private ITimeFactory $timeFactory,
public function __construct(
private ITimeFactory $timeFactory,
private IDBConnection $connection,
private IJobList $jobList,
private LoggerInterface $logger,
private IManager $manager,
private IConfig $config,
private IAvailabilityCoordinator $coordinator,
private IUserManager $userManager) {
private IUserManager $userManager,
) {
parent::__construct($timeFactory);

// Interval 0 might look weird, but the last_checked is always moved
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/BulkUpload/BulkUploadPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BulkUploadPlugin extends ServerPlugin {

public function __construct(
Folder $userFolder,
LoggerInterface $logger
LoggerInterface $logger,
) {
$this->userFolder = $userFolder;
$this->logger = $logger;
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/BulkUpload/MultipartRequestParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public function __construct(
$this->stream = $stream;

$boundary = $this->parseBoundaryFromHeaders($contentType);
$this->boundary = '--'.$boundary."\r\n";
$this->lastBoundary = '--'.$boundary."--\r\n";
$this->boundary = '--' . $boundary . "\r\n";
$this->lastBoundary = '--' . $boundary . "--\r\n";
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function httpPost(RequestInterface $request, ResponseInterface $response)

$requestBody = $request->getBodyAsString();
$this->server->xml->parse($requestBody, $request->getUrl(), $documentType);
if ($documentType !== '{'.self::NS_Nextcloud.'}enable-birthday-calendar') {
if ($documentType !== '{' . self::NS_Nextcloud . '}enable-birthday-calendar') {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions apps/dav/lib/CalDAV/BirthdayService.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function onCardDeleted(int $addressBookId,

$calendar = $this->ensureCalendarExists($principalUri);
foreach (['', '-death', '-anniversary'] as $tag) {
$objectUri = $book['uri'] . '-' . $cardUri . $tag .'.ics';
$objectUri = $book['uri'] . '-' . $cardUri . $tag . '.ics';
$this->calDavBackEnd->deleteCalendarObject($calendar['id'], $objectUri, CalDavBackend::CALENDAR_TYPE_CALENDAR, true);
}
}
Expand Down Expand Up @@ -264,7 +264,7 @@ public function buildDateFromContact(string $cardData,
* @param string $user
*/
public function resetForUser(string $user):void {
$principal = 'principals/users/'.$user;
$principal = 'principals/users/' . $user;
$calendar = $this->calDavBackEnd->getCalendarByUri($principal, self::BIRTHDAY_CALENDAR_URI);
if (!$calendar) {
return; // The user's birthday calendar doesn't exist, no need to purge it
Expand All @@ -281,7 +281,7 @@ public function resetForUser(string $user):void {
* @throws \Sabre\DAV\Exception\BadRequest
*/
public function syncUser(string $user):void {
$principal = 'principals/users/'.$user;
$principal = 'principals/users/' . $user;
$this->ensureCalendarExists($principal);
$books = $this->cardDavBackEnd->getAddressBooksForUser($principal);
foreach ($books as $book) {
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/CachedSubscriptionImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CachedSubscriptionImpl implements ICalendar {
public function __construct(
CachedSubscription $calendar,
array $calendarInfo,
CalDavBackend $backend
CalDavBackend $backend,
) {
$this->calendar = $calendar;
$this->calendarInfo = $calendarInfo;
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/CachedSubscriptionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class CachedSubscriptionProvider implements ICalendarProvider {

public function __construct(
private CalDavBackend $calDavBackend
private CalDavBackend $calDavBackend,
) {
}

Expand Down
18 changes: 9 additions & 9 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public function getCalendarsForUser($principalUri) {

$fields = array_column($this->propertyMap, 0);
$fields = array_map(function (string $field) {
return 'a.'.$field;
return 'a.' . $field;
}, $fields);
$fields[] = 'a.id';
$fields[] = 'a.uri';
Expand Down Expand Up @@ -1713,19 +1713,19 @@ public function calendarQuery($calendarId, array $filters, $calendarType = self:
try {
$matches = $this->validateFilterForObject($row, $filters);
} catch (ParseException $ex) {
$this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'], [
$this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [
'app' => 'dav',
'exception' => $ex,
]);
continue;
} catch (InvalidDataException $ex) {
$this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'], [
$this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [
'app' => 'dav',
'exception' => $ex,
]);
continue;
} catch (MaxInstancesExceededException $ex) {
$this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: '.$row['uri'], [
$this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: ' . $row['uri'], [
'app' => 'dav',
'exception' => $ex,
]);
Expand Down Expand Up @@ -1848,7 +1848,7 @@ public function calendarSearch($principalUri, array $filters, $limit = null, $of
->andWhere($compExpr)
->andWhere($propParamExpr)
->andWhere($query->expr()->iLike('i.value',
$query->createNamedParameter('%'.$this->db->escapeLikeParameter($filters['search-term']).'%')))
$query->createNamedParameter('%' . $this->db->escapeLikeParameter($filters['search-term']) . '%')))
->andWhere($query->expr()->isNull('deleted_at'));

if ($offset) {
Expand Down Expand Up @@ -1890,7 +1890,7 @@ public function search(
array $searchProperties,
array $options,
$limit,
$offset
$offset,
) {
$outerQuery = $this->db->getQueryBuilder();
$innerQuery = $this->db->getQueryBuilder();
Expand Down Expand Up @@ -2066,7 +2066,7 @@ public function search(
return $calendarObjects;
}

private function searchCalendarObjects(IQueryBuilder $query, DateTimeInterface|null $start, DateTimeInterface|null $end): array {
private function searchCalendarObjects(IQueryBuilder $query, ?DateTimeInterface $start, ?DateTimeInterface $end): array {
$calendarObjects = [];
$filterByTimeRange = ($start instanceof DateTimeInterface) || ($end instanceof DateTimeInterface);

Expand Down Expand Up @@ -2099,7 +2099,7 @@ private function searchCalendarObjects(IQueryBuilder $query, DateTimeInterface|n
'time-range' => null,
]);
} catch (MaxInstancesExceededException $ex) {
$this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: '.$row['uri'], [
$this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: ' . $row['uri'], [
'app' => 'dav',
'exception' => $ex,
]);
Expand Down Expand Up @@ -2196,7 +2196,7 @@ public function searchPrincipalUri(string $principalUri,
array $componentTypes,
array $searchProperties,
array $searchParameters,
array $options = []
array $options = [],
): array {
return $this->atomic(function () use ($principalUri, $pattern, $componentTypes, $searchProperties, $searchParameters, $options) {
$escapePattern = !\array_key_exists('escape_like_param', $options) || $options['escape_like_param'] !== false;
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/CalDAV/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ public function getACL() {
$acl = $this->caldavBackend->applyShareAcl($this->getResourceId(), $acl);
$allowedPrincipals = [
$this->getOwner(),
$this->getOwner(). '/calendar-proxy-read',
$this->getOwner(). '/calendar-proxy-write',
$this->getOwner() . '/calendar-proxy-read',
$this->getOwner() . '/calendar-proxy-write',
parent::getOwner(),
'principals/system/public'
];
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/CalendarHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
BackendInterface $caldavBackend,
array $principalInfo,
LoggerInterface $logger,
private bool $returnCachedSubscriptions
private bool $returnCachedSubscriptions,
) {
parent::__construct($caldavBackend, $principalInfo);
$this->l10n = \OC::$server->getL10N('dav');
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/CalendarRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(
PrincipalBackend\BackendInterface $principalBackend,
Backend\BackendInterface $caldavBackend,
$principalPrefix,
LoggerInterface $logger
LoggerInterface $logger,
) {
parent::__construct($principalBackend, $caldavBackend, $principalPrefix);
$this->logger = $logger;
Expand Down
Loading

0 comments on commit 74c38b8

Please sign in to comment.