@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | ]) |
| 137 | 137 | ->executeStatement(); |
| 138 | 138 | |
| 139 | - $id = (string)$qb->getLastInsertId(); |
|
| 139 | + $id = (string) $qb->getLastInsertId(); |
|
| 140 | 140 | |
| 141 | 141 | $comment = $manager->get($id); |
| 142 | 142 | $this->assertInstanceOf(IComment::class, $comment); |
@@ -185,14 +185,14 @@ discard block |
||
| 185 | 185 | // Verifying the root comment |
| 186 | 186 | $this->assertArrayHasKey('comment', $tree); |
| 187 | 187 | $this->assertInstanceOf(IComment::class, $tree['comment']); |
| 188 | - $this->assertSame((string)$headId, $tree['comment']->getId()); |
|
| 188 | + $this->assertSame((string) $headId, $tree['comment']->getId()); |
|
| 189 | 189 | $this->assertArrayHasKey('replies', $tree); |
| 190 | 190 | $this->assertCount(3, $tree['replies']); |
| 191 | 191 | |
| 192 | 192 | // one level deep |
| 193 | 193 | foreach ($tree['replies'] as $reply) { |
| 194 | 194 | $this->assertInstanceOf(IComment::class, $reply['comment']); |
| 195 | - $this->assertSame((string)$id, $reply['comment']->getId()); |
|
| 195 | + $this->assertSame((string) $id, $reply['comment']->getId()); |
|
| 196 | 196 | $this->assertCount(0, $reply['replies']); |
| 197 | 197 | $id--; |
| 198 | 198 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | // Verifying the root comment |
| 208 | 208 | $this->assertArrayHasKey('comment', $tree); |
| 209 | 209 | $this->assertInstanceOf(IComment::class, $tree['comment']); |
| 210 | - $this->assertSame((string)$id, $tree['comment']->getId()); |
|
| 210 | + $this->assertSame((string) $id, $tree['comment']->getId()); |
|
| 211 | 211 | $this->assertArrayHasKey('replies', $tree); |
| 212 | 212 | $this->assertCount(0, $tree['replies']); |
| 213 | 213 | } |
@@ -223,19 +223,19 @@ discard block |
||
| 223 | 223 | $manager = $this->getManager(); |
| 224 | 224 | |
| 225 | 225 | for ($offset = 0; $offset < 3; $offset += 2) { |
| 226 | - $tree = $manager->getTree((string)$headId, 2, $offset); |
|
| 226 | + $tree = $manager->getTree((string) $headId, 2, $offset); |
|
| 227 | 227 | |
| 228 | 228 | // Verifying the root comment |
| 229 | 229 | $this->assertArrayHasKey('comment', $tree); |
| 230 | 230 | $this->assertInstanceOf(IComment::class, $tree['comment']); |
| 231 | - $this->assertSame((string)$headId, $tree['comment']->getId()); |
|
| 231 | + $this->assertSame((string) $headId, $tree['comment']->getId()); |
|
| 232 | 232 | $this->assertArrayHasKey('replies', $tree); |
| 233 | 233 | $this->assertCount(2, $tree['replies']); |
| 234 | 234 | |
| 235 | 235 | // one level deep |
| 236 | 236 | foreach ($tree['replies'] as $reply) { |
| 237 | 237 | $this->assertInstanceOf(IComment::class, $reply['comment']); |
| 238 | - $this->assertSame((string)$idToVerify, $reply['comment']->getId()); |
|
| 238 | + $this->assertSame((string) $idToVerify, $reply['comment']->getId()); |
|
| 239 | 239 | $this->assertCount(0, $reply['replies']); |
| 240 | 240 | $idToVerify--; |
| 241 | 241 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | foreach ($comments as $key => $comment) { |
| 273 | 273 | $this->assertInstanceOf(IComment::class, $comment); |
| 274 | 274 | $this->assertSame('nice one', $comment->getMessage()); |
| 275 | - $this->assertSame((string)$idToVerify, $comment->getId(), 'ID wrong for comment ' . $key . ' on offset: ' . $offset); |
|
| 275 | + $this->assertSame((string) $idToVerify, $comment->getId(), 'ID wrong for comment '.$key.' on offset: '.$offset); |
|
| 276 | 276 | $idToVerify--; |
| 277 | 277 | } |
| 278 | 278 | $offset += 3; |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | $comments = $manager->getForObject('files', 'file64', 0, 0, new \DateTime('-4 hours')); |
| 290 | 290 | |
| 291 | 291 | $this->assertCount(2, $comments); |
| 292 | - $this->assertSame((string)$id2, $comments[0]->getId()); |
|
| 293 | - $this->assertSame((string)$id1, $comments[1]->getId()); |
|
| 292 | + $this->assertSame((string) $id2, $comments[0]->getId()); |
|
| 293 | + $this->assertSame((string) $id1, $comments[1]->getId()); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | public function testGetForObjectWithLimitAndOffsetAndDateTimeConstraint(): void { |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | foreach ($comments as $comment) { |
| 312 | 312 | $this->assertInstanceOf(IComment::class, $comment); |
| 313 | 313 | $this->assertSame('nice one', $comment->getMessage()); |
| 314 | - $this->assertSame((string)$idToVerify, $comment->getId()); |
|
| 314 | + $this->assertSame((string) $idToVerify, $comment->getId()); |
|
| 315 | 315 | $this->assertGreaterThanOrEqual(4, $comment->getId()); |
| 316 | 316 | $idToVerify--; |
| 317 | 317 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | public function testGetNumberOfUnreadCommentsForFolder(): void { |
| 337 | 337 | $folder = $this->createMock(Folder::class); |
| 338 | 338 | $fileIds = range(1111, 1114); |
| 339 | - $children = array_map(function (int $id) { |
|
| 339 | + $children = array_map(function(int $id) { |
|
| 340 | 340 | $file = $this->createMock(Folder::class); |
| 341 | 341 | $file->method('getId') |
| 342 | 342 | ->willReturn($id); |
@@ -365,8 +365,8 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | $manager = $this->getManager(); |
| 367 | 367 | |
| 368 | - $manager->setReadMark('files', (string)$fileIds[0], (new \DateTime())->modify('-1 days'), $user); |
|
| 369 | - $manager->setReadMark('files', (string)$fileIds[2], (new \DateTime()), $user); |
|
| 368 | + $manager->setReadMark('files', (string) $fileIds[0], (new \DateTime())->modify('-1 days'), $user); |
|
| 369 | + $manager->setReadMark('files', (string) $fileIds[2], (new \DateTime()), $user); |
|
| 370 | 370 | |
| 371 | 371 | $amount = $manager->getNumberOfUnreadCommentsForFolder($folder->getId(), $user); |
| 372 | 372 | $this->assertEquals([ |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | $expected = array_reverse($expected); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - $this->assertSame($expected, array_map(static fn (IComment $c): int => (int)$c->getId(), $comments)); |
|
| 398 | + $this->assertSame($expected, array_map(static fn (IComment $c): int => (int) $c->getId(), $comments)); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | public static function dataGetForObjectSince(): array { |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | /** |
| 428 | 428 | * @dataProvider invalidCreateArgsProvider |
| 429 | 429 | */ |
| 430 | - public function testCreateCommentInvalidArguments(string|int $aType, string|int $aId, string|int $oType, string|int $oId): void { |
|
| 430 | + public function testCreateCommentInvalidArguments(string | int $aType, string | int $aId, string | int $oType, string | int $oId): void { |
|
| 431 | 431 | $this->expectException(\InvalidArgumentException::class); |
| 432 | 432 | |
| 433 | 433 | $manager = $this->getManager(); |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | $done = $manager->delete(''); |
| 464 | 464 | $this->assertFalse($done); |
| 465 | 465 | |
| 466 | - $id = (string)$this->addDatabaseEntry(0, 0); |
|
| 466 | + $id = (string) $this->addDatabaseEntry(0, 0); |
|
| 467 | 467 | $comment = $manager->get($id); |
| 468 | 468 | $this->assertInstanceOf(IComment::class, $comment); |
| 469 | 469 | $done = $manager->delete($id); |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | public function testSaveAsChild(): void { |
| 583 | - $id = (string)$this->addDatabaseEntry(0, 0); |
|
| 583 | + $id = (string) $this->addDatabaseEntry(0, 0); |
|
| 584 | 584 | |
| 585 | 585 | $manager = $this->getManager(); |
| 586 | 586 | |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | ->setMessage('full ack') |
| 594 | 594 | ->setVerb('comment') |
| 595 | 595 | // setting the creation time avoids using sleep() while making sure to test with different timestamps |
| 596 | - ->setCreationDateTime(new \DateTime('+' . $i . ' minutes')); |
|
| 596 | + ->setCreationDateTime(new \DateTime('+'.$i.' minutes')); |
|
| 597 | 597 | |
| 598 | 598 | $manager->save($comment); |
| 599 | 599 | |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | /** |
| 617 | 617 | * @dataProvider invalidActorArgsProvider |
| 618 | 618 | */ |
| 619 | - public function testDeleteReferencesOfActorInvalidInput(string|int $type, string|int $id): void { |
|
| 619 | + public function testDeleteReferencesOfActorInvalidInput(string | int $type, string | int $id): void { |
|
| 620 | 620 | $this->expectException(\InvalidArgumentException::class); |
| 621 | 621 | |
| 622 | 622 | $manager = $this->getManager(); |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | $manager = $this->getManager(); |
| 633 | 633 | |
| 634 | 634 | // just to make sure they are really set, with correct actor data |
| 635 | - $comment = $manager->get((string)$ids[1]); |
|
| 635 | + $comment = $manager->get((string) $ids[1]); |
|
| 636 | 636 | $this->assertSame('users', $comment->getActorType()); |
| 637 | 637 | $this->assertSame('alice', $comment->getActorId()); |
| 638 | 638 | |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | $this->assertTrue($wasSuccessful); |
| 641 | 641 | |
| 642 | 642 | foreach ($ids as $id) { |
| 643 | - $comment = $manager->get((string)$id); |
|
| 643 | + $comment = $manager->get((string) $id); |
|
| 644 | 644 | $this->assertSame(ICommentsManager::DELETED_USER, $comment->getActorType()); |
| 645 | 645 | $this->assertSame(ICommentsManager::DELETED_USER, $comment->getActorId()); |
| 646 | 646 | } |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | /** |
| 684 | 684 | * @dataProvider invalidObjectArgsProvider |
| 685 | 685 | */ |
| 686 | - public function testDeleteCommentsAtObjectInvalidInput(string|int $type, string|int $id): void { |
|
| 686 | + public function testDeleteCommentsAtObjectInvalidInput(string | int $type, string | int $id): void { |
|
| 687 | 687 | $this->expectException(\InvalidArgumentException::class); |
| 688 | 688 | |
| 689 | 689 | $manager = $this->getManager(); |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | $manager = $this->getManager(); |
| 700 | 700 | |
| 701 | 701 | // just to make sure they are really set, with correct actor data |
| 702 | - $comment = $manager->get((string)$ids[1]); |
|
| 702 | + $comment = $manager->get((string) $ids[1]); |
|
| 703 | 703 | $this->assertSame('files', $comment->getObjectType()); |
| 704 | 704 | $this->assertSame('file64', $comment->getObjectId()); |
| 705 | 705 | |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | $verified = 0; |
| 710 | 710 | foreach ($ids as $id) { |
| 711 | 711 | try { |
| 712 | - $manager->get((string)$id); |
|
| 712 | + $manager->get((string) $id); |
|
| 713 | 713 | } catch (NotFoundException) { |
| 714 | 714 | $verified++; |
| 715 | 715 | } |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | ); |
| 744 | 744 | |
| 745 | 745 | // just to make sure they are really set, with correct actor data |
| 746 | - $comment = $manager->get((string)$ids[1]); |
|
| 746 | + $comment = $manager->get((string) $ids[1]); |
|
| 747 | 747 | $this->assertSame('files', $comment->getObjectType()); |
| 748 | 748 | $this->assertSame('file64', $comment->getObjectId()); |
| 749 | 749 | |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | $exists = 0; |
| 755 | 755 | foreach ($ids as $id) { |
| 756 | 756 | try { |
| 757 | - $manager->get((string)$id); |
|
| 757 | + $manager->get((string) $id); |
|
| 758 | 758 | $exists++; |
| 759 | 759 | } catch (NotFoundException) { |
| 760 | 760 | $deleted++; |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | $exists = 0; |
| 797 | 797 | foreach ($ids as $id) { |
| 798 | 798 | try { |
| 799 | - $manager->get((string)$id); |
|
| 799 | + $manager->get((string) $id); |
|
| 800 | 800 | $exists++; |
| 801 | 801 | } catch (NotFoundException) { |
| 802 | 802 | $deleted++; |
@@ -894,10 +894,10 @@ discard block |
||
| 894 | 894 | ->method('handle'); |
| 895 | 895 | |
| 896 | 896 | $manager = $this->getManager(); |
| 897 | - $manager->registerEventHandler(function () use ($handler1) { |
|
| 897 | + $manager->registerEventHandler(function() use ($handler1) { |
|
| 898 | 898 | return $handler1; |
| 899 | 899 | }); |
| 900 | - $manager->registerEventHandler(function () use ($handler2) { |
|
| 900 | + $manager->registerEventHandler(function() use ($handler2) { |
|
| 901 | 901 | return $handler2; |
| 902 | 902 | }); |
| 903 | 903 | |
@@ -922,11 +922,11 @@ discard block |
||
| 922 | 922 | public function testResolveDisplayName(): void { |
| 923 | 923 | $manager = $this->getManager(); |
| 924 | 924 | |
| 925 | - $planetClosure = function ($name) { |
|
| 925 | + $planetClosure = function($name) { |
|
| 926 | 926 | return ucfirst($name); |
| 927 | 927 | }; |
| 928 | 928 | |
| 929 | - $galaxyClosure = function ($name) { |
|
| 929 | + $galaxyClosure = function($name) { |
|
| 930 | 930 | return strtoupper($name); |
| 931 | 931 | }; |
| 932 | 932 | |
@@ -943,7 +943,7 @@ discard block |
||
| 943 | 943 | |
| 944 | 944 | $manager = $this->getManager(); |
| 945 | 945 | |
| 946 | - $planetClosure = function ($name) { |
|
| 946 | + $planetClosure = function($name) { |
|
| 947 | 947 | return ucfirst($name); |
| 948 | 948 | }; |
| 949 | 949 | $manager->registerDisplayNameResolver('planet', $planetClosure); |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | |
| 957 | 957 | $manager = $this->getManager(); |
| 958 | 958 | |
| 959 | - $planetClosure = function ($name) { |
|
| 959 | + $planetClosure = function($name) { |
|
| 960 | 960 | return ucfirst($name); |
| 961 | 961 | }; |
| 962 | 962 | $manager->registerDisplayNameResolver(1337, $planetClosure); |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | |
| 969 | 969 | $manager = $this->getManager(); |
| 970 | 970 | |
| 971 | - $planetClosure = function ($name) { |
|
| 971 | + $planetClosure = function($name) { |
|
| 972 | 972 | return ucfirst($name); |
| 973 | 973 | }; |
| 974 | 974 | |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | public function testResolveDisplayNameDirtyResolver(): void { |
| 980 | 980 | $manager = $this->getManager(); |
| 981 | 981 | |
| 982 | - $planetClosure = function () { |
|
| 982 | + $planetClosure = function() { |
|
| 983 | 983 | return null; |
| 984 | 984 | }; |
| 985 | 985 | |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | |
| 992 | 992 | $manager = $this->getManager(); |
| 993 | 993 | |
| 994 | - $planetClosure = function () { |
|
| 994 | + $planetClosure = function() { |
|
| 995 | 995 | return null; |
| 996 | 996 | }; |
| 997 | 997 | |
@@ -1079,14 +1079,14 @@ discard block |
||
| 1079 | 1079 | [$message, $actorId, $verb, $parentText] = $comment; |
| 1080 | 1080 | $parentId = null; |
| 1081 | 1081 | if ($parentText) { |
| 1082 | - $parentId = (string)$comments[$parentText]->getId(); |
|
| 1082 | + $parentId = (string) $comments[$parentText]->getId(); |
|
| 1083 | 1083 | } |
| 1084 | 1084 | $id = ''; |
| 1085 | 1085 | if ($verb === 'reaction_deleted') { |
| 1086 | - $id = $comments[$message . '#' . $actorId]->getId(); |
|
| 1086 | + $id = $comments[$message.'#'.$actorId]->getId(); |
|
| 1087 | 1087 | } |
| 1088 | 1088 | $comment = $this->testSave($message, $actorId, $verb, $parentId, $id); |
| 1089 | - $comments[$comment->getMessage() . '#' . $comment->getActorId()] = $comment; |
|
| 1089 | + $comments[$comment->getMessage().'#'.$comment->getActorId()] = $comment; |
|
| 1090 | 1090 | } |
| 1091 | 1091 | return $comments; |
| 1092 | 1092 | } |
@@ -1100,8 +1100,8 @@ discard block |
||
| 1100 | 1100 | |
| 1101 | 1101 | $processedComments = $this->proccessComments($comments); |
| 1102 | 1102 | $comment = reset($processedComments); |
| 1103 | - $all = $manager->retrieveAllReactions((int)$comment->getId()); |
|
| 1104 | - $actual = array_map(static function (IComment $row): array { |
|
| 1103 | + $all = $manager->retrieveAllReactions((int) $comment->getId()); |
|
| 1104 | + $actual = array_map(static function(IComment $row): array { |
|
| 1105 | 1105 | return [ |
| 1106 | 1106 | $row->getActorId(), |
| 1107 | 1107 | $row->getMessage(), |
@@ -2360,8 +2360,8 @@ discard block |
||
| 2360 | 2360 | |
| 2361 | 2361 | $processedComments = $this->proccessComments($comments); |
| 2362 | 2362 | $comment = reset($processedComments); |
| 2363 | - $all = $manager->retrieveAllReactionsWithSpecificReaction((int)$comment->getId(), $reaction); |
|
| 2364 | - $actual = array_map(static function (IComment $row): array { |
|
| 2363 | + $all = $manager->retrieveAllReactionsWithSpecificReaction((int) $comment->getId(), $reaction); |
|
| 2364 | + $actual = array_map(static function(IComment $row): array { |
|
| 2365 | 2365 | return [ |
| 2366 | 2366 | $row->getActorId(), |
| 2367 | 2367 | $row->getMessage(), |
@@ -2421,8 +2421,8 @@ discard block |
||
| 2421 | 2421 | if ($notFound) { |
| 2422 | 2422 | $this->expectException(\OCP\Comments\NotFoundException::class); |
| 2423 | 2423 | } |
| 2424 | - $comment = $processedComments[$expected['message'] . '#' . $expected['actorId']]; |
|
| 2425 | - $actual = $manager->getReactionComment((int)$comment->getParentId(), $comment->getActorType(), $comment->getActorId(), $comment->getMessage()); |
|
| 2424 | + $comment = $processedComments[$expected['message'].'#'.$expected['actorId']]; |
|
| 2425 | + $actual = $manager->getReactionComment((int) $comment->getParentId(), $comment->getActorType(), $comment->getActorId(), $comment->getMessage()); |
|
| 2426 | 2426 | if (!$notFound) { |
| 2427 | 2427 | $this->assertEquals($expected['message'], $actual->getMessage()); |
| 2428 | 2428 | $this->assertEquals($expected['actorId'], $actual->getActorId()); |