public function receivedException($type = null)
{
$cardinality = $this->cardinality;
if ($type instanceof Throwable || $type instanceof Exception) {
$type = $this->matcherFactory->equalTo($type, true);
} elseif ($this->matcherFactory->isMatcher($type)) {
$type = $this->matcherFactory->adapt($type);
}
if ($result = $this->checkReceivedException($type)) {
return $result;
}
return $this->assertionRecorder->createFailure($this->assertionRenderer->renderGeneratorReceivedException($this->subject, $cardinality, $type));
}