Skip to content

Commit a40eb00

Browse files
committed
fix testing global functions
1 parent cc44027 commit a40eb00

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Subscriber/TestExecutor.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,13 @@ private function prefixes(Location $location): array
145145
"namespace TH\\Doctest\\Runtime\\{$source->getName()}{$extraNamespacePart}\\Example{$location->index}",
146146
];
147147

148-
$prefixes[] = $source instanceof \ReflectionFunctionAbstract
149-
? "use {$source->getNamespaceName()}"
150-
: "use {$source->getName()}";
148+
$fqcn = $source instanceof \ReflectionFunctionAbstract
149+
? $source->getNamespaceName()
150+
: $source->getName();
151+
152+
if ($fqcn !== "") {
153+
$prefixes[] = "use $fqcn;";
154+
}
151155

152156
return $prefixes;
153157
}

0 commit comments

Comments
 (0)