Skip to content

Commit

Permalink
Merge pull request #6236 from nextcloud/dependabot/composer/nextcloud…
Browse files Browse the repository at this point in the history
…/coding-standard-1.2.3
  • Loading branch information
dependabot[bot] authored Aug 26, 2024
2 parents 2d2f7c6 + ba3e97b commit 2233786
Show file tree
Hide file tree
Showing 42 changed files with 136 additions and 136 deletions.
24 changes: 12 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/Activity/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public function getName(): string {

/**
* @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 {
Expand Down
4 changes: 2 additions & 2 deletions lib/Activity/SettingBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public function getName(): string {

/**
* @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 {
Expand Down
4 changes: 2 additions & 2 deletions lib/Activity/SettingChanges.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public function getName(): string {

/**
* @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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function registerCommentsEntity(IEventDispatcher $eventDispatcher): void
$permissionService = $this->getContainer()->get(PermissionService::class);

try {
return $permissionService->checkPermission($cardMapper, (int) $name, Acl::PERMISSION_READ);
return $permissionService->checkPermission($cardMapper, (int)$name, Acl::PERMISSION_READ);
} catch (\Exception $e) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Capabilities implements ICapability {

/** @var IAppManager */
private $appManager;
/** @var PermissionService */
/** @var PermissionService */
private $permissionService;


Expand Down
10 changes: 5 additions & 5 deletions lib/Command/TransferOwnership.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int
try {
$board = $boardId ? $this->boardMapper->find($boardId) : null;
} catch (\Exception $e) {
$output->writeln("Could not find a board for the provided id.");
$output->writeln('Could not find a board for the provided id.');
return 1;
}

if ($boardId !== null && $board->getOwner() !== $owner) {
$output->writeln("$owner is not the owner of the board $boardId (" . $board->getTitle() . ")");
$output->writeln("$owner is not the owner of the board $boardId (" . $board->getTitle() . ')');
return 1;
}

if ($boardId) {
$output->writeln("Transfer board " . $board->getTitle() . " from ". $board->getOwner() ." to $newOwner");
$output->writeln('Transfer board ' . $board->getTitle() . ' from '. $board->getOwner() ." to $newOwner");
} else {
$output->writeln("Transfer all boards from $owner to $newOwner");
}
Expand All @@ -94,12 +94,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int

if ($boardId) {
$this->boardService->transferBoardOwnership($boardId, $newOwner, $remapAssignment);
$output->writeln("<info>Board " . $board->getTitle() . " from ". $board->getOwner() ." transferred to $newOwner completed</info>");
$output->writeln('<info>Board ' . $board->getTitle() . ' from '. $board->getOwner() ." transferred to $newOwner completed</info>");
return 0;
}

foreach ($this->boardService->transferOwnership($owner, $newOwner, $remapAssignment) as $board) {
$output->writeln(" - " . $board->getTitle() . " transferred");
$output->writeln(' - ' . $board->getTitle() . ' transferred');
}
$output->writeln("<info>All boards from $owner to $newOwner transferred</info>");

Expand Down
2 changes: 1 addition & 1 deletion lib/DAV/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Calendar extends ExternalCalendar {
private $children;
/** @var DeckCalendarBackend */
private $backend;
/** @var Board */
/** @var Board */
private $board;

public function __construct(string $principalUri, string $calendarUri, Board $board, DeckCalendarBackend $backend) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/AclMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function findBoardId($id): ?int {
try {
$entity = $this->find($id);
return $entity->getBoardId();
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
}
return null;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Db/AttachmentMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public function find($id) {
public function findByData($cardId, $data) {
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from($this->getTableName())
->where($qb->expr()->eq('card_id', $qb->createNamedParameter($cardId, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->eq('data', $qb->createNamedParameter($data, IQueryBuilder::PARAM_STR)));
->from($this->getTableName())
->where($qb->expr()->eq('card_id', $qb->createNamedParameter($cardId, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->eq('data', $qb->createNamedParameter($data, IQueryBuilder::PARAM_STR)));

return $this->findEntity($qb);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function getDaysUntilDue(): ?int {
$matchDate->setTime(0, 0);

$diff = $today->diff($matchDate);
return (int) $diff->format('%R%a'); // Extract days count in interval
return (int)$diff->format('%R%a'); // Extract days count in interval
}

public function getCalendarPrefix(): string {
Expand Down
6 changes: 3 additions & 3 deletions lib/Db/CardMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ private function extendQueryByFilter(IQueryBuilder $qb, SearchQuery $query) {
foreach ($query->getDuedate() as $duedate) {
$dueDateColumn = $this->databaseType === 'sqlite3' ? $qb->createFunction('DATETIME(`c`.`duedate`)') : 'c.duedate';
$date = $duedate->getValue();
if ($date === "") {
if ($date === '') {
$qb->andWhere($qb->expr()->isNotNull('c.duedate'));
continue;
}
Expand Down Expand Up @@ -461,7 +461,7 @@ private function extendQueryByFilter(IQueryBuilder $qb, SearchQuery $query) {
foreach ($query->getAssigned() as $index => $assignment) {
$qb->innerJoin('c', 'deck_assigned_users', 'au' . $index, $qb->expr()->eq('c.id', 'au' . $index . '.card_id'));
$assignedQueryValue = $assignment->getValue();
if ($assignedQueryValue === "") {
if ($assignedQueryValue === '') {
$qb->andWhere($qb->expr()->isNotNull('au' . $index . '.participant'));
continue;
}
Expand Down Expand Up @@ -589,7 +589,7 @@ public function findBoardId($id): ?int {
}
$this->cache->set('findBoardId:' . $id, $result);
}
return $result !== false ? (int) $result : null;
return $result !== false ? (int)$result : null;
}

public function mapOwner(Card &$card) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Middleware/ExceptionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function afterException($controller, $methodName, \Exception $exception)
];
$this->logger->error($exception->getMessage(), ['exception' => $exception]);
if ($debugMode === true) {
$response['exception'] = (array) $exception;
$response['exception'] = (array)$exception;
}
return new JSONResponse($response, 500);
}
Expand Down
14 changes: 7 additions & 7 deletions lib/Notification/NotificationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ public function sendCardAssigned(Card $card, string $userId): void {
->setUser($userId)
->setDateTime(new DateTime())
->setObject('card', (string)$card->getId())
->setSubject('card-assigned', [
$card->getTitle(),
$board->getTitle(),
$this->currentUser
]);
->setSubject('card-assigned', [
$card->getTitle(),
$board->getTitle(),
$this->currentUser
]);
$this->notificationManager->notify($notification);
}

Expand Down Expand Up @@ -206,9 +206,9 @@ public function sendMention(IComment $comment): void {
$notification = $this->notificationManager->createNotification();
$notification
->setApp('deck')
->setUser((string) $mention['id'])
->setUser((string)$mention['id'])
->setDateTime(new DateTime())
->setObject('card', (string) $card->getId())
->setObject('card', (string)$card->getId())
->setSubject('card-comment-mentioned', [$card->getTitle(), $boardId, $this->currentUser])
->setMessage('{message}', ['message' => $comment->getMessage()]);
$this->notificationManager->notify($notification);
Expand Down
4 changes: 2 additions & 2 deletions lib/Reference/BoardReferenceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private function getBoardId(string $url): ?int {
preg_match('/^' . preg_quote($startIndex, '/') . '(?:\/#!?)?\/board\/([0-9]+)$/', $url, $matches);
}
if ($matches && count($matches) > 1) {
return (int) $matches[1];
return (int)$matches[1];
}

return null;
Expand All @@ -106,7 +106,7 @@ private function getBoardId(string $url): ?int {
public function getCachePrefix(string $referenceId): string {
$boardId = $this->getBoardId($referenceId);
if ($boardId !== null) {
return (string) $boardId;
return (string)$boardId;
}

return $referenceId;
Expand Down
6 changes: 3 additions & 3 deletions lib/Reference/CardReferenceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ public function resolveReference(string $referenceText): ?IReference {
if ($ids !== null) {
[, $cardId] = $ids;
try {
$card = $this->cardService->find((int) $cardId)->jsonSerialize();
$stack = $this->stackService->find((int) $card['stackId'])->jsonSerialize();
$board = $this->boardService->find((int) $stack['boardId'])->jsonSerialize();
$card = $this->cardService->find((int)$cardId)->jsonSerialize();
$stack = $this->stackService->find((int)$card['stackId'])->jsonSerialize();
$board = $this->boardService->find((int)$stack['boardId'])->jsonSerialize();
} catch (NoPermissionException $e) {
// Skip throwing if user has no permissions
return null;
Expand Down
8 changes: 4 additions & 4 deletions lib/Reference/CommentReferenceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function resolveReference(string $referenceText): ?IReference {
try {
$card = $this->cardService->find($cardId)->jsonSerialize();
$board = $this->boardService->find($boardId)->jsonSerialize();
$stack = $this->stackService->find((int) $card['stackId'])->jsonSerialize();
$stack = $this->stackService->find((int)$card['stackId'])->jsonSerialize();
} catch (NoPermissionException $e) {
// Skip throwing if user has no permissions
return null;
Expand Down Expand Up @@ -162,9 +162,9 @@ private function getIds(string $url): ?array {
}
if ($matches && count($matches) > 3) {
return [
(int) $matches[1],
(int) $matches[2],
(int) $matches[3],
(int)$matches[1],
(int)$matches[2],
(int)$matches[3],
];
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Service/CommentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public function list(string $cardId, int $limit = 20, int $offset = 0): DataResp
private function get(int $cardId, int $commentId): IComment {
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
try {
$comment = $this->commentsManager->get((string) $commentId);
if ($comment->getObjectType() !== Application::COMMENT_ENTITY_TYPE || (int) $comment->getObjectId() !== $cardId) {
$comment = $this->commentsManager->get((string)$commentId);
if ($comment->getObjectType() !== Application::COMMENT_ENTITY_TYPE || (int)$comment->getObjectId() !== $cardId) {
throw new CommentNotFoundException();
}
} catch (CommentNotFoundException $e) {
Expand Down Expand Up @@ -134,7 +134,7 @@ public function update(string $cardId, string $commentId, string $message): Data
if (!is_numeric($commentId)) {
throw new BadRequestException('A valid comment id must be provided');
}
$comment = $this->get((int) $cardId, (int) $commentId);
$comment = $this->get((int)$cardId, (int)$commentId);
if ($comment->getActorType() !== 'users' || $comment->getActorId() !== $this->userId) {
throw new NoPermissionException('Only authors are allowed to edit their comment.');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/Importer/BoardImportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public function getData(): \stdClass {
* @return void
*/
public function setConfig(string $configName, $value): void {
if (empty((array) $this->config)) {
if (empty((array)$this->config)) {
$this->setConfigInstance(new \stdClass);
}
$this->config->$configName = $value;
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/Importer/Systems/DeckJsonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function validateUsers(): void {
if (!is_string($nextcloudUid) && !is_numeric($nextcloudUid)) {
throw new \LogicException('User on setting uidRelation is invalid');
}
$nextcloudUid = (string) $nextcloudUid;
$nextcloudUid = (string)$nextcloudUid;
$this->getImportService()->getConfig('uidRelation')->$exportUid = $this->userManager->get($nextcloudUid);
if (!$this->getImportService()->getConfig('uidRelation')->$exportUid) {
throw new \LogicException('User on setting uidRelation not found: ' . $nextcloudUid);
Expand Down Expand Up @@ -106,7 +106,7 @@ public function getCardAssignments(): array {
public function getComments(): array {
$comments = [];
foreach ($this->tmpCards as $sourceCard) {
if (!property_exists($sourceCard, "comments")) {
if (!property_exists($sourceCard, 'comments')) {
continue;
}
$commentsOriginal = $sourceCard->comments;
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/Importer/Systems/TrelloJsonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function validateUsers(): void {
if (!is_string($nextcloudUid) && !is_numeric($nextcloudUid)) {
throw new \LogicException('User on setting uidRelation is invalid');
}
$nextcloudUid = (string) $nextcloudUid;
$nextcloudUid = (string)$nextcloudUid;
$this->getImportService()->getConfig('uidRelation')->$trelloUid = $this->userManager->get($nextcloudUid);
if (!$this->getImportService()->getConfig('uidRelation')->$trelloUid) {
throw new \LogicException('User on setting uidRelation not found: ' . $nextcloudUid);
Expand Down Expand Up @@ -141,7 +141,7 @@ function (\stdClass $a) use ($trelloCard) {
$message = $this->l10n->t(
"This comment has more than %s characters.\n" .
"Added as an attachment to the card with name %s.\n" .
"Accessible on URL: %s.",
'Accessible on URL: %s.',
[
IComment::MAX_MESSAGE_LENGTH,
'comment_' . $commentId . '.md',
Expand Down
Loading

0 comments on commit 2233786

Please sign in to comment.