if (!
$param || !
$hasByRef) { $args = '...\func_get_args()';
} elseif ($param->
isVariadic()) { $args =
substr($args, 0, -2
);
} else { $args .=
sprintf('...\array_slice(\func_get_args(), %d)', \
count($parameters));
} $signature = 'function '.
($function->
returnsReference() ? '&' : ''
) .
($function->
isClosure() ? '' :
$function->name
).'('.
implode(', ',
$parameters).')';
if ($function instanceof \ReflectionMethod
) { $signature =
($function->
isPublic() ? 'public ' :
($function->
isProtected() ? 'protected ' : 'private '
)) .
($function->
isStatic() ? 'static ' : ''
).
$signature;
} if ($function->
hasReturnType()) { $signature .= ': '.self::
exportType($function);
} static $getPrototype;
$getPrototype ??= (new \
ReflectionMethod(\ReflectionMethod::
class, 'getPrototype'
))->
invoke(...
);