Skip to content

PSUseDeclaredVarsMoreThanAssigments - False negative for two same named vars in different scopes #552

@DAXaholic

Description

@DAXaholic

An unused variable is not reported as such if another variable with the same name is used in another scope. In the example below, $b of MyFunc2 should be reported as being unused but it is not detected by the analyzer. If the var. is renamed to e.g. $c it is of course detected correctly.

function MyFunc1() {
    $a = 1
    $b = 1
    $a + $b
}

function MyFunc2() {
    $a = 1
    $b = 1
    $a + $a
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions