Skip to content

Commit 73510ce

Browse files
Merge branch '5.4' into 6.4
* 5.4: [Filesystem] Fix Filesystem::remove() on Windows [DoctrineBridge] Fix compat with DI >= 6.4 [String] Fix *String::snake methods
2 parents db6ddb2 + 6517957 commit 73510ce

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

src/Symfony/Bridge/Doctrine/ManagerRegistry.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {
6161
}
6262
if (isset($this->fileMap[$name])) {
6363
$wrappedInstance = $this->load($this->fileMap[$name], false);
64+
} elseif ((new \ReflectionMethod($this, $this->methodMap[$name]))->isStatic()) {
65+
$wrappedInstance = $this->{$this->methodMap[$name]}($this, false);
6466
} else {
6567
$wrappedInstance = $this->{$this->methodMap[$name]}(false);
6668
}

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private static function doRemove(array $files, bool $isRecursive): void
172172
}
173173
} elseif (is_dir($file)) {
174174
if (!$isRecursive) {
175-
$tmpName = \dirname(realpath($file)).'/.'.strrev(strtr(base64_encode(random_bytes(2)), '/=', '-_'));
175+
$tmpName = \dirname(realpath($file)).'/.!'.strrev(strtr(base64_encode(random_bytes(2)), '/=', '-!'));
176176

177177
if (file_exists($tmpName)) {
178178
try {

src/Symfony/Component/String/AbstractUnicodeString.php

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

src/Symfony/Component/String/ByteString.php

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

src/Symfony/Component/String/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)