Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Covered the new allow-unused-foreach-variables setting in UnusedLocal…
…Variable with tests
- Loading branch information
Showing
5 changed files
with
128 additions
and
0 deletions.
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
10 changes: 10 additions & 0 deletions
10
...ources/files/Rule/UnusedLocalVariable/testRuleAppliesToUnusedForeachKeyWhenNotIgnored.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,10 @@ | ||
<?php | ||
class testRuleAppliesToUnusedForeachKeyWhenNotIgnored | ||
{ | ||
public function testRuleAppliesToUnusedForeachKeyWhenNotIgnored() | ||
{ | ||
foreach ($this->index as $key => $value) { | ||
self::$string{$value} = 'a'; | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...rces/files/Rule/UnusedLocalVariable/testRuleAppliesToUnusedForeachValueWhenNotIgnored.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,10 @@ | ||
<?php | ||
class testRuleAppliesToUnusedForeachValueWhenNotIgnored | ||
{ | ||
public function testRuleAppliesToUnusedForeachValueWhenNotIgnored() | ||
{ | ||
foreach ($this->index as $key => $value) { | ||
self::$string{$key} = 'a'; | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...rces/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToUnusedForeachKeyWhenIgnored.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,10 @@ | ||
<?php | ||
class testRuleDoesNotApplyToUnusedForeachKeyWhenIgnored | ||
{ | ||
public function testRuleDoesNotApplyToUnusedForeachKeyWhenIgnored() | ||
{ | ||
foreach ($this->index as $key => $value) { | ||
self::$string{$value} = 'a'; | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...es/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToUnusedForeachValueWhenIgnored.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,10 @@ | ||
<?php | ||
class testRuleDoesNotApplyToUnusedForeachValueWhenIgnored | ||
{ | ||
public function testRuleDoesNotApplyToUnusedForeachValueWhenIgnored() | ||
{ | ||
foreach ($this->index as $key => $value) { | ||
self::$string{$key} = 'a'; | ||
} | ||
} | ||
} |