-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As reported in 111, if a variable is assigned a value with a combined assignment operator, it would not be reported as unused. Includes unit tests. Fixes 111
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
VariableAnalysis/Tests/CodeAnalysis/fixtures/UnusedVarWithValueChangeFixture.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
// Issue #111. | ||
function foo() { | ||
$var = 'abc'; | ||
$var = 'def'; | ||
|
||
$var2 = 'def'; | ||
$var2 .= 'ghi'; | ||
|
||
$var3 = 10; | ||
$var3 += 20; | ||
} | ||
|
||
// Safeguard that this change doesn't influence (not) reporting on assignments to parameters passed by reference. | ||
function bar(&$param) { | ||
$param .= 'foo'; | ||
} |