diff --git a/example/simple_query.php b/example/simple_query.php index 7f01e1e..fef172f 100644 --- a/example/simple_query.php +++ b/example/simple_query.php @@ -9,25 +9,25 @@ require __DIR__ . '/../vendor/autoload.php'; - run(function ($loop) use ($genFn) { - // Logger to show pretty messages with timestamps. - $logger = new Logger('default'); - $logger->pushHandler(new StreamHandler('php://stdout', Logger::INFO)); +run(function ($loop) use ($genFn) { + // Logger to show pretty messages with timestamps. + $logger = new Logger('default'); + $logger->pushHandler(new StreamHandler('php://stdout', Logger::INFO)); - $httpHandler = new CurlMultiHandler($loop); - $stack = HandlerStack::create($httpHandler); + $httpHandler = new CurlMultiHandler($loop); + $stack = HandlerStack::create($httpHandler); - $httpClient = new Client([ - 'handler' => $stack, - ]); + $httpClient = new Client([ + 'handler' => $stack, + ]); - $promise = $httpClient->getAsync('https://google.com')->then( - function ($result) use ($logger) { $logger->info('Query completed!'); }, - function ($reason) use ($logger) { $logger->error('Query failed :('); } - ); + $promise = $httpClient->getAsync('https://google.com')->then( + function ($result) use ($logger) { $logger->info('Query completed!'); }, + function ($reason) use ($logger) { $logger->error('Query failed :('); } + ); - /* - * The promise isn't completed yet, but it will be resolved in the future, the event loop will take care of it. - * We don't need to call Promise::wait()! - */ - }); + /* + * The promise isn't completed yet, but it will be resolved in the future, the event loop will take care of it. + * We don't need to call Promise::wait()! + */ +}); diff --git a/example/throttle_coroutine.php b/example/throttle_coroutine.php index e3e2cbc..1c0278b 100644 --- a/example/throttle_coroutine.php +++ b/example/throttle_coroutine.php @@ -51,4 +51,6 @@ function ($reason) use ($logger) { $logger->error('Query failed :('); } // This will done only after the completion of all calls in each_limit(). echo 'Done!'; + + return 0; });