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
File
-
vendor/
phpspec/ prophecy/ src/ Prophecy/ Prophet.php, line 79
Class
- Prophet
- Prophet creates prophecies.
Namespace
ProphecyCode
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;
}