Skip to content
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

[Routing] Fixed type annotation #32185

Merged
merged 1 commit into from Jun 26, 2019

Conversation

derrabus
Copy link
Member

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets N/A
License MIT
Doc PR N/A

The UrlGeneratorInterface::generate() method expects an array as argument $parameters, but the docblock does not reflect that. This PR fixes the type. Discovered while working on #32176.

@fabpot
Copy link
Member

fabpot commented Jun 26, 2019

Thank you @derrabus.

@fabpot fabpot merged commit 753bf7e into symfony:3.4 Jun 26, 2019
fabpot added a commit that referenced this pull request Jun 26, 2019
This PR was merged into the 3.4 branch.

Discussion
----------

[Routing] Fixed type annotation

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

The `UrlGeneratorInterface::generate()` method expects an array as argument `$parameters`, but the docblock does not reflect that. This PR fixes the type. Discovered while working on #32176.

Commits
-------

753bf7e Fixed type annotation.
@Tobion
Copy link
Member

Tobion commented Jun 26, 2019

This does not seem correct. Our implementation expects an array. But others might not. The idea was to allow to generate urls from objects, see 04ac1fd

@stof
Copy link
Member

stof commented Jun 26, 2019

But then, our own implementation should deal properly with non-array values (array_replace will not play well there).

@Tobion
Copy link
Member

Tobion commented Jun 26, 2019

Yeah we should probably throw an explicit exception.

@derrabus
Copy link
Member Author

@Tobion I didn't know about that. Out of curiosity: Do you know of any router implementation in the wild that allows something other than array here?

If that is still a valid use-case, we could revert my change here and reconsider the array type-hint I've added on master. #32176

@Tobion
Copy link
Member

Tobion commented Jun 27, 2019

I know there was a bundle allowing to generate urls from objects. But I've never used it and don't know if its maintained.
Maybe it's linked somewhere in the issues about generating urls from objects.

@derrabus derrabus deleted the bugfix/ugi-type-annotation branch June 29, 2019 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants