Commit c61dfca
committed
bug #47423 [String] CamelCase/SnakeCase on uppercase word (mpiot)
This PR was submitted for the 6.2 branch but it was merged into the 5.4 branch instead.
Discussion
----------
[String] CamelCase/SnakeCase on uppercase word
| Q | A
| ------------- | ---
| Branch? | 6.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | ~
| Tickets | Fix #47421
| License | MIT
| Doc PR |
The behavior of `->snake()` method from String component has changed in 6.1.4, now, using `u('SYMFONY')->snake()` return `s_ymfony` instead of `symfony` (#47185).
After, some investigations, it seams the `->camel()` behavior is not exactly the expected one: `u('SYMFONY')->camel()` return `sYMFONY` instead of `SYMFONY`.
This PR give theses behaviors:
- CamelCase:
- '' => ''
- x_y => xY
- xu_yo => xuYo
- symfony_is_great => symfonyIsGreat
- symfony_5_is_great => symfony5IsGreat
- Symfony is great => symfonyIsGreat
- Symfony is a great framework => symfonyIsAGreatFramework
- \*Symfony\* is GREAT!! => symfonyIsGREAT
- **SYMFONY => SYMFONY**
- SnakeCase:
- '' => ''
- x_y => x_y
- X_Y => x_y
- xu_yo => xu_yo
- symfonyIsGreat => symfony_is_great
- symfony5IsGreat => symfony5_is_great
- symfony5isGreat => symfony5is_great
- Symfony is great => symfony_is_great
- symfonyIsAGreatFramework => symfony_is_a_great_framework
- symfonyIsGREAT => symfony_is_great
- symfonyIsREALLYGreat => symfony_is_really_great
- **SYMFONY => symfony**
Commits
-------
c3cae1f [String] CamelCase/SnakeCase on uppercase wordFile tree
3 files changed
+9
-2
lines changed- src/Symfony/Component/String
- Tests
3 files changed
+9
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1042 | 1042 | | |
1043 | 1043 | | |
1044 | 1044 | | |
| 1045 | + | |
1045 | 1046 | | |
1046 | 1047 | | |
1047 | 1048 | | |
1048 | 1049 | | |
1049 | 1050 | | |
| 1051 | + | |
1050 | 1052 | | |
1051 | 1053 | | |
1052 | 1054 | | |
| |||
1066 | 1068 | | |
1067 | 1069 | | |
1068 | 1070 | | |
| 1071 | + | |
1069 | 1072 | | |
1070 | 1073 | | |
1071 | 1074 | | |
1072 | 1075 | | |
1073 | 1076 | | |
1074 | 1077 | | |
1075 | 1078 | | |
| 1079 | + | |
1076 | 1080 | | |
1077 | 1081 | | |
1078 | 1082 | | |
| |||
0 commit comments