From 43e5ae1b4e0b6bcd03040aff1f4e1196b85eaf2c Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Mon, 29 Jan 2024 17:32:25 -0500 Subject: [PATCH 1/5] Upgrade to yiisoft/yii2-symfonymailer:^4 --- composer.json | 2 +- composer.lock | 126 +++++++++++++++------------- src/helpers/MailerHelper.php | 4 +- src/mail/Message.php | 3 +- src/mail/transportadapters/Smtp.php | 6 +- 5 files changed, 76 insertions(+), 65 deletions(-) diff --git a/composer.json b/composer.json index 2b93468ab46..9db53a676b2 100644 --- a/composer.json +++ b/composer.json @@ -64,7 +64,7 @@ "yiisoft/yii2": "~2.0.48.1", "yiisoft/yii2-debug": "~2.1.22.0", "yiisoft/yii2-queue": "~2.3.2", - "yiisoft/yii2-symfonymailer": "^2.0.0" + "yiisoft/yii2-symfonymailer": "^4.0.0" }, "require-dev": { "codeception/codeception": "^5.0.11", diff --git a/composer.lock b/composer.lock index d4c27a4e19c..241f0e422bb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c5d8e3e0d892dd738f5453bdcc40b21c", + "content-hash": "4f678f338eaaea7283729a78f4b9a7e6", "packages": [ { "name": "bacon/bacon-qr-code", @@ -1639,16 +1639,16 @@ }, { "name": "moneyphp/money", - "version": "v4.3.0", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/moneyphp/money.git", - "reference": "50ddfd15b2be01d4bed3bcb0c975a6af5f78a183" + "reference": "5e60aebf09f709dd4ea16bf85e66d65301c0d172" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/moneyphp/money/zipball/50ddfd15b2be01d4bed3bcb0c975a6af5f78a183", - "reference": "50ddfd15b2be01d4bed3bcb0c975a6af5f78a183", + "url": "https://api.github.com/repos/moneyphp/money/zipball/5e60aebf09f709dd4ea16bf85e66d65301c0d172", + "reference": "5e60aebf09f709dd4ea16bf85e66d65301c0d172", "shasum": "" }, "require": { @@ -1672,7 +1672,7 @@ "phpbench/phpbench": "^1.2.5", "phpunit/phpunit": "^9.5.4", "psalm/plugin-phpunit": "^0.18.4", - "psr/cache": "^1.0.1", + "psr/cache": "^1.0.1 || ^2.0 || ^3.0", "vimeo/psalm": "~5.15.0" }, "suggest": { @@ -1721,9 +1721,9 @@ ], "support": { "issues": "https://github.com/moneyphp/money/issues", - "source": "https://github.com/moneyphp/money/tree/v4.3.0" + "source": "https://github.com/moneyphp/money/tree/v4.4.0" }, - "time": "2023-11-22T09:46:30+00:00" + "time": "2024-01-24T08:29:16+00:00" }, { "name": "monolog/monolog", @@ -2055,16 +2055,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.7.3", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419" + "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", - "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fad452781b3d774e3337b0c0b245dd8e5a4455fc", + "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc", "shasum": "" }, "require": { @@ -2107,9 +2107,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.3" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.0" }, - "time": "2023-08-12T11:01:26+00:00" + "time": "2024-01-11T11:49:22+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -6373,31 +6373,41 @@ }, { "name": "yiisoft/yii2-symfonymailer", - "version": "2.0.4", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/yiisoft/yii2-symfonymailer.git", - "reference": "82f5902551a160633c4734b5096977ce76a809d9" + "reference": "21f407239c51fc6d50d369e4469d006afa8c9b2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-symfonymailer/zipball/82f5902551a160633c4734b5096977ce76a809d9", - "reference": "82f5902551a160633c4734b5096977ce76a809d9", + "url": "https://api.github.com/repos/yiisoft/yii2-symfonymailer/zipball/21f407239c51fc6d50d369e4469d006afa8c9b2c", + "reference": "21f407239c51fc6d50d369e4469d006afa8c9b2c", "shasum": "" }, "require": { - "php": ">=7.4.0", - "symfony/mailer": ">=5.4.0", + "php": ">=8.1", + "psr/event-dispatcher": "1.0.0", + "symfony/mailer": "^6.4 || ^7.0", + "symfony/mime": "^6.4 || ^7.0", "yiisoft/yii2": ">=2.0.4" }, "require-dev": { - "phpunit/phpunit": "9.5.10" + "maglnet/composer-require-checker": "^4.7", + "phpunit/phpunit": "^10.5", + "roave/infection-static-analysis-plugin": "^1.34", + "symplify/easy-coding-standard": "^12.1", + "vimeo/psalm": "^5.20" + }, + "suggest": { + "yiisoft/yii2-psr-log-source": "Allows routing transport logs to your Yii2 logger" }, "type": "yii2-extension", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" - } + "dev-master": "3.0.x-dev" + }, + "sort-packages": true }, "autoload": { "psr-4": { @@ -6444,7 +6454,7 @@ "type": "tidelift" } ], - "time": "2022-09-04T10:48:21+00:00" + "time": "2024-01-29T14:13:45+00:00" } ], "packages-dev": [ @@ -6742,16 +6752,16 @@ }, { "name": "codeception/lib-web", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/Codeception/lib-web.git", - "reference": "28cb2ed1169de18e720bec758015aadc37d8344c" + "reference": "cea9d53c9cd665498632acc417c9a96bff7eb2b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/lib-web/zipball/28cb2ed1169de18e720bec758015aadc37d8344c", - "reference": "28cb2ed1169de18e720bec758015aadc37d8344c", + "url": "https://api.github.com/repos/Codeception/lib-web/zipball/cea9d53c9cd665498632acc417c9a96bff7eb2b0", + "reference": "cea9d53c9cd665498632acc417c9a96bff7eb2b0", "shasum": "" }, "require": { @@ -6789,9 +6799,9 @@ ], "support": { "issues": "https://github.com/Codeception/lib-web/issues", - "source": "https://github.com/Codeception/lib-web/tree/1.0.4" + "source": "https://github.com/Codeception/lib-web/tree/1.0.5" }, - "time": "2023-12-01T11:38:22+00:00" + "time": "2024-01-13T11:54:18+00:00" }, { "name": "codeception/lib-xml", @@ -7073,16 +7083,16 @@ }, { "name": "codeception/module-yii2", - "version": "1.1.9", + "version": "1.1.10", "source": { "type": "git", "url": "https://github.com/Codeception/module-yii2.git", - "reference": "70ad7544fc256363acd082b4ef9e7220a18017a0" + "reference": "2971f1fb44cd3088f7ecbe78bc51161c037a6551" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/module-yii2/zipball/70ad7544fc256363acd082b4ef9e7220a18017a0", - "reference": "70ad7544fc256363acd082b4ef9e7220a18017a0", + "url": "https://api.github.com/repos/Codeception/module-yii2/zipball/2971f1fb44cd3088f7ecbe78bc51161c037a6551", + "reference": "2971f1fb44cd3088f7ecbe78bc51161c037a6551", "shasum": "" }, "require": { @@ -7127,9 +7137,9 @@ ], "support": { "issues": "https://github.com/Codeception/module-yii2/issues", - "source": "https://github.com/Codeception/module-yii2/tree/1.1.9" + "source": "https://github.com/Codeception/module-yii2/tree/1.1.10" }, - "time": "2023-06-16T03:48:50+00:00" + "time": "2023-12-04T09:18:47+00:00" }, { "name": "codeception/stub", @@ -7671,25 +7681,27 @@ }, { "name": "nikic/php-parser", - "version": "v4.18.0", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999" + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999", - "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc", + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -7697,7 +7709,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -7721,9 +7733,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0" }, - "time": "2023-12-10T21:03:43+00:00" + "time": "2024-01-07T17:17:35+00:00" }, { "name": "phar-io/manifest", @@ -7913,16 +7925,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.56", + "version": "1.10.57", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "27816a01aea996191ee14d010f325434c0ee76fa" + "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/27816a01aea996191ee14d010f325434c0ee76fa", - "reference": "27816a01aea996191ee14d010f325434c0ee76fa", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e", + "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e", "shasum": "" }, "require": { @@ -7971,7 +7983,7 @@ "type": "tidelift" } ], - "time": "2024-01-15T10:43:00+00:00" + "time": "2024-01-24T11:51:34+00:00" }, { "name": "phpunit/php-code-coverage", @@ -8296,16 +8308,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.5", + "version": "10.5.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ed21115d505b4b4f7dc7b5651464e19a2c7f7856" + "reference": "0bd663704f0165c9e76fe4f06ffa6a1ca727fdbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ed21115d505b4b4f7dc7b5651464e19a2c7f7856", - "reference": "ed21115d505b4b4f7dc7b5651464e19a2c7f7856", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0bd663704f0165c9e76fe4f06ffa6a1ca727fdbe", + "reference": "0bd663704f0165c9e76fe4f06ffa6a1ca727fdbe", "shasum": "" }, "require": { @@ -8377,7 +8389,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.5" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.9" }, "funding": [ { @@ -8393,7 +8405,7 @@ "type": "tidelift" } ], - "time": "2023-12-27T15:13:52+00:00" + "time": "2024-01-22T14:35:40+00:00" }, { "name": "psy/psysh", @@ -10271,5 +10283,5 @@ "platform-overrides": { "php": "8.2" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/src/helpers/MailerHelper.php b/src/helpers/MailerHelper.php index 527711735fd..a0edc8b6ba6 100644 --- a/src/helpers/MailerHelper.php +++ b/src/helpers/MailerHelper.php @@ -134,12 +134,12 @@ public static function normalizeEmails(mixed $emails): array */ public static function settingsReport(Mailer $mailer, ?TransportAdapterInterface $transportAdapter = null): string { - $transport = $mailer->getTransport(); + $transportType = $transportAdapter ? get_class($transportAdapter) : App::mailSettings()->transportType; $settings = [ Craft::t('app', 'From') => self::_emailList($mailer->from), Craft::t('app', 'Reply To') => self::_emailList($mailer->replyTo), Craft::t('app', 'Template') => $mailer->template, - Craft::t('app', 'Transport Type') => get_class($transport), + Craft::t('app', 'Transport Type') => $transportType, ]; $transportSettings = []; diff --git a/src/mail/Message.php b/src/mail/Message.php index af797ac025e..f3a582548ae 100644 --- a/src/mail/Message.php +++ b/src/mail/Message.php @@ -46,9 +46,8 @@ class Message extends \yii\symfonymailer\Message * user model(s). You may pass an array of addresses if this message is from * multiple people. You may also specify sender name in addition to email * address using format: `[email => name]`. - * @return self self reference */ - public function setFrom($from): self + public function setFrom($from): static { parent::setFrom(MailerHelper::normalizeEmails($from)); return $this; diff --git a/src/mail/transportadapters/Smtp.php b/src/mail/transportadapters/Smtp.php index 82745edb771..11dd25eca58 100644 --- a/src/mail/transportadapters/Smtp.php +++ b/src/mail/transportadapters/Smtp.php @@ -34,9 +34,9 @@ public static function displayName(): string public ?string $host = null; /** - * @var string|null The port that should be used + * @var int|string|null The port that should be used */ - public ?string $port = null; + public int|string|null $port = null; /** * @var bool|string|null Whether to use authentication @@ -149,7 +149,7 @@ public function defineTransport(): array|AbstractTransport $config = [ 'scheme' => 'smtp', 'host' => App::parseEnv($this->host), - 'port' => App::parseEnv($this->port) ?: 0, + 'port' => (int) App::parseEnv($this->port) ?: 0, ]; if (App::parseBooleanEnv($this->useAuthentication) ?? false) { From c6a7165bc5d4761165b2ebe32bcb798360200330 Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Tue, 30 Jan 2024 05:48:13 -0500 Subject: [PATCH 2/5] Pass port as null --- src/mail/transportadapters/Smtp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mail/transportadapters/Smtp.php b/src/mail/transportadapters/Smtp.php index 11dd25eca58..8b0ebb5b051 100644 --- a/src/mail/transportadapters/Smtp.php +++ b/src/mail/transportadapters/Smtp.php @@ -149,7 +149,7 @@ public function defineTransport(): array|AbstractTransport $config = [ 'scheme' => 'smtp', 'host' => App::parseEnv($this->host), - 'port' => (int) App::parseEnv($this->port) ?: 0, + 'port' => $this->port ? (int) App::parseEnv($this->port) : null, ]; if (App::parseBooleanEnv($this->useAuthentication) ?? false) { From af7bb26b30d5cd053d13b2a0f0e979ed76f20460 Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Tue, 30 Jan 2024 09:32:13 -0500 Subject: [PATCH 3/5] Remove deprecated props --- src/mail/transportadapters/Gmail.php | 6 ------ src/mail/transportadapters/Smtp.php | 13 ------------- 2 files changed, 19 deletions(-) diff --git a/src/mail/transportadapters/Gmail.php b/src/mail/transportadapters/Gmail.php index 76b6db5b137..ac551c54666 100644 --- a/src/mail/transportadapters/Gmail.php +++ b/src/mail/transportadapters/Gmail.php @@ -38,12 +38,6 @@ public static function displayName(): string */ public ?string $password = null; - /** - * @var int The timeout duration (in seconds) - * @deprecated in 4.3.7. - */ - public int $timeout = 10; - /** * @inheritdoc */ diff --git a/src/mail/transportadapters/Smtp.php b/src/mail/transportadapters/Smtp.php index 8b0ebb5b051..812cf94c199 100644 --- a/src/mail/transportadapters/Smtp.php +++ b/src/mail/transportadapters/Smtp.php @@ -53,18 +53,6 @@ public static function displayName(): string */ public ?string $password = null; - /** - * @var string|null The encryption method that should be used, if any (ssl or tls) - * @deprecated in 4.3.7. All SMTP requests will use TLS whenever port 465 is used, or the port isn’t specified and OpenSSL is installed. - */ - public ?string $encryptionMethod = null; - - /** - * @var string|int The timeout duration (in seconds) - * @deprecated in 4.3.7. - */ - public string|int $timeout = 10; - /** * @inheritdoc */ @@ -92,7 +80,6 @@ protected function defineBehaviors(): array 'useAuthentication', 'username', 'password', - 'encryptionMethod', ], ], ]; From 8038f1a2ddf1271009329a3de5153fc841b7b1a7 Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Tue, 30 Jan 2024 09:35:19 -0500 Subject: [PATCH 4/5] Changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef06b43263c..3fddd8df4e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Release Notes for Craft CMS 5 +## Unreleased + +- Updated `yiisoft/yii2-symfonymailer` to v4 +- Removed `\craft\mail\transportadapters\Smtp::$encryptionMethod` +- Removed `\craft\mail\transportadapters\Smtp::$timeout` +- Removed `\craft\mail\transportadapters\Gmail::$timeout` + ## 5.0.0-alpha.9 - 2024-01-29 - Added live conditional field support to inline-editable Matrix blocks. ([#14223](https://github.com/craftcms/cms/pull/14223)) From 946a13b7f3cb3c099b22df602c92592a2b813baa Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Tue, 30 Jan 2024 09:52:12 -0800 Subject: [PATCH 5/5] Release notes [ci skip] --- CHANGELOG-WIP.md | 4 ++++ CHANGELOG.md | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG-WIP.md b/CHANGELOG-WIP.md index f820c9e6770..33a6ca61aa0 100644 --- a/CHANGELOG-WIP.md +++ b/CHANGELOG-WIP.md @@ -436,6 +436,9 @@ - Deprecated the `_elements/element.twig` control panel template. `elementChip()` or `elementCard()` should be used instead. - Deprecated the `cp.elements.element` control panel template hook. - Removed the `_includes/revisionmenu.twig` control panel template. +- Removed `\craft\mail\transportadapters\Gmail::$timeout`. +- Removed `\craft\mail\transportadapters\Smtp::$encryptionMethod`. +- Removed `\craft\mail\transportadapters\Smtp::$timeout`. - Removed `craft\base\ApplicationTrait::getMatrix()`. - Removed `craft\base\Element::$contentId`. - Removed `craft\base\Element::ATTR_STATUS_MODIFIED`. `craft\enums\AttributeStatus::Modified` should be used instead. @@ -569,6 +572,7 @@ - Craft now requires `pragmarx/recovery`. - Craft now requires `web-auth/webauthn-lib`. - Updated `illuminate/collections` to v10. +- Updated `yiisoft/yii2-symfonymailer` to v4. - Craft no longer requires `composer/composer`. - New database tables now default to the `utf8mb4` charset, and the `utf8mb4_0900_ai_ci` or `utf8mb4_unicode_ci` collation, on MySQL. Existing installs should run `db/convert-charset` after upgrading, to ensure all tables have consistent charsets and collations. ([#11823](https://github.com/craftcms/cms/discussions/11823)) - The `defaultTemplateExtensions` config setting now lists `twig` before `html` by default. ([#11809](https://github.com/craftcms/cms/discussions/11809)) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0d069ca7fe..cb8068a5158 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,10 @@ - Added the `languageMenu` and `languageMenuField` form macros. - Added `craft\models\Site::getLanguage()`. - Added `craft\models\Site::setLanguage()`. -- Updated `yiisoft/yii2-symfonymailer` to v4 -- Removed `\craft\mail\transportadapters\Smtp::$encryptionMethod` -- Removed `\craft\mail\transportadapters\Smtp::$timeout` -- Removed `\craft\mail\transportadapters\Gmail::$timeout` +- Removed `\craft\mail\transportadapters\Gmail::$timeout`. +- Removed `\craft\mail\transportadapters\Smtp::$encryptionMethod`. +- Removed `\craft\mail\transportadapters\Smtp::$timeout`. +- Updated `yiisoft/yii2-symfonymailer` to v4. ## 5.0.0-alpha.9 - 2024-01-29