src/Gobie/Regex/Wrappers/Mb/MbRegex.php
private static function prepareReplaceMap($pattern, $replacement)
    {
        $isPatternArray     = \is_array($pattern);
        $isReplacementArray = \is_array($replacement) && !\is_callable($replacement);

        if (!$isPatternArray && $isReplacementArray) {
            \trigger_error('Parameter mismatch, pattern is a string while replacement is an array', \E_USER_WARNING);
        }

        if ($isPatternArray) {
            $replacement = $isReplacementArray
                ? \array_pad($replacement, \count($pattern), '')
                : \array_fill(0, \count($pattern), $replacement);
        } else {
            $pattern     = (array) $pattern;
            $replacement = (array) $replacement;
        }

        return \array_map(null, $pattern, $replacement);
    }
private static function prepareReplaceMap($pattern, $replacement)
    {
        $isPatternArray     = \is_array($pattern);
        $isReplacementArray = \is_array($replacement) && !\is_callable($replacement);

        if (!$isPatternArray && $isReplacementArray) {
            \trigger_error('Parameter mismatch, pattern is a string while replacement is an array', \E_USER_WARNING);
        }

        if ($isPatternArray) {
            $replacement = $isReplacementArray
                ? \array_pad($replacement, \count($pattern), '')
                : \array_fill(0, \count($pattern), $replacement);
        } else {
            $pattern     = (array) $pattern;
            $replacement = (array) $replacement;
        }

        return \array_map(null, $pattern, $replacement);
    }
Prepare map (pattern, replacement) from arguments.

@param string|string[]         $pattern     Pattern or array of patterns
@param callable|string|mixed[] $replacement Replacement (string or callback) or array of replacements
@return string[][] Array of pattern and replacement