Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use foreach() instead of for(). Fixes #30.

  • Loading branch information...
commit ed729014d11d08987e4673705fdf1cefb85107e8 1 parent ff8ec1a
@sebastianbergmann authored
Showing with 6 additions and 9 deletions.
  1. +3 −5 PHPUnit/Framework/TestResult.php
  2. +3 −4 PHPUnit/Util/Filter.php
View
8 PHPUnit/Framework/TestResult.php
@@ -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]);
}
}
}
View
7 PHPUnit/Util/Filter.php
@@ -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]);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.