function Invocation::__construct
@psalm-param class-string $className @psalm-param non-empty-string $methodName
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Runtime/ Invocation.php, line 49
Class
- Invocation
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\Framework\MockObjectCode
public function __construct(string $className, string $methodName, array $parameters, string $returnType, MockObjectInternal|StubInternal $object, bool $cloneObjects = false, bool $proxiedCall = false) {
$this->className = $className;
$this->methodName = $methodName;
$this->object = $object;
$this->proxiedCall = $proxiedCall;
if (strtolower($methodName) === '__tostring') {
$returnType = 'string';
}
if (str_starts_with($returnType, '?')) {
$returnType = substr($returnType, 1);
$this->isReturnTypeNullable = true;
}
else {
$this->isReturnTypeNullable = false;
}
$this->returnType = $returnType;
if (!$cloneObjects) {
$this->parameters = $parameters;
return;
}
foreach ($parameters as $key => $value) {
if (is_object($value)) {
$parameters[$key] = Cloner::clone($value);
}
}
$this->parameters = $parameters;
}