private function buildParameterArray($methodSignature, $providedParameters)
    {
        $parameters = [];
        foreach ($methodSignature as $position => $parameterData) {
            if (!isset($parameterData['variadic'])) {
                $parameters[$position] = $this->resolveParameter($position, $parameterData, $providedParameters);
            } else {
                // variadic parameter must be the last one, so
                // the rest of the provided paramters should be piped
                // into it to mimic native php behaviour
                foreach ($providedParameters as $variadicParameter) {
                    $parameters[] = $variadicParameter;
                }
            }
        }
        return $parameters;
    }