|
1 | 1 | # Changelog
|
2 | 2 |
|
3 |
| -## 0.5.0 (xxxx-xx-xx) |
| 3 | +## 0.5.0 (2018-04-05) |
4 | 4 |
|
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 |
6 | 227 |
|
7 | 228 | ## 0.4.3 (2017-04-27)
|
8 | 229 |
|
|