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
        );
    }