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

Breadcrumb

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

function ProphecyTrait::prophesize

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

@not-deprecated

Throws

DoubleException

InterfaceNotFoundException

File

vendor/phpspec/prophecy-phpunit/src/ProphecyTrait.php, line 45

Class

ProphecyTrait
@mixin TestCase

Namespace

Prophecy\PhpUnit

Code

protected function prophesize(?string $classOrInterface = null) : ObjectProphecy {
    static $isPhpUnit9;
    $isPhpUnit9 = $isPhpUnit9 ?? method_exists($this, 'recordDoubledType');
    if (!$isPhpUnit9) {
        // PHPUnit 10.1
        $this->registerFailureType(PredictionException::class);
    }
    elseif (\is_string($classOrInterface)) {
        // PHPUnit 9
        \assert($this instanceof TestCase);
        $this->recordDoubledType($classOrInterface);
    }
    return $this->getProphet()
        ->prophesize($classOrInterface);
}

API Navigation

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