Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): Bump nextcloud/coding-standard from 1.2.1 to 1.2.3 #2016

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function markProcessed(INotification $notification): void {
}
foreach ($deleted as $user => $notifications) {
foreach ($notifications as $data) {
$this->push->pushDeleteToDevice((string) $user, [$data['id']], $data['app']);
$this->push->pushDeleteToDevice((string)$user, [$data['id']], $data['app']);
}
}
if (!$isAlreadyDeferring) {
Expand Down
2 changes: 1 addition & 1 deletion lib/BackgroundJob/GenerateUserSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function run($argument): void {
->setMaxResults(1);

$result = $query->executeQuery();
$maxId = (int) $result->fetchOne();
$maxId = (int)$result->fetchOne();
$result->closeCursor();

$this->userManager->callForSeenUsers(function (IUser $user) use ($maxId) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Command/Generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$subjectTitle = 'cli';
} else {
$subject = (int) $subject;
$subject = (int)$subject;
$subjectTitle = 'dummy';
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/APIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,6 @@ public function generateNotificationV3(
return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
}

return new DataResponse(['id' => (int) $this->notificationApp->getLastInsertedId()]);
return new DataResponse(['id' => (int)$this->notificationApp->getLastInsertedId()]);
}
}
4 changes: 2 additions & 2 deletions lib/Controller/EndpointController.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function confirmIdsForUser(string $apiVersion, array $ids): DataResponse
}

$ids = array_unique(array_filter(array_map(
static fn ($id) => is_numeric($id) ? (int) $id : 0,
static fn ($id) => is_numeric($id) ? (int)$id : 0,
$ids
)));

Expand Down Expand Up @@ -333,6 +333,6 @@ protected function getCurrentUser(): string {
$user = $user->getUID();
}

return (string) $user;
return (string)$user;
}
}
2 changes: 1 addition & 1 deletion lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function personal(int $batchSetting, string $soundNotification, string $s
*/
#[OpenAPI(scope: OpenAPI::SCOPE_ADMINISTRATION)]
public function admin(int $batchSetting, string $soundNotification, string $soundTalk): DataResponse {
$this->config->setAppValue(Application::APP_ID, 'setting_batchtime', (string) $batchSetting);
$this->config->setAppValue(Application::APP_ID, 'setting_batchtime', (string)$batchSetting);
$this->config->setAppValue(Application::APP_ID, 'sound_notification', $soundNotification !== 'no' ? 'yes' : 'no');
$this->config->setAppValue(Application::APP_ID, 'sound_talk', $soundTalk !== 'no' ? 'yes' : 'no');

Expand Down
18 changes: 9 additions & 9 deletions lib/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function count(INotification $notification): int {
$this->sqlWhere($sql, $notification);

$statement = $sql->executeQuery();
$count = (int) $statement->fetchOne();
$count = (int)$statement->fetchOne();
$statement->closeCursor();

return $count;
Expand Down Expand Up @@ -87,10 +87,10 @@ public function delete(INotification $notification): array {
}

$deleted[$row['user']][] = [
'id' => (int) $row['notification_id'],
'id' => (int)$row['notification_id'],
'app' => $row['app'],
];
$notifications[(int) $row['notification_id']] = $this->notificationFromRow($row);
$notifications[(int)$row['notification_id']] = $this->notificationFromRow($row);
}
$statement->closeCursor();

Expand Down Expand Up @@ -159,7 +159,7 @@ public function deleteById(int $id, string $user, ?INotification $notification =
$sql->delete('notifications')
->where($sql->expr()->eq('notification_id', $sql->createNamedParameter($id)))
->andWhere($sql->expr()->eq('user', $sql->createNamedParameter($user)));
return (bool) $sql->executeStatement();
return (bool)$sql->executeStatement();
}

/**
Expand Down Expand Up @@ -220,7 +220,7 @@ public function confirmIdsForUser(string $user, array $ids): array {

$existing = [];
while ($row = $result->fetch()) {
$existing[] = (int) $row['notification_id'];
$existing[] = (int)$row['notification_id'];
}
$result->closeCursor();

Expand Down Expand Up @@ -366,17 +366,17 @@ protected function sqlInsert(IQueryBuilder $sql, INotification $notification) {
*/
protected function notificationFromRow(array $row): INotification {
$dateTime = new \DateTime();
$dateTime->setTimestamp((int) $row['timestamp']);
$dateTime->setTimestamp((int)$row['timestamp']);

$notification = $this->manager->createNotification();
$notification->setApp($row['app'])
->setUser($row['user'])
->setDateTime($dateTime)
->setObject($row['object_type'], $row['object_id'])
->setSubject($row['subject'], (array) json_decode($row['subject_parameters'], true));
->setSubject($row['subject'], (array)json_decode($row['subject_parameters'], true));

if ($row['message'] !== '' && $row['message'] !== null) {
$notification->setMessage($row['message'], (array) json_decode($row['message_parameters'], true));
$notification->setMessage($row['message'], (array)json_decode($row['message_parameters'], true));
}
if ($row['link'] !== '' && $row['link'] !== null) {
$notification->setLink($row['link']);
Expand All @@ -385,7 +385,7 @@ protected function notificationFromRow(array $row): INotification {
$notification->setIcon($row['icon']);
}

$actions = (array) json_decode($row['actions'], true);
$actions = (array)json_decode($row['actions'], true);
foreach ($actions as $actionData) {
$action = $notification->createAction();
$action->setLabel($actionData['label'])
Expand Down
2 changes: 1 addition & 1 deletion lib/Listener/PostLoginListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function handle(Event $event): void {
} catch (DoesNotExistException $e) {
$defaultSoundNotification = $this->config->getAppValue(Application::APP_ID, 'sound_notification') === 'yes' ? 'yes' : 'no';
$defaultSoundTalk = $this->config->getAppValue(Application::APP_ID, 'sound_talk') === 'yes' ? 'yes' : 'no';
$defaultBatchtime = (int) $this->config->getAppValue(Application::APP_ID, 'setting_batchtime');
$defaultBatchtime = (int)$this->config->getAppValue(Application::APP_ID, 'setting_batchtime');

if ($defaultBatchtime !== Settings::EMAIL_SEND_WEEKLY
&& $defaultBatchtime !== Settings::EMAIL_SEND_DAILY
Expand Down
2 changes: 1 addition & 1 deletion lib/Listener/UserCreatedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function handle(Event $event): void {

$defaultSoundNotification = $this->config->getAppValue(Application::APP_ID, 'sound_notification') === 'yes' ? 'yes' : 'no';
$defaultSoundTalk = $this->config->getAppValue(Application::APP_ID, 'sound_talk') === 'yes' ? 'yes' : 'no';
$defaultBatchtime = (int) $this->config->getAppValue(Application::APP_ID, 'setting_batchtime');
$defaultBatchtime = (int)$this->config->getAppValue(Application::APP_ID, 'setting_batchtime');

if ($defaultBatchtime !== Settings::EMAIL_SEND_WEEKLY
&& $defaultBatchtime !== Settings::EMAIL_SEND_DAILY
Expand Down
2 changes: 1 addition & 1 deletion lib/Migration/Version2010Date20210218082811.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array
while ($row = $result->fetch()) {
$insert
->setParameter('uid', $row['uid'])
->setParameter('token', (int) $row['token'], IQueryBuilder::PARAM_INT)
->setParameter('token', (int)$row['token'], IQueryBuilder::PARAM_INT)
->setParameter('deviceidentifier', $row['deviceidentifier'])
->setParameter('devicepublickey', $row['devicepublickey'])
->setParameter('devicepublickeyhash', $row['devicepublickeyhash'])
Expand Down
8 changes: 4 additions & 4 deletions lib/Model/SettingsMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ public function getUsersByNextSendTime(int $limit): array {
public function createSettingsFromRow(array $row): Settings {
return $this->mapRowToEntity([
'id' => $row['id'],
'user_id' => (string) $row['user_id'],
'batch_time' => (int) $row['batch_time'],
'last_send_id' => (int) $row['last_send_id'],
'next_send_time' => (int) $row['next_send_time'],
'user_id' => (string)$row['user_id'],
'batch_time' => (int)$row['batch_time'],
'last_send_id' => (int)$row['last_send_id'],
'next_send_time' => (int)$row['next_send_time'],
]);
}
}
2 changes: 1 addition & 1 deletion lib/Notifier/AdminNotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function prepare(INotification $notification, string $languageCode): INot
switch ($notification->getSubject()) {
case 'dummy':
$subjectParams = $notification->getSubjectParameters();
$numActions = (int) $subjectParams[0];
$numActions = (int)$subjectParams[0];

$user = $this->userManager->get($notification->getUser());
assert($user instanceof IUser);
Expand Down
14 changes: 7 additions & 7 deletions lib/Push.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function flushPayloads(): void {

if (!empty($this->deleteAllsToPush)) {
foreach ($this->deleteAllsToPush as $userId => $bool) {
$this->pushDeleteToDevice((string) $userId, null);
$this->pushDeleteToDevice((string)$userId, null);
}
$this->deleteAllsToPush = [];
}
Expand All @@ -190,10 +190,10 @@ public function flushPayloads(): void {
foreach ($this->deletesToPush as $userId => $data) {
foreach ($data as $client => $notificationIds) {
if ($client === 'talk') {
$this->pushDeleteToDevice((string) $userId, $notificationIds, $client);
$this->pushDeleteToDevice((string)$userId, $notificationIds, $client);
} else {
foreach ($notificationIds as $notificationId) {
$this->pushDeleteToDevice((string) $userId, [$notificationId], $client);
$this->pushDeleteToDevice((string)$userId, [$notificationId], $client);
}
}
}
Expand Down Expand Up @@ -318,7 +318,7 @@ public function pushToDevice(int $id, INotification $notification, ?OutputInterf
$maxAge = time() - 60 * 24 * 60 * 60;

foreach ($devices as $device) {
$device['token'] = (int) $device['token'];
$device['token'] = (int)$device['token'];
$this->printInfo('');
$this->printInfo('Device token:' . $device['token']);

Expand Down Expand Up @@ -411,7 +411,7 @@ public function pushDeleteToDevice(string $userId, ?array $notificationIds, stri

$userKey = $this->keyManager->getKey($user);
foreach ($devices as $device) {
$device['token'] = (int) $device['token'];
$device['token'] = (int)$device['token'];
if (!$this->validateToken($device['token'], $maxAge)) {
// Token does not exist anymore
continue;
Expand Down Expand Up @@ -488,7 +488,7 @@ protected function sendNotificationsToProxies(): void {

$response = $client->post($proxyServer . '/notifications', $requestData);
$status = $response->getStatusCode();
$body = (string) $response->getBody();
$body = (string)$response->getBody();
try {
$bodyData = json_decode($body, true);
} catch (\JsonException $e) {
Expand Down Expand Up @@ -544,7 +544,7 @@ protected function sendNotificationsToProxies(): void {
}
} elseif ($status !== Http::STATUS_OK) {
if ($status === Http::STATUS_TOO_MANY_REQUESTS) {
$this->config->setAppValue(Application::APP_ID, 'rate_limit_reached', (string) $this->timeFactory->getTime());
$this->config->setAppValue(Application::APP_ID, 'rate_limit_reached', (string)$this->timeFactory->getTime());
}
$error = $body && $bodyData === null ? $body : 'no reason given';
$this->printInfo('Could not send notification to push server [' . $proxyServer . ']: ' . $error);
Expand Down
6 changes: 3 additions & 3 deletions lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function getForm(): TemplateResponse {

$defaultSoundNotification = $this->config->getAppValue(Application::APP_ID, 'sound_notification') === 'yes' ? 'yes' : 'no';
$defaultSoundTalk = $this->config->getAppValue(Application::APP_ID, 'sound_talk') === 'yes' ? 'yes' : 'no';
$defaultBatchtime = (int) $this->config->getAppValue(Application::APP_ID, 'setting_batchtime');
$defaultBatchtime = (int)$this->config->getAppValue(Application::APP_ID, 'setting_batchtime');

if ($defaultBatchtime !== Settings::EMAIL_SEND_WEEKLY
&& $defaultBatchtime !== Settings::EMAIL_SEND_DAILY
Expand Down Expand Up @@ -59,8 +59,8 @@ public function getSection(): string {

/**
* @return int whether the form should be rather on the top or bottom of
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/Settings/AdminSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function getName(): string {

/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*
* E.g.: 70
* @since 9.1
Expand Down
4 changes: 2 additions & 2 deletions lib/Settings/Personal.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ public function getSection(): string {

/**
* @return int whether the form should be rather on the top or bottom of
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/Settings/PersonalSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public function getName(): string {

/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*
* E.g.: 70
* @since 9.1
Expand Down
2 changes: 1 addition & 1 deletion lib/Settings/SetupWarningOnRateLimitReached.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getName(): string {
* @inheritDoc
*/
public function run(): SetupResult {
$lastReached = (int) $this->config->getAppValue(Application::APP_ID, 'rate_limit_reached', '0');
$lastReached = (int)$this->config->getAppValue(Application::APP_ID, 'rate_limit_reached', '0');
if ($lastReached < ($this->timeFactory->getTime() - 7 * 24 * 3600)) {
return SetupResult::success();
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ public function checkResponseBodyIsEmpty() {
*/
public function checkNumNotifications(int $numNotifications) {
$notifications = $this->getArrayOfNotificationsResponded($this->response);
Assert::assertCount((int) $numNotifications, $notifications);
Assert::assertCount((int)$numNotifications, $notifications);

$notificationIds = [];
foreach ($notifications as $notification) {
$notificationIds[] = (int) $notification['notification_id'];
$notificationIds[] = (int)$notification['notification_id'];
}

$this->notificationIds[] = $notificationIds;
Expand Down Expand Up @@ -182,7 +182,7 @@ public function userNumNotifications(string $user, int $numNotifications, string
$previousNotificationIds = end($this->notificationIds);
}

$this->checkNumNotifications((int) $numNotifications);
$this->checkNumNotifications((int)$numNotifications);

if ($missingLast) {
$now = end($this->notificationIds);
Expand Down
Loading