8000 Prepare v0.5.0 release · reactphp/event-loop@f3ab8ed · GitHub
[go: up one dir, main page]

Skip to content

Commit f3ab8ed

Browse files
committed
Prepare v0.5.0 release
1 parent 4ea7246 commit f3ab8ed

File tree

3 files changed

+231
-13
lines changed

3 files changed

+231
-13
lines changed

CHANGELOG.md

Lines changed: 223 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,229 @@
11
# Changelog
22

3-
## 0.5.0 (xxxx-xx-xx)
3+
## 0.5.0 (2018-04-05)
44

5-
* BC break: Remove `LoopInterface::tick()` (@jsor, #72)
5+
A major feature release with a significant documentation overhaul and long overdue API cleanup!
6+
7+
This update involves a number of BC breaks due to dropped support for deprecated
8+
functionality. We've tried hard to avoid BC breaks where possible and minimize
9+
impact otherwise. We expect that most consumers of this package will actually
10+
not be affected by any BC breaks, see below for more details.
11+
12+
We realize that the changes listed below may seem overwhelming, but we've tried
13+
to be very clear about any possible BC breaks. Don't worry: In fact, all ReactPHP
14+
components are already compatible and support both this new release as well as
15+
providing backwards compatibility with the last release.
16+
17+
* Feature / BC break: Add support for signal handling via new
18+
`LoopInterface::addSignal()` and `LoopInterface::removeSignal()` methods.
19+
(#104 by @WyriHaximus and #111 and #150 by @clue)
20+
21+
```php
22+
$loop->addSignal(SIGINT, function () {
23+
echo 'CTRL-C';
24+
});
25+
```
26+
27+
* Feature: Significant documentation updates for `LoopInterface` and `Factory`.
28+
(#100, #119, #126, #127, #159 and #160 by @clue, #113 by @WyriHaximus and #81 and #91 by @jsor)
29+
30+
* Feature: Add examples to ease getting started
31+
(#99, #100 and #125 by @clue, #59 by @WyriHaximus and #143 by @jsor)
32+
33+
* Feature: Documentation for advanced timer concepts, such as monotonic time source vs wall-clock time
34+
and high precision timers with millisecond accuracy or below.
35+
(#130 and #157 by @clue)
36+
37+
* Feature: Documentation for advanced stream concepts, such as edge-triggered event listeners
38+
and stream buffers and allow throwing Exception if stream resource is not supported.
39+
(#129 and #158 by @clue)
40+
41+
* Feature: Throw `BadMethodCallException` on manual loop creation when required extension isn't installed.
42+
(#153 by @WyriHaximus)
43+
44+
* Feature / BC break: First class support for legacy PHP 5.3 through PHP 7.2 and HHVM
45+
and remove all `callable` type hints for consistency reasons.
46+
(#141 and #151 by @clue)
47+
48+
* BC break: Documentation for timer API and clean up unneeded timer API.
49+
(#102 by @clue)
50+
51+
Remove `TimerInterface::cancel()`, use `LoopInterface::cancelTimer()` instead:
52+
53+
```php
54+
// old (method invoked on timer instance)
55+
$timer->cancel();
56+
57+
// already supported before: invoke method on loop instance
58+
$loop->cancelTimer($timer);
59+
```
60+
61+
Remove unneeded `TimerInterface::setData()` and `TimerInterface::getData()`,
62+
use closure binding to add arbitrary data to timer instead:
63+
64+
```php
65+
// old (limited setData() and getData() only allows single variable)
66+
$name = 'Tester';
67+
$timer = $loop->addTimer(1.0, function ($timer) {
68+
echo 'Hello ' . $timer->getData() . PHP_EOL;
69+
});
70+
$timer->setData($name);
71+
72+
// already supported before: closure binding allows any number of variables
73+
$name = 'Tester';
74+
$loop->addTimer(1.0, function () use ($name) {
75+
echo 'Hello ' . $name . PHP_EOL;
76+
});
77+
```
78+
79+
Remove unneeded `TimerInterface::getLoop()`, use closure binding instead:
80+
81+
```php
82+
// old (getLoop() called on timer instance)
83+
$loop->addTimer(0.1, function ($timer) {
84+
$timer->getLoop()->stop();
85+
});
86+
87+
// already supported before: use closure binding as usual
88+
$loop->addTimer(0.1, function () use ($loop) {
89+
$loop->stop();
90+
});
91+
```
92+
93+
* BC break: Remove unneeded `LoopInterface::isTimerActive()` and
94+
`TimerInterface::isActive()` to reduce API surface.
95+
(#133 by @clue)
96+
97+
```php
98+
// old (method on timer instance or on loop instance)
99+
$timer->isActive();
100+
$loop->isTimerActive($timer);
101+
```
102+
103+
* BC break: Move `TimerInterface` one level up to `React\EventLoop\TimerInterface`.
104+
(#138 by @WyriHaximus)
105+
106+
```php
107+
// old (notice obsolete "Timer" namespace)
108+
assert($timer instanceof React\EventLoop\Timer\TimerInterface);
109+
110+
// new
111+
assert($timer instanceof React\EventLoop\TimerInterface);
112+
```
113+
114+
* BC break: Remove unneeded `LoopInterface::nextTick()` (and internal `NextTickQueue`),
115+
use `LoopInterface::futureTick()` instead.
116+
(#30 by @clue)
117+
118+
```php
119+
// old (removed)
120+
$loop->nextTick(function () {
121+
echo 'tick';
122+
});
123+
124+
// already supported before
125+
$loop->futureTick(function () {
126+
echo 'tick';
127+
});
128+
```
129+
130+
* BC break: Remove unneeded `$loop` argument for `LoopInterface::futureTick()`
131+
(and fix internal cyclic dependency).
132+
(#103 by @clue)
133+
134+
```php
135+
// old ($loop gets passed by default)
136+
$loop->futureTick(function ($loop) {
137+
$loop->stop();
138+
});
139+
140+
// already supported before: use closure binding as usual
141+
$loop->futureTick(function () use ($loop) {
142+
$loop->stop();
143+
});
144+
```
145+
146+
* BC break: Remove unneeded `LoopInterface::tick()`.
147+
(#72 by @jsor)
148+
149+
```php
150+
// old (removed)
151+
$loop->tick();
152+
153+
// suggested work around for testing purposes only
154+
$loop->futureTick(function () use ($loop) {
155+
$loop->stop();
156+
});
157+
```
158+
159+
* BC break: Documentation for advanced stream API and clean up unneeded stream API.
160+
(#110 by @clue)
161+
162+
Remove unneeded `$loop` argument for `LoopInterface::addReadStream()`
163+
and `LoopInterface::addWriteStream()`, use closure binding instead:
164+
165+
```php
166+
// old ($loop gets passed by default)
167+
$loop->addReadStream($stream, function ($stream, $loop) {
168+
$loop->removeReadStream($stream);
169+
});
170+
171+
// already supported before: use closure binding as usual
172+
$loop->addReadStream($stream, function ($stream) use ($loop) {
173+
$loop->removeReadStream($stream);
174+
});
175+
```
176+
177+
* BC break: Remove unneeded `LoopInterface::removeStream()` method,
178+
use `LoopInterface::removeReadStream()` and `LoopInterface::removeWriteStream()` instead.
179+
(#118 by @clue)
180+
181+
```php
182+
// old
183+
$loop->removeStream($stream);
184+
185+
// already supported before
186+
$loop->removeReadStream($stream);
187+
$loop->removeWriteStream($stream);
188+
```
189+
190+
* BC break: Rename `LibEventLoop` to `ExtLibeventLoop` and `LibEvLoop` to `ExtLibevLoop`
191+
for consistent naming for event loop implementations.
192+
(#128 by @clue)
193+
194+
* BC break: Remove optional `EventBaseConfig` argument from `ExtEventLoop`
195+
and make its `FEATURE_FDS` enabled by default.
196+
(#156 by @WyriHaximus)
197+
198+
* BC break: Mark all classes as final to discourage inheritance.
199+
(#131 by @clue)
200+
201+
* Fix: Fix `ExtEventLoop` to keep track of stream resources (refcount)
202+
(#123 by @clue)
203+
204+
* Fix: Ensure large timer interval does not overflow on 32bit systems
205+
(#132 by @clue)
206+
207+
* Fix: Fix separately removing readable and writable side of stream when closing
208+
(#139 by @clue)
209+
210+
* Fix: Properly clean up event watchers for `ext-event` and `ext-libev`
211+
(#149 by @clue)
212+
213+
* Fix: Minor code cleanup and remove unneeded references
214+
(#145 by @seregazhuk)
215+
216+
* Fix: Discourage outdated `ext-libevent` on PHP 7
217+
(#62 by @cboden)
218+
219+
* Improve test suite by adding forward compatibility with PHPUnit 6 and PHPUnit 5,
220+
lock Travis distro so new defaults will not break the build,
221+
improve test suite to be less fragile and increase test timeouts,
222+
test against PHP 7.2 and reduce fwrite() call length to one chunk.
223+
(#106 and #144 by @clue, #120 and #124 by @carusogabriel, #147 by nawarian and #92 by @kelunik)
224+
225+
* A number of changes were originally planned for this release but have been backported
226+
to the last `v0.4.3` already: #74, #76, #79, #81 (refs #65, #66, #67), #88 and #93
6227

7228
## 0.4.3 (2017-04-27)
8229

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
# EventLoop Component
22

33
[![Build Status](https://travis-ci.org/reactphp/event-loop.svg?branch=master)](https://travis-ci.org/reactphp/event-loop)
4-
[![Code Climate](https://codeclimate.com/github/reactphp/event-loop/badges/gpa.svg)](https://codeclimate.com/github/reactphp/event-loop)
54

6-
Event loop abstraction layer that libraries can use for evented I/O.
5+
[ReactPHP](https://reactphp.org/)'s core reactor event loop that libraries can use for evented I/O.
76

87
In order for async based libraries to be interoperable, they need to use the
98
same event loop. This component provides a common `LoopInterface` that any
109
library can target. This allows them to be used in the same loop, with one
1110
single [`run()`](#run) call that is controlled by the user.
1211

13-
> The master branch contains the code for the upcoming 0.5 release.
14-
For the code of the current stable 0.4.x release, checkout the
15-
[0.4 branch](https://github.com/reactphp/event-loop/tree/0.4).
16-
1712
**Table of Contents**
1813

1914
* [Quickstart example](#quickstart-example)
@@ -649,15 +644,17 @@ to remove a stream that was never added or is invalid has no effect.
649644

650645
## Install
651646

652-
The recommended way to install this library is [through Composer](http://getcomposer.org).
653-
[New to Composer?](http://getcomposer.org/doc/00-intro.md)
647+
The recommended way to install this library is [through Composer](https://getcomposer.org).
648+
[New to Composer?](https://getcomposer.org/doc/00-intro.md)
654649

655650
This will install the latest supported version:
656651

657652
```bash
658-
$ composer require react/event-loop
653+
$ composer require react/event-loop:^0.5
659654
```
660655

656+
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
657+
661658
This project aims to run on any platform and thus does not require any PHP
662659
extensions and supports running on legacy PHP 5.3 through current PHP 7+ and
663660
HHVM.
@@ -669,7 +666,7 @@ See also [event loop implementations](#loop-implementations) for more details.
669666
## Tests
670667

671668
To run the test suite, you first need to clone this repo and then install all
672-
dependencies [through Composer](http://getcomposer.org):
669+
dependencies [through Composer](https://getcomposer.org):
673670

674671
```bash
675672
$ composer install

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react/event-loop",
3-
"description": "Event loop abstraction layer that libraries can use for evented I/O.",
3+
"description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.",
44
"keywords": ["event-loop", "asynchronous"],
55
"license": "MIT",
66
"require": {

0 commit comments

Comments
 (0)
0