Skip to content

Commit

Permalink
Use ReflectionType::getName() when available.
Browse files Browse the repository at this point in the history
  • Loading branch information
jails committed Aug 22, 2019
1 parent 57f21e7 commit 3430f5c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Plugin/Double.php
Expand Up @@ -411,9 +411,8 @@ protected static function _generateReturnType($method)
if (method_exists($type, 'allowsNull') && $type->allowsNull()) {
$allowsNull = '?';
}
if (!$type->isBuiltin()) {
$type = '\\' . (method_exists($type, 'getName') ? $type->getName() : $type);
}
$type = (!$type->isBuiltin() ? '\\' : '') . (method_exists($type, 'getName') ? $type->getName() : (string) $type);

if (defined('HHVM_VERSION')) {
$type = preg_replace('~\\\?HH\\\(mixed|void)?~', '', $type instanceof ReflectionType && method_exists($type, 'getName') ? $type->getName() : $type);
}
Expand Down

0 comments on commit 3430f5c

Please sign in to comment.