public function createRequest($method,
$uri, array
$headers =
[],
$body = null,
$protocolVersion = '1.1'
): RequestInterface
{ if (2 < \
func_num_args()) { trigger_deprecation('symfony/http-client', '6.2', 'Passing more than 2 arguments to "%s()" is deprecated.', __METHOD__
);
} if ($this->responseFactory instanceof RequestFactoryInterface
) { $request =
$this->responseFactory->
createRequest($method,
$uri);
} elseif (class_exists(Psr17FactoryDiscovery::
class)) { $request = Psr17FactoryDiscovery::
findRequestFactory()->
createRequest($method,
$uri);
} elseif (class_exists(Request::
class)) { $request =
new Request($method,
$uri);
} else { throw new \
LogicException(sprintf('You cannot use "%s()" as no PSR-17 factories have been found. Try running "composer require php-http/discovery psr/http-factory-implementation:*".', __METHOD__
));
} $request =
$request ->
withProtocolVersion($protocolVersion) ->
withBody($this->
createStream($body ?? ''
)) ;