Skip to content

Commit

Permalink
Use foreach() instead of for(). Fixes #30.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Aug 2, 2006
1 parent ff8ec1a commit ed72901
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 3 additions & 5 deletions PHPUnit/Framework/TestResult.php
Expand Up @@ -151,11 +151,9 @@ public function addListener(PHPUnit_Framework_TestListener $listener)
*/
public function removeListener(PHPUnit_Framework_TestListener $listener)
{
$max = count($this->listeners);

for ($i = 0; $i < $max; $i++) {
if ($this->listeners[$i] === $listener) {
unset($this->listeners[$i]);
foreach ($this->listeners as $key => $_listener) {
if ($listener === $_listener) {
unset($this->listeners[$key]);
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions PHPUnit/Util/Filter.php
Expand Up @@ -128,11 +128,10 @@ public static function removeFileFromFilter($filename, $group = 'DEFAULT')
{
if (isset(self::$filteredFiles[$group])) {
$filename = self::getCanonicalFilename($filename);
$max = count(self::$filteredFiles[$group]);

for ($i = 0; $i < $max; $i++) {
if (self::$filteredFiles[$group][$i] == $filename) {
unset(self::$filteredFiles[$group][$i]);
foreach (self::$filteredFiles[$group] as $key => $_filename) {
if ($filename == $_filename) {
unset(self::$filteredFiles[$group][$key]);
}
}
}
Expand Down

0 comments on commit ed72901

Please sign in to comment.