private function getFunctionParameters(string $onEvent, callable $function, array $objects) : array
    {
        $parameters = [];

        $reflectionFunction = $this->reflectionTools->getReflectionFunction($function);

        foreach ($reflectionFunction->getParameters() as $reflectionParameter) {
            $parameterClass = $reflectionParameter->getClass();

            if ($parameterClass !== null) {
                $parameterClassName = $parameterClass->getName();

                if (isset($objects[$parameterClassName])) {
                    $parameters[] = $objects[$parameterClassName];

                    continue;
                }
            }

            throw $this->cannotResolveParameter($onEvent, array_keys($objects), $reflectionParameter);
        }

        return $parameters;
    }