symfony/symfony — pull request #8863 by SamFleming (2013-08-27 08:26:48+00:00)
Title: [Form] Abstract FormRenderer::humanize into FormUtil

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |

I came across the need to humanize a form field name the same way that is used when displaying a label and found that without creating an instance of FormRenderer there was no way to achieve this without duplicating code.

Looking through the codebase I found the FormUtil class and the FormRender::humanize function. To me the humanize function is more of a utility function than functionally dedicated to a specific Renderer class, however I assume it wasn't put in the FormRendererInterface for nothing.

I've abstracted the logic from FormRenderer::humanize and created a function in FormUtil for it. I've left in FormRenderer::humanize for backwards-compatibility.

I don't necessarily expect this PR to be accepted, as I'm not aware on the reasons for the humanize function being part of the interface. Hopefully someone can shed some light on this?