Skip to content

Should the selector in the method "get" from "HttpFoundation/ParameterBag" be changed? #14039

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy