src/Matcher/ToReceive.php
protected function _check($reference)
    {
        $isString = is_string($reference);
        if ($isString) {
            if (!class_exists($reference)) {
                throw new InvalidArgumentException("Can't Spy the unexisting class `{$reference}`.");
            }
            $reflection = Inspector::inspect($reference);
        } else {
            $reflection = Inspector::inspect(get_class($reference));
        }

        if (!$reflection->isInternal()) {
            return;
        }
        if (!$isString) {
            throw new InvalidArgumentException("Can't Spy built-in PHP instances, create a test double using `Double::instance()`.");
        }
    }
protected function _check($reference)
    {
        $isString = is_string($reference);
        if ($isString) {
            if (!class_exists($reference)) {
                throw new InvalidArgumentException("Can't Spy the unexisting class `{$reference}`.");
            }
            $reflection = Inspector::inspect($reference);
        } else {
            $reflection = Inspector::inspect(get_class($reference));
        }

        if (!$reflection->isInternal()) {
            return;
        }
        if (!$isString) {
            throw new InvalidArgumentException("Can't Spy built-in PHP instances, create a test double using `Double::instance()`.");
        }
    }
protected function _check ( $ reference ) { $ isString = is_string ( $ reference ) ; if ( $ isString ) { if ( ! class_exists ( $ reference ) ) { throw new InvalidArgumentException ( "Can't Spy the unexisting class `{$reference}`." ) ; } $ reflection = Inspector :: inspect ( $ reference ) ; } else { $ reflection = Inspector :: inspect ( get_class ( $ reference ) ) ; } if ( ! $ reflection -> isInternal ( ) ) { return ; } if ( ! $ isString ) { throw new InvalidArgumentException ( "Can't Spy built-in PHP instances, create a test double using `Double::instance()`." ) ; } }
Check the actual value can receive messages.

@param mixed $reference An instance or a fully-namespaced class name.
Check the actual value can receive messages .