Skip to content

Commit

Permalink
Merge branch '7.0' into 7.1
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nicolas-grekas committed Jun 28, 2024
2 parents 2be52e2 + 119b348 commit 1422108
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions AbstractUnicodeString.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ public function reverse(): static

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

return $str;
}
Expand Down
4 changes: 2 additions & 2 deletions ByteString.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ public function slice(int $start = 0, ?int $length = null): static

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

return $str;
}
Expand Down
2 changes: 2 additions & 0 deletions Tests/AbstractAsciiTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,8 @@ public static function provideSnake()
['symfony_is_great', 'symfonyIsGREAT'],
['symfony_is_really_great', 'symfonyIsREALLYGreat'],
['symfony', 'SYMFONY'],
['symfony_is_great', 'SYMFONY IS GREAT'],
['symfony_is_great', 'SYMFONY_IS_GREAT'],
];
}

Expand Down

0 comments on commit 1422108

Please sign in to comment.