Skip to content

Commit 83a0f25

Browse files
lcobucciondrejmirtes
authored andcommitted
Simplify assertion method name trimming
Reducing the number of functions called and avoiding duplicated operations.
1 parent 6c980c1 commit 83a0f25

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Type/PHPUnit/Assert/AssertTypeSpecifyingExtensionHelper.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ public static function isSupported(
4141

4242
private static function trimName(string $name): string
4343
{
44-
if (substr($name, 0, strlen('assert')) !== 'assert') {
44+
if (strpos($name, 'assert') !== 0) {
4545
return $name;
4646
}
4747

4848
$name = substr($name, strlen('assert'));
49-
if (substr($name, 0, 3) === 'Not') {
50-
$name = substr($name, 3);
49+
50+
if (strpos($name, 'Not') === 0) {
51+
return substr($name, 3);
5152
}
5253

5354
return $name;

0 commit comments

Comments
 (0)