Skip to content

[Bug] ForeachArrayMergeSniff throws an error for inline control structure #110

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
lenaorobei opened this issue Jun 5, 2019 · 0 comments · Fixed by #111
Closed

[Bug] ForeachArrayMergeSniff throws an error for inline control structure #110

lenaorobei opened this issue Jun 5, 2019 · 0 comments · Fixed by #111
Assignees
Labels
accepted New rule is accepted bug Something isn't working

Comments

@lenaorobei
Copy link
Contributor

Steps to reproduce

Run ForeachArrayMergeSniff against file that contains inline control structure.

foreach ([] as $item)
// inline foreach
    $a = array_merge([], []);

foreach ([] as $item)
// array_merge after inline foreach
$a = array_merge([], []);

Expected result

Sniff detects nothing. There is no way to detect function scope without {}.

Actual result

An error occurred during processing; checking has been aborted. The error message was: Undefined index: scope_opener in ...

@lenaorobei lenaorobei added bug Something isn't working accepted New rule is accepted labels Jun 5, 2019
@lenaorobei lenaorobei self-assigned this Jun 5, 2019
magento-devops-reposync-svc pushed a commit that referenced this issue Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted New rule is accepted bug Something isn't working
Projects
None yet
1 participant