src/Exceptions/DifferentValuesException.php
private static function calculateArrayDiff($expected, $actual, $strict)
    {
        if (count($expected) !== count($actual)) {
            throw new \LogicException(
                sprintf(
                    'Array element count mismatch. Found %s, expected %s.',
                    count($actual),
                    count($expected)
                ),
                self::ARRAY_COUNT_MISMATCH
            );
        }

        reset($actual);
        foreach ($expected as $key => $value) {
            if ($key !== key($actual)) {
                throw new \LogicException(
                    sprintf(
                        'Array key mismatch. Found %s, expected %s.',
                        key($actual),
                        $key
                    ),
                    self::ARRAY_KEY_MISMATCH
                );
            }

            try {
                self::calculateDiff($value, current($actual), $strict);
            } catch (\Exception $exception) {
                throw new \LogicException(
                    sprintf(
                        'Array value mismatch for key %s.',
                        key($actual)
                    ),
                    self::ARRAY_VALUE_MISMATCH,
                    $exception
                );
            }
            next($actual);
        }
    }
private static function calculateArrayDiff($expected, $actual, $strict)
    {
        if (count($expected) !== count($actual)) {
            throw new \LogicException(
                sprintf(
                    'Array element count mismatch. Found %s, expected %s.',
                    count($actual),
                    count($expected)
                ),
                self::ARRAY_COUNT_MISMATCH
            );
        }

        reset($actual);
        foreach ($expected as $key => $value) {
            if ($key !== key($actual)) {
                throw new \LogicException(
                    sprintf(
                        'Array key mismatch. Found %s, expected %s.',
                        key($actual),
                        $key
                    ),
                    self::ARRAY_KEY_MISMATCH
                );
            }

            try {
                self::calculateDiff($value, current($actual), $strict);
            } catch (\Exception $exception) {
                throw new \LogicException(
                    sprintf(
                        'Array value mismatch for key %s.',
                        key($actual)
                    ),
                    self::ARRAY_VALUE_MISMATCH,
                    $exception
                );
            }
            next($actual);
        }
    }
Check for differences in arrays.

@param array $expected The expected value.

@param array $actual   The actual value.

@param bool  $strict   Run in strict mode.

@return void

@throws \LogicException When the values differ.