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

Breadcrumb

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

function LazyDouble::setParentClass

Tells doubler to use specific class as parent one for double.

@template U of object @phpstan-param class-string<U>|ReflectionClass<U> $class @phpstan-this-out static<U>

Parameters

class-string|ReflectionClass<object> $class:

Return value

void

Throws

ClassNotFoundException

DoubleException

File

vendor/phpspec/prophecy/src/Prophecy/Doubler/LazyDouble.php, line 66

Class

LazyDouble
Lazy double. Gives simple interface to describe double before creating it.

Namespace

Prophecy\Doubler

Code

public function setParentClass($class) {
    if (null !== $this->double) {
        throw new DoubleException('Can not extend class with already instantiated double.');
    }
    if (!$class instanceof ReflectionClass) {
        if (!class_exists($class)) {
            throw new ClassNotFoundException(sprintf('Class %s not found.', $class), $class);
        }
        $class = new ReflectionClass($class);
    }
    
    /** @var static<U> $this */
    $this->class = $class;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal