Skip to content

Commit 119b348

Browse files
Merge branch '6.4' into 7.0
* 6.4: Revert "bug #57520 [SecurityBundle] Remove unused memory users’ `name` attribute from the XSD (MatTheCat)" [HttpKernel] Enable optional cache-warmers when cache-dir != build-dir [Filesystem] Fix Filesystem::remove() on Windows [DoctrineBridge] Fix compat with DI >= 6.4 [String] Fix *String::snake methods
2 parents a716227 + 76792db commit 119b348

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

AbstractUnicodeString.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ public function reverse(): static
346346

347347
public function snake(): static
348348
{
349-
$str = $this->camel();
350-
$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');
349+
$str = clone $this;
350+
$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'));
351351

352352
return $str;
353353
}

ByteString.php

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

343343
public function snake(): static
344344
{
345-
$str = $this->camel();
346-
$str->string = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $str->string));
345+
$str = clone $this;
346+
$str->string = str_replace(' ', '_', strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1 \2', $str->string)));
347347

348348
return $str;
349349
}

Tests/AbstractAsciiTestCase.php

+2
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,8 @@ public static function provideSnake()
10751075
['symfony_is_great', 'symfonyIsGREAT'],
10761076
['symfony_is_really_great', 'symfonyIsREALLYGreat'],
10771077
['symfony', 'SYMFONY'],
1078+
['symfony_is_great', 'SYMFONY IS GREAT'],
1079+
['symfony_is_great', 'SYMFONY_IS_GREAT'],
10781080
];
10791081
}
10801082

0 commit comments

Comments
 (0)