function MockMethod::exportDefaultValue
Throws
1 call to MockMethod::exportDefaultValue()
- MockMethod::methodParametersForDeclaration in vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ MockMethod.php - Returns the parameters of a function or method.
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ MockMethod.php, line 346
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 exportDefaultValue(ReflectionParameter $parameter) : string {
try {
$defaultValue = $parameter->getDefaultValue();
if (!is_object($defaultValue)) {
return var_export($defaultValue, true);
}
$parameterAsString = $parameter->__toString();
return explode(' = ', substr(substr($parameterAsString, strpos($parameterAsString, '<optional> ') + strlen('<optional> ')), 0, -2))[1];
// @codeCoverageIgnoreStart
} catch (\ReflectionException $e) {
throw new ReflectionException($e->getMessage(), $e->getCode(), $e);
}
// @codeCoverageIgnoreEnd
}