Skip to content

ParameterBag->keys() return type is incorrect #439

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

Open
nreynis opened this issue Apr 7, 2025 · 0 comments
Open

ParameterBag->keys() return type is incorrect #439

nreynis opened this issue Apr 7, 2025 · 0 comments

Comments

@nreynis
Copy link

nreynis commented Apr 7, 2025

In the ParameterBag stub the return type is improperly narrowed to list<string>.

The implementation use a simple array_keys call. Therefore the return type MUST be list<array-key>.

With the current type narrowing it's impossible to correctly parse a query string with numeric keys (ie: https://domain.tld/search?0=value&78=something). Worse, trusting PHPStan than the key is a string might lead to a runtime TypeError.

@nreynis nreynis changed the title ParameterBag->keys return type is incorrect ParameterBag->keys() return type is incorrect Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant