Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4364734

Browse filesBrowse files
[String] Fix camel() method with unicode string
1 parent 3b4cbfe commit 4364734
Copy full SHA for 4364734

File tree

2 files changed

+7
-6
lines changed
Filter options

2 files changed

+7
-6
lines changed

‎src/Symfony/Component/String/AbstractUnicodeString.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/String/AbstractUnicodeString.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function ascii(array $rules = []): self
162162
public function camel(): parent
163163
{
164164
$str = clone $this;
165-
$str->string = str_replace(' ', '', preg_replace_callback('/\b.(?![A-Z]{2,})/u', static function ($m) use (&$i) {
165+
$str->string = str_replace(' ', '', preg_replace_callback('/\b.(?!\p{Lu})/u', static function ($m) use (&$i) {
166166
return 1 === ++$i ? ('İ' === $m[0] ? '' : mb_strtolower($m[0], 'UTF-8')) : mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8');
167167
}, preg_replace('/[^\pL0-9]++/u', ' ', $this->string)));
168168

‎src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,7 @@ public static function provideCamel()
10461046
['symfonyIsGreat', 'symfony_is_great'],
10471047
['symfony5IsGreat', 'symfony_5_is_great'],
10481048
['symfonyIsGreat', 'Symfony is great'],
1049+
['SYMFONYISGREAT', 'SYMFONY_IS_GREAT'],
10491050
['symfonyIsAGreatFramework', 'Symfony is a great framework'],
10501051
['symfonyIsGREAT', '*Symfony* is GREAT!!'],
10511052
['SYMFONY', 'SYMFONY'],
@@ -1077,12 +1078,12 @@ public static function provideSnake()
10771078
['symfony_is_great', 'symfonyIsGREAT'],
10781079
['symfony_is_really_great', 'symfonyIsREALLYGreat'],
10791080
['symfony', 'SYMFONY'],
1080-
['symfony_is_great', 'SYMFONY IS GREAT'],
1081-
['symfony_is_great', 'SYMFONY_IS_GREAT'],
1081+
['symfonyisgreat', 'SYMFONY IS GREAT'],
1082+
['symfonyisgreat', 'SYMFONY_IS_GREAT'],
10821083
['symfony_is_great', 'symfony is great'],
1083-
['symfony_is_great', 'SYMFONY IS GREAT'],
1084-
['symfony_is_great', 'SYMFONY _ IS _ GREAT'],
1085-
['symfony_is_great', 'Symfony IS GREAT!'],
1084+
['symfonyisgreat', 'SYMFONY IS GREAT'],
1085+
['symfonyisgreat', 'SYMFONY _ IS _ GREAT'],
1086+
['symfony_isgreat', 'Symfony IS GREAT!'],
10861087
];
10871088
}
10881089

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.