1
0
mirror of https://github.com/danog/amp.git synced 2024-11-30 04:29:08 +01:00

Fix all deprecated warnings in examples.

This commit is contained in:
Douglas G.R 2014-12-26 15:29:51 -02:00
parent a99b923819
commit 4c791d5952
4 changed files with 5 additions and 5 deletions

View File

@ -28,7 +28,7 @@ use Amp\Reactor;
define('RUN_TIME', 10);
printf("Each line you type will be echoed back for the next %d seconds ...\n\n", RUN_TIME);
(new ReactorFactory)->select()->run(function(Reactor $reactor) {
Amp\getReactor()->run(function(Reactor $reactor) {
// Set the STDIN stream to "non-blocking" mode
stream_set_blocking(STDIN, false);
@ -41,7 +41,7 @@ printf("Each line you type will be echoed back for the next %d seconds ...\n\n",
// Countdown RUN_TIME seconds then end the event loop
$secondsRemaining = RUN_TIME;
$reactor->repeat(function() use (&$secondsRemaining) {
$reactor->repeat(function() use (&$secondsRemaining, $reactor) {
if (--$secondsRemaining > 0) {
echo "$secondsRemaining seconds to shutdown\n";
} else {

View File

@ -5,7 +5,7 @@ use Amp\ReactorFactory;
require __DIR__ . '/../vendor/autoload.php';
(new ReactorFactory)->select()->run(function(Reactor $reactor) {
Amp\getReactor()->run(function(Reactor $reactor) {
$ticker = function() {
$now = time();
$vowel = ($now % 2) ? 'i' : 'o';

View File

@ -28,7 +28,7 @@ class Server {
private $ioGranularity = 8192;
public function __construct(Amp\Reactor $reactor = null) {
$this->reactor = $reactor ?: Amp\reactor();
$this->reactor = $reactor ?: Amp\getReactor();
}
public function start($address) {

View File

@ -13,7 +13,7 @@
* // Any constant beginning with SIG* is an available signal
* print_r((new ReflectionClass('UV'))->getConstants());
*/
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/../vendor/autoload.php';
(new Amp\UvReactor)->run(function($reactor) {
// Let's tick off output once per second so we can see activity.