Skip to content

[RFC] Rename some HeaderUtils methods #27026

@javiereguiluz

Description

@javiereguiluz
Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? yes
Symfony version 4.1

I'd like to propose to rename some methods of HeaderUtils before Symfony 4.1 is released.

split()

I don't like that name because PHP removed the split() function in PHP 7.0. Could we rename it to explode() to be inline with modern PHP naming?

combineParts()

I wonder if combine() would be enough. Maybe not. It's just that this method name is not "symmetrical" to split() (which should be called splitParts() then).

joinAssoc()

This is the method name I like the least. I've looked up in the "Header Fields" section of HTTP standard (https://tools.ietf.org/html/rfc7230#section-3.2) but there's no terminology about headers that we could use here.

I've looked up in other frameworks and I haven't found much. Spring for example calls this
toCommaDelimitedString()

The problem I see with joinAssoc() name is that it explains the low level details of how it works (joining associative arrays into a single string). I'd prefer a method that describes what it does: stringify(), toString(), asString(), etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    HttpFoundationRFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions