Chore(deps-dev): Bump nextcloud/coding-standard from 1.2.1 to 1.2.3

Bumps [nextcloud/coding-standard](https://github.com/nextcloud/coding-standard) from 1.2.1 to 1.2.3.
- [Release notes](https://github.com/nextcloud/coding-standard/releases)
- [Changelog](https://github.com/nextcloud/coding-standard/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nextcloud/coding-standard/compare/v1.2.1...v1.2.3)

---
updated-dependencies:
- dependency-name: nextcloud/coding-standard
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2024-08-24 01:08:07 +00:00
committed by Julius Härtl
parent 3daad1b9bc
commit ba3e97b73d
42 changed files with 136 additions and 136 deletions

View File

@@ -39,8 +39,8 @@ class Filter implements \OCP\Activity\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(): int {

View File

@@ -47,8 +47,8 @@ abstract class SettingBase 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(): int {

View File

@@ -25,8 +25,8 @@ class SettingChanges extends SettingBase {
/**
* @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 {

View File

@@ -176,7 +176,7 @@ class Application extends App implements IBootstrap {
$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;
}

View File

@@ -14,7 +14,7 @@ class Capabilities implements ICapability {
/** @var IAppManager */
private $appManager;
/** @var PermissionService */
/** @var PermissionService */
private $permissionService;

View File

@@ -72,17 +72,17 @@ final class TransferOwnership extends Command {
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");
}
@@ -94,12 +94,12 @@ final class TransferOwnership extends Command {
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>");

View File

@@ -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) {

View File

@@ -75,7 +75,7 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
try {
$entity = $this->find($id);
return $entity->getBoardId();
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
}
return null;
}

View File

@@ -61,9 +61,9 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
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);
}

View File

@@ -165,7 +165,7 @@ class Card extends RelationalEntity {
$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 {

View File

@@ -410,7 +410,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
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;
}
@@ -461,7 +461,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
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;
}
@@ -589,7 +589,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
}
$this->cache->set('findBoardId:' . $id, $result);
}
return $result !== false ? (int) $result : null;
return $result !== false ? (int)$result : null;
}
public function mapOwner(Card &$card) {

View File

@@ -89,7 +89,7 @@ class ExceptionMiddleware extends Middleware {
];
$this->logger->error($exception->getMessage(), ['exception' => $exception]);
if ($debugMode === true) {
$response['exception'] = (array) $exception;
$response['exception'] = (array)$exception;
}
return new JSONResponse($response, 500);
}

View File

@@ -142,11 +142,11 @@ class NotificationHelper {
->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);
}
@@ -206,9 +206,9 @@ class NotificationHelper {
$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);

View File

@@ -97,7 +97,7 @@ class BoardReferenceProvider implements IReferenceProvider {
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;
@@ -106,7 +106,7 @@ class BoardReferenceProvider implements IReferenceProvider {
public function getCachePrefix(string $referenceId): string {
$boardId = $this->getBoardId($referenceId);
if ($boardId !== null) {
return (string) $boardId;
return (string)$boardId;
}
return $referenceId;

View File

@@ -111,9 +111,9 @@ class CardReferenceProvider extends ADiscoverableReferenceProvider implements IS
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;

View File

@@ -73,7 +73,7 @@ class CommentReferenceProvider implements IReferenceProvider {
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;
@@ -162,9 +162,9 @@ class CommentReferenceProvider implements IReferenceProvider {
}
if ($matches && count($matches) > 3) {
return [
(int) $matches[1],
(int) $matches[2],
(int) $matches[3],
(int)$matches[1],
(int)$matches[2],
(int)$matches[3],
];
}

View File

@@ -65,8 +65,8 @@ class CommentService {
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) {
@@ -134,7 +134,7 @@ class CommentService {
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.');
}

View File

@@ -404,7 +404,7 @@ class BoardImportService {
* @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;

View File

@@ -51,7 +51,7 @@ class DeckJsonService extends ABoardImportService {
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);
@@ -106,7 +106,7 @@ class DeckJsonService extends ABoardImportService {
public function getComments(): array {
$comments = [];
foreach ($this->tmpCards as $sourceCard) {
if (!property_exists($sourceCard, "comments")) {
if (!property_exists($sourceCard, 'comments')) {
continue;
}
$commentsOriginal = $sourceCard->comments;

View File

@@ -71,7 +71,7 @@ class TrelloJsonService extends ABoardImportService {
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);
@@ -141,7 +141,7 @@ class TrelloJsonService extends ABoardImportService {
$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',

View File

@@ -143,7 +143,7 @@ class PermissionService {
try {
$board = $this->getBoard($boardId);
return $userId === $board->getOwner();
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
}
return false;
}
@@ -205,8 +205,8 @@ class PermissionService {
*/
public function findUsers($boardId, $refresh = false) {
// cache users of a board so we don't query them for every cards
if (array_key_exists((string) $boardId, $this->users) && !$refresh) {
return $this->users[(string) $boardId];
if (array_key_exists((string)$boardId, $this->users) && !$refresh) {
return $this->users[(string)$boardId];
}
try {
@@ -269,8 +269,8 @@ class PermissionService {
}
}
}
$this->users[(string) $boardId] = $users;
return $this->users[(string) $boardId];
$this->users[(string)$boardId] = $users;
return $this->users[(string)$boardId];
}
public function canCreate() {

View File

@@ -110,7 +110,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
try {
$board = $this->boardMapper->find($boardId);
$valid = $valid && !$board->getArchived();
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
$valid = false;
}
@@ -966,8 +966,8 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
protected function filterSharesOfUser(array $shares): array {
// Deck shares when the user has a share exception
foreach ($shares as $id => $share) {
$type = (int) $share['share_type'];
$permissions = (int) $share['permissions'];
$type = (int)$share['share_type'];
$permissions = (int)$share['permissions'];
if ($type === self::SHARE_TYPE_DECK_USER) {
unset($shares[$share['parent']]);

View File

@@ -45,7 +45,7 @@ abstract class BaseValidator {
} else {
if (!$this->{$rule}($value)) {
throw new BadRequestException(
$field . ' must be provided and must be '. str_replace("_", " ", $rule));
$field . ' must be provided and must be '. str_replace('_', ' ', $rule));
}
}
}
@@ -111,7 +111,7 @@ abstract class BaseValidator {
*/
private function max($value, $limit): bool {
if (!$limit || !is_numeric($limit)) {
throw new Exception("Validation rule max requires at least 1 parameter. " . json_encode($limit));
throw new Exception('Validation rule max requires at least 1 parameter. ' . json_encode($limit));
}
return $this->getSize($value) <= $limit;
}
@@ -121,7 +121,7 @@ abstract class BaseValidator {
*/
private function min($value, $limit): bool {
if (!$limit || !is_numeric($limit)) {
throw new Exception("Validation rule max requires at least 1 parameter.");
throw new Exception('Validation rule max requires at least 1 parameter.');
}
return $this->getSize($value) >= $limit;
}
@@ -129,7 +129,7 @@ abstract class BaseValidator {
/**
* Get the size of an attribute.
*
* @param mixed $value
* @param mixed $value
* @return int
*/
protected function getSize($value): int {
@@ -158,6 +158,6 @@ abstract class BaseValidator {
: $field . ' must be at least '. $parameter . ' characters long ';
}
return $field . ' must be provided and must be '. str_replace("_", " ", $rule);
return $field . ' must be provided and must be '. str_replace('_', ' ', $rule);
}
}