Skip to content

Commit 9233162

Browse files
staabmsebastianbergmann
authored andcommitted
remove unnecessary str_contains()
1 parent b90dee5 commit 9233162

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Logging/TestDox/NamePrettifier.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public function prettifyTestClassName(string $className): string
108108
return $result;
109109
}
110110

111+
// NOTE: this method is on a hot path and very performance sensitive. change with care.
111112
public function prettifyTestMethodName(string $name): string
112113
{
113114
$buffer = '';
@@ -136,8 +137,9 @@ public function prettifyTestMethodName(string $name): string
136137

137138
$name[0] = strtoupper($name[0]);
138139

139-
if (str_contains($name, '_')) {
140-
return trim(str_replace('_', ' ', $name));
140+
$noUnderscore = str_replace('_', ' ', $name);
141+
if ($noUnderscore !== $name) {
142+
return trim($noUnderscore);
141143
}
142144

143145
$wasNumeric = false;

0 commit comments

Comments
 (0)