Skip to content

Commit fc05617

Browse files
committed
Bump to PHP 8.3
1 parent 2c36391 commit fc05617

File tree

52 files changed

+690
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+690
-103
lines changed

.gitlab-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ stages:
1616
- scan
1717

1818
variables:
19-
default_php_image: registry.gitlab.com/minds/engine/php:8.2
19+
default_php_image: registry.gitlab.com/minds/engine/php:8.3
2020

2121
baseimage:prepare:
2222
stage: baseimage
@@ -31,7 +31,7 @@ baseimage:prepare:
3131
rules:
3232
- if: '$CI_COMMIT_REF_NAME == "master"'
3333
when: never
34-
- if: '$CI_COMMIT_REF_NAME != "master"'
34+
- if: '$CI_COMMIT_REF_NAME != "master" && $CI_PIPELINE_SOURCE == "push"'
3535
changes:
3636
- containers/php/*
3737
when: manual
@@ -46,7 +46,7 @@ baseimage:deploy:
4646
- /kaniko/executor
4747
--context "${CI_PROJECT_DIR}/containers/php"
4848
--dockerfile "${CI_PROJECT_DIR}/containers/php/Dockerfile"
49-
--destination "${CI_REGISTRY_IMAGE}/php:8.2"
49+
--destination "${CI_REGISTRY_IMAGE}/php:8.3"
5050
rules:
5151
- if: '$CI_COMMIT_REF_NAME == "master"'
5252
changes:

Controllers/Cli/Email.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public function bulkSendUnreadMessageEmailAcrossTenants(): void
368368
if ($includeMinds) {
369369
try {
370370
$this->unreadMessagesDispatcher->dispatchForTenant(-1, $createdAfterTimestamp);
371-
} catch(\Exception $e) {
371+
} catch (\Exception $e) {
372372
$this->out("Error sending for tenant_id: -1");
373373
$this->out($e->getMessage());
374374
}
@@ -377,7 +377,7 @@ public function bulkSendUnreadMessageEmailAcrossTenants(): void
377377
foreach ($this->multiTenantDataService->getTenants(limit: 9999999) as $tenant) {
378378
try {
379379
$this->unreadMessagesDispatcher->dispatchForTenant($tenant->id, $createdAfterTimestamp);
380-
} catch(\Exception $e) {
380+
} catch (\Exception $e) {
381381
$this->out("Error sending for tenant_id: $tenant->id");
382382
$this->out($e->getMessage());
383383
}

Controllers/Cli/Search.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function reindex_group_posts()
133133
}
134134
}
135135

136-
} catch(\Exception $e) {
136+
} catch (\Exception $e) {
137137
$this->out("Error reindexing for tenant_id: $tenant->id");
138138
$this->out($e->getMessage());
139139
}

Controllers/Cli/Stripe.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public function sync_membership_webhooks(): void
289289
if ($this->getOpt('sync_site_memberships')) {
290290
Di::_()->get(SiteMembershipsRenewalsService::class)->syncSiteMemberships($tenantId);
291291
}
292-
} catch(\Exception $e) {
292+
} catch (\Exception $e) {
293293
$this->out($e->getMessage());
294294
}
295295
}

Controllers/api/v2/search/suggest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function get($pages)
8787
query: $query,
8888
includeNsfw: $includeNsfw
8989
);
90-
} catch(\Exception $e) {
90+
} catch (\Exception $e) {
9191
$this->logger->error($e);
9292
}
9393
}

Core/Authentication/Oidc/Services/OidcUserService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ public function register(
8686
$this->oidcUserRepository->linkSubToUserGuid($sub, $providerId, (int) $user->getGuid());
8787

8888
try {
89-
if((bool) $this->config->get('tenant_id')) {
89+
if ((bool) $this->config->get('tenant_id')) {
9090
$this->tenantUserWelcomeEmailer
9191
->setUser($user)
9292
->queue($user);
9393
}
94-
} catch(\Exception $e) {
94+
} catch (\Exception $e) {
9595
$this->logger->error($e);
9696
}
9797

Core/Authentication/PersonalApiKeys/Repositories/PersonalApiKeyRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function add(PersonalApiKey $personalApiKey): bool
6363
]);
6464
}
6565
$this->commitTransaction();
66-
} catch(\Exception $e) {
66+
} catch (\Exception $e) {
6767
$this->rollbackTransaction();
6868
throw $e;
6969
}

Core/Blogs/Manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ private function isBlogOwnerImageOwner(Blog $blog, string $entityGuid): bool
297297
}
298298

299299
return true;
300-
} catch(\Exception $e) {
300+
} catch (\Exception $e) {
301301
$this->logger->error($e);
302302
return false;
303303
}

Core/Channels/BannerService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function upload(string $path, User $user): bool
7979
->save(true);
8080

8181
return true;
82-
} catch(\Exception $e) {
82+
} catch (\Exception $e) {
8383
$this->logger->error($e);
8484
return false;
8585
}

Core/Channels/Delegates/Artifacts/ElasticsearchDocumentsDelegate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function delete($userGuid)
137137

138138
try {
139139
$this->elasticsearch->getClient()->delete($params);
140-
} catch(Missing404Exception $e) {
140+
} catch (Missing404Exception $e) {
141141
$this->logger->info($e->getMessage());
142142
}
143143

Core/Chat/Services/RichEmbedService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function parseFromText(
5959
createdTimestamp: new DateTime('now'),
6060
updatedTimestamp: new DateTime('now')
6161
);
62-
} catch(ServerErrorException $e) {
62+
} catch (ServerErrorException $e) {
6363
$this->logger->error($e);
6464
return null;
6565
}

Core/Chat/Services/RoomService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ public function replyToRoomInviteRequest(
665665

666666
$this->roomRepository->commitTransaction();
667667

668-
switch($chatRoomInviteRequestAction) {
668+
switch ($chatRoomInviteRequestAction) {
669669
case ChatRoomInviteRequestActionEnum::ACCEPT:
670670
$this->analyticsDelegate->onChatRequestAccept(
671671
actor: $user,

Core/Email/Confirmation/Controller.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function sendEmail(ServerRequest $request): JsonResponse
7171

7272
try {
7373
$this->manager->requireEmailTwoFactor($user);
74-
} catch(TwoFactorRequiredException $e) {
74+
} catch (TwoFactorRequiredException $e) {
7575
return new JsonResponse([
7676
'status' => 'success',
7777
'key' => $e->getKey()
@@ -106,17 +106,17 @@ public function verifyCode(ServerRequest $request): JsonResponse
106106

107107
try {
108108
$this->manager->authenticateEmailTwoFactor($user, $code);
109-
} catch(TwoFactorInvalidCodeException $e) {
109+
} catch (TwoFactorInvalidCodeException $e) {
110110
throw new EmailConfirmationInvalidCodeException();
111111
}
112112

113113
try {
114-
if((bool) $this->config->get('tenant_id')) {
114+
if ((bool) $this->config->get('tenant_id')) {
115115
$this->tenantUserWelcomeEmailer
116116
->setUser($user)
117117
->queue($user);
118118
}
119-
} catch(\Exception $e) {
119+
} catch (\Exception $e) {
120120
$this->logger->error($e);
121121
}
122122

Core/Email/Repository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function getList(array $options = [])
130130
$key = "$userGuid::$campaign::$topic";
131131

132132
if (!isset($notifications[$key])) {
133-
$notifications[$key] = ( new EmailSubscription())
133+
$notifications[$key] = (new EmailSubscription())
134134
->setCampaign($campaign)
135135
->setTopic($topic)
136136
->setUserGuid($userGuid)

Core/Email/V2/Campaigns/Recurring/Digest/Digest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function build(): ?Message
8181

8282
$trackingQuery = http_build_query($tracking);
8383

84-
if(!$siteName = $this->config->get('site_name')) {
84+
if (!$siteName = $this->config->get('site_name')) {
8585
$siteName = 'Minds';
8686
}
8787

Core/Email/V2/Campaigns/Recurring/ForgotPassword/ForgotPasswordEmailer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function build()
6666

6767
$this->template->setLocale($this->user->getLanguage());
6868

69-
if(!$siteName = $this->config->get('site_name')) {
69+
if (!$siteName = $this->config->get('site_name')) {
7070
$siteName = 'Minds';
7171
}
7272

Core/Email/V2/Campaigns/Recurring/TenantUserWelcome/TenantUserWelcomeEmailer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private function getMembershipPriceLabel(SiteMembership $siteMembership): string
201201
{
202202
$price = $siteMembership->membershipPriceInCents / 100;
203203

204-
switch($siteMembership->membershipPricingModel) {
204+
switch ($siteMembership->membershipPricingModel) {
205205
case SiteMembershipPricingModelEnum::ONE_TIME:
206206
return "$$price / one-time";
207207
case SiteMembershipPricingModelEnum::RECURRING:

Core/Email/V2/Campaigns/Recurring/TwoFactor/TwoFactor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function build()
7070

7171
$translator = $this->template->getTranslator();
7272

73-
if(!$siteName = $this->config->get('site_name')) {
73+
if (!$siteName = $this->config->get('site_name')) {
7474
$siteName = 'Minds';
7575
}
7676

Core/Email/V2/Campaigns/Recurring/UnreadMessages/UnreadMessages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function build(): ?Message
8383

8484
$trackingQuery = http_build_query($tracking);
8585

86-
if(!$siteName = $this->config->get('site_name')) {
86+
if (!$siteName = $this->config->get('site_name')) {
8787
$siteName = 'Minds';
8888
}
8989

Core/Email/V2/Campaigns/Recurring/UnreadMessages/UnreadMessagesDispatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function dispatchForTenant(int $tenantId, int $createdAfterTimestamp): vo
4848

4949
$this->logger->info("Sending for tenant_id: $tenantId ...");
5050

51-
foreach($unreadCountData as $data) {
51+
foreach ($unreadCountData as $data) {
5252
$user = $this->entitiesBuilder->single($data['user_guid']);
5353

5454
if (!$user || !($user instanceof User)) {

Core/Email/V2/Partials/UnreadMessages/UnreadMessagesPartial.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function build()
115115
private function getChatRoomAvatarUrls(
116116
ChatRoomListItem $chatRoomListItem
117117
): array {
118-
if(!$cdnUrl = $this->config->get('cdn_url')) {
118+
if (!$cdnUrl = $this->config->get('cdn_url')) {
119119
$cdnUrl = 'http://www.minds.com/';
120120
}
121121

@@ -170,7 +170,7 @@ private function sortByActiveFirst(array $unreadChatRoomListItems): array
170170
usort($unreadChatRoomListItems, function ($a, $b) use ($sortOrder) {
171171
return $sortOrder[$a->status->name] <=> $sortOrder[$b->status->name];
172172
});
173-
} catch(\Exception $e) {
173+
} catch (\Exception $e) {
174174
$this->logger->error($e);
175175
}
176176

Core/Entities/Actions/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function save(bool $isUpdate = null)
142142
entity: $this->entity,
143143
columns: $this->mutatedAttributes
144144
);
145-
} catch(\InvalidArgumentException $e) {
145+
} catch (\InvalidArgumentException $e) {
146146
$this->logger->warning($e);
147147
$success = false;
148148
}

Core/EventStreams/Topics/ChatNotificationsTopic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function consume(
5959
): void {
6060
$consumer = $this->getConsumer($subscriptionId);
6161

62-
while(true) {
62+
while (true) {
6363
$message = $consumer->receive();
6464
try {
6565
$data = json_decode($message->getDataAsString(), true);

Core/Feeds/Activity/Manager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ public function deleteRemindsOfEntityByUser($entity, User $user): bool
487487

488488
if ($reminds) {
489489
// Delete each remind
490-
foreach($reminds as $remind) {
490+
foreach ($reminds as $remind) {
491491
if (!$this->delete($remind)) {
492492
$success = false;
493493
}
@@ -521,7 +521,7 @@ public function countRemindsOfEntityByUser($entity, User $user): int
521521
]);
522522

523523
// Cross-check if entityGuid has been reminded
524-
if($entity->getEntityGuid()) {
524+
if ($entity->getEntityGuid()) {
525525
$count += $this->elasticManager->getCount([
526526
'algorithm' => 'latest',
527527
'type' => 'activity',

Core/Feeds/Elastic/Repository.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,13 @@ public function getList(array $opts = [])
8282
foreach ($opts['pinned_guids'] as $pinned_guid) {
8383
array_unshift($response['hits']['hits'], [
8484
'_type' => 'activity',
85+
'_index' => $this->index,
8586
'_source' => [
8687
'guid' => $pinned_guid,
8788
'owner_guid' => null,
8889
'score' => 0,
8990
'timestamp' => 0,
91+
'@timestamp' => 0,
9092
],
9193
]);
9294
}

Core/Feeds/GraphQL/TagRecommendations/Manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function prepend(
101101
}
102102

103103
return $edges;
104-
} catch(\Exception $e) {
104+
} catch (\Exception $e) {
105105
$this->logger->error($e);
106106
$edges = $unmodifiedEdges; // reset and log error.
107107
return $edges;

Core/Groups/V2/Membership/Manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public function cancelRequest(Group $group, User $user): bool
235235
try {
236236
// TODO: Check if this check is still needed when we remove legacy writes.
237237
$userMembership = $this->repository->get($group->getGuid(), $user->getGuid());
238-
} catch(NotFoundException $e) {
238+
} catch (NotFoundException $e) {
239239
// do nothing.
240240
}
241241

Core/MultiTenant/EventStreams/FeaturedEntitySyncSubscription.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private function syncFeaturedUserAddition(FeaturedUser $featuredUser, int $tenan
122122

123123
$this->featuredEntityAutoSubscribeService->handleFeaturedUser($featuredUser, $user);
124124
$this->logger->info('Handled user: ' . $user->getGuid() . ' for featured user: ' . $featuredUser->entityGuid);
125-
} catch(\Exception $e) {
125+
} catch (\Exception $e) {
126126
$this->logger->error($e);
127127
}
128128
}
@@ -144,7 +144,7 @@ private function syncFeaturedGroupAddition(FeaturedGroup $featuredGroup, int $te
144144
try {
145145
$this->featuredEntityAutoSubscribeService->handleFeaturedGroup($featuredGroup, $user);
146146
$this->logger->info('Handled user: ' . $user->getGuid() . ' for featured group: ' . $featuredGroup->entityGuid);
147-
} catch(\Exception $e) {
147+
} catch (\Exception $e) {
148148
$this->logger->error($e);
149149
}
150150
}

Core/MultiTenant/Services/TenantEmailService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function sendToAllUsers(Tenant $tenant, SenderInterface $emailSender): vo
3333
try {
3434
$emailSender->send($user);
3535
$this->logger->info('Ran for tenant: ' . $tenant?->id. ', user: ' . $user?->getGuid());
36-
} catch(\Exception $e) {
36+
} catch (\Exception $e) {
3737
$this->logger->error($e);
3838
}
3939
}
@@ -66,7 +66,7 @@ public function sendToAllUsersAcrossTenants(SenderInterface $emailSender): bool
6666
*/
6767
private function isEmailDisabled(SenderInterface $emailSender, Tenant $tenant)
6868
{
69-
switch(true) {
69+
switch (true) {
7070
case $emailSender instanceof DigestSender:
7171
return !$tenant->config->digestEmailEnabled;
7272
default:

Core/MultiTenant/Types/Validators/TenantUserInputValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function validate(object $input): void
4040

4141
try {
4242
$this->getUsernameLengthValidator()->validate($input->username);
43-
} catch(StringLengthException $e) {
43+
} catch (StringLengthException $e) {
4444
throw new GraphQLException($e->getMessage(), 400, null, "Validation", ['field' => 'username']);
4545
}
4646

Core/Notifications/NotificationsEventStreamsSubscription.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public function consume(EventInterface $event): bool
240240
$notifications,
241241
$this->buildGroupQueueReceivedNotifications($event)
242242
);
243-
} catch(\Exception $e) {
243+
} catch (\Exception $e) {
244244
$this->logger->error($e);
245245
return false;
246246
}

Core/Notifications/PostSubscriptions/Helpers/PostNotificationDispatchHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private function canDispatchForGroupContainer(PostSubscription $postSubscription
7474
if (!$membership->isMember()) {
7575
return false;
7676
}
77-
} catch(NotFoundException $e) {
77+
} catch (NotFoundException $e) {
7878
$this->logger->info("Skipping for user {$postSubscription->userGuid} as they are not a member of this group");
7979
return false;
8080
}

Core/Notifications/Push/ManualSend/Services/ManualSendService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(
3131
*/
3232
public function send(ManualSendRequest $request): bool
3333
{
34-
switch($request->platform) {
34+
switch ($request->platform) {
3535
case PushNotificationPlatformEnum::ANDROID:
3636
return $this->sendFcmRequest($request);
3737
break;

0 commit comments

Comments
 (0)