Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[String] Fix snake conversion #47185

Merged
merged 1 commit into from Aug 4, 2022
Merged

[String] Fix snake conversion #47185

merged 1 commit into from Aug 4, 2022

Conversation

simPod
Copy link
Contributor

@simPod simPod commented Aug 4, 2022

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #47054
License MIT

@derrabus
Copy link
Member

derrabus commented Aug 4, 2022

Thank you @simPod.

@derrabus derrabus merged commit 2e5f939 into symfony:5.4 Aug 4, 2022
@simPod simPod deleted the fix-snake branch August 4, 2022 19:56
This was referenced Aug 26, 2022
fabpot added a commit that referenced this pull request Sep 1, 2022
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 word
@fabpot fabpot mentioned this pull request Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong conversion to snake case from upper snake case
5 participants