Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated package php-http/message-factory to psr/http-factory #300

Draft
wants to merge 5 commits into
base: 3.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,5 @@
<UnresolvableInclude errorLevel="info" />

<RawObjectIteration errorLevel="info" />

<!-- Disable error caused by deprecated interface-->
<DeprecatedInterface errorLevel="info" />
</issueHandlers>
</psalm>
15 changes: 9 additions & 6 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
use Http\Discovery\MessageFactoryDiscovery;
use Http\Discovery\UriFactoryDiscovery;
use Http\Message\Authentication;
use Http\Message\UriFactory;
use Psr\Http\Message\UriFactoryInterface;
use Psr\Http\Client\ClientInterface as HttpClient;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -66,7 +66,7 @@ class Client implements ClientInterface

public const CONFIG_RETRY_PLUGIN_CONFIG = 'retry_plugin_config';

/** @var \Http\Message\UriFactory */
/** @var UriFactoryInterface */
private $uriFactory;

/** @var string|null */
Expand Down Expand Up @@ -122,7 +122,7 @@ class Client implements ClientInterface
* User agent prefix.
* - Apigee\Edge\Client::CONFIG_HTTP_CLIENT_BUILDER: \Apigee\Edge\HttpClient\Utility\BuilderInterface|null
* Http client builder.
* - Apigee\Edge\Client::CONFIG_URI_FACTORY: \Http\Message\UriFactory|null
* - Apigee\Edge\Client::CONFIG_URI_FACTORY: \Psr\Http\Message\UriFactoryInterface|null
* Factory for PSR-7 URIs.
* - Apigee\Edge\Client::CONFIG_REQUEST_FACTORY: \Http\Message\RequestFactory|null
* Factory for PSR-7 Requests.
Expand Down Expand Up @@ -153,9 +153,12 @@ public function getJournal(): JournalInterface
}

/**
* {@inheritdoc}
* Create a new URI.
*
* @return UriFactoryInterface
*/
public function getUriFactory(): UriFactory
#[\ReturnTypeWillChange]
public function getUriFactory(): UriFactoryInterface
{
return $this->uriFactory;
}
Expand Down Expand Up @@ -266,7 +269,7 @@ protected function configureOptions(OptionsResolver $resolver): void
$resolver->setAllowedTypes(static::CONFIG_USER_AGENT_PREFIX, ['null', 'string']);
$resolver->setAllowedTypes(static::CONFIG_HTTP_CLIENT_BUILDER, ['null', '\Apigee\Edge\HttpClient\Utility\BuilderInterface']);
$resolver->setAllowedTypes(static::CONFIG_JOURNAL, ['null', '\Apigee\Edge\HttpClient\Utility\JournalInterface']);
$resolver->setAllowedTypes(static::CONFIG_URI_FACTORY, ['null', '\Http\Message\UriFactory']);
$resolver->setAllowedTypes(static::CONFIG_URI_FACTORY, ['null', '\Psr\Http\Message\UriFactoryInterface']);
$resolver->setAllowedTypes(static::CONFIG_REQUEST_FACTORY, ['null', '\Http\Message\RequestFactory']);
$resolver->setAllowedTypes(static::CONFIG_ERROR_FORMATTER, ['null', '\Http\Message\Formatter']);
$resolver->setAllowedTypes(static::CONFIG_RETRY_PLUGIN_CONFIG, ['null', 'array']);
Expand Down
7 changes: 5 additions & 2 deletions src/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
namespace Apigee\Edge;

use Apigee\Edge\HttpClient\Utility\JournalInterface;
use Http\Message\UriFactory;
use Psr\Http\Client\ClientInterface as HttpClient;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriFactoryInterface;

/**
* Interface ClientInterface.
Expand Down Expand Up @@ -75,8 +75,11 @@ public function getJournal(): JournalInterface;

/**
* Returns the URI factory used by the Client.
*
* @return UriFactoryInterface
*/
public function getUriFactory(): UriFactory;
#[\ReturnTypeWillChange]
public function getUriFactory(): UriFactoryInterface;

/**
* Returns the version of the API client.
Expand Down
Loading