src/Provider/Indexable.php
private function buildCallback($type, $object)
    {
        if (!array_key_exists($type, $this->callbacks)) {
            return null;
        }

        $callback = $this->callbacks[$type];

        if (is_callable($callback) or is_callable([$object, $callback])) {
            return $callback;
        }

        if (is_string($callback)) {
            return $this->buildExpressionCallback($type, $object, $callback);
        }

        throw new \InvalidArgumentException(sprintf('Callback for type "%s" is not a valid callback.', $type));
    }
private function buildCallback($type, $object)
    {
        if (!array_key_exists($type, $this->callbacks)) {
            return null;
        }

        $callback = $this->callbacks[$type];

        if (is_callable($callback) or is_callable([$object, $callback])) {
            return $callback;
        }

        if (is_string($callback)) {
            return $this->buildExpressionCallback($type, $object, $callback);
        }

        throw new \InvalidArgumentException(sprintf('Callback for type "%s" is not a valid callback.', $type));
    }
Builds and initialises a callback.

@param string $type
@param object $object

@return callable|string|ExpressionLanguage|null