From 583fcbcae4cac95e831e2e28e728a9296b261db9 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Fri, 27 Dec 2024 13:36:05 -0800 Subject: [PATCH 1/2] Missing `@deprecated` [ci skip] --- src/web/twig/Extension.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/web/twig/Extension.php b/src/web/twig/Extension.php index 10388a51a95..d838889bc30 100644 --- a/src/web/twig/Extension.php +++ b/src/web/twig/Extension.php @@ -468,6 +468,7 @@ public function ucfirstFilter(mixed $string): string * @param TwigEnvironment $env * @param string $string * @return string + * @deprecated in 3.5.0 */ public function ucwordsFilter(TwigEnvironment $env, string $string): string { From d8f0ee0739f06d75e4fe6f879dc8d304fbe3b672 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Fri, 27 Dec 2024 13:38:38 -0800 Subject: [PATCH 2/2] =?UTF-8?q?ucfirst=20=E2=86=92=20capitalize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG-WIP.md | 1 + src/templates/settings/plugins/index.twig | 2 +- src/web/twig/Extension.php | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-WIP.md b/CHANGELOG-WIP.md index 438851f161d..c0c64b6ab93 100644 --- a/CHANGELOG-WIP.md +++ b/CHANGELOG-WIP.md @@ -8,6 +8,7 @@ ## Development - The `duration` Twig filter now has a `language` argument. ([#16332](https://github.com/craftcms/cms/pull/16332)) +- Deprecated the `ucfirst` Twig filter. `capitalize` should be used instead. ## Extensibility - `craft\helpers\DateTimeHelper::humanDuration()` now has a `$language` argument. ([#16332](https://github.com/craftcms/cms/pull/16332)) diff --git a/src/templates/settings/plugins/index.twig b/src/templates/settings/plugins/index.twig index 7f6d4e24ada..cfc7ef41235 100644 --- a/src/templates/settings/plugins/index.twig +++ b/src/templates/settings/plugins/index.twig @@ -111,7 +111,7 @@ {% switch issue %} {% case 'wrong_edition' %} {{ 'This license is for the {name} edition.'|t('app', { - name: config.licensedEdition|ucfirst + name: config.licensedEdition|capitalize, }) }} {% case 'no_trials' %} {{ 'Plugin trials are not allowed on this domain.'|t('app') }} diff --git a/src/web/twig/Extension.php b/src/web/twig/Extension.php index bc5667e7b0b..5e684f3199e 100644 --- a/src/web/twig/Extension.php +++ b/src/web/twig/Extension.php @@ -457,9 +457,11 @@ public function truncateFilter(string $string, int $length, string $suffix = ' * * @param mixed $string The multibyte string. * @return string The string with the first character converted to upercase. + * @deprecated in 4.14.0 */ public function ucfirstFilter(mixed $string): string { + Craft::$app->getDeprecator()->log('ucfirst', 'The `|ucfirst` filter has been deprecated. Use `|capitalize` instead.'); return StringHelper::upperCaseFirst((string)$string); }