public static function exportSignature(\ReflectionFunctionAbstract
$function, bool
$withParameterTypes = true, string &
$args = null
): string
{ $hasByRef = false;
$args = '';
$param = null;
$parameters =
[];
foreach ($function->
getParameters() as $param) { $parameters[] =
($param->
getAttributes(\SensitiveParameter::
class) ? '#[\SensitiveParameter] ' : ''
) .
($withParameterTypes &&
$param->
hasType() ? self::
exportType($param).' ' : ''
) .
($param->
isPassedByReference() ? '&' : ''
) .
($param->
isVariadic() ? '...' : ''
).'$'.
$param->name
.
($param->
isOptional() && !
$param->
isVariadic() ? ' = '.self::
exportDefault($param) : ''
);
$hasByRef =
$hasByRef ||
$param->
isPassedByReference();
$args .= ($param->
isVariadic() ? '...$' : '$'
).
$param->name.', ';
} 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));
}