src/Verification/GeneratorVerifier.php
public function receivedException($type = null): ?EventCollection
    {
        $cardinality = $this->cardinality;

        if ($type instanceof InstanceHandle) {
            $type = $type->get();
        }

        if ($type instanceof Throwable) {
            $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
            )
        );
    }
public function receivedException($type = null): ?EventCollection
    {
        $cardinality = $this->cardinality;

        if ($type instanceof InstanceHandle) {
            $type = $type->get();
        }

        if ($type instanceof Throwable) {
            $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
            )
        );
    }
public function receivedException ( $ type = null ) : ? EventCollection { $ cardinality = $ this -> cardinality ; if ( $ type instanceof InstanceHandle ) { $ type = $ type -> get ( ) ; } if ( $ type instanceof Throwable ) { $ 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 ) ) ; }
Throws an exception unless the subject received an exception of the
supplied type.

@param Matcher|Throwable|string|null $type An exception to match, the type of exception, or null for any exception.

@return EventCollection|null     The result, or null if the assertion recorder does not throw exceptions.
@throws InvalidArgumentException If the type is invalid.
@throws Throwable                If the assertion fails, and the assertion recorder throws exceptions.
Throws an exception unless the subject received an exception of the supplied type .