Skip to content

Commit 75a59f1

Browse files
committed
Improve documentation regarding deprecated Factory
1 parent a499b82 commit 75a59f1

File tree

2 files changed

+49
-33
lines changed

2 files changed

+49
-33
lines changed

README.md

+38-30
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@ single [`run()`](#run) call that is controlled by the user.
1313

1414
* [Quickstart example](#quickstart-example)
1515
* [Usage](#usage)
16-
* [Loop](#loop)
17-
* [Loop methods](#loop-methods)
18-
* [get()](#get)
19-
* [Factory](#factory)
20-
* [create()](#create)
21-
* [Loop implementations](#loop-implementations)
22-
* [StreamSelectLoop](#streamselectloop)
23-
* [ExtEventLoop](#exteventloop)
24-
* [ExtLibeventLoop](#extlibeventloop)
25-
* [ExtLibevLoop](#extlibevloop)
26-
* [ExtEvLoop](#extevloop)
27-
* [ExtUvLoop](#extuvloop)
28-
* [LoopInterface](#loopinterface)
29-
* [run()](#run)
30-
* [stop()](#stop)
31-
* [addTimer()](#addtimer)
32-
* [addPeriodicTimer()](#addperiodictimer)
33-
* [cancelTimer()](#canceltimer)
34-
* [futureTick()](#futuretick)
35-
* [addSignal()](#addsignal)
36-
* [removeSignal()](#removesignal)
37-
* [addReadStream()](#addreadstream)
38-
* [addWriteStream()](#addwritestream)
39-
* [removeReadStream()](#removereadstream)
40-
* [removeWriteStream()](#removewritestream)
16+
* [Loop](#loop)
17+
* [Loop methods](#loop-methods)
18+
* [get()](#get)
19+
* [~~Factory~~](#factory)
20+
* [~~create()~~](#create)
21+
* [Loop implementations](#loop-implementations)
22+
* [StreamSelectLoop](#streamselectloop)
23+
* [ExtEventLoop](#exteventloop)
24+
* [ExtLibeventLoop](#extlibeventloop)
25+
* [ExtLibevLoop](#extlibevloop)
26+
* [ExtEvLoop](#extevloop)
27+
* [ExtUvLoop](#extuvloop)
28+
* [LoopInterface](#loopinterface)
29+
* [run()](#run)
30+
* [stop()](#stop)
31+
* [addTimer()](#addtimer)
32+
* [addPeriodicTimer()](#addperiodictimer)
33+
* [cancelTimer()](#canceltimer)
34+
* [futureTick()](#futuretick)
35+
* [addSignal()](#addsignal)
36+
* [removeSignal()](#removesignal)
37+
* [addReadStream()](#addreadstream)
38+
* [addWriteStream()](#addwritestream)
39+
* [removeReadStream()](#removereadstream)
40+
* [removeWriteStream()](#removewritestream)
4141
* [Install](#install)
4242
* [Tests](#tests)
4343
* [License](#license)
@@ -262,18 +262,26 @@ Loop::run();
262262

263263
See [`LoopInterface`](#loopinterface) for more details about available methods.
264264

265-
### Factory
265+
### ~~Factory~~
266266

267-
The `Factory` class exists as a convenient way to pick the best available
267+
> Deprecated since v1.2.0, see [`Loop` class](#loop) instead.
268+
269+
The deprecated `Factory` class exists as a convenient way to pick the best available
268270
[event loop implementation](#loop-implementations).
269271

270-
#### create()
272+
#### ~~create()~~
273+
274+
> Deprecated since v1.2.0, see [`Loop::get()`](#get) instead.
271275
272-
The `create(): LoopInterface` method can be used to create a new event loop
273-
instance:
276+
The deprecated `create(): LoopInterface` method can be used to
277+
create a new event loop instance:
274278

275279
```php
280+
// deprecated
276281
$loop = React\EventLoop\Factory::create();
282+
283+
// new
284+
$loop = React\EventLoop\Loop::get();
277285
```
278286

279287
This method always returns an instance implementing [`LoopInterface`](#loopinterface),

src/Factory.php

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,31 @@
33
namespace React\EventLoop;
44

55
/**
6-
* The `Factory` class exists as a convenient way to pick the best available event loop implementation.
6+
* [Deprecated] The `Factory` class exists as a convenient way to pick the best available event loop implementation.
7+
*
8+
* @deprecated 1.2.0 See Loop instead.
9+
* @see Loop
710
*/
811
final class Factory
912
{
1013
/**
11-
* Creates a new event loop instance
14+
* [Deprecated] Creates a new event loop instance
1215
*
1316
* ```php
17+
* // deprecated
1418
* $loop = React\EventLoop\Factory::create();
19+
*
20+
* // new
21+
* $loop = React\EventLoop\Loop::get();
1522
* ```
1623
*
1724
* This method always returns an instance implementing `LoopInterface`,
1825
* the actual event loop implementation is an implementation detail.
1926
*
2027
* This method should usually only be called once at the beginning of the program.
2128
*
22-
* @deprecated Use Loop::get instead
29+
* @deprecated 1.2.0 See Loop::get() instead.
30+
* @see Loop::get()
2331
*
2432
* @return LoopInterface
2533
*/

0 commit comments

Comments
 (0)