src/Exceptions/DifferentValuesException.php
private static function calculateDiff($expected, $actual, $strict)
    {
        if ($expected === $actual) {
            return;
        }

        if (gettype($expected) !== gettype($actual)) {
            // Only exception of the rule: array values are transported as empty string.
            if (!$strict && self::isEmptyArrayEquivalent($expected, $actual)) {
                return;
            }

            throw new \LogicException(
                sprintf(
                    'Encountered type %s expected %s (Found %s, expected %s)',
                    gettype($actual),
                    gettype($expected),
                    var_export($actual, true),
                    var_export($expected, true)
                ),
                self::TYPE_MISMATCH
            );
        }

        if (is_array($expected)) {
            self::calculateArrayDiff($expected, $actual, $strict);
        }

        throw new \LogicException(
            sprintf(
                'Found %s expected %s',
                var_export($actual, true),
                var_export($expected, true)
            ),
            self::VALUE_MISMATCH
        );
    }
private static function calculateDiff($expected, $actual, $strict)
    {
        if ($expected === $actual) {
            return;
        }

        if (gettype($expected) !== gettype($actual)) {
            // Only exception of the rule: array values are transported as empty string.
            if (!$strict && self::isEmptyArrayEquivalent($expected, $actual)) {
                return;
            }

            throw new \LogicException(
                sprintf(
                    'Encountered type %s expected %s (Found %s, expected %s)',
                    gettype($actual),
                    gettype($expected),
                    var_export($actual, true),
                    var_export($expected, true)
                ),
                self::TYPE_MISMATCH
            );
        }

        if (is_array($expected)) {
            self::calculateArrayDiff($expected, $actual, $strict);
        }

        throw new \LogicException(
            sprintf(
                'Found %s expected %s',
                var_export($actual, true),
                var_export($expected, true)
            ),
            self::VALUE_MISMATCH
        );
    }
Helper to determine if two values are the same.

@param mixed $expected The expected value.

@param mixed $actual   The actual value.

@param bool  $strict   Run in strict mode.

@return void

@throws \LogicException When the values differ.