Merge pull request #6236 from nextcloud/dependabot/composer/nextcloud/coding-standard-1.2.3

This commit is contained in:
dependabot[bot]
2024-08-26 06:21:33 +00:00
committed by GitHub
42 changed files with 136 additions and 136 deletions

24
composer.lock generated
View File

@@ -399,16 +399,16 @@
}, },
{ {
"name": "nextcloud/coding-standard", "name": "nextcloud/coding-standard",
"version": "v1.2.1", "version": "v1.2.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nextcloud/coding-standard.git", "url": "https://github.com/nextcloud/coding-standard.git",
"reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e" "reference": "bc9c53a5306114b60c4363057aff9c2ed10a54da"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e", "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/bc9c53a5306114b60c4363057aff9c2ed10a54da",
"reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e", "reference": "bc9c53a5306114b60c4363057aff9c2ed10a54da",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -434,9 +434,9 @@
"description": "Nextcloud coding standards for the php cs fixer", "description": "Nextcloud coding standards for the php cs fixer",
"support": { "support": {
"issues": "https://github.com/nextcloud/coding-standard/issues", "issues": "https://github.com/nextcloud/coding-standard/issues",
"source": "https://github.com/nextcloud/coding-standard/tree/v1.2.1" "source": "https://github.com/nextcloud/coding-standard/tree/v1.2.3"
}, },
"time": "2024-02-01T14:54:37+00:00" "time": "2024-08-23T14:32:32+00:00"
}, },
{ {
"name": "nextcloud/ocp", "name": "nextcloud/ocp",
@@ -661,16 +661,16 @@
}, },
{ {
"name": "php-cs-fixer/shim", "name": "php-cs-fixer/shim",
"version": "v3.49.0", "version": "v3.62.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-CS-Fixer/shim.git", "url": "https://github.com/PHP-CS-Fixer/shim.git",
"reference": "f7d3219cac46632f12362c9aa7c2ac0d2fe92c52" "reference": "7a91d5ce45c486f5b445d95901228507a02f60ae"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/f7d3219cac46632f12362c9aa7c2ac0d2fe92c52", "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/7a91d5ce45c486f5b445d95901228507a02f60ae",
"reference": "f7d3219cac46632f12362c9aa7c2ac0d2fe92c52", "reference": "7a91d5ce45c486f5b445d95901228507a02f60ae",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -707,9 +707,9 @@
"description": "A tool to automatically fix PHP code style", "description": "A tool to automatically fix PHP code style",
"support": { "support": {
"issues": "https://github.com/PHP-CS-Fixer/shim/issues", "issues": "https://github.com/PHP-CS-Fixer/shim/issues",
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.49.0" "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.62.0"
}, },
"time": "2024-02-02T00:42:09+00:00" "time": "2024-08-07T17:03:46+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",

View File

@@ -72,17 +72,17 @@ final class TransferOwnership extends Command {
try { try {
$board = $boardId ? $this->boardMapper->find($boardId) : null; $board = $boardId ? $this->boardMapper->find($boardId) : null;
} catch (\Exception $e) { } 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; return 1;
} }
if ($boardId !== null && $board->getOwner() !== $owner) { 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; return 1;
} }
if ($boardId) { 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 { } else {
$output->writeln("Transfer all boards from $owner to $newOwner"); $output->writeln("Transfer all boards from $owner to $newOwner");
} }
@@ -94,12 +94,12 @@ final class TransferOwnership extends Command {
if ($boardId) { if ($boardId) {
$this->boardService->transferBoardOwnership($boardId, $newOwner, $remapAssignment); $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; return 0;
} }
foreach ($this->boardService->transferOwnership($owner, $newOwner, $remapAssignment) as $board) { 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>"); $output->writeln("<info>All boards from $owner to $newOwner transferred</info>");

View File

@@ -410,7 +410,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
foreach ($query->getDuedate() as $duedate) { foreach ($query->getDuedate() as $duedate) {
$dueDateColumn = $this->databaseType === 'sqlite3' ? $qb->createFunction('DATETIME(`c`.`duedate`)') : 'c.duedate'; $dueDateColumn = $this->databaseType === 'sqlite3' ? $qb->createFunction('DATETIME(`c`.`duedate`)') : 'c.duedate';
$date = $duedate->getValue(); $date = $duedate->getValue();
if ($date === "") { if ($date === '') {
$qb->andWhere($qb->expr()->isNotNull('c.duedate')); $qb->andWhere($qb->expr()->isNotNull('c.duedate'));
continue; continue;
} }
@@ -461,7 +461,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
foreach ($query->getAssigned() as $index => $assignment) { foreach ($query->getAssigned() as $index => $assignment) {
$qb->innerJoin('c', 'deck_assigned_users', 'au' . $index, $qb->expr()->eq('c.id', 'au' . $index . '.card_id')); $qb->innerJoin('c', 'deck_assigned_users', 'au' . $index, $qb->expr()->eq('c.id', 'au' . $index . '.card_id'));
$assignedQueryValue = $assignment->getValue(); $assignedQueryValue = $assignment->getValue();
if ($assignedQueryValue === "") { if ($assignedQueryValue === '') {
$qb->andWhere($qb->expr()->isNotNull('au' . $index . '.participant')); $qb->andWhere($qb->expr()->isNotNull('au' . $index . '.participant'));
continue; continue;
} }

View File

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

View File

@@ -141,7 +141,7 @@ class TrelloJsonService extends ABoardImportService {
$message = $this->l10n->t( $message = $this->l10n->t(
"This comment has more than %s characters.\n" . "This comment has more than %s characters.\n" .
"Added as an attachment to the card with name %s.\n" . "Added as an attachment to the card with name %s.\n" .
"Accessible on URL: %s.", 'Accessible on URL: %s.',
[ [
IComment::MAX_MESSAGE_LENGTH, IComment::MAX_MESSAGE_LENGTH,
'comment_' . $commentId . '.md', 'comment_' . $commentId . '.md',

View File

@@ -45,7 +45,7 @@ abstract class BaseValidator {
} else { } else {
if (!$this->{$rule}($value)) { if (!$this->{$rule}($value)) {
throw new BadRequestException( 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 { private function max($value, $limit): bool {
if (!$limit || !is_numeric($limit)) { 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; return $this->getSize($value) <= $limit;
} }
@@ -121,7 +121,7 @@ abstract class BaseValidator {
*/ */
private function min($value, $limit): bool { private function min($value, $limit): bool {
if (!$limit || !is_numeric($limit)) { 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; return $this->getSize($value) >= $limit;
} }
@@ -158,6 +158,6 @@ abstract class BaseValidator {
: $field . ' must be at least '. $parameter . ' characters long '; : $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);
} }
} }

View File

@@ -31,11 +31,11 @@ use OCP\Server;
* @group DB * @group DB
*/ */
class BoardDatabaseTest extends \Test\TestCase { class BoardDatabaseTest extends \Test\TestCase {
public const TEST_USER1 = "test-share-user1"; public const TEST_USER1 = 'test-share-user1';
public const TEST_USER2 = "test-share-user2"; public const TEST_USER2 = 'test-share-user2';
public const TEST_USER3 = "test-share-user3"; public const TEST_USER3 = 'test-share-user3';
public const TEST_USER4 = "test-share-user4"; public const TEST_USER4 = 'test-share-user4';
public const TEST_GROUP1 = "test-share-group1"; public const TEST_GROUP1 = 'test-share-group1';
/** @var BoardService */ /** @var BoardService */
private $boardService; private $boardService;

View File

@@ -71,7 +71,7 @@ class BoardContext implements Context {
break; break;
} }
} }
Assert::assertNotNull($id, "Could not find board named ".$boardName); Assert::assertNotNull($id, 'Could not find board named '.$boardName);
} else { } else {
$id = $this->board['id']; $id = $this->board['id'];
} }

View File

@@ -32,7 +32,7 @@ class SessionContext implements Context {
'boardId' => $board['id'], 'boardId' => $board['id'],
]); ]);
$res = json_decode((string)$this->getResponse()->getBody(), true); $res = json_decode((string)$this->getResponse()->getBody(), true);
Assert::assertArrayHasKey('token', $res['ocs']['data'], "session creation did not respond with a token"); Assert::assertArrayHasKey('token', $res['ocs']['data'], 'session creation did not respond with a token');
// store token // store token
$user = $this->serverContext->getCurrentUser(); $user = $this->serverContext->getCurrentUser();
@@ -44,7 +44,7 @@ class SessionContext implements Context {
*/ */
public function theResponseShouldHaveActiveSessions($length) { public function theResponseShouldHaveActiveSessions($length) {
$board = $this->boardContext->getLastUsedBoard(); $board = $this->boardContext->getLastUsedBoard();
Assert::assertEquals($length, count($board['activeSessions']), "unexpected count of active sessions"); Assert::assertEquals($length, count($board['activeSessions']), 'unexpected count of active sessions');
} }
/** /**
@@ -52,7 +52,7 @@ class SessionContext implements Context {
*/ */
public function theUserShouldBeInTheListOfActiveSessions($user) { public function theUserShouldBeInTheListOfActiveSessions($user) {
$board = $this->boardContext->getLastUsedBoard(); $board = $this->boardContext->getLastUsedBoard();
Assert::assertContains($user, $board['activeSessions'], "user is not found in the list of active sessions"); Assert::assertContains($user, $board['activeSessions'], 'user is not found in the list of active sessions');
} }
/** /**
@@ -67,7 +67,7 @@ class SessionContext implements Context {
$user = $this->serverContext->getCurrentUser(); $user = $this->serverContext->getCurrentUser();
$token = $this->tokens[$user]; $token = $this->tokens[$user];
Assert::assertNotEmpty($token, "no token for the user found"); Assert::assertNotEmpty($token, 'no token for the user found');
$this->requestContext->sendOCSRequest('POST', '/apps/deck/api/v1.0/session/close', [ $this->requestContext->sendOCSRequest('POST', '/apps/deck/api/v1.0/session/close', [
'boardId' => $board['id'], 'boardId' => $board['id'],
'token' => $token 'token' => $token

View File

@@ -88,8 +88,8 @@ class UserExportTest extends \Test\TestCase {
public function getComment($id) { public function getComment($id) {
$comment = new Comment(); $comment = new Comment();
$comment->setActor("users", "admin"); $comment->setActor('users', 'admin');
$comment->setMessage("fake comment" . $id); $comment->setMessage('fake comment' . $id);
return $comment; return $comment;
} }
public function testExecute() { public function testExecute() {

View File

@@ -27,7 +27,7 @@ class AclTest extends \Test\TestCase {
private function createAclUser() { private function createAclUser() {
$acl = new Acl(); $acl = new Acl();
$acl->setId(1); $acl->setId(1);
$acl->setParticipant("admin"); $acl->setParticipant('admin');
$acl->setType(Acl::PERMISSION_TYPE_USER); $acl->setType(Acl::PERMISSION_TYPE_USER);
$acl->setBoardId(1); $acl->setBoardId(1);
$acl->setPermissionEdit(true); $acl->setPermissionEdit(true);
@@ -39,7 +39,7 @@ class AclTest extends \Test\TestCase {
private function createAclGroup() { private function createAclGroup() {
$acl = new Acl(); $acl = new Acl();
$acl->setId(1); $acl->setId(1);
$acl->setParticipant("administrators"); $acl->setParticipant('administrators');
$acl->setType(Acl::PERMISSION_TYPE_GROUP); $acl->setType(Acl::PERMISSION_TYPE_GROUP);
$acl->setBoardId(1); $acl->setBoardId(1);
$acl->setPermissionEdit(true); $acl->setPermissionEdit(true);

View File

@@ -28,7 +28,7 @@ class AttachmentTest extends \Test\TestCase {
$attachment = new Attachment(); $attachment = new Attachment();
$attachment->setId(1); $attachment->setId(1);
$attachment->setCardId(123); $attachment->setCardId(123);
$attachment->setData("blob"); $attachment->setData('blob');
$attachment->setCreatedBy('admin'); $attachment->setCreatedBy('admin');
$attachment->setType('deck_file'); $attachment->setType('deck_file');
return $attachment; return $attachment;

View File

@@ -8,9 +8,9 @@ class BoardTest extends TestCase {
private function createBoard() { private function createBoard() {
$board = new Board(); $board = new Board();
$board->setId(1); $board->setId(1);
$board->setTitle("My Board"); $board->setTitle('My Board');
$board->setOwner("admin"); $board->setOwner('admin');
$board->setColor("000000"); $board->setColor('000000');
$board->setArchived(false); $board->setArchived(false);
// TODO: relation shared labels acl // TODO: relation shared labels acl
return $board; return $board;
@@ -20,9 +20,9 @@ class BoardTest extends TestCase {
$board->setUsers(['user1', 'user2']); $board->setUsers(['user1', 'user2']);
$this->assertEquals([ $this->assertEquals([
'id' => 1, 'id' => 1,
'title' => "My Board", 'title' => 'My Board',
'owner' => "admin", 'owner' => 'admin',
'color' => "000000", 'color' => '000000',
'labels' => [], 'labels' => [],
'permissions' => [], 'permissions' => [],
'stacks' => [], 'stacks' => [],
@@ -44,9 +44,9 @@ class BoardTest extends TestCase {
self::assertNull($board->getLabels()); self::assertNull($board->getLabels());
$this->assertEquals([ $this->assertEquals([
'id' => 1, 'id' => 1,
'title' => "My Board", 'title' => 'My Board',
'owner' => "admin", 'owner' => 'admin',
'color' => "000000", 'color' => '000000',
'labels' => [], 'labels' => [],
'permissions' => [], 'permissions' => [],
'stacks' => [], 'stacks' => [],
@@ -63,13 +63,13 @@ class BoardTest extends TestCase {
public function testSetLabels() { public function testSetLabels() {
$board = $this->createBoard(); $board = $this->createBoard();
$board->setLabels(["foo", "bar"]); $board->setLabels(['foo', 'bar']);
$this->assertEquals([ $this->assertEquals([
'id' => 1, 'id' => 1,
'title' => "My Board", 'title' => 'My Board',
'owner' => "admin", 'owner' => 'admin',
'color' => "000000", 'color' => '000000',
'labels' => ["foo", "bar"], 'labels' => ['foo', 'bar'],
'permissions' => [], 'permissions' => [],
'stacks' => [], 'stacks' => [],
'deletedAt' => 0, 'deletedAt' => 0,
@@ -95,9 +95,9 @@ class BoardTest extends TestCase {
$board->setShared(1); $board->setShared(1);
$this->assertEquals([ $this->assertEquals([
'id' => 1, 'id' => 1,
'title' => "My Board", 'title' => 'My Board',
'owner' => "admin", 'owner' => 'admin',
'color' => "000000", 'color' => '000000',
'labels' => [], 'labels' => [],
'permissions' => [], 'permissions' => [],
'stacks' => [], 'stacks' => [],

View File

@@ -32,13 +32,13 @@ class CardTest extends TestCase {
private function createCard() { private function createCard() {
$card = new Card(); $card = new Card();
$card->setId(1); $card->setId(1);
$card->setTitle("My Card"); $card->setTitle('My Card');
$card->setDescription("a long description"); $card->setDescription('a long description');
$card->setStackId(1); $card->setStackId(1);
$card->setType('text'); $card->setType('text');
$card->setLastModified(234); $card->setLastModified(234);
$card->setCreatedAt(123); $card->setCreatedAt(123);
$card->setOwner("admin"); $card->setOwner('admin');
$card->setOrder(12); $card->setOrder(12);
$card->setArchived(false); $card->setArchived(false);
$card->setDone(null); $card->setDone(null);
@@ -68,8 +68,8 @@ class CardTest extends TestCase {
$card = $this->createCard(); $card = $this->createCard();
$this->assertEquals([ $this->assertEquals([
'id' => 1, 'id' => 1,
'title' => "My Card", 'title' => 'My Card',
'description' => "a long description", 'description' => 'a long description',
'type' => 'text', 'type' => 'text',
'lastModified' => 234, 'lastModified' => 234,
'createdAt' => 123, 'createdAt' => 123,
@@ -96,8 +96,8 @@ class CardTest extends TestCase {
$card->setLabels([]); $card->setLabels([]);
$this->assertEquals([ $this->assertEquals([
'id' => 1, 'id' => 1,
'title' => "My Card", 'title' => 'My Card',
'description' => "a long description", 'description' => 'a long description',
'type' => 'text', 'type' => 'text',
'lastModified' => 234, 'lastModified' => 234,
'createdAt' => 123, 'createdAt' => 123,
@@ -126,8 +126,8 @@ class CardTest extends TestCase {
$card->setLabels([]); $card->setLabels([]);
$this->assertEquals([ $this->assertEquals([
'id' => 1, 'id' => 1,
'title' => "My Card", 'title' => 'My Card',
'description' => "a long description", 'description' => 'a long description',
'type' => 'text', 'type' => 'text',
'lastModified' => 234, 'lastModified' => 234,
'createdAt' => 123, 'createdAt' => 123,

View File

@@ -29,8 +29,8 @@ class LabelTest extends TestCase {
private function createLabel() { private function createLabel() {
$label = new Label(); $label = new Label();
$label->setId(1); $label->setId(1);
$label->setTitle("My Label"); $label->setTitle('My Label');
$label->setColor("000000"); $label->setColor('000000');
return $label; return $label;
} }
public function testJsonSerializeBoard() { public function testJsonSerializeBoard() {

View File

@@ -27,7 +27,7 @@ class StackTest extends \Test\TestCase {
private function createStack() { private function createStack() {
$board = new Stack(); $board = new Stack();
$board->setId(1); $board->setId(1);
$board->setTitle("My Stack"); $board->setTitle('My Stack');
$board->setBoardId(1); $board->setBoardId(1);
$board->setOrder(1); $board->setOrder(1);
return $board; return $board;
@@ -36,7 +36,7 @@ class StackTest extends \Test\TestCase {
$stack = $this->createStack(); $stack = $this->createStack();
$this->assertEquals([ $this->assertEquals([
'id' => 1, 'id' => 1,
'title' => "My Stack", 'title' => 'My Stack',
'order' => 1, 'order' => 1,
'boardId' => 1, 'boardId' => 1,
'deletedAt' => 0, 'deletedAt' => 0,
@@ -45,15 +45,15 @@ class StackTest extends \Test\TestCase {
], $stack->jsonSerialize()); ], $stack->jsonSerialize());
} }
public function testJsonSerializeWithCards() { public function testJsonSerializeWithCards() {
$cards = ["foo", "bar"]; $cards = ['foo', 'bar'];
$stack = $this->createStack(); $stack = $this->createStack();
$stack->setCards($cards); $stack->setCards($cards);
$this->assertEquals([ $this->assertEquals([
'id' => 1, 'id' => 1,
'title' => "My Stack", 'title' => 'My Stack',
'order' => 1, 'order' => 1,
'boardId' => 1, 'boardId' => 1,
'cards' => ["foo", "bar"], 'cards' => ['foo', 'bar'],
'deletedAt' => 0, 'deletedAt' => 0,
'lastModified' => 0, 'lastModified' => 0,
'ETag' => $stack->getETag(), 'ETag' => $stack->getETag(),

View File

@@ -69,8 +69,8 @@ class ExceptionMiddlewareTest extends \Test\TestCase {
public function testAfterException($exception, $status, $message) { public function testAfterException($exception, $status, $message) {
$result = $this->exceptionMiddleware->afterException($this->controller, 'bar', $exception); $result = $this->exceptionMiddleware->afterException($this->controller, 'bar', $exception);
$expected = new JSONResponse([ $expected = new JSONResponse([
"status" => $status, 'status' => $status,
"message" => $message 'message' => $message
], $status); ], $status);
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }

View File

@@ -212,8 +212,8 @@ class StackServiceTest extends TestCase {
$this->stackMapper->expects($this->once())->method('update')->willReturn($stackToBeDeleted); $this->stackMapper->expects($this->once())->method('update')->willReturn($stackToBeDeleted);
$this->cardMapper->expects($this->once())->method('findAll')->willReturn([]); $this->cardMapper->expects($this->once())->method('findAll')->willReturn([]);
$this->stackService->delete(123); $this->stackService->delete(123);
$this->assertTrue($stackToBeDeleted->getDeletedAt() <= time(), "deletedAt is in the past"); $this->assertTrue($stackToBeDeleted->getDeletedAt() <= time(), 'deletedAt is in the past');
$this->assertTrue($stackToBeDeleted->getDeletedAt() > 0, "deletedAt is set"); $this->assertTrue($stackToBeDeleted->getDeletedAt() > 0, 'deletedAt is set');
} }
public function testUpdate() { public function testUpdate() {