Skip to content

Commit 73a309f

Browse files
committed
Internal: Fix psalm error in mail settings migration
1 parent 2ef3fcc commit 73a309f

File tree

2 files changed

+47
-11
lines changed

2 files changed

+47
-11
lines changed

src/CoreBundle/Migrations/Schema/V200/Version20250707212800.php

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,31 @@ private function migrateMailConf(string $oldMailConfPath): array
3434
return [];
3535
}
3636

37-
include $oldMailConfPath;
37+
/** @var array{
38+
* SMTP_USER?: string,
39+
* SMTP_PASS?: string,
40+
* SMTP_HOST?: string,
41+
* SMTP_PORT?: string,
42+
* EXCLUDE_JSON?: bool,
43+
* DKIM?: bool,
44+
* DKIM_SELECTOR?: string,
45+
* DKIM_DOMAIN?: string,
46+
* DKIM_PRIVATE_KEY_STRING?: string,
47+
* DKIM_PRIVATE_KEY?: string,
48+
* DKIM_PASSPHRASE?: string,
49+
* XOAUTH2_METHOD?: bool,
50+
* XOAUTH2_URL_AUTHORIZE?: string,
51+
* XOAUTH2_URL_ACCES_TOKEN?: string,
52+
* XOAUTH2_URL_RESOURCE_OWNER_DETAILS?: string,
53+
* XOAUTH2_SCOPES?: string,
54+
* XOAUTH2_CLIENT_ID?: string,
55+
* XOAUTH2_CLIENT_SECRET?: string,
56+
* XOAUTH2_REFRESH_TOKEN?: string,
57+
* } $platform_email
58+
*/
59+
$platform_email = [];
3860

39-
global $platform_email;
61+
include $oldMailConfPath;
4062

4163
$mailerScheme = 'null';
4264
$smtpSecure = $platform_email['SMTP_SECURE'] ?? '';

src/CoreBundle/Migrations/Schema/V200/Version20250721200725.php

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ public function up(Schema $schema): void
1818
$updateRootPath = $this->getUpdateRootPath();
1919
$oldMailConfPath = $updateRootPath.'/app/config/mail.conf.php';
2020

21-
$legacyMailConfig = file_exists($oldMailConfPath);
22-
23-
if ($legacyMailConfig) {
24-
include $oldMailConfPath;
25-
26-
global $platform_email;
27-
}
28-
2921
$envFile = $projectDir.'/.env';
3022

3123
$dotenv = new Dotenv();
@@ -67,7 +59,29 @@ public function up(Schema $schema): void
6759
$settings['mailer_debug_enable'] = !empty($_ENV['SMTP_DEBUG']) ? 'true' : 'false';
6860
}
6961

70-
if ($legacyMailConfig) {
62+
if (file_exists($oldMailConfPath)) {
63+
/** @var array{
64+
* EXCLUDE_JSON?: bool,
65+
* DKIM?: bool,
66+
* DKIM_SELECTOR?: string,
67+
* DKIM_DOMAIN?: string,
68+
* DKIM_PRIVATE_KEY_STRING?: string,
69+
* DKIM_PRIVATE_KEY?: string,
70+
* DKIM_PASSPHRASE?: string,
71+
* XOAUTH2_METHOD?: bool,
72+
* XOAUTH2_URL_AUTHORIZE?: string,
73+
* XOAUTH2_URL_ACCES_TOKEN?: string,
74+
* XOAUTH2_URL_RESOURCE_OWNER_DETAILS?: string,
75+
* XOAUTH2_SCOPES?: string,
76+
* XOAUTH2_CLIENT_ID?: string,
77+
* XOAUTH2_CLIENT_SECRET?: string,
78+
* XOAUTH2_REFRESH_TOKEN?: string,
79+
* } $platform_email
80+
*/
81+
$platform_email = [];
82+
83+
include $oldMailConfPath;
84+
7185
$settings['mailer_exclude_json'] = $platform_email['EXCLUDE_JSON'] ?? false;
7286

7387
$dkim = [

0 commit comments

Comments
 (0)