Skip to content

Consistent naming for event loop implementations #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ For the code of the current stable 0.4.x release, checkout the
* [create()](#create)
* [Loop implementations](#loop-implementations)
* [StreamSelectLoop](#streamselectloop)
* [LibEventLoop](#libeventloop)
* [LibEvLoop](#libevloop)
* [ExtEventLoop](#exteventloop)
* [ExtLibeventLoop](#extlibeventloop)
* [ExtLibevLoop](#extlibevloop)
* [LoopInterface](#loopinterface)
* [addtimer()](#addtimer)
* [addPeriodicTimer()](#addperiodictimer)
Expand Down Expand Up @@ -184,7 +184,16 @@ It is commonly installed as part of many PHP distributions.
If this extension is missing (or you're running on Windows), signal handling is
not supported and throws a `BadMethodCallException` instead.

#### LibEventLoop
#### ExtEventLoop

An `ext-event` based event loop.

This uses the [`event` PECL extension](https://pecl.php.net/package/event).
It supports the same backends as libevent.

This loop is known to work with PHP 5.4 through PHP 7+.

#### ExtLibeventLoop

An `ext-libevent` based event loop.

Expand All @@ -198,7 +207,7 @@ To reiterate: Using this event loop on PHP 7 is not recommended.
Accordingly, the [`Factory`](#factory) will not try to use this event loop on
PHP 7.

#### LibEvLoop
#### ExtLibevLoop

An `ext-libev` based event loop.

Expand All @@ -209,15 +218,6 @@ This loop does only work with PHP 5.
An update for PHP 7 is [unlikely](https://github.com/m4rw3r/php-libev/issues/8)
to happen any time soon.

#### ExtEventLoop

An `ext-event` based event loop.

This uses the [`event` PECL extension](https://pecl.php.net/package/event).
It supports the same backends as libevent.

This loop is known to work with PHP 5.4 through PHP 7+.

### LoopInterface

#### addTimer()
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"phpunit/phpunit": "~4.8.35 || ^5.7 || ^6.4"
},
"suggest": {
"ext-libevent": ">=0.1.0 for LibEventLoop and PHP5 only",
"ext-event": "~1.0 for ExtEventLoop",
"ext-libev": "for LibEvLoop",
"ext-pcntl": "For signals support when using the stream_select loop"
"ext-libevent": ">=0.1.0 for ExtLibeventLoop and PHP 5 only",
"ext-libev": "for ExtLibevLoop and PHP 5 only",
"ext-pcntl": "For signal handling support when using the StreamSelectLoop"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/LibEvLoop.php → src/ExtLibevLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @see https://github.com/m4rw3r/php-libev
* @see https://gist.github.com/1688204
*/
class LibEvLoop implements LoopInterface
class ExtLibevLoop implements LoopInterface
{
private $loop;
private $futureTickQueue;
Expand Down
2 changes: 1 addition & 1 deletion src/LibEventLoop.php → src/ExtLibeventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @link https://pecl.php.net/package/libevent
*/
class LibEventLoop implements LoopInterface
class ExtLibeventLoop implements LoopInterface
{
const MICROSECONDS_PER_SECOND = 1000000;

Expand Down
6 changes: 3 additions & 3 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public static function create()
{
// @codeCoverageIgnoreStart
if (class_exists('libev\EventLoop', false)) {
return new LibEvLoop;
return new ExtLibevLoop();
} elseif (class_exists('EventBase', false)) {
return new ExtEventLoop;
return new ExtEventLoop();
} elseif (function_exists('event_base_new') && PHP_VERSION_ID < 70000) {
// only use ext-libevent on PHP < 7 for now
return new LibEventLoop();
return new ExtLibeventLoop();
}

return new StreamSelectLoop();
Expand Down
8 changes: 4 additions & 4 deletions tests/LibEvLoopTest.php → tests/ExtLibevLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

namespace React\Tests\EventLoop;

use React\EventLoop\LibEvLoop;
use React\EventLoop\ExtLibevLoop;

class LibEvLoopTest extends AbstractLoopTest
class ExtLibevLoopTest extends AbstractLoopTest
{
public function createLoop()
{
if (!class_exists('libev\EventLoop')) {
$this->markTestSkipped('libev tests skipped because ext-libev is not installed.');
}

return new LibEvLoop();
return new ExtLibevLoop();
}

public function testLibEvConstructor()
{
$loop = new LibEvLoop();
$loop = new ExtLibevLoop();
}
}
6 changes: 3 additions & 3 deletions tests/LibEventLoopTest.php → tests/ExtLibeventLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace React\Tests\EventLoop;

use React\EventLoop\LibEventLoop;
use React\EventLoop\ExtLibeventLoop;

class LibEventLoopTest extends AbstractLoopTest
class ExtLibeventLoopTest extends AbstractLoopTest
{
private $fifoPath;

Expand All @@ -18,7 +18,7 @@ public function createLoop()
$this->markTestSkipped('libevent tests skipped because ext-libevent is not installed.');
}

return new LibEventLoop();
return new ExtLibeventLoop();
}

public function tearDown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

namespace React\Tests\EventLoop\Timer;

use React\EventLoop\LibEvLoop;
use React\EventLoop\ExtLibevLoop;

class LibEvTimerTest extends AbstractTimerTest
class ExtLibevTimerTest extends AbstractTimerTest
{
public function createLoop()
{
if (!class_exists('libev\EventLoop')) {
$this->markTestSkipped('libev tests skipped because ext-libev is not installed.');
}

return new LibEvLoop();
return new ExtLibevLoop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

namespace React\Tests\EventLoop\Timer;

use React\EventLoop\LibEventLoop;
use React\EventLoop\ExtLibeventLoop;

class LibEventTimerTest extends AbstractTimerTest
class ExtLibeventTimerTest extends AbstractTimerTest
{
public function createLoop()
{
if (!function_exists('event_base_new')) {
$this->markTestSkipped('libevent tests skipped because ext-libevent is not installed.');
}

return new LibEventLoop();
return new ExtLibeventLoop();
}
}