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

Add ignore unused foreach option #66

Merged
merged 8 commits into from
Feb 8, 2019
Merged

Conversation

sirbrillig
Copy link
Owner

@sirbrillig sirbrillig commented Jan 28, 2019

This adds a new option, allowUnusedForeachVariables. If the option is set to true, it will cause unused keys or values created by the as statement in a foreach loop to never be marked as unused.

With this option unset, the following block would produce two warnings. Neither $key nor $value are used. With the option set, neither of these warnings will be recorded.

foreach ($array as $key => $value) {
  echo 'hello';
}

Fixes #65

@sirbrillig sirbrillig changed the title Add ignore unused foreach Add ignore unused foreach option Jan 28, 2019
@sirbrillig sirbrillig merged commit 30e1278 into master Feb 8, 2019
@sirbrillig sirbrillig deleted the add-ignore-unused-foreach branch February 8, 2019 15:46
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

Successfully merging this pull request may close these issues.

1 participant