Skip to content

Commit 1422108

Browse files
Merge branch '7.0' into 7.1
* 7.0: 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 2be52e2 + 119b348 commit 1422108

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

AbstractUnicodeString.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ public function reverse(): static
361361

362362
public function snake(): static
363363
{
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');
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'));
366366

367367
return $str;
368368
}

ByteString.php

Lines changed: 2 additions & 2 deletions
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 = $this->camel();
351-
$str->string = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $str->string));
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)));
352352

353353
return $str;
354354
}

Tests/AbstractAsciiTestCase.php

Lines changed: 2 additions & 0 deletions
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)