Skip to content

Unused variable in global scope not found #37

Closed
@sirbrillig

Description

@sirbrillig

A variable defined in a foreach statement and never used is not found.

$foo = [1, 2, 3];
// The next line should report an unused variable
foreach ( $foo as $bar ) {
  echo 'hi';
}

tldr: The global scope is not scanned because there's no token to indicate when it ends.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions