protected function mergeArguments(array $injections, array $arguments)
    {
        // Get total count of arguments
        $numberOfArguments = count($injections) + count($arguments);

        // Prepare an array with null values for given count
        $result = array_fill(0, $numberOfArguments, null);

        // Get count of injections for performance reasons outside loop
        $countInjections = count($injections);

        // Iterate the injections and position them in result
        for ($i = 0; $i < $countInjections; ++$i) {
            if (null !== $injections[$i]['position']) {
                $position = $injections[$i]['position'] - 1;
            } else {
                $position = $i;
            }

            $result[$position] = $injections[$i]['instance'];
        }

        // Iterate over remaining arguments and fill in the holes
        foreach ($result as $key => $value) {
            if ($result[$key] === null) {
                $result[$key] = array_shift($arguments);
            }
        }

        return $result;
    }