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

What is the purpose of the first argument of the map filter? #3160

Closed
ericmorand opened this issue Sep 24, 2019 · 3 comments
Closed

What is the purpose of the first argument of the map filter? #3160

ericmorand opened this issue Sep 24, 2019 · 3 comments

Comments

@ericmorand
Copy link
Contributor

ericmorand commented Sep 24, 2019

https://twig.symfony.com/doc/2.x/filters/map.html

The doc of the map filter declare on argument named array:

array: The sequence or mapping

What is its purpose? Isn't it the value that the filter is applied to? If so it shouldn't be part of the documentation arguments.

@stof
Copy link
Member

stof commented Sep 24, 2019

This looks like a mistake in the doc. The PHP function indeed has the array as first argument, but this is indeed the value being filtered.

@ericmorand
Copy link
Contributor Author

ericmorand commented Sep 24, 2019

OK, that's what I assumed.

I'm reviewing the whole functions and filters doc to make sure that Twing support for named arguments is correct. And I couldn't find a fit for array. I'm glad it's just a doc issue.

@ericmorand
Copy link
Contributor Author

Same issue with reduce by the way:

https://twig.symfony.com/doc/2.x/filters/reduce.html

ericmorand added a commit to ericmorand/Twig that referenced this issue Oct 1, 2019
fabpot pushed a commit to ericmorand/Twig that referenced this issue Oct 1, 2019
fabpot added a commit that referenced this issue Oct 1, 2019
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #3164).

Discussion
----------

Fix issue #3160

Commits
-------

4eb40f2 Fix issue #3160
@fabpot fabpot closed this as completed Oct 1, 2019
fabpot added a commit that referenced this issue Oct 1, 2019
* 1.x:
  Fix issue #3159
  Fix issue #3160
fabpot added a commit that referenced this issue Oct 1, 2019
* 2.x:
  Fix issue #3159
  Fix issue #3160
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants