Skip to content

Commit bb0b679

Browse files
committed
Remove deprecated API and mark Sender as @internal only
1 parent c16c52d commit bb0b679

File tree

3 files changed

+21
-88
lines changed

3 files changed

+21
-88
lines changed

README.md

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,13 @@ mess with most of the low-level details.
4040
* [submit()](#submit)
4141
* [send()](#send)
4242
* [withOptions()](#withoptions)
43-
* [withSender()](#withsender)
4443
* [withBase()](#withbase)
4544
* [withoutBase()](#withoutbase)
4645
* [ResponseInterface](#responseinterface)
4746
* [RequestInterface](#requestinterface)
4847
* [UriInterface](#uriinterface)
4948
* [ResponseException](#responseexception)
5049
* [Advanced](#advanced)
51-
* [Sender](#sender)
5250
* [SOCKS proxy](#socks-proxy)
5351
* [Options](#options)
5452
* [Install](#install)
@@ -106,11 +104,6 @@ $connector = new \React\Socket\Connector($loop, array(
106104
$browser = new Browser($loop, $connector);
107105
```
108106

109-
Legacy notice: This project previously used different APIs that are now
110-
deprecated, but continue to work unchanged. This legacy API will be removed in
111-
a future version, so it's highly recommended to upgrade to the above API.
112-
See also [`Sender`](#sender).
113-
114107
#### Methods
115108

116109
The `Browser` offers several methods that resemble the HTTP protocol methods:
@@ -363,22 +356,6 @@ actually returns a *new* [`Browser`](#browser) instance with the [options](#opti
363356

364357
See [options](#options) for more details.
365358

366-
#### withSender()
367-
368-
> [deprecated] The `Sender` is deprecated and will likely be removed in a
369-
future version.
370-
371-
The `withSender(Sender $sender)` method can be used to change the [`Sender`](#sender) instance to use:
372-
373-
```php
374-
$newBrowser = $browser->withSender($sender);
375-
```
376-
377-
Notice that the [`Browser`](#browser) is an immutable object, i.e. the `withSender()` method
378-
actually returns a *new* [`Browser`](#browser) instance with the given [`Sender`](#sender) applied.
379-
380-
See [`Sender`](#sender) for more details.
381-
382359
#### withBase()
383360

384361
The `withBase($baseUri)` method can be used to change the base URI used to
@@ -457,25 +434,6 @@ The `getResponse()` method can be used to access its underlying [`ResponseIntefa
457434

458435
## Advanced
459436

460-
### Sender
461-
462-
> [deprecated] The `Sender` is deprecated and will likely be removed in a
463-
future version.
464-
465-
The `Sender` is responsible for passing the [`RequestInterface`](#requestinterface) objects to
466-
the underlying [`HttpClient`](https://github.com/reactphp/http-client) library
467-
and keeps track of its transmission and converts its reponses back to [`ResponseInterface`](#responseinterface) objects.
468-
469-
It also registers everything with the main [`EventLoop`](https://github.com/reactphp/event-loop#usage)
470-
and the default [`Connector`](https://github.com/reactphp/socket-client) and [DNS `Resolver`](https://github.com/reactphp/dns).
471-
472-
See also [`Browser::withSender()`](#withsender) for changing the `Sender` instance during runtime.
473-
474-
Legacy notice: The `Sender` class mostly exists in order to abstract changes
475-
on the underlying components away from this package. As such, it offers a number
476-
of legacy APIs that are now deprecated and no longer in active use. These APIs
477-
continue to work unchanged, but will be removed in a future version.
478-
479437
### SOCKS proxy
480438

481439
You can also establish your outgoing connections through a SOCKS proxy server

src/Browser.php

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,13 @@ class Browser
2121
* Instantiate the Browser
2222
*
2323
* @param LoopInterface $loop
24-
* @param ConnectorInterface|Sender|null $connector [optional] Connector to
25-
* use. Should be `null` in order to use default Connector. Passing a
26-
* Sender instance is deprecated and only supported for BC reasons and
27-
* will be removed in future versions.
28-
* @param MessageFactory $messageFactory [internal] Only used internally and
29-
* will be removed in future versions.
24+
* @param ConnectorInterface|null $connector [optional] Connector to use.
25+
* Should be `null` in order to use default Connector.
3026
*/
31-
public function __construct(LoopInterface $loop, $connector = null, MessageFactory $messageFactory = null)
27+
public function __construct(LoopInterface $loop, ConnectorInterface $connector = null)
3228
{
33-
if (!$connector instanceof Sender) {
34-
$connector = Sender::createFromLoop($loop, $connector);
35-
}
36-
if ($messageFactory === null) {
37-
$messageFactory = new MessageFactory();
38-
}
39-
$this->sender = $connector;
40-
$this->messageFactory = $messageFactory;
29+
$this->sender = Sender::createFromLoop($loop, $connector);
30+
$this->messageFactory = new MessageFactory();
4131
}
4232

4333
public function get($url, $headers = array())
@@ -142,13 +132,4 @@ public function withOptions(array $options)
142132

143133
return $browser;
144134
}
145-
146-
/** @deprecated */
147-
public function withSender(Sender $sender)
148-
{
149-
$browser = clone $this;
150-
$browser->sender = $sender;
151-
152-
return $browser;
153-
}
154135
}

src/Io/Sender.php

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@
1616
use React\Stream\ReadableStreamInterface;
1717

1818
/**
19-
* @deprecated as of v1.4.0, see `Browser`
19+
* [Internal] Sends requests and receives responses
20+
*
21+
* The `Sender` is responsible for passing the [`RequestInterface`](#requestinterface) objects to
22+
* the underlying [`HttpClient`](https://github.com/reactphp/http-client) library
23+
* and keeps track of its transmission and converts its reponses back to [`ResponseInterface`](#responseinterface) objects.
24+
*
25+
* It also registers everything with the main [`EventLoop`](https://github.com/reactphp/event-loop#usage)
26+
* and the default [`Connector`](https://github.com/reactphp/socket-client) and [DNS `Resolver`](https://github.com/reactphp/dns).
27+
*
28+
* The `Sender` class mostly exists in order to abstract changes on the underlying
29+
* components away from this package in order to provide backwards and forwards
30+
* compatibility.
31+
*
32+
* @internal You SHOULD NOT rely on this API, it is subject to change without prior notice!
2033
* @see Browser
2134
*/
2235
class Sender
@@ -44,32 +57,13 @@ public static function createFromLoop(LoopInterface $loop, ConnectorInterface $c
4457
return new self(new HttpClient($loop, $connector));
4558
}
4659

47-
/**
48-
* [deprecated] create sender attached to the given event loop and DNS resolver
49-
*
50-
* @param LoopInterface $loop
51-
* @param \React\Dns\Resolver\Resolver|string $dns DNS resolver instance or IP address
52-
* @return self
53-
* @deprecated as of v1.2.0, see createFromLoop()
54-
* @see self::createFromLoop()
55-
*/
56-
public static function createFromLoopDns(LoopInterface $loop, $dns)
57-
{
58-
return self::createFromLoop($loop, new Connector($loop, array(
59-
'dns' => $dns
60-
)));
61-
}
62-
6360
private $http;
6461

6562
/**
66-
* [deprecated] Instantiate Sender
63+
* [internal] Instantiate Sender
6764
*
6865
* @param HttpClient $http
69-
* @deprecated explicitly calling this constructor is deprecated and it
70-
* will be removed in a future version! Please use the above static
71-
* `create*()` methods instead for future compatibility
72-
* @see self::createFromLoop()
66+
* @internal
7367
*/
7468
public function __construct(HttpClient $http)
7569
{

0 commit comments

Comments
 (0)