protected function resolveCallableArguments(
        callable $callable,
        array $providedArguments
    )/*# : array */ {
        // object with __invoke defined or \Closure
        if (is_object($callable) && !$callable instanceof \Closure) {
            $reflector = new \ReflectionClass($callable);
            $method = $reflector->getMethod('__invoke');

        // array-like callable
        } elseif (is_array($callable)) {
            $reflector = new \ReflectionClass($callable[0]);
            $method = $reflector->getMethod($callable[1]);

        // simple function
        } else {
            $method = new \ReflectionFunction($callable);
        }

        // dereference the provided arguments
        $this->dereferenceArray($providedArguments);

        // match provided arguments with method parameter definitions
        return $this->matchMethodArguments(
            $method->getParameters(),
            $providedArguments
        );
    }