src/Call/CallVerifier.php
public function threw($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->checkThrew($type)) {
            return $result;
        }

        return $this->assertionRecorder->createFailure(
            $this->assertionRenderer
                ->renderThrew($this->call, $cardinality, $type)
        );
    }
public function threw($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->checkThrew($type)) {
            return $result;
        }

        return $this->assertionRecorder->createFailure(
            $this->assertionRenderer
                ->renderThrew($this->call, $cardinality, $type)
        );
    }
public function threw ( $ 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 -> checkThrew ( $ type ) ) { return $ result ; } return $ this -> assertionRecorder -> createFailure ( $ this -> assertionRenderer -> renderThrew ( $ this -> call , $ cardinality , $ type ) ) ; }
Throws an exception unless this call threw 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 InvalidCardinalityException If the cardinality is invalid.
@throws InvalidArgumentException    If the type is invalid.
@throws Throwable                   If the assertion fails, and the assertion recorder throws exceptions.
Throws an exception unless this call threw an exception of the supplied type .