8000 [2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper by issei-m · Pull Request #18761 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper #18761

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
wants to merge 2 commits into from

Conversation

issei-m
Copy link
Contributor
@issei-m issei-m commented May 12, 2016
Q A
Branch? 2.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

For #18747

@issei-m issei-m changed the title [2.8] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper [2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper May 12, 2016
@@ -188,7 +186,7 @@ private function matchChild(FormInterface $form, PropertyPathIteratorInterface $
}

/** @var FormInterface $child */
foreach ($children as $key => $child) {
foreach ($children as $i => $child) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason for this change? If not, I like the original more. $i implies that it's being used for incrementation, but you're simply referring to the key here.

Copy link
Contributor Author
@issei-m issei-m May 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an intention to make the key of $children meaningless. (The name of iterator_to_array's 2nd parameter is $use_keys)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used to unset something below. if you mean to make it meaningless, you should remove it altogether

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moreover, i implies it's just counter indeed. But also implies it's an integer, IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alekitto How do you think about this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the change: in my opinion is more clear that the variable contains an integer counter, not a meaningful key name.
Moreover it makes it consistent with the existing codebase, for example: $i is used in DI Definition::removeMethodCall method in a similar way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alekitto Thank you for advicing!

@fabpot
Copy link
Member
fabpot commented May 13, 2016

Thank you @issei-m.

fabpot added a commit that referenced this pull request May 13, 2016
… false in ViolationMapper (issei-m)

This PR was squashed before being merged into the 2.3 branch (closes #18761).

Discussion
----------

[2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper

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

For #18747

Commits
-------

7101cab [2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper
@fabpot fabpot closed this May 13, 2016
@issei-m issei-m deleted the fix-violation-mapper-bug-23 branch May 13, 2016 15:30
@fabpot
Copy link
Member
fabpot commented May 13, 2016

@issei-m Can you submit a new PR on 2.7 to update the tests? When merging, I had to revert all tests changes due to conflicts hard to resolve easily :) Thanks.

@fabpot
Copy link
Member
fabpot commented May 13, 2016

nevermind, I see the other PR now :)

@issei-m
Copy link
Contributor Author
issei-m commented May 13, 2016

@fabpot Thanks for merging. For 2.7 is here: #18773.
btw will #18747 be unnecessary anymore?

@issei-m
Copy link
Contributor Author
issei-m commented May 13, 2016

@fabpot Ah, OK! I will close #18773 ;)

@fabpot fabpot mentioned this pull request May 13, 2016
@fabpot fabpot mentioned this pull request May 30, 2016
This was referenced Jun 6, 2016
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.

5 participants
0