Skip to content

Commit e2dfaeb

Browse files
committed
mark classes as final and methods and properties as private
1 parent 14a2a39 commit e2dfaeb

6 files changed

+9
-10
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Changed
66
- Abstract method `HttpClientPool::chooseHttpClient()` has now an explicit return type (`Http\Client\Common\HttpClientPoolItem`)
77
- Interface method `Plugin::handleRequest(...)` has now an explicit return type (`Http\Promise\Promise`)
8+
- Made all classes final as they are not intended to be extended.
89

910
### Removed
1011
- Deprecated option `debug_plugins` has been removed from `PluginClient`

src/BatchClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @author Joel Wurtz <jwurtz@jolicode.com>
1717
*/
18-
class BatchClient implements HttpClient
18+
final class BatchClient implements HttpClient
1919
{
2020
/**
2121
* @var HttpClient

src/Deferred.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/**
1010
* A deferred allow to return a promise which has not been resolved yet.
1111
*/
12-
class Deferred implements Promise
12+
final class Deferred implements Promise
1313
{
1414
private $value;
1515

src/HttpClientPoolItem.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @author Joel Wurtz <joel.wurtz@gmail.com>
1818
*/
19-
class HttpClientPoolItem implements HttpClient, HttpAsyncClient
19+
final class HttpClientPoolItem implements HttpClient, HttpAsyncClient
2020
{
2121
/**
2222
* @var int Number of request this client is currently sending

src/HttpClientRouter.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
/**
1313
* Route a request to a specific client in the stack based using a RequestMatcher.
1414
*
15+
* This is not a HttpClientPool client because it uses a matcher to select the client.
16+
*
1517
* @author Joel Wurtz <joel.wurtz@gmail.com>
1618
*/
1719
final class HttpClientRouter implements HttpClient, HttpAsyncClient
@@ -26,19 +28,15 @@ final class HttpClientRouter implements HttpClient, HttpAsyncClient
2628
*/
2729
public function sendRequest(RequestInterface $request): ResponseInterface
2830
{
29-
$client = $this->chooseHttpClient($request);
30-
31-
return $client->sendRequest($request);
31+
return $this->chooseHttpClient($request)->sendRequest($request);
3232
}
3333

3434
/**
3535
* {@inheritdoc}
3636
*/
3737
public function sendAsyncRequest(RequestInterface $request)
3838
{
39-
$client = $this->chooseHttpClient($request);
40-
41-
return $client->sendAsyncRequest($request);
39+
return $this->chooseHttpClient($request)->sendAsyncRequest($request);
4240
}
4341

4442
/**

src/HttpMethodsClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
2525
* @author David Buchmann <mail@davidbu.ch>
2626
*/
27-
class HttpMethodsClient implements HttpClient
27+
final class HttpMethodsClient implements HttpClient
2828
{
2929
/**
3030
* @var HttpClient

0 commit comments

Comments
 (0)