function MockMethod::methodParametersForCall
Returns the parameters of a function or method.
Throws
1 call to MockMethod::methodParametersForCall()
- MockMethod::fromReflection in vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ MockMethod.php
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ MockMethod.php, line 315
Class
- MockMethod
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\Framework\MockObject\GeneratorCode
private static function methodParametersForCall(ReflectionMethod $method) : string {
$parameters = [];
foreach ($method->getParameters() as $i => $parameter) {
$name = '$' . $parameter->getName();
/* Note: PHP extensions may use empty names for reference arguments
* or "..." for methods taking a variable number of arguments.
*/
if ($name === '$' || $name === '$...') {
$name = '$arg' . $i;
}
if ($parameter->isVariadic()) {
continue;
}
if ($parameter->isPassedByReference()) {
$parameters[] = '&' . $name;
}
else {
$parameters[] = $name;
}
}
return implode(', ', $parameters);
}