Skip to content

Commit

Permalink
cs:fix in preparation of updated coding standard
Browse files Browse the repository at this point in the history
Signed-off-by: dartcafe <[email protected]>
  • Loading branch information
dartcafe committed Sep 28, 2024
1 parent 2676031 commit d174a4b
Show file tree
Hide file tree
Showing 113 changed files with 166 additions and 158 deletions.
2 changes: 1 addition & 1 deletion lib/Activity/PollChanges.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class PollChanges implements IFilter {
public function __construct(
protected IL10N $l10n,
protected IURLGenerator $urlGenerator
protected IURLGenerator $urlGenerator,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Command/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Command extends \Symfony\Component\Console\Command\Command {
public function __construct(
) {
parent::__construct();
$this->question = new ConfirmationQuestion('Continue (y/n)? ['. ($this->defaultContinueAnswer ? 'y' : 'n') . '] ', $this->defaultContinueAnswer);
$this->question = new ConfirmationQuestion('Continue (y/n)? [' . ($this->defaultContinueAnswer ? 'y' : 'n') . '] ', $this->defaultContinueAnswer);
}

protected function configure(): void {
Expand Down
2 changes: 1 addition & 1 deletion lib/Command/Db/Purge.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Purge extends Command {

public function __construct(
private IDBConnection $connection,
private TableManager $tableManager
private TableManager $tableManager,
) {
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Command/Poll/TransferOwnership.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class TransferOwnership extends Command {
public function __construct(
private IUserManager $userManager,
private PollService $pollService
private PollService $pollService,
) {
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Command/Share/TShareCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct(
private ShareMapper $shareMapper,
private ShareService $shareService,
private IUserManager $userManager,
private IGroupManager $groupManager
private IGroupManager $groupManager,
) {
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/BaseApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(
IRequest $request,
string $corsMethods = 'PUT, POST, GET, DELETE',
string $corsAllowedHeaders = 'Authorization, Content-Type, Accept',
int $corsMaxAge = 1728000
int $corsMaxAge = 1728000,
) {
parent::__construct($appName, $request, $corsMethods, $corsAllowedHeaders, $corsMaxAge);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/CommentApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CommentApiController extends BaseApiController {
public function __construct(
string $appName,
IRequest $request,
private CommentService $commentService
private CommentService $commentService,
) {
parent::__construct($appName, $request);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CommentController extends BaseController {
public function __construct(
string $appName,
IRequest $request,
private CommentService $commentService
private CommentService $commentService,
) {
parent::__construct($appName, $request);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/OptionApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class OptionApiController extends BaseApiController {
public function __construct(
string $appName,
IRequest $request,
private OptionService $optionService
private OptionService $optionService,
) {
parent::__construct($appName, $request);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/PublicController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(
private SubscriptionService $subscriptionService,
private SystemService $systemService,
private VoteService $voteService,
private WatchService $watchService
private WatchService $watchService,
) {
parent::__construct($appName, $request);
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public function getSession(): JSONResponse {
*/
#[PublicPage]
#[ShareTokenRequired]
public function watchPoll(int|null $offset): JSONResponse {
public function watchPoll(?int $offset): JSONResponse {
return $this->responseLong(fn () => [
'updates' => $this->watchService->watchUpdates($this->userSession->getShare()->getPollId(), $offset)
]);
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SettingsController extends BaseController {
public function __construct(
string $appName,
IRequest $request,
private SettingsService $settingsService
private SettingsService $settingsService,
) {
parent::__construct($appName, $request);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/ShareApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(
string $appName,
IRequest $request,
private MailService $mailService,
private ShareService $shareService
private ShareService $shareService,
) {
parent::__construct($appName, $request);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/SubscriptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SubscriptionController extends BaseController {
public function __construct(
string $appName,
IRequest $request,
private SubscriptionService $subscriptionService
private SubscriptionService $subscriptionService,
) {
parent::__construct($appName, $request);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/SystemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SystemController extends BaseController {
public function __construct(
string $appName,
IRequest $request,
private SystemService $systemService
private SystemService $systemService,
) {
parent::__construct($appName, $request);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/VoteApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class VoteApiController extends BaseApiController {
public function __construct(
string $appName,
IRequest $request,
private VoteService $voteService
private VoteService $voteService,
) {
parent::__construct($appName, $request);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/WatchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class WatchController extends BaseController {
public function __construct(
string $appName,
IRequest $request,
private WatchService $watchService
private WatchService $watchService,
) {
parent::__construct($appName, $request);
}
Expand All @@ -33,7 +33,7 @@ public function __construct(
*/
#[NoAdminRequired]
#[NoCSRFRequired]
public function watchPoll(int $pollId, int|null $offset): JSONResponse {
public function watchPoll(int $pollId, ?int $offset): JSONResponse {
return $this->responseLong(fn () => ['updates' => $this->watchService->watchUpdates($pollId, $offset)]);
}
}
4 changes: 2 additions & 2 deletions lib/Dashboard/PollWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PollWidget implements IWidget {
*/
public function __construct(
private IL10N $l10n,
private IURLGenerator $urlGenerator
private IURLGenerator $urlGenerator,
) {
}

Expand All @@ -39,7 +39,7 @@ public function getIconClass(): string {
return 'icon-polls-dark';
}

public function getUrl(): string|null {
public function getUrl(): ?string {
return $this->urlGenerator->linkToRouteAbsolute(AppConstants::APP_ID . '.page.index');
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Db/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Comment extends EntityWithUser implements JsonSerializable {
public $id = null;
protected int $pollId = 0;
protected string $userId = '';
protected string|null $comment = null;
protected ?string $comment = null;
protected int $timestamp = 0;
protected int $deleted = 0;

Expand Down
2 changes: 1 addition & 1 deletion lib/Db/CommentMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function findByPoll(int $pollId, bool $getDeleted = false): array {
/**
* @return void
*/
public function renameUserId(string $userId, string $replacementId, int|null $pollId = null): void {
public function renameUserId(string $userId, string $replacementId, ?int $pollId = null): void {
$query = $this->db->getQueryBuilder();
$query->update($this->getTableName(), self::TABLE)
->set('user_id', $query->createNamedParameter($replacementId))
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/IndexManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function removeGenericIndicesFromTable(string $tableName): array {
*
* @return null|string
*/
public function removeNamedIndexFromTable(string $tableName, string $indexName): string|null {
public function removeNamedIndexFromTable(string $tableName, string $indexName): ?string {
$tableName = $this->dbPrefix . $tableName;
$message = null;
try {
Expand Down
6 changes: 3 additions & 3 deletions lib/Db/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class Log extends Entity implements JsonSerializable {
// schema columns
public $id = null;
protected int $pollId = 0;
protected string|null $userId = '';
protected string|null $displayName = '';
protected string|null $messageId = '';
protected ?string $userId = '';
protected ?string $displayName = '';
protected ?string $messageId = '';
protected int $created = 0;
protected int $processed = 0;

Expand Down
4 changes: 2 additions & 2 deletions lib/Db/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Option extends EntityWithUser implements JsonSerializable {
protected int $deleted = 0;

// joined columns
protected string|null $userVoteAnswer = '';
protected ?string $userVoteAnswer = '';
protected int $optionLimit = 0;
protected int $voteLimit = 0;
protected int $userCountYesVotes = 0;
Expand Down Expand Up @@ -132,7 +132,7 @@ private function getVotes(): array {
];
}

public function getOwnerUser(): UserBase|null {
public function getOwnerUser(): ?UserBase {
if ($this->getOwner() === '') {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/OptionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function findOptionsWithDuration(): array {
return $this->findEntities($qb);
}

public function renameUserId(string $userId, string $replacementName, int|null $pollId = null): void {
public function renameUserId(string $userId, string $replacementName, ?int $pollId = null): void {
$query = $this->db->getQueryBuilder();
$query->update($this->getTableName())
->set('owner', $query->createNamedParameter($replacementName))
Expand Down
10 changes: 5 additions & 5 deletions lib/Db/Poll.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class Poll extends EntityWithUser implements JsonSerializable {
public $id = null;
protected string $type = '';
protected string $title = '';
protected string|null $description = '';
protected string|null $owner = '';
protected ?string $description = '';
protected ?string $owner = '';
protected int $created = 0;
protected int $expire = 0;
protected int $deleted = 0;
Expand All @@ -146,15 +146,15 @@ class Poll extends EntityWithUser implements JsonSerializable {
protected int $hideBookedUp = 0;
protected int $useNo = 0;
protected int $lastInteraction = 0;
protected string|null $miscSettings = '';
protected ?string $miscSettings = '';

// joined columns
protected int|null $isCurrentUserLocked = 0;
protected ?int $isCurrentUserLocked = 0;
protected int $maxDate = 0;
protected int $minDate = 0;
protected string $userRole = self::ROLE_NONE;
protected string $shareToken = '';
protected string|null $groupShares = '';
protected ?string $groupShares = '';
protected int $countOptions = 0;

// subqueried columns
Expand Down
16 changes: 8 additions & 8 deletions lib/Db/PollMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ protected function joinUserRole(IQueryBuilder &$qb, string $fromAlias, string $c
$qb->selectAlias($joinAlias . '.locked', 'is_current_user_locked')
->addGroupBy($joinAlias . '.locked');

$qb->addSelect($qb->createFunction('coalesce(' . $joinAlias . '.token, '. $emptyString . ') AS share_token'))
$qb->addSelect($qb->createFunction('coalesce(' . $joinAlias . '.token, ' . $emptyString . ') AS share_token'))
->addGroupBy($joinAlias . '.token');

$qb->leftJoin(
Expand All @@ -235,19 +235,19 @@ protected function joinGroupShares(IQueryBuilder &$qb, string $fromAlias): void
$joinAlias = 'group_shares';

if ($this->db->getDatabasePlatform() instanceof PostgreSQLPlatform) {
$qb->addSelect($qb->createFunction('string_agg(distinct ' . $joinAlias . '.user_id, \''. self::CONCAT_SEPARATOR . '\') AS group_shares'));
$qb->addSelect($qb->createFunction('string_agg(distinct ' . $joinAlias . '.user_id, \'' . self::CONCAT_SEPARATOR . '\') AS group_shares'));

} elseif ($this->db->getDatabasePlatform() instanceof OraclePlatform) {
$qb->addSelect($qb->createFunction('listagg(distinct ' . $joinAlias . '.user_id, \''. self::CONCAT_SEPARATOR . '\') WITHIN GROUP (ORDER BY ' . $joinAlias . '.user_id) AS group_shares'));
$qb->addSelect($qb->createFunction('listagg(distinct ' . $joinAlias . '.user_id, \'' . self::CONCAT_SEPARATOR . '\') WITHIN GROUP (ORDER BY ' . $joinAlias . '.user_id) AS group_shares'));

} elseif ($this->db->getDatabasePlatform() instanceof SqlitePlatform) {
$qb->addSelect($qb->createFunction('group_concat(replace(distinct ' . $joinAlias . '.user_id ,\'\',\'\'), \''. self::CONCAT_SEPARATOR . '\') AS group_shares'));
$qb->addSelect($qb->createFunction('group_concat(replace(distinct ' . $joinAlias . '.user_id ,\'\',\'\'), \'' . self::CONCAT_SEPARATOR . '\') AS group_shares'));

} elseif ($this->db->getDatabasePlatform() instanceof MySQLPlatform) {
$qb->addSelect($qb->createFunction('group_concat(distinct ' . $joinAlias . '.user_id SEPARATOR "'. self::CONCAT_SEPARATOR . '") AS group_shares'));
$qb->addSelect($qb->createFunction('group_concat(distinct ' . $joinAlias . '.user_id SEPARATOR "' . self::CONCAT_SEPARATOR . '") AS group_shares'));

} else {
$qb->addSelect($qb->createFunction('group_concat(distinct ' . $joinAlias . '.user_id SEPARATOR "'. self::CONCAT_SEPARATOR . '") AS group_shares'));
$qb->addSelect($qb->createFunction('group_concat(distinct ' . $joinAlias . '.user_id SEPARATOR "' . self::CONCAT_SEPARATOR . '") AS group_shares'));
}

$qb->leftJoin(
Expand Down Expand Up @@ -275,7 +275,7 @@ protected function joinOptionsForMaxDate(IQueryBuilder &$qb, string $fromAlias):
$zero = $qb->createNamedParameter(0, IQueryBuilder::PARAM_INT);
$saveMin = $qb->createNamedParameter(time(), IQueryBuilder::PARAM_INT);

$qb->addSelect($qb->createFunction('coalesce(MAX(' . $joinAlias . '.timestamp), '. $zero . ') AS max_date'))
$qb->addSelect($qb->createFunction('coalesce(MAX(' . $joinAlias . '.timestamp), ' . $zero . ') AS max_date'))
->addSelect($qb->createFunction('coalesce(MIN(' . $joinAlias . '.timestamp), ' . $saveMin . ') AS min_date'));
$qb->selectAlias($qb->func()->count($joinAlias . '.id'), 'count_options');

Expand All @@ -295,7 +295,7 @@ protected function joinOptionsForMaxDate(IQueryBuilder &$qb, string $fromAlias):
/**
* Subquery for votes count
*/
protected function subQueryVotesCount(string $fromAlias, IParameter $currentUserId, IParameter|null $answerFilter = null): IQueryBuilder {
protected function subQueryVotesCount(string $fromAlias, IParameter $currentUserId, ?IParameter $answerFilter = null): IQueryBuilder {
$subAlias = 'user_vote_sub';

$subQuery = $this->db->getQueryBuilder();
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/Preferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Preferences extends Entity implements JsonSerializable {
public $id = 0;
protected string $userId = '';
protected int $timestamp = 0;
protected string|null $preferences = '';
protected ?string $preferences = '';

public function __construct() {
$this->addType('timestamp', 'int');
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/PreferencesMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(IDBConnection $db) {
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
* @return Preferences
*/
public function find(string|null $userId): Preferences {
public function find(?string $userId): Preferences {
$qb = $this->db->getQueryBuilder();

$qb->select('*')
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/QBMapperWithUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ abstract class QBMapperWithUser extends QBMapper {
public function __construct(
IDBConnection $db,
string $tableName,
string|null $entityClass = null
?string $entityClass = null,
) {
parent::__construct($db, $tableName, $entityClass);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Db/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ class Share extends EntityWithUser implements JsonSerializable {
protected string $type = '';
protected string $label = '';
protected string $userId = '';
protected string|null $displayName = null;
protected string|null $emailAddress = null;
protected ?string $displayName = null;
protected ?string $emailAddress = null;
protected int $invitationSent = 0;
protected int $reminderSent = 0;
protected int $locked = 0;
protected string|null $miscSettings = '';
protected ?string $miscSettings = '';
protected int $deleted = 0;

// joined columns
Expand Down
Loading

0 comments on commit d174a4b

Please sign in to comment.