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

Breadcrumb

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

function Prophet::prophesize

Creates new object prophecy.

@template T of object @phpstan-param class-string<T>|null $classOrInterface @phpstan-return ($classOrInterface is null ? ObjectProphecy<object> : ObjectProphecy<T>)

Parameters

null|string $classOrInterface Class or interface name:

Return value

ObjectProphecy

File

vendor/phpspec/prophecy/src/Prophecy/Prophet.php, line 79

Class

Prophet
Prophet creates prophecies.

Namespace

Prophecy

Code

public function prophesize($classOrInterface = null) {
    $this->prophecies[] = $prophecy = new ObjectProphecy(new LazyDouble($this->doubler), new CallCenter($this->util), $this->revealer);
    if ($classOrInterface) {
        if (class_exists($classOrInterface)) {
            return $prophecy->willExtend($classOrInterface);
        }
        if (interface_exists($classOrInterface)) {
            return $prophecy->willImplement($classOrInterface);
        }
        throw new ClassNotFoundException(sprintf('Cannot prophesize class %s, because it cannot be found.', $classOrInterface), $classOrInterface);
    }
    return $prophecy;
}

API Navigation

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