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
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\DoublerCode
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;
}