Skip to content

Commit 12d75e4

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: [Router] Discard in-memory cache of routes when writing the file-based cache [Security] Verify Hungarian translation force HTTP 1.1 for Mailgun API requests [String] Revert "Fixed u()->snake(), b()->snake() and s()->snake() methods" normalize underscores in snake() [Security][Validator] Added missing Portuguese(pt) translations Fixes #54550 some pt_BR translations Fix MockArraySessionStorage to generate more conform ids Bump Symfony version to 5.4.42 Update VERSION for 5.4.41 Update CONTRIBUTORS for 5.4.41 Update CHANGELOG for 5.4.41
2 parents 1422108 + 8c8c73c commit 12d75e4

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

AbstractUnicodeString.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function ascii(array $rules = []): self
155155
public function camel(): static
156156
{
157157
$str = clone $this;
158-
$str->string = str_replace(' ', '', preg_replace_callback('/\b.(?![A-Z]{2,})/u', static function ($m) {
158+
$str->string = str_replace(' ', '', preg_replace_callback('/\b.(?!\p{Lu})/u', static function ($m) {
159159
static $i = 0;
160160

161161
return 1 === ++$i ? ('İ' === $m[0] ? '' : mb_strtolower($m[0], 'UTF-8')) : mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8');
@@ -361,8 +361,8 @@ public function reverse(): static
361361

362362
public function snake(): static
363363
{
364-
$str = clone $this;
365-
$str->string = str_replace(' ', '_', mb_strtolower(preg_replace(['/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u'], '\1 \2', $str->string), 'UTF-8'));
364+
$str = $this->camel();
365+
$str->string = mb_strtolower(preg_replace(['/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u'], '\1_\2', $str->string), 'UTF-8');
366366

367367
return $str;
368368
}

ByteString.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ public function slice(int $start = 0, ?int $length = null): static
347347

348348
public function snake(): static
349349
{
350-
$str = clone $this;
351-
$str->string = str_replace(' ', '_', strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1 \2', $str->string)));
350+
$str = $this->camel();
351+
$str->string = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $str->string));
352352

353353
return $str;
354354
}

Tests/AbstractAsciiTestCase.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,7 @@ public static function provideCamel()
10441044
['symfonyIsGreat', 'symfony_is_great'],
10451045
['symfony5IsGreat', 'symfony_5_is_great'],
10461046
['symfonyIsGreat', 'Symfony is great'],
1047+
['SYMFONYISGREAT', 'SYMFONY_IS_GREAT'],
10471048
['symfonyIsAGreatFramework', 'Symfony is a great framework'],
10481049
['symfonyIsGREAT', '*Symfony* is GREAT!!'],
10491050
['SYMFONY', 'SYMFONY'],
@@ -1075,8 +1076,12 @@ public static function provideSnake()
10751076
['symfony_is_great', 'symfonyIsGREAT'],
10761077
['symfony_is_really_great', 'symfonyIsREALLYGreat'],
10771078
['symfony', 'SYMFONY'],
1078-
['symfony_is_great', 'SYMFONY IS GREAT'],
1079-
['symfony_is_great', 'SYMFONY_IS_GREAT'],
1079+
['symfonyisgreat', 'SYMFONY IS GREAT'],
1080+
['symfonyisgreat', 'SYMFONY_IS_GREAT'],
1081+
['symfony_is_great', 'symfony is great'],
1082+
['symfonyisgreat', 'SYMFONY IS GREAT'],
1083+
['symfonyisgreat', 'SYMFONY _ IS _ GREAT'],
1084+
['symfony_isgreat', 'Symfony IS GREAT!'],
10801085
];
10811086
}
10821087

0 commit comments

Comments
 (0)