diff --git a/CHANGELOG.md b/CHANGELOG.md index c6a01d9..183b001 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Changed - Abstract method `HttpClientPool::chooseHttpClient()` has now an explicit return type (`Http\Client\Common\HttpClientPoolItem`) - Interface method `Plugin::handleRequest(...)` has now an explicit return type (`Http\Promise\Promise`) +- Made all classes final as they are not intended to be extended. ### Removed - Deprecated option `debug_plugins` has been removed from `PluginClient` diff --git a/src/BatchClient.php b/src/BatchClient.php index 8dfeb81..38532ed 100644 --- a/src/BatchClient.php +++ b/src/BatchClient.php @@ -15,7 +15,7 @@ * * @author Joel Wurtz */ -class BatchClient implements HttpClient +final class BatchClient implements HttpClient { /** * @var HttpClient diff --git a/src/Deferred.php b/src/Deferred.php index 7413451..c294a8d 100644 --- a/src/Deferred.php +++ b/src/Deferred.php @@ -9,7 +9,7 @@ /** * A deferred allow to return a promise which has not been resolved yet. */ -class Deferred implements Promise +final class Deferred implements Promise { private $value; diff --git a/src/HttpClientPoolItem.php b/src/HttpClientPoolItem.php index a46ee2f..becde17 100644 --- a/src/HttpClientPoolItem.php +++ b/src/HttpClientPoolItem.php @@ -16,7 +16,7 @@ * * @author Joel Wurtz */ -class HttpClientPoolItem implements HttpClient, HttpAsyncClient +final class HttpClientPoolItem implements HttpClient, HttpAsyncClient { /** * @var int Number of request this client is currently sending diff --git a/src/HttpClientRouter.php b/src/HttpClientRouter.php index 00ca15f..d4e00df 100644 --- a/src/HttpClientRouter.php +++ b/src/HttpClientRouter.php @@ -12,6 +12,8 @@ /** * Route a request to a specific client in the stack based using a RequestMatcher. * + * This is not a HttpClientPool client because it uses a matcher to select the client. + * * @author Joel Wurtz */ final class HttpClientRouter implements HttpClient, HttpAsyncClient @@ -26,9 +28,7 @@ final class HttpClientRouter implements HttpClient, HttpAsyncClient */ public function sendRequest(RequestInterface $request): ResponseInterface { - $client = $this->chooseHttpClient($request); - - return $client->sendRequest($request); + return $this->chooseHttpClient($request)->sendRequest($request); } /** @@ -36,9 +36,7 @@ public function sendRequest(RequestInterface $request): ResponseInterface */ public function sendAsyncRequest(RequestInterface $request) { - $client = $this->chooseHttpClient($request); - - return $client->sendAsyncRequest($request); + return $this->chooseHttpClient($request)->sendAsyncRequest($request); } /** diff --git a/src/HttpMethodsClient.php b/src/HttpMethodsClient.php index bc02ef8..082575a 100644 --- a/src/HttpMethodsClient.php +++ b/src/HttpMethodsClient.php @@ -24,7 +24,7 @@ * @author Márk Sági-Kazár * @author David Buchmann */ -class HttpMethodsClient implements HttpClient +final class HttpMethodsClient implements HttpClient { /** * @var HttpClient