diff --git a/lib/Activity/ActivityManager.php b/lib/Activity/ActivityManager.php index 4e1d192e0..15d4bd59d 100644 --- a/lib/Activity/ActivityManager.php +++ b/lib/Activity/ActivityManager.php @@ -45,8 +45,8 @@ use OCP\AppFramework\Db\MultipleObjectsReturnedException; use OCP\Comments\IComment; use OCP\IUser; -use OCP\Server; use OCP\L10N\IFactory; +use OCP\Server; use Psr\Log\LoggerInterface; class ActivityManager { @@ -332,8 +332,8 @@ private function createEvent($objectType, $entity, $subject, $additionalParams = case self::SUBJECT_BOARD_UPDATE_ARCHIVED: case self::SUBJECT_BOARD_DELETE: case self::SUBJECT_BOARD_RESTORE: - // Not defined as there is no activity for - // case self::SUBJECT_BOARD_UPDATE_COLOR + // Not defined as there is no activity for + // case self::SUBJECT_BOARD_UPDATE_COLOR break; case self::SUBJECT_CARD_COMMENT_CREATE: $eventType = 'deck_comment'; @@ -374,7 +374,7 @@ private function createEvent($objectType, $entity, $subject, $additionalParams = $additionalParams['before'] = $additionalParams['before']->format('c'); } - break; + break; case self::SUBJECT_ATTACHMENT_CREATE: case self::SUBJECT_ATTACHMENT_UPDATE: case self::SUBJECT_ATTACHMENT_DELETE: diff --git a/lib/Activity/CommentEventHandler.php b/lib/Activity/CommentEventHandler.php index dc68c3239..47e11a9fd 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 7808ef013..0b7a63e7e 100644 --- a/lib/Activity/DeckProvider.php +++ b/lib/Activity/DeckProvider.php @@ -26,6 +26,7 @@ namespace OCA\Deck\Activity; use OCA\Deck\Db\Acl; +use OCA\Deck\Service\CardService; use OCP\Activity\IEvent; use OCP\Activity\IProvider; use OCP\Comments\IComment; @@ -35,7 +36,6 @@ use OCP\IURLGenerator; use OCP\IUserManager; use OCP\L10N\IFactory; -use OCA\Deck\Service\CardService; class DeckProvider implements IProvider { diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 01257a875..bf4514280 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -43,11 +43,11 @@ use OCA\Deck\Event\SessionClosedEvent; use OCA\Deck\Event\SessionCreatedEvent; use OCA\Deck\Listeners\BeforeTemplateRenderedListener; -use OCA\Deck\Listeners\ParticipantCleanupListener; use OCA\Deck\Listeners\FullTextSearchEventListener; +use OCA\Deck\Listeners\LiveUpdateListener; +use OCA\Deck\Listeners\ParticipantCleanupListener; use OCA\Deck\Listeners\ResourceAdditionalScriptsListener; use OCA\Deck\Listeners\ResourceListener; -use OCA\Deck\Listeners\LiveUpdateListener; use OCA\Deck\Middleware\DefaultBoardMiddleware; use OCA\Deck\Middleware\ExceptionMiddleware; use OCA\Deck\Notification\Notifier; diff --git a/lib/Controller/AttachmentApiController.php b/lib/Controller/AttachmentApiController.php index debf93f6f..181bca72a 100644 --- a/lib/Controller/AttachmentApiController.php +++ b/lib/Controller/AttachmentApiController.php @@ -22,11 +22,11 @@ */ namespace OCA\Deck\Controller; +use OCA\Deck\Service\AttachmentService; use OCP\AppFramework\ApiController; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; -use OCA\Deck\Service\AttachmentService; class AttachmentApiController extends ApiController { private $attachmentService; diff --git a/lib/Controller/BoardApiController.php b/lib/Controller/BoardApiController.php index 32a9a971c..4d7f6bee1 100644 --- a/lib/Controller/BoardApiController.php +++ b/lib/Controller/BoardApiController.php @@ -25,13 +25,13 @@ namespace OCA\Deck\Controller; use OCA\Deck\Db\Board; +use OCA\Deck\Service\BoardService; use OCA\Deck\StatusException; use OCP\AppFramework\ApiController; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; -use OCP\IRequest; -use OCA\Deck\Service\BoardService; +use OCP\IRequest; use Sabre\HTTP\Util; /** diff --git a/lib/Controller/CardApiController.php b/lib/Controller/CardApiController.php index 443ad3719..e7e2add1c 100644 --- a/lib/Controller/CardApiController.php +++ b/lib/Controller/CardApiController.php @@ -23,20 +23,20 @@ * */ - namespace OCA\Deck\Controller; - - use OCA\Deck\Service\AssignmentService; - use OCP\AppFramework\ApiController; - use OCP\AppFramework\Http; - use OCP\AppFramework\Http\DataResponse; - use OCP\IRequest; - use OCA\Deck\Service\CardService; - - /** - * Class BoardApiController - * - * @package OCA\Deck\Controller - */ +namespace OCA\Deck\Controller; + +use OCA\Deck\Service\AssignmentService; +use OCA\Deck\Service\CardService; +use OCP\AppFramework\ApiController; +use OCP\AppFramework\Http; +use OCP\AppFramework\Http\DataResponse; +use OCP\IRequest; + +/** + * Class BoardApiController + * + * @package OCA\Deck\Controller + */ class CardApiController extends ApiController { private $cardService; private $userId; diff --git a/lib/Controller/CardController.php b/lib/Controller/CardController.php index d86ac5f93..9d2cddeea 100644 --- a/lib/Controller/CardController.php +++ b/lib/Controller/CardController.php @@ -25,8 +25,8 @@ use OCA\Deck\Service\AssignmentService; use OCA\Deck\Service\CardService; -use OCP\IRequest; use OCP\AppFramework\Controller; +use OCP\IRequest; class CardController extends Controller { private $userId; diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php index b64e23106..d263994cb 100644 --- a/lib/Controller/ConfigController.php +++ b/lib/Controller/ConfigController.php @@ -36,7 +36,7 @@ public function __construct( $AppName, IRequest $request, ConfigService $configService - ) { + ) { parent::__construct($AppName, $request); $this->configService = $configService; diff --git a/lib/Controller/LabelApiController.php b/lib/Controller/LabelApiController.php index 979b103a5..63cf2f513 100644 --- a/lib/Controller/LabelApiController.php +++ b/lib/Controller/LabelApiController.php @@ -23,11 +23,11 @@ namespace OCA\Deck\Controller; +use OCA\Deck\Service\LabelService; use OCP\AppFramework\ApiController; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; -use OCA\Deck\Service\LabelService; /** * Class BoardApiController diff --git a/lib/Controller/LabelController.php b/lib/Controller/LabelController.php index 530647326..71794e749 100644 --- a/lib/Controller/LabelController.php +++ b/lib/Controller/LabelController.php @@ -24,8 +24,8 @@ namespace OCA\Deck\Controller; use OCA\Deck\Service\LabelService; -use OCP\IRequest; use OCP\AppFramework\Controller; +use OCP\IRequest; class LabelController extends Controller { private $labelService; diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 88ef05ff9..1f23bbde4 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -23,25 +23,25 @@ namespace OCA\Deck\Controller; +use \OCP\AppFramework\Http\RedirectResponse; use OCA\Deck\AppInfo\Application; +use OCA\Deck\Db\Acl; +use OCA\Deck\Db\CardMapper; +use OCA\Deck\Service\CardService; use OCA\Deck\Service\ConfigService; use OCA\Deck\Service\PermissionService; use OCA\Files\Event\LoadSidebar; use OCA\Text\Event\LoadEditor; use OCA\Viewer\Event\LoadViewer; +use OCP\AppFramework\Controller; use OCP\AppFramework\Http\ContentSecurityPolicy; +use OCP\AppFramework\Http\TemplateResponse; use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent as CollaborationResourcesEvent; use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IInitialStateService; use OCP\IRequest; -use OCP\AppFramework\Http\TemplateResponse; -use OCP\AppFramework\Controller; -use OCA\Deck\Db\CardMapper; use OCP\IURLGenerator; -use \OCP\AppFramework\Http\RedirectResponse; -use OCA\Deck\Db\Acl; -use OCA\Deck\Service\CardService; class PageController extends Controller { private PermissionService $permissionService; @@ -64,7 +64,7 @@ public function __construct( IURLGenerator $urlGenerator, CardService $cardService, IConfig $config - ) { + ) { parent::__construct($AppName, $request); $this->permissionService = $permissionService; diff --git a/lib/Controller/SessionController.php b/lib/Controller/SessionController.php index 1d1744c9c..0e6a66b7c 100644 --- a/lib/Controller/SessionController.php +++ b/lib/Controller/SessionController.php @@ -24,14 +24,14 @@ namespace OCA\Deck\Controller; -use OCA\Deck\Service\SessionService; -use OCA\Deck\Service\PermissionService; +use OCA\Deck\Db\Acl; use OCA\Deck\Db\BoardMapper; +use OCA\Deck\Service\PermissionService; +use OCA\Deck\Service\SessionService; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCSController; use OCP\IRequest; -use OCA\Deck\Db\Acl; class SessionController extends OCSController { private SessionService $sessionService; diff --git a/lib/Controller/StackApiController.php b/lib/Controller/StackApiController.php index d39bd7f5b..f210770de 100644 --- a/lib/Controller/StackApiController.php +++ b/lib/Controller/StackApiController.php @@ -24,13 +24,13 @@ namespace OCA\Deck\Controller; +use OCA\Deck\Service\BoardService; +use OCA\Deck\Service\StackService; use OCA\Deck\StatusException; use OCP\AppFramework\ApiController; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; -use OCA\Deck\Service\StackService; -use OCA\Deck\Service\BoardService; use Sabre\HTTP\Util; /** diff --git a/lib/Controller/StackController.php b/lib/Controller/StackController.php index 6452ef310..c59bf9e1b 100644 --- a/lib/Controller/StackController.php +++ b/lib/Controller/StackController.php @@ -25,10 +25,10 @@ use OCA\Deck\Service\StackService; -use OCP\IRequest; - use OCP\AppFramework\Controller; +use OCP\IRequest; + class StackController extends Controller { private $userId; private $stackService; diff --git a/lib/Cron/CardDescriptionActivity.php b/lib/Cron/CardDescriptionActivity.php index 8b973410d..35dce02e9 100644 --- a/lib/Cron/CardDescriptionActivity.php +++ b/lib/Cron/CardDescriptionActivity.php @@ -24,10 +24,10 @@ namespace OCA\Deck\Cron; -use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\Job; use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Db\CardMapper; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\Job; class CardDescriptionActivity extends Job { diff --git a/lib/Cron/DeleteCron.php b/lib/Cron/DeleteCron.php index f766931d9..edea4d02f 100644 --- a/lib/Cron/DeleteCron.php +++ b/lib/Cron/DeleteCron.php @@ -24,14 +24,14 @@ namespace OCA\Deck\Cron; -use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\TimedJob; use OCA\Deck\Db\AttachmentMapper; use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\CardMapper; use OCA\Deck\InvalidAttachmentType; use OCA\Deck\Service\AttachmentService; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJob; +use OCP\BackgroundJob\TimedJob; class DeleteCron extends TimedJob { diff --git a/lib/Cron/ScheduledNotifications.php b/lib/Cron/ScheduledNotifications.php index 09fee228b..ef72e644c 100644 --- a/lib/Cron/ScheduledNotifications.php +++ b/lib/Cron/ScheduledNotifications.php @@ -23,12 +23,12 @@ namespace OCA\Deck\Cron; -use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\Job; use OCA\Deck\Db\Card; use OCA\Deck\Db\CardMapper; use OCA\Deck\Notification\NotificationHelper; use OCP\AppFramework\Db\DoesNotExistException; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\Job; use OCP\ILogger; class ScheduledNotifications extends Job { diff --git a/lib/Cron/SessionsCleanup.php b/lib/Cron/SessionsCleanup.php index cbdf18713..a372c9e72 100644 --- a/lib/Cron/SessionsCleanup.php +++ b/lib/Cron/SessionsCleanup.php @@ -39,8 +39,8 @@ class SessionsCleanup extends TimedJob { public function __construct(ITimeFactory $time, - SessionService $sessionService, - ILogger $logger) { + SessionService $sessionService, + ILogger $logger) { parent::__construct($time); $this->sessionService = $sessionService; $this->logger = $logger; diff --git a/lib/Db/BoardMapper.php b/lib/Db/BoardMapper.php index 6c2a79451..88613fb30 100644 --- a/lib/Db/BoardMapper.php +++ b/lib/Db/BoardMapper.php @@ -29,8 +29,8 @@ use OCP\AppFramework\Db\QBMapper; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; -use OCP\IUserManager; use OCP\IGroupManager; +use OCP\IUserManager; use Psr\Log\LoggerInterface; /** @template-extends QBMapper */ @@ -159,7 +159,7 @@ public function findBoardIds(string $userId): array { } public function findAllForUser(string $userId, ?int $since = null, bool $includeArchived = true, ?int $before = null, - ?string $term = null): array { + ?string $term = null): array { $useCache = ($since === -1 && $includeArchived === true && $before === null && $term === null); if (!isset($this->userBoardCache[$userId]) || !$useCache) { $groups = $this->groupManager->getUserGroupIds( @@ -198,7 +198,7 @@ public function findAllForUser(string $userId, ?int $since = null, bool $include * Find all boards for a given user */ public function findAllByUser(string $userId, ?int $limit = null, ?int $offset = null, ?int $since = null, - bool $includeArchived = true, ?int $before = null, ?string $term = null): array { + bool $includeArchived = true, ?int $before = null, ?string $term = null): array { // FIXME this used to be a UNION to get boards owned by $userId and the user shares in one single query // Is it possible with the query builder? $qb = $this->db->getQueryBuilder(); @@ -305,7 +305,7 @@ public function findAllByOwner(string $userId, ?int $limit = null, ?int $offset * Find all boards for a given user */ public function findAllByGroups(string $userId, array $groups, ?int $limit = null, ?int $offset = null, ?int $since = null, - bool $includeArchived = true, ?int $before = null, ?string $term = null): array { + bool $includeArchived = true, ?int $before = null, ?string $term = null): array { if (count($groups) <= 0) { return []; } @@ -359,7 +359,7 @@ public function findAllByGroups(string $userId, array $groups, ?int $limit = nul } public function findAllByCircles(string $userId, ?int $limit = null, ?int $offset = null, ?int $since = null, - bool $includeArchived = true, ?int $before = null, ?string $term = null) { + bool $includeArchived = true, ?int $before = null, ?string $term = null) { $circles = $this->circlesService->getUserCircles($userId); if (count($circles) === 0) { return []; diff --git a/lib/Db/ChangeHelper.php b/lib/Db/ChangeHelper.php index bb9342886..004a05da2 100644 --- a/lib/Db/ChangeHelper.php +++ b/lib/Db/ChangeHelper.php @@ -23,8 +23,8 @@ namespace OCA\Deck\Db; -use OCP\ICacheFactory; use OCP\ICache; +use OCP\ICacheFactory; use OCP\IDBConnection; use OCP\IRequest; diff --git a/lib/Db/StackMapper.php b/lib/Db/StackMapper.php index 162f1ee56..7f5d8f565 100644 --- a/lib/Db/StackMapper.php +++ b/lib/Db/StackMapper.php @@ -28,9 +28,9 @@ use OCP\AppFramework\Db\MultipleObjectsReturnedException; use OCP\Cache\CappedMemoryCache; use OCP\DB\QueryBuilder\IQueryBuilder; -use OCP\IDBConnection; use OCP\ICache; use OCP\ICacheFactory; +use OCP\IDBConnection; /** @template-extends DeckMapper */ class StackMapper extends DeckMapper implements IPermissionMapper { diff --git a/lib/Listeners/LiveUpdateListener.php b/lib/Listeners/LiveUpdateListener.php index f099057ce..5ef6bba77 100644 --- a/lib/Listeners/LiveUpdateListener.php +++ b/lib/Listeners/LiveUpdateListener.php @@ -27,13 +27,13 @@ namespace OCA\Deck\Listeners; use OCA\Deck\Db\StackMapper; -use OCA\Deck\NotifyPushEvents; use OCA\Deck\Event\AAclEvent; use OCA\Deck\Event\ACardEvent; use OCA\Deck\Event\BoardUpdatedEvent; use OCA\Deck\Event\CardUpdatedEvent; use OCA\Deck\Event\SessionClosedEvent; use OCA\Deck\Event\SessionCreatedEvent; +use OCA\Deck\NotifyPushEvents; use OCA\Deck\Service\SessionService; use OCA\NotifyPush\Queue\IQueue; use OCP\EventDispatcher\Event; diff --git a/lib/Middleware/ExceptionMiddleware.php b/lib/Middleware/ExceptionMiddleware.php index 48a5f3e24..f3f4e5179 100644 --- a/lib/Middleware/ExceptionMiddleware.php +++ b/lib/Middleware/ExceptionMiddleware.php @@ -24,16 +24,16 @@ namespace OCA\Deck\Middleware; use OCA\Deck\Controller\PageController; -use OCA\Deck\StatusException; use OCA\Deck\Exceptions\ConflictException; +use OCA\Deck\StatusException; use OCP\AppFramework\Db\DoesNotExistException; -use OCP\AppFramework\Middleware; use OCP\AppFramework\Http\JSONResponse; +use OCP\AppFramework\Middleware; use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCSController; +use OCP\IConfig; use OCP\ILogger; use OCP\IRequest; -use OCP\IConfig; class ExceptionMiddleware extends Middleware { diff --git a/lib/Reference/BoardReferenceProvider.php b/lib/Reference/BoardReferenceProvider.php index 8443341a3..62f0a7362 100644 --- a/lib/Reference/BoardReferenceProvider.php +++ b/lib/Reference/BoardReferenceProvider.php @@ -38,9 +38,9 @@ class BoardReferenceProvider implements IReferenceProvider { private IL10N $l10n; public function __construct(BoardService $boardService, - IURLGenerator $urlGenerator, - IL10N $l10n, - ?string $userId) { + IURLGenerator $urlGenerator, + IL10N $l10n, + ?string $userId) { $this->urlGenerator = $urlGenerator; $this->boardService = $boardService; $this->userId = $userId; diff --git a/lib/Reference/CardReferenceProvider.php b/lib/Reference/CardReferenceProvider.php index 5cca7feeb..f3dcac5cd 100644 --- a/lib/Reference/CardReferenceProvider.php +++ b/lib/Reference/CardReferenceProvider.php @@ -47,11 +47,11 @@ class CardReferenceProvider extends ADiscoverableReferenceProvider implements IS private IL10N $l10n; public function __construct(CardService $cardService, - BoardService $boardService, - StackService $stackService, - IURLGenerator $urlGenerator, - IL10N $l10n, - ?string $userId) { + BoardService $boardService, + StackService $stackService, + IURLGenerator $urlGenerator, + IL10N $l10n, + ?string $userId) { $this->cardService = $cardService; $this->urlGenerator = $urlGenerator; $this->boardService = $boardService; diff --git a/lib/Reference/CommentReferenceProvider.php b/lib/Reference/CommentReferenceProvider.php index c45b61bee..54606421b 100644 --- a/lib/Reference/CommentReferenceProvider.php +++ b/lib/Reference/CommentReferenceProvider.php @@ -48,12 +48,12 @@ class CommentReferenceProvider implements IReferenceProvider { private CommentService $commentService; public function __construct(CardService $cardService, - BoardService $boardService, - StackService $stackService, - CommentService $commentService, - IURLGenerator $urlGenerator, - IL10N $l10n, - ?string $userId) { + BoardService $boardService, + StackService $stackService, + CommentService $commentService, + IURLGenerator $urlGenerator, + IL10N $l10n, + ?string $userId) { $this->cardService = $cardService; $this->urlGenerator = $urlGenerator; $this->boardService = $boardService; diff --git a/lib/Service/AttachmentService.php b/lib/Service/AttachmentService.php index b563f0bcf..82a946c09 100644 --- a/lib/Service/AttachmentService.php +++ b/lib/Service/AttachmentService.php @@ -26,6 +26,7 @@ use OCA\Deck\Activity\ActivityManager; use OCA\Deck\AppInfo\Application; use OCA\Deck\BadRequestException; +use OCA\Deck\Cache\AttachmentCacheHelper; use OCA\Deck\Db\Acl; use OCA\Deck\Db\Attachment; use OCA\Deck\Db\AttachmentMapper; @@ -34,7 +35,6 @@ use OCA\Deck\InvalidAttachmentType; use OCA\Deck\NoPermissionException; use OCA\Deck\NotFoundException; -use OCA\Deck\Cache\AttachmentCacheHelper; use OCA\Deck\StatusException; use OCA\Deck\Validators\AttachmentServiceValidator; use OCP\AppFramework\Db\IMapperException; diff --git a/lib/Service/BoardService.php b/lib/Service/BoardService.php index e0c8aa7fc..78010b723 100644 --- a/lib/Service/BoardService.php +++ b/lib/Service/BoardService.php @@ -27,13 +27,17 @@ use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ChangeSet; use OCA\Deck\AppInfo\Application; +use OCA\Deck\BadRequestException; use OCA\Deck\Db\Acl; use OCA\Deck\Db\AclMapper; use OCA\Deck\Db\AssignmentMapper; +use OCA\Deck\Db\Board; +use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\ChangeHelper; use OCA\Deck\Db\IPermissionMapper; use OCA\Deck\Db\Label; +use OCA\Deck\Db\LabelMapper; use OCA\Deck\Db\Session; use OCA\Deck\Db\SessionMapper; use OCA\Deck\Db\Stack; @@ -41,24 +45,20 @@ use OCA\Deck\Event\AclCreatedEvent; use OCA\Deck\Event\AclDeletedEvent; use OCA\Deck\Event\AclUpdatedEvent; +use OCA\Deck\Event\BoardUpdatedEvent; use OCA\Deck\NoPermissionException; use OCA\Deck\Notification\NotificationHelper; +use OCA\Deck\Validators\BoardServiceValidator; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\MultipleObjectsReturnedException; +use OCP\DB\Exception as DbException; use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IDBConnection; use OCP\IGroupManager; use OCP\IL10N; -use OCP\DB\Exception as DbException; -use OCA\Deck\Db\Board; -use OCA\Deck\Db\BoardMapper; -use OCA\Deck\Db\LabelMapper; -use OCP\IUserManager; -use OCA\Deck\BadRequestException; -use OCA\Deck\Event\BoardUpdatedEvent; -use OCA\Deck\Validators\BoardServiceValidator; use OCP\IURLGenerator; +use OCP\IUserManager; use OCP\Server; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; @@ -145,7 +145,7 @@ public function setUserId(string $userId): void { * Get all boards that are shared with a user, their groups or circles */ public function getUserBoards(?int $since = null, bool $includeArchived = true, ?int $before = null, - ?string $term = null): array { + ?string $term = null): array { return $this->boardMapper->findAllForUser($this->userId, $since, $includeArchived, $before, $term); } diff --git a/lib/Service/CardService.php b/lib/Service/CardService.php index 58af9575e..d29427fb5 100644 --- a/lib/Service/CardService.php +++ b/lib/Service/CardService.php @@ -28,13 +28,16 @@ use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ChangeSet; +use OCA\Deck\BadRequestException; +use OCA\Deck\Db\Acl; use OCA\Deck\Db\Assignment; use OCA\Deck\Db\AssignmentMapper; +use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\Card; use OCA\Deck\Db\CardMapper; -use OCA\Deck\Db\Acl; use OCA\Deck\Db\ChangeHelper; use OCA\Deck\Db\Label; +use OCA\Deck\Db\LabelMapper; use OCA\Deck\Db\StackMapper; use OCA\Deck\Event\CardCreatedEvent; use OCA\Deck\Event\CardDeletedEvent; @@ -42,16 +45,13 @@ use OCA\Deck\Model\CardDetails; use OCA\Deck\NoPermissionException; use OCA\Deck\Notification\NotificationHelper; -use OCA\Deck\Db\BoardMapper; -use OCA\Deck\Db\LabelMapper; use OCA\Deck\StatusException; -use OCA\Deck\BadRequestException; use OCA\Deck\Validators\CardServiceValidator; use OCP\Comments\ICommentsManager; use OCP\EventDispatcher\IEventDispatcher; use OCP\IRequest; -use OCP\IUserManager; use OCP\IURLGenerator; +use OCP\IUserManager; use Psr\Log\LoggerInterface; class CardService { diff --git a/lib/Service/DefaultBoardService.php b/lib/Service/DefaultBoardService.php index 5698994d6..ccfb41028 100644 --- a/lib/Service/DefaultBoardService.php +++ b/lib/Service/DefaultBoardService.php @@ -24,10 +24,10 @@ namespace OCA\Deck\Service; use OCA\Deck\AppInfo\Application; +use OCA\Deck\BadRequestException; use OCA\Deck\Db\BoardMapper; use OCP\IConfig; use OCP\IL10N; -use OCA\Deck\BadRequestException; use OCP\PreConditionNotMetException; class DefaultBoardService { @@ -39,13 +39,13 @@ class DefaultBoardService { private $l10n; public function __construct( - IL10N $l10n, - BoardMapper $boardMapper, - BoardService $boardService, - StackService $stackService, - CardService $cardService, - IConfig $config - ) { + IL10N $l10n, + BoardMapper $boardMapper, + BoardService $boardService, + StackService $stackService, + CardService $cardService, + IConfig $config + ) { $this->boardService = $boardService; $this->stackService = $stackService; $this->cardService = $cardService; diff --git a/lib/Service/FileService.php b/lib/Service/FileService.php index 5a3dbfb20..d4e5c4c90 100644 --- a/lib/Service/FileService.php +++ b/lib/Service/FileService.php @@ -25,8 +25,8 @@ use OCA\Deck\Db\Attachment; use OCA\Deck\Db\AttachmentMapper; -use OCA\Deck\StatusException; use OCA\Deck\Exceptions\ConflictException; +use OCA\Deck\StatusException; use OCP\AppFramework\Http\StreamResponse; use OCP\Files\IAppData; use OCP\Files\IMimeTypeDetector; diff --git a/lib/Service/Importer/Systems/TrelloJsonService.php b/lib/Service/Importer/Systems/TrelloJsonService.php index a4a3673c1..71c897cec 100644 --- a/lib/Service/Importer/Systems/TrelloJsonService.php +++ b/lib/Service/Importer/Systems/TrelloJsonService.php @@ -332,7 +332,7 @@ public function getAclList(): array { return $return; } - private function translateColor(string $color): string { + private function translateColor(?string $color): string { switch ($color) { case 'red': return 'ff0000'; diff --git a/lib/Service/LabelService.php b/lib/Service/LabelService.php index 61ed58f07..aacb93bfd 100644 --- a/lib/Service/LabelService.php +++ b/lib/Service/LabelService.php @@ -23,12 +23,12 @@ namespace OCA\Deck\Service; +use OCA\Deck\BadRequestException; +use OCA\Deck\Db\Acl; use OCA\Deck\Db\ChangeHelper; use OCA\Deck\Db\Label; -use OCA\Deck\Db\Acl; use OCA\Deck\Db\LabelMapper; use OCA\Deck\StatusException; -use OCA\Deck\BadRequestException; use OCA\Deck\Validators\LabelServiceValidator; class LabelService { @@ -50,7 +50,7 @@ public function __construct( BoardService $boardService, ChangeHelper $changeHelper, LabelServiceValidator $labelServiceValidator - ) { + ) { $this->labelMapper = $labelMapper; $this->permissionService = $permissionService; $this->boardService = $boardService; diff --git a/lib/Service/OverviewService.php b/lib/Service/OverviewService.php index 7c1f4479f..d2a705f7b 100644 --- a/lib/Service/OverviewService.php +++ b/lib/Service/OverviewService.php @@ -29,11 +29,11 @@ use OCA\Deck\Db\AssignmentMapper; use OCA\Deck\Db\Board; +use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\CardMapper; +use OCA\Deck\Db\LabelMapper; use OCA\Deck\Model\CardDetails; use OCP\Comments\ICommentsManager; -use OCA\Deck\Db\BoardMapper; -use OCA\Deck\Db\LabelMapper; use OCP\IUserManager; class OverviewService { diff --git a/lib/Service/PermissionService.php b/lib/Service/PermissionService.php index 64c4305a8..18f112d2d 100644 --- a/lib/Service/PermissionService.php +++ b/lib/Service/PermissionService.php @@ -23,7 +23,6 @@ namespace OCA\Deck\Service; -use OCP\Cache\CappedMemoryCache; use OCA\Circles\Model\Member; use OCA\Deck\Db\Acl; use OCA\Deck\Db\AclMapper; @@ -34,6 +33,7 @@ use OCA\Deck\NoPermissionException; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\MultipleObjectsReturnedException; +use OCP\Cache\CappedMemoryCache; use OCP\IConfig; use OCP\IGroupManager; use OCP\ILogger; diff --git a/lib/Service/SessionService.php b/lib/Service/SessionService.php index a6287a050..7f0f619f5 100644 --- a/lib/Service/SessionService.php +++ b/lib/Service/SessionService.php @@ -26,12 +26,12 @@ use OCA\Deck\Db\Session; use OCA\Deck\Db\SessionMapper; -use OCA\Deck\Event\SessionCreatedEvent; use OCA\Deck\Event\SessionClosedEvent; +use OCA\Deck\Event\SessionCreatedEvent; +use OCA\NotifyPush\Queue\IQueue; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Utility\ITimeFactory; use OCP\EventDispatcher\IEventDispatcher; -use OCA\NotifyPush\Queue\IQueue; use OCP\Security\ISecureRandom; class SessionService { diff --git a/lib/Validators/LabelServiceValidator.php b/lib/Validators/LabelServiceValidator.php index c350cb769..ce23c81b2 100644 --- a/lib/Validators/LabelServiceValidator.php +++ b/lib/Validators/LabelServiceValidator.php @@ -23,7 +23,7 @@ * */ - declare(strict_types=1); +declare(strict_types=1); namespace OCA\Deck\Validators; diff --git a/psalm.xml b/psalm.xml index 178ff30fd..ef4ac1d4e 100644 --- a/psalm.xml +++ b/psalm.xml @@ -20,8 +20,6 @@ - - diff --git a/tests/integration/database/AssignmentMapperTest.php b/tests/integration/database/AssignmentMapperTest.php index 7066c494a..9b9f08070 100644 --- a/tests/integration/database/AssignmentMapperTest.php +++ b/tests/integration/database/AssignmentMapperTest.php @@ -26,8 +26,8 @@ use OCA\Deck\NotFoundException; use OCA\Deck\Service\AssignmentService; use OCA\Deck\Service\BoardService; -use OCA\Deck\Service\StackService; use OCA\Deck\Service\CardService; +use OCA\Deck\Service\StackService; use OCP\IGroupManager; use OCP\IUserManager; use OCP\IUserSession; diff --git a/tests/integration/features/bootstrap/RequestContext.php b/tests/integration/features/bootstrap/RequestContext.php index ebf01e80a..f980ea4d4 100644 --- a/tests/integration/features/bootstrap/RequestContext.php +++ b/tests/integration/features/bootstrap/RequestContext.php @@ -1,11 +1,11 @@ - + $types + + + Command + + + + + Command + + - - void - - - $this->boardMapper - $this->stackMapper - - - $this->boardMapper - $this->stackMapper - + + Command + @@ -27,10 +29,10 @@ Util - $this->userId + userId]]> - $this->userId + userId]]> @@ -76,6 +78,11 @@ NotFound + + + $userManager + + VCalendar @@ -84,7 +91,7 @@ - $entity->getId() + getId()]]> getUserIdGroups @@ -113,15 +120,6 @@ public function __construct(Card $card, ?Board $board = null) { - - - try { - $attachment = $this->attachmentMapper->find($attachmentId); - } catch (IMapperException $e) { - throw new NoPermissionException('Permission denied'); - } - - findAll @@ -139,6 +137,21 @@ is_resource($content) + + + getCommand()]]> + getCommand()]]> + getCommand()]]> + ChoiceQuestion + Command + Command + Question + Question + + + Command + + getShareByToken @@ -148,5 +161,9 @@ [self::class, 'listenPreShare'] + + GenericEvent + GenericEvent + diff --git a/tests/unit/Activity/ActivityManagerTest.php b/tests/unit/Activity/ActivityManagerTest.php index da721f13c..21ee1f271 100644 --- a/tests/unit/Activity/ActivityManagerTest.php +++ b/tests/unit/Activity/ActivityManagerTest.php @@ -39,8 +39,8 @@ use OCP\IL10N; use OCP\IUser; use OCP\L10N\IFactory; -use PHPUnit\Framework\TestCase; use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; class ActivityManagerTest extends TestCase { diff --git a/tests/unit/Activity/DeckProviderTest.php b/tests/unit/Activity/DeckProviderTest.php index 4302834cb..02b6be1c2 100644 --- a/tests/unit/Activity/DeckProviderTest.php +++ b/tests/unit/Activity/DeckProviderTest.php @@ -26,6 +26,7 @@ use OC\Activity\Event; use OCA\Deck\Db\Acl; use OCA\Deck\Db\Card; +use OCA\Deck\Service\CardService; use OCP\Activity\IEvent; use OCP\Comments\IComment; use OCP\Comments\ICommentsManager; @@ -38,7 +39,6 @@ use OCP\RichObjectStrings\IValidator; use PHPUnit\Framework\TestCase; use PHPUnit_Framework_MockObject_MockObject as MockObject; -use OCA\Deck\Service\CardService; class DeckProviderTest extends TestCase { diff --git a/tests/unit/Middleware/ExceptionMiddlewareTest.php b/tests/unit/Middleware/ExceptionMiddlewareTest.php index dc00ac40a..c737fe672 100644 --- a/tests/unit/Middleware/ExceptionMiddlewareTest.php +++ b/tests/unit/Middleware/ExceptionMiddlewareTest.php @@ -31,8 +31,8 @@ use OCA\Deck\Service\PermissionService; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; -use OCP\ILogger; use OCP\IConfig; +use OCP\ILogger; use OCP\IRequest; class ExceptionMiddlewareTest extends \Test\TestCase { diff --git a/tests/unit/Service/BoardServiceTest.php b/tests/unit/Service/BoardServiceTest.php index b6a922327..2d9610058 100644 --- a/tests/unit/Service/BoardServiceTest.php +++ b/tests/unit/Service/BoardServiceTest.php @@ -23,6 +23,7 @@ namespace OCA\Deck\Service; +use \Test\TestCase; use OC\L10N\L10N; use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Db\Acl; @@ -41,16 +42,15 @@ use OCA\Deck\Event\AclDeletedEvent; use OCA\Deck\NoPermissionException; use OCA\Deck\Notification\NotificationHelper; +use OCA\Deck\Validators\BoardServiceValidator; use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IDBConnection; +use OCP\IGroupManager; +use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; -use OCP\IGroupManager; use PHPUnit\Framework\MockObject\MockObject; -use \Test\TestCase; -use OCP\IURLGenerator; -use OCA\Deck\Validators\BoardServiceValidator; class BoardServiceTest extends TestCase { diff --git a/tests/unit/Service/CardServiceTest.php b/tests/unit/Service/CardServiceTest.php index f0a9eb58e..5d675a170 100644 --- a/tests/unit/Service/CardServiceTest.php +++ b/tests/unit/Service/CardServiceTest.php @@ -27,13 +27,13 @@ use OCA\Deck\Db\Assignment; use OCA\Deck\Db\AssignmentMapper; use OCA\Deck\Db\Board; +use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\Card; use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\ChangeHelper; +use OCA\Deck\Db\LabelMapper; use OCA\Deck\Db\Stack; use OCA\Deck\Db\StackMapper; -use OCA\Deck\Db\BoardMapper; -use OCA\Deck\Db\LabelMapper; use OCA\Deck\Model\CardDetails; use OCA\Deck\Notification\NotificationHelper; use OCA\Deck\StatusException; @@ -42,13 +42,13 @@ use OCP\Comments\ICommentsManager; use OCP\EventDispatcher\IEventDispatcher; use OCP\IRequest; +use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Test\TestCase; -use OCP\IURLGenerator; class CardServiceTest extends TestCase { diff --git a/tests/unit/Service/DefaultBoardServiceTest.php b/tests/unit/Service/DefaultBoardServiceTest.php index 2e38c83bc..a6cd809c3 100644 --- a/tests/unit/Service/DefaultBoardServiceTest.php +++ b/tests/unit/Service/DefaultBoardServiceTest.php @@ -23,13 +23,13 @@ namespace OCA\Deck\Service; -use OCA\Deck\Db\Card; +use \Test\TestCase; use OCA\Deck\Db\Board; -use OCA\Deck\Db\Stack; 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 aa573a3c5..ec3cf44c7 100644 --- a/tests/unit/Service/StackServiceTest.php +++ b/tests/unit/Service/StackServiceTest.php @@ -23,11 +23,12 @@ namespace OCA\Deck\Service; +use \Test\TestCase; use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Db\AssignmentMapper; +use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\Card; use OCA\Deck\Db\CardMapper; -use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\ChangeHelper; use OCA\Deck\Db\Label; use OCA\Deck\Db\LabelMapper; @@ -37,7 +38,6 @@ use OCA\Deck\Validators\StackServiceValidator; use OCP\EventDispatcher\IEventDispatcher; use Psr\Log\LoggerInterface; -use \Test\TestCase; /** * Class StackServiceTest @@ -117,17 +117,17 @@ public function testFindAll() { $this->permissionService->expects($this->once())->method('checkPermission'); $this->stackMapper->expects($this->once())->method('findAll')->willReturn($this->getStacks()); $this->cardService->expects($this->atLeastOnce())->method('enrichCards')->will( - $this->returnCallback( - function ($cards) { - foreach ($cards as $card) { - $card->setLabels($this->getLabels()[$card->getId()]); - } - return array_map(function ($card) { - return new CardDetails($card); - }, $cards); - } - ) - ); + $this->returnCallback( + function ($cards) { + foreach ($cards as $card) { + $card->setLabels($this->getLabels()[$card->getId()]); + } + return array_map(function ($card) { + return new CardDetails($card); + }, $cards); + } + ) + ); $this->cardMapper->expects($this->any())->method('findAll')->willReturn($this->getCards(222)); diff --git a/tests/unit/controller/BoardApiControllerTest.php b/tests/unit/controller/BoardApiControllerTest.php index 3fd9198f0..d74b0bd7d 100644 --- a/tests/unit/controller/BoardApiControllerTest.php +++ b/tests/unit/controller/BoardApiControllerTest.php @@ -22,13 +22,13 @@ */ namespace OCA\Deck\Controller; +use OCA\Deck\Db\Board; +use OCA\Deck\Service\BoardService; use OCP\AppFramework\Http; + use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; -use OCA\Deck\Service\BoardService; -use OCA\Deck\Db\Board; - class BoardApiControllerTest extends \Test\TestCase { private $appName = 'deck'; private $userId = 'admin'; diff --git a/tests/unit/controller/BoardImportApiControllerTest.php b/tests/unit/controller/BoardImportApiControllerTest.php index 926e4c473..20db54ae6 100644 --- a/tests/unit/controller/BoardImportApiControllerTest.php +++ b/tests/unit/controller/BoardImportApiControllerTest.php @@ -23,10 +23,10 @@ namespace OCA\Deck\Controller; use OCA\Deck\Db\Board; +use OCA\Deck\Service\Importer\BoardImportService; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; -use OCA\Deck\Service\Importer\BoardImportService; class BoardImportApiControllerTest extends \Test\TestCase { private $appName = 'deck'; diff --git a/tests/unit/controller/CardApiControllerTest.php b/tests/unit/controller/CardApiControllerTest.php index 4ef894f16..dfc498173 100644 --- a/tests/unit/controller/CardApiControllerTest.php +++ b/tests/unit/controller/CardApiControllerTest.php @@ -22,14 +22,14 @@ */ namespace OCA\Deck\Controller; +use OCA\Deck\Db\Card; use OCA\Deck\Service\AssignmentService; +use OCA\Deck\Service\CardService; use OCP\AppFramework\Http; + use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; -use OCA\Deck\Db\Card; -use OCA\Deck\Service\CardService; - class CardApiControllerTest extends \Test\TestCase { private $controller; private $request; diff --git a/tests/unit/controller/LabelApiControllerTest.php b/tests/unit/controller/LabelApiControllerTest.php index 86dec24f6..602d7a89c 100644 --- a/tests/unit/controller/LabelApiControllerTest.php +++ b/tests/unit/controller/LabelApiControllerTest.php @@ -22,13 +22,13 @@ */ namespace OCA\Deck\Controller; +use OCA\Deck\Db\Label; +use OCA\Deck\Service\LabelService; use OCP\AppFramework\Http; + use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; -use OCA\Deck\Db\Label; -use OCA\Deck\Service\LabelService; - class LabelApiControllerTest extends \Test\TestCase { private $controller; private $request; diff --git a/tests/unit/controller/PageControllerTest.php b/tests/unit/controller/PageControllerTest.php index 81c10bfbe..f2ed9edfa 100644 --- a/tests/unit/controller/PageControllerTest.php +++ b/tests/unit/controller/PageControllerTest.php @@ -29,9 +29,9 @@ use OCA\Deck\Service\ConfigService; use OCA\Deck\Service\PermissionService; use OCP\EventDispatcher\IEventDispatcher; +use OCP\IConfig; use OCP\IInitialStateService; use OCP\IRequest; -use OCP\IConfig; use OCP\IURLGenerator; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/controller/StackApiControllerTest.php b/tests/unit/controller/StackApiControllerTest.php index 4d30176a9..11d3438e1 100644 --- a/tests/unit/controller/StackApiControllerTest.php +++ b/tests/unit/controller/StackApiControllerTest.php @@ -22,14 +22,14 @@ */ namespace OCA\Deck\Controller; +use OCA\Deck\Db\Stack; +use OCA\Deck\Service\BoardService; +use OCA\Deck\Service\StackService; + use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; -use OCA\Deck\Service\BoardService; -use OCA\Deck\Service\StackService; -use OCA\Deck\Db\Stack; - class StackApiControllerTest extends \Test\TestCase { private $appName = 'deck'; private $userId = 'admin';