Skip to content

Commit

Permalink
apply new 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 e1acc2f commit 45be7ad
Show file tree
Hide file tree
Showing 96 changed files with 122 additions and 114 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
2 changes: 1 addition & 1 deletion lib/Controller/PollApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(
string $appName,
IRequest $request,
private Acl $acl,
private PollService $pollService
private PollService $pollService,
) {
parent::__construct($appName, $request);
}
Expand Down
2 changes: 1 addition & 1 deletion 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
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
2 changes: 1 addition & 1 deletion 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 Down
2 changes: 1 addition & 1 deletion 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 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
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
14 changes: 7 additions & 7 deletions lib/Db/PollMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,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 @@ -234,19 +234,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 @@ -274,7 +274,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 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 $entityClass = null
?string $entityClass = null,
) {
parent::__construct($db, $tableName, $entityClass);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Db/TableManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function purgeTables(): array {
->setParameter('appid', AppConstants::APP_ID)
->executeStatement();

$this->logger->info('Removed all app config records from '. $this->dbPrefix . 'appconfig');
$this->logger->info('Removed all app config records from ' . $this->dbPrefix . 'appconfig');
$messages[] = 'Removed all app config records from ' . $this->dbPrefix . 'appconfig';
$messages[] = 'Done.';
$messages[] = '';
Expand Down Expand Up @@ -273,7 +273,7 @@ public function deleteAllDuplicates(?IOutput $output = null): array {
$count = $this->deleteDuplicates($tableName, $index['columns']);

if ($count) {
$messages[] = 'Removed '. $count. ' duplicate records from ' . $this->dbPrefix . $tableName;
$messages[] = 'Removed ' . $count . ' duplicate records from ' . $this->dbPrefix . $tableName;
$this->logger->info(end($messages));
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Db/VoteMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function deleteByPollAndUserId(int $pollId, string $userId): void {
$qb->executeStatement();
}

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())
->set('user_id', $query->createNamedParameter($replacementId))
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/CommentAddEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class CommentAddEvent extends CommentEvent {
public function __construct(
protected Comment $comment
protected Comment $comment,
) {
parent::__construct($comment);
$this->eventId = self::ADD;
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/CommentDeleteEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class CommentDeleteEvent extends CommentEvent {
public function __construct(
protected Comment $comment
protected Comment $comment,
) {
parent::__construct($comment);
$this->log = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/OptionConfirmedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class OptionConfirmedEvent extends OptionEvent {
public function __construct(
protected Option $option
protected Option $option,
) {
parent::__construct($option);
$this->eventId = self::CONFIRM;
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/OptionDeletedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class OptionDeletedEvent extends OptionEvent {
public function __construct(
protected Option $option
protected Option $option,
) {
parent::__construct($option);
$this->eventId = $option->getDeleted() ? self::DELETE : self::RESTORE;
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/OptionUnconfirmedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class OptionUnconfirmedEvent extends OptionEvent {
public function __construct(
protected Option $option
protected Option $option,
) {
parent::__construct($option);
$this->eventId = self::UNCONFIRM;
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/OptionUpdatedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class OptionUpdatedEvent extends OptionEvent {
public function __construct(
protected Option $option
protected Option $option,
) {
parent::__construct($option);
$this->eventId = self::UPDATE;
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/PollArchivedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class PollArchivedEvent extends PollEvent {
public function __construct(
protected Poll $poll
protected Poll $poll,
) {
parent::__construct($poll);
$this->eventId = self::DELETE;
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/PollCreatedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class PollCreatedEvent extends PollEvent {
public function __construct(
protected Poll $poll
protected Poll $poll,
) {
parent::__construct($poll);
$this->eventId = self::ADD;
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/PollDeletedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class PollDeletedEvent extends PollEvent {
public function __construct(
protected Poll $poll
protected Poll $poll,
) {
parent::__construct($poll);
$this->eventId = self::DELETE;
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/PollEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract class PollEvent extends BaseEvent {
public const OPTION_REORDER = 'poll_option_reorder';

public function __construct(
protected Poll $poll
protected Poll $poll,
) {
parent::__construct($poll);
$this->activityObjectType = 'poll';
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/PollExpiredEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class PollExpiredEvent extends PollEvent {
* @psalm-suppress PossiblyUnusedMethod
*/
public function __construct(
protected Poll $poll
protected Poll $poll,
) {
parent::__construct($poll);
$this->eventId = self::EXPIRE;
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/PollOptionReorderedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class PollOptionReorderedEvent extends PollEvent {
public function __construct(
protected Poll $poll
protected Poll $poll,
) {
parent::__construct($poll);
$this->log = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/PollOwnerChangeEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class PollOwnerChangeEvent extends PollEvent {
public function __construct(
protected Poll $poll
protected Poll $poll,
) {
parent::__construct($poll);
$this->eventId = self::OWNER_CHANGE;
Expand Down
2 changes: 1 addition & 1 deletion lib/Event/PollRestoredEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class PollRestoredEvent extends PollEvent {
public function __construct(
protected Poll $poll
protected Poll $poll,
) {
parent::__construct($poll);
$this->eventId = self::RESTORE;
Expand Down
Loading

0 comments on commit 45be7ad

Please sign in to comment.