Skip to content

Commit

Permalink
Simplify foreach
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored and sebastianbergmann committed Mar 15, 2024
1 parent a0ad562 commit 9e89be8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Logging/TestDox/NamePrettifier.php
Expand Up @@ -27,7 +27,7 @@
use function method_exists;
use function preg_quote;
use function preg_replace;
use function range;
use function rtrim;
use function sprintf;
use function str_contains;
use function str_ends_with;
Expand Down Expand Up @@ -115,6 +115,7 @@ public function prettifyTestMethodName(string $name): string
}

$string = rtrim($name, '0123456789');

if (array_key_exists($string, self::$strings)) {
$name = $string;
} elseif ($string === $name) {
Expand Down Expand Up @@ -143,7 +144,9 @@ public function prettifyTestMethodName(string $name): string

$buffer = '';

foreach (range(0, strlen($name) - 1) as $i) {
$len = strlen($name);

for ($i = 0; $i < $len; $i++) {
if ($i > 0 && $name[$i] >= 'A' && $name[$i] <= 'Z') {
$buffer .= ' ' . strtolower($name[$i]);
} else {
Expand Down

0 comments on commit 9e89be8

Please sign in to comment.