From fc7b47d2679727a44c522433f5523406266151b1 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Fri, 22 Jun 2018 22:33:31 +0200 Subject: [PATCH 1/2] Alias timer interface for event-loop 0.4 and 0.5 compatibility --- composer.json | 3 ++- src/Client.php | 2 +- src/timer_class_alias.php | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 src/timer_class_alias.php diff --git a/composer.json b/composer.json index d31108b..c8a641f 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,8 @@ "autoload": { "psr-4": { "Phergie\\Irc\\Client\\React\\": "src" - } + }, + "files": ["src/timer_class_alias.php"] }, "autoload-dev": { "psr-4": { diff --git a/src/Client.php b/src/Client.php index 1edb5ff..211ad05 100755 --- a/src/Client.php +++ b/src/Client.php @@ -19,7 +19,7 @@ use React\Dns\Resolver\Factory; use React\Dns\Resolver\Resolver; use React\EventLoop\LoopInterface; -use React\EventLoop\Timer\TimerInterface; +use React\EventLoop\TimerInterface; use React\Promise\Deferred; use React\Promise\PromiseInterface; use React\Stream\DuplexResourceStream; diff --git a/src/timer_class_alias.php b/src/timer_class_alias.php new file mode 100644 index 0000000..ef7f7c4 --- /dev/null +++ b/src/timer_class_alias.php @@ -0,0 +1,5 @@ + Date: Sun, 24 Jun 2018 00:27:37 +0200 Subject: [PATCH 2/2] Bumped react/event-loop to 1.0 and 0.5, and drop 0.4 support --- composer.json | 5 ++--- composer.lock | 24 ++++++++++++------------ src/Client.php | 14 -------------- src/timer_class_alias.php | 5 ----- tests/ClientTest.php | 18 ++---------------- 5 files changed, 16 insertions(+), 50 deletions(-) delete mode 100644 src/timer_class_alias.php diff --git a/composer.json b/composer.json index c8a641f..86fe367 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "phergie/phergie-irc-parser": "~2.0", "phergie/phergie-irc-generator": "~1.5", "phergie/phergie-irc-connection": "~2.0", - "react/event-loop": "^1.0 || ^0.5 || ^0.4.0", + "react/event-loop": "^1.0 || ^0.5", "react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4", "react/socket": "^1.0 || ^0.8 || ^0.7", "react/dns": "~0.4.0", @@ -31,8 +31,7 @@ "autoload": { "psr-4": { "Phergie\\Irc\\Client\\React\\": "src" - }, - "files": ["src/timer_class_alias.php"] + } }, "autoload-dev": { "psr-4": { diff --git a/composer.lock b/composer.lock index 5a033c5..1e34537 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "c00f627875c74e37142749a93e3723f2", + "content-hash": "cdd6f771342dfc2ca49f7e14a0a147eb", "packages": [ { "name": "evenement/evenement", @@ -365,28 +365,27 @@ }, { "name": "react/event-loop", - "version": "v0.4.3", + "version": "v0.5.2", "source": { "type": "git", "url": "https://github.com/reactphp/event-loop.git", - "reference": "8bde03488ee897dc6bb3d91e4e17c353f9c5252f" + "reference": "e94985d93c689c554265b01014f8c3064921ca27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/event-loop/zipball/8bde03488ee897dc6bb3d91e4e17c353f9c5252f", - "reference": "8bde03488ee897dc6bb3d91e4e17c353f9c5252f", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/e94985d93c689c554265b01014f8c3064921ca27", + "reference": "e94985d93c689c554265b01014f8c3064921ca27", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.8.35 || ^5.7 || ^6.4" }, "suggest": { - "ext-event": "~1.0", - "ext-libev": "*", - "ext-libevent": ">=0.1.0" + "ext-event": "~1.0 for ExtEventLoop", + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" }, "type": "library", "autoload": { @@ -398,12 +397,12 @@ "license": [ "MIT" ], - "description": "Event loop abstraction layer that libraries can use for evented I/O.", + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", "keywords": [ "asynchronous", "event-loop" ], - "time": "2017-04-27T10:56:23+00:00" + "time": "2018-04-24T11:23:06+00:00" }, { "name": "react/promise", @@ -1558,6 +1557,7 @@ "github", "test" ], + "abandoned": "php-coveralls/php-coveralls", "time": "2013-05-04T08:07:33+00:00" }, { diff --git a/src/Client.php b/src/Client.php index 211ad05..1d0f01e 100755 --- a/src/Client.php +++ b/src/Client.php @@ -822,20 +822,6 @@ public function cancelTimer(TimerInterface $timer) $this->getLoop()->cancelTimer($timer); } - /** - * Checks if a timer created using addTimer() or addPeriodicTimer() is - * active. Proxies to the isTimerActive() implementation of the event loop - * implementation returned by getLoop(). - * - * @param \React\EventLoop\Timer\TimerInterface $timer Timer returned by - * addTimer() or addPeriodicTimer() - * @return boolean TRUE if the specified timer is active, FALSE otherwise - */ - public function isTimerActive(TimerInterface $timer) - { - return $this->getLoop()->isTimerActive($timer); - } - /** * There are certain incoming events that the client processes internally. * These functions are essential to the client-server relationship: for example, diff --git a/src/timer_class_alias.php b/src/timer_class_alias.php deleted file mode 100644 index ef7f7c4..0000000 --- a/src/timer_class_alias.php +++ /dev/null @@ -1,5 +0,0 @@ -cancelTimer($timer); } - /** - * Tests isTimerActive(). - */ - public function testIsTimerActive() - { - $timer = $this->getMockTimer(); - $loop = $this->getMockLoop(); - Phake::when($this->client)->getLoop()->thenReturn($loop); - - $this->client->isTimerActive($timer); - - Phake::verify($loop)->isTimerActive($timer); - } - /** * Returns a mock logger. * @@ -848,11 +834,11 @@ protected function getMockLogger() /** * Returns a mock timer. * - * @return \React\EventLoop\Timer\TimerInterface + * @return \React\EventLoop\TimerInterface */ protected function getMockTimer() { - return Phake::mock('\React\EventLoop\Timer\TimerInterface'); + return Phake::mock('\React\EventLoop\TimerInterface'); } /**