8000 $request->query->get() can return array, but PHPDoc doesn't include array · Issue #42478 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

$request->query->get() can return array, but PHPDoc doesn't include array #42478

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

Closed
ThomasTr opened this issue Aug 11, 2021 · 2 comments
Closed

Comments

@ThomasTr
Copy link
Contributor

Symfony version(s) affected: 5.3.6

Description
According to the documentation here:
https://symfony.com/doc/current/components/http_foundation.html#accessing-request-data

// the query string is '?foo[bar]=baz'

$request->query->get('foo');
// returns ['bar' => 'baz']

$request->query->get() can return arrays, but PHPDoc in InputBag for method get() says

@return string|int|float|bool|null

Possible Solution
In my assumption it should be save to add array to the return annotation?
If so, I'm happy to prepare a pull request.

@wouterj
Copy link
Member
wouterj commented Aug 11, 2021

Hi! It seems like the docs are wrong here. In Symfony 5.1, the InputBag was introduced to avoid having the array return type: #34363 (as that makes it quite easy to break applications by adding [] to the URL).

Are you willing to submit a fix for the docs? :)

@wouterj wouterj closed this as completed Aug 11, 2021
@ThomasTr
Copy link
Contributor Author
5E5B

Ah ok, thanks for the hint. Will head over to the docs :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0