Skip to content

Commit b0a438b

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 2722cdb + 131f4e8 commit b0a438b

File tree

7 files changed

+19
-7
lines changed

7 files changed

+19
-7
lines changed

src/Symfony/Bridge/Doctrine/ManagerRegistry.php

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {
5858
}
5959
if (isset($this->fileMap[$name])) {
6060
$wrappedInstance = $this->load($this->fileMap[$name], false);
61+
} elseif ((new \ReflectionMethod($this, $this->methodMap[$name]))->isStatic()) {
62+
$wrappedInstance = $this->{$this->methodMap[$name]}($this, false);
6163
} else {
6264
$wrappedInstance = $this->{$this->methodMap[$name]}(false);
6365
}

src/Symfony/Bundle/SecurityBundle/Resources/config/schema/security-1.0.xsd

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112

113113
<xsd:complexType name="user">
114114
<xsd:attribute name="identifier" type="xsd:string" />
115+
<xsd:attribute name="name" type="xsd:string" />
115116
<xsd:attribute name="password" type="xsd:string" />
116117
<xsd:attribute name="roles" type="xsd:string" />
117118
</xsd:complexType>

src/Symfony/Component/Filesystem/Filesystem.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private static function doRemove(array $files, bool $isRecursive): void
164164
}
165165
} elseif (is_dir($file)) {
166166
if (!$isRecursive) {
167-
$tmpName = \dirname(realpath($file)).'/.'.strrev(strtr(base64_encode(random_bytes(2)), '/=', '-_'));
167+
$tmpName = \dirname(realpath($file)).'/.!'.strrev(strtr(base64_encode(random_bytes(2)), '/=', '-!'));
168168

169169
if (file_exists($tmpName)) {
170170
try {

src/Symfony/Component/HttpKernel/Kernel.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,17 @@ protected function initializeContainer(): void
528528
touch($oldContainerDir.'.legacy');
529529
}
530530

531-
$preload = $this instanceof WarmableInterface ? (array) $this->warmUp($this->container->getParameter('kernel.cache_dir'), $buildDir) : [];
531+
$cacheDir = $this->container->getParameter('kernel.cache_dir');
532+
$preload = $this instanceof WarmableInterface ? (array) $this->warmUp($cacheDir, $buildDir) : [];
532533

533534
if ($this->container->has('cache_warmer')) {
534-
$preload = array_merge($preload, (array) $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir'), $buildDir));
535+
$cacheWarmer = $this->container->get('cache_warmer');
536+
537+
if ($cacheDir !== $buildDir) {
538+
$cacheWarmer->enableOptionalWarmers();
539+
}
540+
541+
$preload = array_merge($preload, (array) $cacheWarmer->warmUp($cacheDir, $buildDir));
535542
}
536543

537544
if ($preload && file_exists($preloadFile = $buildDir.'/'.$class.'.preload.php')) {

src/Symfony/Component/String/AbstractUnicodeString.php

+2-2
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
}

src/Symfony/Component/String/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 = $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
}

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