function MockMethod::fromReflection
Throws
3 calls to MockMethod::fromReflection()
- Generator::generateCodeForTestDoubleClass in vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ Generator.php - Generator::interfaceMethods in vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ Generator.php - @psalm-param class-string $interfaceName
- Generator::mockClassMethods in vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ Generator.php - @psalm-return list<MockMethod>
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ MockMethod.php, line 75
Class
- MockMethod
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\Framework\MockObject\GeneratorCode
public static function fromReflection(ReflectionMethod $method, bool $callOriginalMethod, bool $cloneArguments) : self {
if ($method->isPrivate()) {
$modifier = 'private';
}
elseif ($method->isProtected()) {
$modifier = 'protected';
}
else {
$modifier = 'public';
}
if ($method->isStatic()) {
$modifier .= ' static';
}
if ($method->returnsReference()) {
$reference = '&';
}
else {
$reference = '';
}
$docComment = $method->getDocComment();
if (is_string($docComment) && preg_match('#\\*[ \\t]*+@deprecated[ \\t]*+(.*?)\\r?+\\n[ \\t]*+\\*(?:[ \\t]*+@|/$)#s', $docComment, $deprecation)) {
$deprecation = trim(preg_replace('#[ \\t]*\\r?\\n[ \\t]*+\\*[ \\t]*+#', ' ', $deprecation[1]));
}
else {
$deprecation = null;
}
return new self($method->getDeclaringClass()
->getName(), $method->getName(), $cloneArguments, $modifier, self::methodParametersForDeclaration($method), self::methodParametersForCall($method), self::methodParametersDefaultValues($method), count($method->getParameters()), (new ReflectionMapper())->fromReturnType($method), $reference, $callOriginalMethod, $method->isStatic(), $deprecation);
}