Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Invocation.php

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\MockObject

Code

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;
}
RSS feed
Powered by Drupal