-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] CamelCaseToSnakeCaseNameConverter upper camel case not working #21399
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
Comments
@markusu49 this is happening because |
Isn't this naming Microsoft-specific (see Wikipedia)? What is the |
It's not limited to Microsoft but more generally in programming languages. |
PascalCase is just another name for upper camel case - people often call things differently. However, the denormalize method supports it:
Why shouldn't the normalize method, too? |
@theofidry as your last quote points it out, there is indeed two kind of camel case: lower and upper, PascalCase being a synonym of upper camelCase (also known as StudlyCaps). I was not aware of that but according to https://fr.wikipedia.org/wiki/CamelCase, it seems true. The |
@chalasr IMO it's up to discussion, and tbh I don't feel strongly about it, but if the denormalize method supports it, the normalize one should as well indeed. |
Also I would intuitively prefer a CamelCaseToSnakeCaseNameConverter and a PascalCaseToSnakeCaseNameConverter than only the former handling both |
Isn't "lower camel case" simply "camel case", whereas "upper camel case" is "pascal case"? The class/arguments are unclear in their current form. Two separate converter classes would be more appropriate. Edit: We posted at the same time, but indeed, @chalasr, that would be much more intuitive. |
How should we handle edge cases then, like passing |
@markusu49 Your fix is legit on 2.7. If we want to separate, we have to deprecate this argument and introduce the new converter, that must be done on master, in another PR. |
…(markusu49) This PR was merged into the 2.7 branch. Discussion ---------- [Serializer] fix upper camel case conversion (see #21399) | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | ? | Deprecations? | no | Tests pass? | yes | Fixed tickets | #21399 | License | MIT Improve upper camel case support of CamelCaseToSnakeCaseConverter (`ThisIsATest` now converts to `this_is_a_test` instead of `_this_is_a_test`). Commits ------- 81e771c [Serializer] fix upper camel case conversion (see #21399)
* 2.7: Permit empty suffix on Windows [Console][Table] fixed render when using multiple rowspans. add docblocks for Twig url and path function to improve ide completion check for circular refs caused by method calls [Serializer] fix upper camel case conversion (see #21399) [DI] Auto register extension configuration classes as a resource [Console] Updated phpdoc on return types
* 2.8: Permit empty suffix on Windows [Console][Table] fixed render when using multiple rowspans. add docblocks for Twig url and path function to improve ide completion check for circular refs caused by method calls [Serializer] fix upper camel case conversion (see #21399) [DI] Auto register extension configuration classes as a resource [Console] Updated phpdoc on return types
* 3.2: Permit empty suffix on Windows fixed CS [FrameworkBundle] Remove unused import [Console][Table] fixed render when using multiple rowspans. add docblocks for Twig url and path function to improve ide completion check for circular refs caused by method calls [Serializer] fix upper camel case conversion (see #21399) [DI] Auto register extension configuration classes as a resource [Console] Updated phpdoc on return types
The CamelCaseToSnakeCaseNameConverter provides a constructor argument to specify whether to use lower camel case or not. Denormalizing upper camel case works fine, but normalizing
ThisIsATest
returns_this_is_a_test
(should bethis_is_a_test
).The text was updated successfully, but these errors were encountered: