src/Call/CallVerifier.php
public function checkReturned($value = null): ?EventCollection
    {
        $cardinality = $this->resetCardinality()->assertSingular();

        if ($responseEvent = $this->call->responseEvent()) {
            list($exception, $returnValue) = $this->call->response();

            $hasReturned = !$exception;
        } else {
            $returnValue = null;
            $hasReturned = false;
        }

        if (0 === func_num_args()) {
            list($matchCount, $matchingEvents) =
                $this->matchIf($responseEvent, $hasReturned);

            if ($cardinality->matches($matchCount, 1)) {
                return $this->assertionRecorder->createSuccess($matchingEvents);
            }

            return null;
        }

        $value = $this->matcherFactory->adapt($value);

        list($matchCount, $matchingEvents) = $this->matchIf(
            $responseEvent,
            $hasReturned && $value->matches($returnValue)
        );

        if ($cardinality->matches($matchCount, 1)) {
            return $this->assertionRecorder->createSuccess($matchingEvents);
        }

        return null;
    }
public function checkReturned($value = null): ?EventCollection
    {
        $cardinality = $this->resetCardinality()->assertSingular();

        if ($responseEvent = $this->call->responseEvent()) {
            list($exception, $returnValue) = $this->call->response();

            $hasReturned = !$exception;
        } else {
            $returnValue = null;
            $hasReturned = false;
        }

        if (0 === func_num_args()) {
            list($matchCount, $matchingEvents) =
                $this->matchIf($responseEvent, $hasReturned);

            if ($cardinality->matches($matchCount, 1)) {
                return $this->assertionRecorder->createSuccess($matchingEvents);
            }

            return null;
        }

        $value = $this->matcherFactory->adapt($value);

        list($matchCount, $matchingEvents) = $this->matchIf(
            $responseEvent,
            $hasReturned && $value->matches($returnValue)
        );

        if ($cardinality->matches($matchCount, 1)) {
            return $this->assertionRecorder->createSuccess($matchingEvents);
        }

        return null;
    }
public function checkReturned ( $ value = null ) : ? EventCollection { $ cardinality = $ this -> resetCardinality ( ) -> assertSingular ( ) ; if ( $ responseEvent = $ this -> call -> responseEvent ( ) ) { list ( $ exception , $ returnValue ) = $ this -> call -> response ( ) ; $ hasReturned = ! $ exception ; } else { $ returnValue = null ; $ hasReturned = false ; } if ( 0 === func_num_args ( ) ) { list ( $ matchCount , $ matchingEvents ) = $ this -> matchIf ( $ responseEvent , $ hasReturned ) ; if ( $ cardinality -> matches ( $ matchCount , 1 ) ) { return $ this -> assertionRecorder -> createSuccess ( $ matchingEvents ) ; } return null ; } $ value = $ this -> matcherFactory -> adapt ( $ value ) ; list ( $ matchCount , $ matchingEvents ) = $ this -> matchIf ( $ responseEvent , $ hasReturned && $ value -> matches ( $ returnValue ) ) ; if ( $ cardinality -> matches ( $ matchCount , 1 ) ) { return $ this -> assertionRecorder -> createSuccess ( $ matchingEvents ) ; } return null ; }
Checks if this call returned the supplied value.

When called with no arguments, this method simply checks that the call
returned any value.

@param mixed $value The value.

@return EventCollection|null        The result.
@throws InvalidCardinalityException If the cardinality is invalid.
Checks if this call returned the supplied value .