From 1fdc1644622bb8822c92fd2e22f6c5df190c024c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 5 Feb 2024 07:14:04 +0100 Subject: [PATCH] style: Apply php-cs-fixer updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Activity/CommentEventHandler.php | 2 +- lib/Activity/DeckProvider.php | 2 +- lib/Controller/BoardController.php | 2 +- lib/Controller/PageController.php | 2 +- lib/Controller/SessionController.php | 2 +- lib/Db/CardMapper.php | 6 +++--- lib/Event/CardUpdatedEvent.php | 2 +- lib/Service/ConfigService.php | 6 +++--- lib/Service/SearchService.php | 2 +- tests/integration/features/bootstrap/BoardContext.php | 4 ++-- tests/unit/Service/BoardServiceTest.php | 2 +- tests/unit/Service/DefaultBoardServiceTest.php | 2 +- tests/unit/Service/StackServiceTest.php | 2 +- 13 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/Activity/CommentEventHandler.php b/lib/Activity/CommentEventHandler.php index 47e11a9fd..3de458c10 100644 --- a/lib/Activity/CommentEventHandler.php +++ b/lib/Activity/CommentEventHandler.php @@ -23,12 +23,12 @@ namespace OCA\Deck\Activity; -use \OCP\Comments\ICommentsEventHandler; use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\ChangeHelper; use OCA\Deck\Notification\NotificationHelper; use OCP\Comments\CommentsEvent; use OCP\Comments\IComment; +use OCP\Comments\ICommentsEventHandler; class CommentEventHandler implements ICommentsEventHandler { diff --git a/lib/Activity/DeckProvider.php b/lib/Activity/DeckProvider.php index 12f9be73c..db7975bfc 100644 --- a/lib/Activity/DeckProvider.php +++ b/lib/Activity/DeckProvider.php @@ -77,7 +77,7 @@ class DeckProvider implements IProvider { * @throws \InvalidArgumentException Should be thrown if your provider does not know this event * @since 11.0.0 */ - public function parse($language, IEvent $event, IEvent $previousEvent = null): IEvent { + public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent { if ($event->getApp() !== 'deck') { throw new \InvalidArgumentException(); } diff --git a/lib/Controller/BoardController.php b/lib/Controller/BoardController.php index 0220a43db..bcfaa6e42 100644 --- a/lib/Controller/BoardController.php +++ b/lib/Controller/BoardController.php @@ -55,7 +55,7 @@ class BoardController extends ApiController { * @param $boardId * @return \OCP\AppFramework\Db\Entity */ - public function read($boardId) { + public function read(int $boardId) { return $this->boardService->find($boardId); } diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 7c81a6093..ab45b0b4b 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -23,7 +23,6 @@ namespace OCA\Deck\Controller; -use \OCP\AppFramework\Http\RedirectResponse; use OCA\Deck\Db\Acl; use OCA\Deck\Db\CardMapper; use OCA\Deck\Service\BoardService; @@ -37,6 +36,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\ContentSecurityPolicy; +use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent as CollaborationResourcesEvent; diff --git a/lib/Controller/SessionController.php b/lib/Controller/SessionController.php index 4a28f0a08..918512291 100644 --- a/lib/Controller/SessionController.php +++ b/lib/Controller/SessionController.php @@ -68,7 +68,7 @@ class SessionController extends OCSController { #[NoAdminRequired] #[NoCSRFRequired] - public function close(int $boardId, string $token = null): DataResponse { + public function close(int $boardId, ?string $token = null): DataResponse { if ($token === null) { return new DataResponse(); } diff --git a/lib/Db/CardMapper.php b/lib/Db/CardMapper.php index a5d5c6f03..e12f02de9 100644 --- a/lib/Db/CardMapper.php +++ b/lib/Db/CardMapper.php @@ -313,7 +313,7 @@ class CardMapper extends QBMapper implements IPermissionMapper { return $this->findEntities($qb); } - public function search(array $boardIds, SearchQuery $query, int $limit = null, int $offset = null): array { + public function search(array $boardIds, SearchQuery $query, ?int $limit = null, ?int $offset = null): array { $qb = $this->queryCardsByBoards($boardIds); $this->extendQueryByFilter($qb, $query); @@ -356,7 +356,7 @@ class CardMapper extends QBMapper implements IPermissionMapper { return $entities; } - public function searchComments(array $boardIds, SearchQuery $query, int $limit = null, int $offset = null): array { + public function searchComments(array $boardIds, SearchQuery $query, ?int $limit = null, ?int $offset = null): array { if (count($query->getTextTokens()) === 0) { return []; } @@ -614,7 +614,7 @@ class CardMapper extends QBMapper implements IPermissionMapper { }); } - public function transferOwnership(string $ownerId, string $newOwnerId, int $boardId = null): void { + public function transferOwnership(string $ownerId, string $newOwnerId, ?int $boardId = null): void { $params = [ 'owner' => $ownerId, 'newOwner' => $newOwnerId diff --git a/lib/Event/CardUpdatedEvent.php b/lib/Event/CardUpdatedEvent.php index e5006f8df..012bd8267 100644 --- a/lib/Event/CardUpdatedEvent.php +++ b/lib/Event/CardUpdatedEvent.php @@ -31,7 +31,7 @@ use OCA\Deck\Db\Card; class CardUpdatedEvent extends ACardEvent { private $cardBefore; - public function __construct(Card $card, Card $before = null) { + public function __construct(Card $card, ?Card $before = null) { parent::__construct($card); $this->cardBefore = $before; } diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index c0732922d..006565dea 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -110,7 +110,7 @@ class ConfigService { return false; } - public function isCalendarEnabled(int $boardId = null): bool { + public function isCalendarEnabled(?int $boardId = null): bool { if ($this->getUserId() === null) { return false; } @@ -124,7 +124,7 @@ class ConfigService { return (bool)$this->config->getUserValue($this->getUserId(), Application::APP_ID, 'board:' . $boardId . ':calendar', $defaultState); } - public function isCardDetailsInModal(int $boardId = null): bool { + public function isCardDetailsInModal(?int $boardId = null): bool { if ($this->getUserId() === null) { return false; } @@ -223,7 +223,7 @@ class ConfigService { return array_filter($groups); } - public function getAttachmentFolder(string $userId = null): string { + public function getAttachmentFolder(?string $userId = null): string { if ($userId === null && $this->getUserId() === null) { throw new NoPermissionException('Must be logged in get the attachment folder'); } diff --git a/lib/Service/SearchService.php b/lib/Service/SearchService.php index 50a891e21..131c09e01 100644 --- a/lib/Service/SearchService.php +++ b/lib/Service/SearchService.php @@ -75,7 +75,7 @@ class SearchService { $this->urlGenerator = $urlGenerator; } - public function searchCards(string $term, int $limit = null, ?int $cursor = null): array { + public function searchCards(string $term, ?int $limit = null, ?int $cursor = null): array { $boards = $this->boardService->getUserBoards(); $boardIds = array_map(static function (Board $board) { return $board->getId(); diff --git a/tests/integration/features/bootstrap/BoardContext.php b/tests/integration/features/bootstrap/BoardContext.php index 09d05fa30..4f59b2cf7 100644 --- a/tests/integration/features/bootstrap/BoardContext.php +++ b/tests/integration/features/bootstrap/BoardContext.php @@ -83,7 +83,7 @@ class BoardContext implements Context { /** * @When shares the board with user :user */ - public function sharesTheBoardWithUser($user, TableNode $permissions = null) { + public function sharesTheBoardWithUser($user, ?TableNode $permissions = null) { $defaults = [ 'permissionEdit' => '0', 'permissionShare' => '0', @@ -103,7 +103,7 @@ class BoardContext implements Context { /** * @When shares the board with group :group */ - public function sharesTheBoardWithGroup($group, TableNode $permissions = null) { + public function sharesTheBoardWithGroup($group, ?TableNode $permissions = null) { $defaults = [ 'permissionEdit' => '0', 'permissionShare' => '0', diff --git a/tests/unit/Service/BoardServiceTest.php b/tests/unit/Service/BoardServiceTest.php index f02e456ba..bba051cc5 100644 --- a/tests/unit/Service/BoardServiceTest.php +++ b/tests/unit/Service/BoardServiceTest.php @@ -23,7 +23,6 @@ namespace OCA\Deck\Service; -use \Test\TestCase; use OC\L10N\L10N; use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Db\Acl; @@ -51,6 +50,7 @@ use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; class BoardServiceTest extends TestCase { diff --git a/tests/unit/Service/DefaultBoardServiceTest.php b/tests/unit/Service/DefaultBoardServiceTest.php index a6cd809c3..a2f42623c 100644 --- a/tests/unit/Service/DefaultBoardServiceTest.php +++ b/tests/unit/Service/DefaultBoardServiceTest.php @@ -23,13 +23,13 @@ namespace OCA\Deck\Service; -use \Test\TestCase; use OCA\Deck\Db\Board; use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\Card; use OCA\Deck\Db\Stack; use OCP\IConfig; use OCP\IL10N; +use Test\TestCase; class DefaultBoardServiceTest extends TestCase { diff --git a/tests/unit/Service/StackServiceTest.php b/tests/unit/Service/StackServiceTest.php index ec3cf44c7..48062cc45 100644 --- a/tests/unit/Service/StackServiceTest.php +++ b/tests/unit/Service/StackServiceTest.php @@ -23,7 +23,6 @@ namespace OCA\Deck\Service; -use \Test\TestCase; use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Db\AssignmentMapper; use OCA\Deck\Db\BoardMapper; @@ -38,6 +37,7 @@ use OCA\Deck\Model\CardDetails; use OCA\Deck\Validators\StackServiceValidator; use OCP\EventDispatcher\IEventDispatcher; use Psr\Log\LoggerInterface; +use Test\TestCase; /** * Class StackServiceTest