Skip to content

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

Closed
@lenaorobei

Description

@lenaorobei

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 ...

Metadata

Metadata

Assignees

Labels

acceptedNew rule is acceptedbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions