8000 Should the selector in the method "get" from "HttpFoundation/ParameterBag" be changed? · Issue #14039 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Should the selector in the method "get" from "HttpFoundation/ParameterBag" be changed? #14039
Closed
@enriquemorenotent

Description

@enriquemorenotent

I have been considering the get method in HttpFoundation. Basically we iterate around nested arrays using this kind of naming convention:

If we do get("foo[bar][baz]") we access $this->params['foo']['bar']['baz'].

The problem with this is that any string can be a key selector. Then how would you access a key that had the "[" or "]" chars as part of their key? For instance:

$this->params["some[thing]"]

While we all will agree that this is a terrible name for a key, is it a possibility. Should we maybe reconsider the way get is called? I would propose the following:

get(array("foo", "bar", "baz"));

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0