diff --git a/.php_cs b/.php_cs new file mode 100644 index 0000000..fe026e5 --- /dev/null +++ b/.php_cs @@ -0,0 +1,16 @@ +in(__DIR__); + +return Symfony\CS\Config\Config::create() + ->fixers(array( + '-concat_without_spaces', + '-empty_return', + '-new_with_braces', + 'align_double_arrow', + 'align_equals', + 'ordered_use', + 'short_array_syntax', + )) + ->finder($finder); diff --git a/.travis.yml b/.travis.yml index f0beae0..d984493 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ language: php -php: ["5.5", "5.6", "hhvm", "hhvm-nightly"] +php: ["5.5", "5.6", "7", "nightly", "hhvm", "hhvm-nightly"] matrix: - allow_failures: [{"php": "hhvm"}, {"php": "hhvm-nightly"}] + allow_failures: [{"php": "nightly"}, {"php": "hhvm"}, {"php": "hhvm-nightly"}] fast_finish: true env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d207f1..4d41aa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Recoil Changelog +### 0.3.0 (2015-06-26) + +* **[BC]** Removed `StrandInterface::resume()` +* **[NEW]** `return` statement can be used to return a value inside a coroutine (requires PHP 7) +* **[IMPROVED]** Improved method documentation on `Recoil` facade (thanks @rjkip) + ### 0.2.1 (2014-10-16) * **[IMPROVED]** Added support for cancellable promises diff --git a/README.md b/README.md index 069299f..8c1f918 100644 --- a/README.md +++ b/README.md @@ -175,14 +175,15 @@ Recoil::run( ### Returning a value from a coroutine -Because PHP's `return` keyword can not be used to return a value inside a generator, the kernel API provides -`Recoil::return_()` to send a value to the calling coroutine. Just like `return`, execution of the coroutine stops when a -value is returned. +#### PHP 7 + +To return a value from a coroutine, simply use the `return` keyword as you would in a normal function. ```php function multiply($a, $b) { - yield Recoil::return_($a * $b); + yield Recoil::noop(); + return $a * $b; echo 'This code is never reached.'; } @@ -194,6 +195,20 @@ Recoil::run( ); ``` +#### PHP 5 + +Because the `return` keyword can not be used to return a value inside a generator before PHP version 7, the kernel API provides +`Recoil::return_()` to send a value to the calling coroutine. Just like `return`, execution of the coroutine stops when a +value is returned. + +```php +function multiply($a, $b) +{ + yield Recoil::return_($a * $b); + echo 'This code is never reached.'; +} +``` + ### Throwing and catching exceptions One of the major advantages made available by coroutines is that errors can be reported using familiar exception @@ -305,4 +320,4 @@ $eventLoop->run(); [Build Status]: http://img.shields.io/travis/recoilphp/recoil/develop.svg?style=flat-square [Test Coverage]: http://img.shields.io/coveralls/recoilphp/recoil/develop.svg?style=flat-square -[SemVer]: http://img.shields.io/:semver-0.2.1-yellow.svg?style=flat-square +[SemVer]: http://img.shields.io/:semver-0.3.0-yellow.svg?style=flat-square diff --git a/composer.lock b/composer.lock index a189264..3c40350 100644 --- a/composer.lock +++ b/composer.lock @@ -1,7 +1,7 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], "hash": "6c46870c8c4b6ec529f2e4a3c08df6aa", @@ -54,16 +54,16 @@ }, { "name": "guzzle/guzzle", - "version": "v3.9.2", + "version": "v3.9.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle3.git", - "reference": "54991459675c1a2924122afbb0e5609ade581155" + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/54991459675c1a2924122afbb0e5609ade581155", - "reference": "54991459675c1a2924122afbb0e5609ade581155", + "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9", + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9", "shasum": "" }, "require": { @@ -104,6 +104,9 @@ "zendframework/zend-cache": "2.*,<2.3", "zendframework/zend-log": "2.*,<2.3" }, + "suggest": { + "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." + }, "type": "library", "extra": { "branch-alias": { @@ -131,7 +134,7 @@ "homepage": "https://github.com/guzzle/guzzle/contributors" } ], - "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", "homepage": "http://guzzlephp.org/", "keywords": [ "client", @@ -142,7 +145,65 @@ "rest", "web service" ], - "time": "2014-08-11 04:32:36" + "time": "2015-03-18 18:23:50" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "af0e1758de355eb113917ad79c3c0e3604bce4bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/af0e1758de355eb113917ad79c3c0e3604bce4bd", + "reference": "af0e1758de355eb113917ad79c3c0e3604bce4bd", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2015-06-24 19:55:15" }, { "name": "icecave/repr", @@ -193,135 +254,560 @@ "representation", "string" ], - "time": "2014-07-25 05:44:41" + "time": "2014-07-25 05:44:41" + }, + { + "name": "psr/http-message", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298", + "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2015-05-04 20:22:00" + }, + { + "name": "react/cache", + "version": "v0.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "9882ab5d8b00617baae83c6996f5a34668c11beb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/9882ab5d8b00617baae83c6996f5a34668c11beb", + "reference": "9882ab5d8b00617baae83c6996f5a34668c11beb", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "react/promise": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.4-dev" + } + }, + "autoload": { + "psr-4": { + "React\\Cache\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Async caching.", + "keywords": [ + "cache" + ], + "time": "2014-02-02 01:11:26" + }, + { + "name": "react/child-process", + "version": "v0.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/child-process.git", + "reference": "8bf211533bcbb2034e00528a47400367570dc3d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/8bf211533bcbb2034e00528a47400367570dc3d7", + "reference": "8bf211533bcbb2034e00528a47400367570dc3d7", + "shasum": "" + }, + "require": { + "evenement/evenement": "~2.0", + "php": ">=5.4.0", + "react/event-loop": "0.4.*", + "react/stream": "0.4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.4-dev" + } + }, + "autoload": { + "psr-4": { + "React\\ChildProcess\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Library for executing child processes.", + "keywords": [ + "process" + ], + "time": "2014-02-02 01:11:26" + }, + { + "name": "react/dns", + "version": "v0.4.1", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "8c5ccc35dcb4b06b70eb9201842363fac7b0f3cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/8c5ccc35dcb4b06b70eb9201842363fac7b0f3cf", + "reference": "8c5ccc35dcb4b06b70eb9201842363fac7b0f3cf", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "react/cache": "0.4.*", + "react/promise": "~2.0", + "react/socket": "0.4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.4-dev" + } + }, + "autoload": { + "psr-4": { + "React\\Dns\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Async DNS resolver.", + "keywords": [ + "dns", + "dns-resolver" + ], + "time": "2014-04-12 14:09:10" + }, + { + "name": "react/event-loop", + "version": "v0.4.1", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "18c5297087ca01de85518e2b55078f444144aa1b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/18c5297087ca01de85518e2b55078f444144aa1b", + "reference": "18c5297087ca01de85518e2b55078f444144aa1b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "suggest": { + "ext-event": "~1.0", + "ext-libev": "*", + "ext-libevent": ">=0.1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.4-dev" + } + }, + "autoload": { + "psr-4": { + "React\\EventLoop\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Event loop abstraction layer that libraries can use for evented I/O.", + "keywords": [ + "event-loop" + ], + "time": "2014-02-26 17:36:58" + }, + { + "name": "react/http", + "version": "v0.4.1", + "source": { + "type": "git", + "url": "https://github.com/reactphp/http.git", + "reference": "f575989d67b7db0a65f5dd7e431d8f47af6c2f7b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/http/zipball/f575989d67b7db0a65f5dd7e431d8f47af6c2f7b", + "reference": "f575989d67b7db0a65f5dd7e431d8f47af6c2f7b", + "shasum": "" + }, + "require": { + "evenement/evenement": "^2.0", + "guzzlehttp/psr7": "^1.0", + "php": ">=5.4.0", + "react/socket": "^0.4", + "react/stream": "^0.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.5-dev" + } + }, + "autoload": { + "psr-4": { + "React\\Http\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Library for building an evented http server.", + "keywords": [ + "http" + ], + "time": "2015-05-21 20:12:09" + }, + { + "name": "react/http-client", + "version": "v0.4.4", + "source": { + "type": "git", + "url": "https://github.com/reactphp/http-client.git", + "reference": "391e1e771c2255954226204edcdc5a2764938e6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/http-client/zipball/391e1e771c2255954226204edcdc5a2764938e6a", + "reference": "391e1e771c2255954226204edcdc5a2764938e6a", + "shasum": "" + }, + "require": { + "evenement/evenement": "~2.0", + "guzzle/parser": "~3.0", + "php": ">=5.4.0", + "react/dns": "0.4.*", + "react/event-loop": "0.4.*", + "react/socket-client": "0.4.*", + "react/stream": "0.4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.5-dev" + } + }, + "autoload": { + "psr-4": { + "React\\HttpClient\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Asynchronous HTTP client library.", + "keywords": [ + "http" + ], + "time": "2015-06-16 20:58:52" + }, + { + "name": "react/promise", + "version": "v2.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/365fcee430dfa4ace1fbc75737ca60ceea7eeeef", + "reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "React\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@googlemail.com" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "time": "2014-12-30 13:32:42" + }, + { + "name": "react/react", + "version": "v0.4.2", + "source": { + "type": "git", + "url": "https://github.com/reactphp/react.git", + "reference": "457b6b8a16a37c11278cac0870d6d2ff911c5765" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/react/zipball/457b6b8a16a37c11278cac0870d6d2ff911c5765", + "reference": "457b6b8a16a37c11278cac0870d6d2ff911c5765", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "react/cache": "0.4.*", + "react/child-process": "0.4.*", + "react/dns": "0.4.*", + "react/event-loop": "0.4.*", + "react/http": "0.4.*", + "react/http-client": "0.4.*", + "react/promise": "~2.1", + "react/socket": "0.4.*", + "react/socket-client": "0.4.*", + "react/stream": "0.4.*" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "ext-event": "Allows for use of a more performant event-loop implementation.", + "ext-libev": "Allows for use of a more performant event-loop implementation.", + "ext-libevent": "Allows for use of a more performant event-loop implementation." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.5-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Nuclear Reactor written in PHP.", + "keywords": [ + "asynchronous", + "event-loop", + "reactor" + ], + "time": "2014-12-11 02:06:55" + }, + { + "name": "react/socket", + "version": "v0.4.2", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "a6acf405ca53fc6cfbfe7c77778ededff46aa7cc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/a6acf405ca53fc6cfbfe7c77778ededff46aa7cc", + "reference": "a6acf405ca53fc6cfbfe7c77778ededff46aa7cc", + "shasum": "" + }, + "require": { + "evenement/evenement": "~2.0", + "php": ">=5.4.0", + "react/event-loop": "0.4.*", + "react/stream": "0.4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.4-dev" + } + }, + "autoload": { + "psr-4": { + "React\\Socket\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Library for building an evented socket server.", + "keywords": [ + "Socket" + ], + "time": "2014-05-25 17:02:16" }, { - "name": "react/promise", - "version": "v2.1.0", + "name": "react/socket-client", + "version": "v0.4.3", "source": { "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "937b04f1b0ee8f6d180e75a0830aac778ca4bcd6" + "url": "https://github.com/reactphp/socket-client.git", + "reference": "1375dac21b1881cba31c2b38f412dc039566673f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/937b04f1b0ee8f6d180e75a0830aac778ca4bcd6", - "reference": "937b04f1b0ee8f6d180e75a0830aac778ca4bcd6", + "url": "https://api.github.com/repos/reactphp/socket-client/zipball/1375dac21b1881cba31c2b38f412dc039566673f", + "reference": "1375dac21b1881cba31c2b38f412dc039566673f", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=5.4.0", + "react/dns": "0.4.*", + "react/event-loop": "0.4.*", + "react/promise": "~2.0", + "react/stream": "0.4.*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "0.4-dev" } }, "autoload": { "psr-4": { - "React\\Promise\\": "src/" - }, - "files": [ - "src/functions.php" - ] + "React\\SocketClient\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Jan Sorgalla", - "email": "jsorgalla@googlemail.com" - } + "description": "Async connector to open TCP/IP and SSL/TLS based connections.", + "keywords": [ + "Socket" ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "time": "2014-10-15 20:05:57" + "time": "2015-03-20 15:24:06" }, { - "name": "react/react", - "version": "v0.4.0", + "name": "react/stream", + "version": "v0.4.2", "source": { "type": "git", - "url": "https://github.com/reactphp/react.git", - "reference": "3a5d12166b38d059a96c232d809332e7f3e60d9d" + "url": "https://github.com/reactphp/stream.git", + "reference": "acc7a5fec02e0aea674560e1d13c40ed0c8c5465" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/react/zipball/3a5d12166b38d059a96c232d809332e7f3e60d9d", - "reference": "3a5d12166b38d059a96c232d809332e7f3e60d9d", + "url": "https://api.github.com/repos/reactphp/stream/zipball/acc7a5fec02e0aea674560e1d13c40ed0c8c5465", + "reference": "acc7a5fec02e0aea674560e1d13c40ed0c8c5465", "shasum": "" }, "require": { "evenement/evenement": "~2.0", - "guzzle/parser": "~3.0", - "php": ">=5.4.0", - "react/promise": "~2.0" - }, - "replace": { - "react/cache": "self.version", - "react/dns": "self.version", - "react/event-loop": "self.version", - "react/http": "self.version", - "react/http-client": "self.version", - "react/socket": "self.version", - "react/socket-client": "self.version", - "react/stream": "self.version" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "3.7.*" + "react/event-loop": "0.4.*", + "react/promise": "~2.0" }, "suggest": { - "ext-event": "Allows for use of a more performant event-loop implementation.", - "ext-libev": "Allows for use of a more performant event-loop implementation.", - "ext-libevent": "Allows for use of a more performant event-loop implementation." + "react/event-loop": "0.4.*", + "react/promise": "~2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.4-dev" + "dev-master": "0.5-dev" } }, "autoload": { "psr-4": { - "React\\": "src" + "React\\Stream\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Nuclear Reactor written in PHP.", + "description": "Basic readable and writable stream interfaces that support piping.", "keywords": [ - "event-loop", - "reactor" + "pipe", + "stream" ], - "time": "2014-02-03 02:33:04" + "time": "2014-09-10 03:32:31" }, { "name": "symfony/event-dispatcher", - "version": "v2.5.5", - "target-dir": "Symfony/Component/EventDispatcher", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "f6281337bf5f985f585d1db6a83adb05ce531f46" + "reference": "be3c5ff8d503c46768aeb78ce6333051aa6f26d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/f6281337bf5f985f585d1db6a83adb05ce531f46", - "reference": "f6281337bf5f985f585d1db6a83adb05ce531f46", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/be3c5ff8d503c46768aeb78ce6333051aa6f26d9", + "reference": "be3c5ff8d503c46768aeb78ce6333051aa6f26d9", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.0", - "symfony/dependency-injection": "~2.0,<2.6.0", - "symfony/stopwatch": "~2.2" + "symfony/config": "~2.0,>=2.0.5", + "symfony/dependency-injection": "~2.6", + "symfony/expression-language": "~2.6", + "symfony/phpunit-bridge": "~2.7", + "symfony/stopwatch": "~2.3" }, "suggest": { "symfony/dependency-injection": "", @@ -330,11 +816,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" } }, @@ -343,98 +829,39 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony EventDispatcher Component", - "homepage": "http://symfony.com", - "time": "2014-09-28 15:56:11" + "homepage": "https://symfony.com", + "time": "2015-06-08 09:37:21" } ], "packages-dev": [ - { - "name": "dflydev/markdown", - "version": "v1.0.3", - "source": { - "type": "git", - "url": "https://github.com/dflydev/dflydev-markdown.git", - "reference": "6baed9b50f29c980795b6656d43722aadb126f7e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-markdown/zipball/6baed9b50f29c980795b6656d43722aadb126f7e", - "reference": "6baed9b50f29c980795b6656d43722aadb126f7e", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "dflydev\\markdown": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Dragonfly Development Inc.", - "email": "info@dflydev.com", - "homepage": "http://dflydev.com" - }, - { - "name": "Beau Simensen", - "email": "beau@dflydev.com", - "homepage": "http://beausimensen.com" - }, - { - "name": "Michel Fortin", - "homepage": "http://michelf.com" - }, - { - "name": "John Gruber", - "homepage": "http://daringfireball.net" - } - ], - "description": "PHP Markdown & Extra", - "homepage": "http://github.com/dflydev/dflydev-markdown", - "keywords": [ - "markdown" - ], - "time": "2013-09-23 12:00:18" - }, { "name": "icecave/archer", - "version": "1.3.0", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/IcecaveStudios/archer.git", - "reference": "5b1b4748d0fd6a8f977486d15d10e52e68349379" + "reference": "4b82c195cbc7d65780dbdeffda2c6ba92e56684c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/IcecaveStudios/archer/zipball/5b1b4748d0fd6a8f977486d15d10e52e68349379", - "reference": "5b1b4748d0fd6a8f977486d15d10e52e68349379", + "url": "https://api.github.com/repos/IcecaveStudios/archer/zipball/4b82c195cbc7d65780dbdeffda2c6ba92e56684c", + "reference": "4b82c195cbc7d65780dbdeffda2c6ba92e56684c", "shasum": "" }, "require": { "phake/phake": "~1", "php": ">=5.3", - "sami/sami": "~1.1.0", + "sami/sami": "~3", "satooshi/php-coveralls": "~0.6", "symfony/console": "~2", "symfony/process": "~2" @@ -493,36 +920,87 @@ "testing", "unit" ], - "time": "2014-09-18 03:05:28" + "time": "2015-03-26 02:38:44" + }, + { + "name": "michelf/php-markdown", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/michelf/php-markdown.git", + "reference": "e1aabe18173231ebcefc90e615565742fc1c7fd9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/e1aabe18173231ebcefc90e615565742fc1c7fd9", + "reference": "e1aabe18173231ebcefc90e615565742fc1c7fd9", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-lib": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Michelf": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "John Gruber", + "homepage": "http://daringfireball.net/" + }, + { + "name": "Michel Fortin", + "email": "michel.fortin@michelf.ca", + "homepage": "https://michelf.ca/", + "role": "Developer" + } + ], + "description": "PHP Markdown", + "homepage": "https://michelf.ca/projects/php-markdown/", + "keywords": [ + "markdown" + ], + "time": "2015-03-01 12:03:08" }, { "name": "nikic/php-parser", - "version": "v0.9.5", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb" + "reference": "dff239267fd1befa1cd40430c9ed12591aa720ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ef70767475434bdb3615b43c327e2cae17ef12eb", - "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dff239267fd1befa1cd40430c9ed12591aa720ca", + "reference": "dff239267fd1befa1cd40430c9ed12591aa720ca", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.2" + "php": ">=5.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.9-dev" + "dev-master": "1.3-dev" } }, "autoload": { - "psr-0": { - "PHPParser": "lib/" - } + "files": [ + "lib/bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -538,7 +1016,7 @@ "parser", "php" ], - "time": "2014-07-23 18:24:17" + "time": "2015-05-02 15:40:40" }, { "name": "phake/phake", @@ -596,18 +1074,67 @@ ], "time": "2013-08-06 22:31:04" }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2015-02-03 12:10:50" + }, { "name": "pimple/pimple", - "version": "v1.0.2", + "version": "v3.0.0", "source": { "type": "git", - "url": "https://github.com/fabpot/Pimple.git", - "reference": "ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94" + "url": "https://github.com/silexphp/Pimple.git", + "reference": "876bf0899d01feacd2a2e83f04641e51350099ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Pimple/zipball/ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94", - "reference": "ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/876bf0899d01feacd2a2e83f04641e51350099ef", + "reference": "876bf0899d01feacd2a2e83f04641e51350099ef", "shasum": "" }, "require": { @@ -616,12 +1143,12 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { "psr-0": { - "Pimple": "lib/" + "Pimple": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -631,9 +1158,7 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "email": "fabien@symfony.com" } ], "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", @@ -642,7 +1167,7 @@ "container", "dependency injection" ], - "time": "2013-03-08 08:21:40" + "time": "2014-07-24 09:48:15" }, { "name": "psr/log", @@ -684,29 +1209,30 @@ }, { "name": "sami/sami", - "version": "v1.1", + "version": "v3.0.5", "source": { "type": "git", - "url": "https://github.com/fabpot/Sami.git", - "reference": "46c58957ce4823c613e8535626b81e2fd80a9865" + "url": "https://github.com/FriendsOfPHP/Sami.git", + "reference": "0828c3700604eee9ec3f6f4affa6a9224f4ce76a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Sami/zipball/46c58957ce4823c613e8535626b81e2fd80a9865", - "reference": "46c58957ce4823c613e8535626b81e2fd80a9865", + "url": "https://api.github.com/repos/FriendsOfPHP/Sami/zipball/0828c3700604eee9ec3f6f4affa6a9224f4ce76a", + "reference": "0828c3700604eee9ec3f6f4affa6a9224f4ce76a", "shasum": "" }, "require": { - "dflydev/markdown": "1.0.*", - "nikic/php-parser": "0.9.*", - "php": ">=5.3.0", - "pimple/pimple": "1.0.*", + "michelf/php-markdown": "~1.3", + "nikic/php-parser": "~1.0", + "php": ">=5.3.3", + "phpdocumentor/reflection-docblock": "~2.0", + "pimple/pimple": "~3.0", "symfony/console": "~2.1", "symfony/filesystem": "~2.1", "symfony/finder": "~2.1", "symfony/process": "~2.1", "symfony/yaml": "~2.1", - "twig/twig": "1.*" + "twig/twig": "~1.13" }, "bin": [ "sami.php" @@ -714,12 +1240,12 @@ "type": "application", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { - "psr-0": { - "Sami": "." + "psr-4": { + "Sami\\": "Sami/" } }, "notification-url": "https://packagist.org/downloads/", @@ -729,9 +1255,7 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "email": "fabien@symfony.com" } ], "description": "Sami, an API documentation generator", @@ -739,7 +1263,7 @@ "keywords": [ "phpdoc" ], - "time": "2013-08-04 13:56:41" + "time": "2015-05-30 16:31:24" }, { "name": "satooshi/php-coveralls", @@ -811,31 +1335,33 @@ }, { "name": "symfony/config", - "version": "v2.5.5", - "target-dir": "Symfony/Component/Config", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "0316364bfebc8b080077c731a99f189341476bd7" + "reference": "58ded81f1f582a87c528ef3dae9a859f78b5f374" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/0316364bfebc8b080077c731a99f189341476bd7", - "reference": "0316364bfebc8b080077c731a99f189341476bd7", + "url": "https://api.github.com/repos/symfony/Config/zipball/58ded81f1f582a87c528ef3dae9a859f78b5f374", + "reference": "58ded81f1f582a87c528ef3dae9a859f78b5f374", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": ">=5.3.9", "symfony/filesystem": "~2.3" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Config\\": "" } }, @@ -844,53 +1370,55 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Config Component", - "homepage": "http://symfony.com", - "time": "2014-09-23 05:25:11" + "homepage": "https://symfony.com", + "time": "2015-06-11 14:06:56" }, { "name": "symfony/console", - "version": "v2.5.5", - "target-dir": "Symfony/Component/Console", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "ca053eaa031c93afb68a71e4eb1f4168dfd4a661" + "reference": "564398bc1f33faf92fc2ec86859983d30eb81806" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/ca053eaa031c93afb68a71e4eb1f4168dfd4a661", - "reference": "ca053eaa031c93afb68a71e4eb1f4168dfd4a661", + "url": "https://api.github.com/repos/symfony/Console/zipball/564398bc1f33faf92fc2ec86859983d30eb81806", + "reference": "564398bc1f33faf92fc2ec86859983d30eb81806", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1" + "symfony/event-dispatcher": "~2.1", + "symfony/phpunit-bridge": "~2.7", + "symfony/process": "~2.1" }, "suggest": { "psr/log": "For using the console logger", - "symfony/event-dispatcher": "" + "symfony/event-dispatcher": "", + "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Console\\": "" } }, @@ -899,45 +1427,47 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Console Component", - "homepage": "http://symfony.com", - "time": "2014-09-25 09:53:56" + "homepage": "https://symfony.com", + "time": "2015-06-10 15:30:22" }, { "name": "symfony/filesystem", - "version": "v2.5.5", - "target-dir": "Symfony/Component/Filesystem", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "4e62fab0060a826561c78b665925b37c870c45f5" + "reference": "a0d43eb3e17d4f4c6990289805a488a0482a07f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/4e62fab0060a826561c78b665925b37c870c45f5", - "reference": "4e62fab0060a826561c78b665925b37c870c45f5", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a0d43eb3e17d4f4c6990289805a488a0482a07f3", + "reference": "a0d43eb3e17d4f4c6990289805a488a0482a07f3", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Filesystem\\": "" } }, @@ -946,45 +1476,47 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Filesystem Component", - "homepage": "http://symfony.com", - "time": "2014-09-22 09:14:18" + "homepage": "https://symfony.com", + "time": "2015-06-08 09:37:21" }, { "name": "symfony/finder", - "version": "v2.5.5", - "target-dir": "Symfony/Component/Finder", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "d5033742b9a6206ef6d06e813870bca18e9205df" + "reference": "c13a40d638aeede1e8400f8c956c7f9246c05f75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/d5033742b9a6206ef6d06e813870bca18e9205df", - "reference": "d5033742b9a6206ef6d06e813870bca18e9205df", + "url": "https://api.github.com/repos/symfony/Finder/zipball/c13a40d638aeede1e8400f8c956c7f9246c05f75", + "reference": "c13a40d638aeede1e8400f8c956c7f9246c05f75", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Finder\\": "" } }, @@ -993,45 +1525,47 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Finder Component", - "homepage": "http://symfony.com", - "time": "2014-09-27 08:35:39" + "homepage": "https://symfony.com", + "time": "2015-06-04 20:11:48" }, { "name": "symfony/process", - "version": "v2.5.5", - "target-dir": "Symfony/Component/Process", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Process.git", - "reference": "8a1ec96c4e519cee0fb971ea48a1eb7369dda54b" + "reference": "552d8efdc80980cbcca50b28d626ac8e36e3cdd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/8a1ec96c4e519cee0fb971ea48a1eb7369dda54b", - "reference": "8a1ec96c4e519cee0fb971ea48a1eb7369dda54b", + "url": "https://api.github.com/repos/symfony/Process/zipball/552d8efdc80980cbcca50b28d626ac8e36e3cdd1", + "reference": "552d8efdc80980cbcca50b28d626ac8e36e3cdd1", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Process\\": "" } }, @@ -1040,45 +1574,47 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Process Component", - "homepage": "http://symfony.com", - "time": "2014-09-23 05:25:11" + "homepage": "https://symfony.com", + "time": "2015-06-08 09:37:21" }, { "name": "symfony/stopwatch", - "version": "v2.5.5", - "target-dir": "Symfony/Component/Stopwatch", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Stopwatch.git", - "reference": "9f8a33a24f2378c0ec5f372a8d50b2d43069c050" + "reference": "c653f1985f6c2b7dbffd04d48b9c0a96aaef814b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/9f8a33a24f2378c0ec5f372a8d50b2d43069c050", - "reference": "9f8a33a24f2378c0ec5f372a8d50b2d43069c050", + "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/c653f1985f6c2b7dbffd04d48b9c0a96aaef814b", + "reference": "c653f1985f6c2b7dbffd04d48b9c0a96aaef814b", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Stopwatch\\": "" } }, @@ -1087,45 +1623,47 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Stopwatch Component", - "homepage": "http://symfony.com", - "time": "2014-09-22 09:14:18" + "homepage": "https://symfony.com", + "time": "2015-06-04 20:11:48" }, { "name": "symfony/yaml", - "version": "v2.5.5", - "target-dir": "Symfony/Component/Yaml", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "b1dbc53593b98c2d694ebf383660ac9134d30b96" + "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/b1dbc53593b98c2d694ebf383660ac9134d30b96", - "reference": "b1dbc53593b98c2d694ebf383660ac9134d30b96", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/9808e75c609a14f6db02f70fccf4ca4aab53c160", + "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Yaml\\": "" } }, @@ -1134,40 +1672,40 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Yaml Component", - "homepage": "http://symfony.com", - "time": "2014-09-22 09:14:18" + "homepage": "https://symfony.com", + "time": "2015-06-10 15:30:22" }, { "name": "twig/twig", - "version": "v1.16.1", + "version": "v1.18.2", "source": { "type": "git", - "url": "https://github.com/fabpot/Twig.git", - "reference": "7c4c01dcf578523cfcddf383641a4f12790270ec" + "url": "https://github.com/twigphp/Twig.git", + "reference": "e8e6575abf6102af53ec283f7f14b89e304fa602" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig/zipball/7c4c01dcf578523cfcddf383641a4f12790270ec", - "reference": "7c4c01dcf578523cfcddf383641a4f12790270ec", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/e8e6575abf6102af53ec283f7f14b89e304fa602", + "reference": "e8e6575abf6102af53ec283f7f14b89e304fa602", "shasum": "" }, "require": { - "php": ">=5.2.4" + "php": ">=5.2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.16-dev" + "dev-master": "1.18-dev" } }, "autoload": { @@ -1193,7 +1731,7 @@ }, { "name": "Twig Team", - "homepage": "https://github.com/fabpot/Twig/graphs/contributors", + "homepage": "http://twig.sensiolabs.org/contributors", "role": "Contributors" } ], @@ -1202,7 +1740,7 @@ "keywords": [ "templating" ], - "time": "2014-10-10 14:09:53" + "time": "2015-06-06 23:31:24" } ], "aliases": [ @@ -1218,6 +1756,7 @@ "phake/phake": 15 }, "prefer-stable": false, + "prefer-lowest": false, "platform": { "php": ">=5.5" }, diff --git a/examples/strand-suspend-resume b/examples/strand-suspend-resume new file mode 100755 index 0000000..f420488 --- /dev/null +++ b/examples/strand-suspend-resume @@ -0,0 +1,42 @@ +#!/usr/bin/env php +kernel()->eventLoop(); + $loop->addTimer( + 1, + function () use ($strand) { + $strand->resumeWithValue( + 'The strand was resumed by a timer!' + ); + } + ); + } + )); + + echo $value . PHP_EOL; + } +); diff --git a/src/Channel/BidirectionalChannelAdaptor.php b/src/Channel/BidirectionalChannelAdaptor.php index 7e0e5a5..337ac35 100644 --- a/src/Channel/BidirectionalChannelAdaptor.php +++ b/src/Channel/BidirectionalChannelAdaptor.php @@ -13,7 +13,7 @@ public function __construct( ReadableChannelInterface $readChannel, WritableChannelInterface $writeChannel ) { - $this->readChannel = $readChannel; + $this->readChannel = $readChannel; $this->writeChannel = $writeChannel; } diff --git a/src/Channel/Channel.php b/src/Channel/Channel.php index 4ed9a16..59f7f4e 100644 --- a/src/Channel/Channel.php +++ b/src/Channel/Channel.php @@ -13,8 +13,8 @@ class Channel implements ReadableChannelInterface, WritableChannelInterface { public function __construct() { - $this->closed = false; - $this->readStrands = new SplQueue(); + $this->closed = false; + $this->readStrands = new SplQueue(); $this->writeStrands = new SplQueue(); } diff --git a/src/Channel/ReadableStreamChannel.php b/src/Channel/ReadableStreamChannel.php index a9e9aba..82f36d2 100644 --- a/src/Channel/ReadableStreamChannel.php +++ b/src/Channel/ReadableStreamChannel.php @@ -1,7 +1,6 @@ stream = $stream; + $this->stream = $stream; $this->unserializer = $unserializer; - $this->bufferSize = $bufferSize; + $this->bufferSize = $bufferSize; } /** diff --git a/src/Channel/Serialization/PhpUnserializer.php b/src/Channel/Serialization/PhpUnserializer.php index a3b5571..05927fc 100644 --- a/src/Channel/Serialization/PhpUnserializer.php +++ b/src/Channel/Serialization/PhpUnserializer.php @@ -12,8 +12,8 @@ class PhpUnserializer implements UnserializerInterface { public function __construct() { - $this->buffer = ''; - $this->packets = new SplQueue(); + $this->buffer = ''; + $this->packets = new SplQueue(); $this->falsePacket = serialize(false); } @@ -39,7 +39,7 @@ public function feed($buffer) break; } - $packet = substr($this->buffer, self::PACKET_SIZE_LENGTH, $packetSize); + $packet = substr($this->buffer, self::PACKET_SIZE_LENGTH, $packetSize); $this->buffer = substr($this->buffer, self::PACKET_SIZE_LENGTH + $packetSize); $this->packets->push($packet); } diff --git a/src/Channel/WritableChannelInterface.php b/src/Channel/WritableChannelInterface.php index 484c0b3..517d03c 100644 --- a/src/Channel/WritableChannelInterface.php +++ b/src/Channel/WritableChannelInterface.php @@ -1,9 +1,9 @@ stream = $stream; + $this->stream = $stream; $this->serializer = $serializer; } diff --git a/src/Coroutine/CoroutineAdaptor.php b/src/Coroutine/CoroutineAdaptor.php index 9ea61f6..62747a9 100644 --- a/src/Coroutine/CoroutineAdaptor.php +++ b/src/Coroutine/CoroutineAdaptor.php @@ -2,11 +2,11 @@ namespace Recoil\Coroutine; use Generator; -use Recoil\Kernel\Strand\StrandInterface; -use Recoil\Recoil; use Icecave\Repr\Repr; use InvalidArgumentException; use React\Promise\PromiseInterface; +use Recoil\Kernel\Strand\StrandInterface; +use Recoil\Recoil; /** * The default coroutine adaptor implementation. diff --git a/src/Coroutine/CoroutineAdaptorInterface.php b/src/Coroutine/CoroutineAdaptorInterface.php index fda9228..f0fc320 100644 --- a/src/Coroutine/CoroutineAdaptorInterface.php +++ b/src/Coroutine/CoroutineAdaptorInterface.php @@ -1,8 +1,8 @@ generator = $generator; + if (null === self::$hasReturnValue) { + self::$hasReturnValue = method_exists(Generator::class, 'getReturn'); + } + + $this->generator = $generator; $this->finalizeCallbacks = []; } @@ -40,6 +44,8 @@ public function call(StrandInterface $strand) $strand->call( $this->generator->current() ); + } elseif (self::$hasReturnValue) { + $strand->returnValue($this->generator->getReturn()); } else { $strand->returnValue(null); } @@ -66,6 +72,8 @@ public function resumeWithValue(StrandInterface $strand, $value) $strand->call( $this->generator->current() ); + } elseif (self::$hasReturnValue) { + $strand->returnValue($this->generator->getReturn()); } else { $strand->returnValue(null); } @@ -92,6 +100,8 @@ public function resumeWithException(StrandInterface $strand, Exception $exceptio $strand->call( $this->generator->current() ); + } elseif (self::$hasReturnValue) { + $strand->returnValue($this->generator->getReturn()); } else { $strand->returnValue(null); } @@ -127,6 +137,7 @@ public function registerFinalizeCallback(callable $callback) $this->finalizeCallbacks[] = $callback; } + private static $hasReturnValue; private $generator; private $finalizeCallbacks; } diff --git a/src/Kernel/Api/KernelApi.php b/src/Kernel/Api/KernelApi.php index 1d24405..2cc8459 100644 --- a/src/Kernel/Api/KernelApi.php +++ b/src/Kernel/Api/KernelApi.php @@ -188,8 +188,8 @@ public function execute(StrandInterface $strand, $coroutine) /** * Wait for one or more of the given strands to exit. * - * @param StrandInterface $strand The currently executing strand. - * @param array $strands The strands to wait for. + * @param StrandInterface $strand The currently executing strand. + * @param StrandInterface[] $strands The strands to wait for. */ public function select(StrandInterface $strand, array $strands) { diff --git a/src/Kernel/Api/KernelApiCall.php b/src/Kernel/Api/KernelApiCall.php index 4a93012..b06f227 100644 --- a/src/Kernel/Api/KernelApiCall.php +++ b/src/Kernel/Api/KernelApiCall.php @@ -22,7 +22,7 @@ class KernelApiCall implements CoroutineInterface */ public function __construct($name, array $arguments) { - $this->name = $name; + $this->name = $name; $this->arguments = $arguments; } diff --git a/src/Kernel/Api/KernelApiInterface.php b/src/Kernel/Api/KernelApiInterface.php index 4cb4aeb..d1377da 100644 --- a/src/Kernel/Api/KernelApiInterface.php +++ b/src/Kernel/Api/KernelApiInterface.php @@ -130,8 +130,8 @@ public function execute(StrandInterface $strand, $coroutine); /** * Wait for one or more of the given strands to exit. * - * @param StrandInterface $strand The currently executing strand. - * @param array $strands The strands to wait for. + * @param StrandInterface $strand The currently executing strand. + * @param StrandInterface[] $strands The strands to wait for. */ public function select(StrandInterface $strand, array $strands); diff --git a/src/Kernel/Api/Select.php b/src/Kernel/Api/Select.php index 9adc7b6..cc597db 100644 --- a/src/Kernel/Api/Select.php +++ b/src/Kernel/Api/Select.php @@ -18,7 +18,7 @@ class Select implements CoroutineInterface public function __construct(array $strands) { $this->substrands = new SplObjectStorage(); - $this->exited = []; + $this->exited = []; foreach ($strands as $index => $strand) { if ($strand->hasExited()) { diff --git a/src/Kernel/Api/Timeout.php b/src/Kernel/Api/Timeout.php index fa0921a..b3635c5 100644 --- a/src/Kernel/Api/Timeout.php +++ b/src/Kernel/Api/Timeout.php @@ -18,7 +18,7 @@ class Timeout implements CoroutineInterface public function __construct($timeout, $coroutine) { - $this->timeout = $timeout; + $this->timeout = $timeout; $this->coroutine = $coroutine; } diff --git a/src/Kernel/Api/WaitAll.php b/src/Kernel/Api/WaitAll.php index 3aed9f7..6afc0ac 100644 --- a/src/Kernel/Api/WaitAll.php +++ b/src/Kernel/Api/WaitAll.php @@ -20,7 +20,7 @@ public function __construct(array $coroutines) { $this->coroutines = $coroutines; $this->substrands = []; - $this->values = []; + $this->values = []; } /** diff --git a/src/Kernel/Kernel.php b/src/Kernel/Kernel.php index 7344adb..6adff2f 100644 --- a/src/Kernel/Kernel.php +++ b/src/Kernel/Kernel.php @@ -1,6 +1,8 @@ eventLoop = $eventLoop; - $this->api = $api; + $this->eventLoop = $eventLoop; + $this->api = $api; $this->coroutineAdaptor = $coroutineAdaptor; - $this->strandFactory = $strandFactory; - $this->strands = []; + $this->strandFactory = $strandFactory; + $this->strands = []; $this->terminateStrands = false; } @@ -149,7 +149,7 @@ public function eventLoop() public function stop($stopEventLoop = true) { $this->terminateStrands = true; - $this->stopEventLoop = $stopEventLoop; + $this->stopEventLoop = $stopEventLoop; } /** @@ -176,7 +176,7 @@ public function onTick() } $this->terminateStrands = false; - $this->stopEventLoop = false; + $this->stopEventLoop = false; } private $eventLoop; diff --git a/src/Kernel/KernelInterface.php b/src/Kernel/KernelInterface.php index 6891ceb..b165c62 100644 --- a/src/Kernel/KernelInterface.php +++ b/src/Kernel/KernelInterface.php @@ -1,10 +1,10 @@ stack); + $coroutine = array_pop($this->stack); $this->current = end($this->stack); $coroutine->finalize($this); @@ -109,7 +109,7 @@ public function call($coroutine) return null; } - $this->state = self::STATE_CALL; + $this->state = self::STATE_CALL; $this->resumeData = null; return $coroutine; @@ -151,20 +151,6 @@ public function suspend() $this->kernel->detachStrand($this); } - /** - * Resume execution of this strand. - */ - public function resume() - { - if (!$this->suspended) { - return; - } - - $this->suspended = false; - - $this->kernel->attachStrand($this); - } - /** * Resume execution of this strand and send a value to the current coroutine. * @@ -174,7 +160,7 @@ public function resumeWithValue($value) { $this->resume(); - $this->state = self::STATE_RESUME; + $this->state = self::STATE_RESUME; $this->resumeData = $value; } @@ -187,7 +173,7 @@ public function resumeWithException(Exception $exception) { $this->resume(); - $this->state = self::STATE_EXCEPTION; + $this->state = self::STATE_EXCEPTION; $this->resumeData = $exception; } @@ -198,7 +184,7 @@ public function terminate() { $this->resume(); - $this->state = self::STATE_TERMINATE; + $this->state = self::STATE_TERMINATE; $this->resumeData = null; } @@ -241,8 +227,22 @@ public function tick() } } - const STATE_CALL = 1; - const STATE_RESUME = 2; + /** + * Resume execution of this strand. + */ + private function resume() + { + if (!$this->suspended) { + return; + } + + $this->suspended = false; + + $this->kernel->attachStrand($this); + } + + const STATE_CALL = 1; + const STATE_RESUME = 2; const STATE_EXCEPTION = 3; const STATE_TERMINATE = 4; diff --git a/src/Kernel/Strand/StrandInterface.php b/src/Kernel/Strand/StrandInterface.php index cda1d64..44c5d3a 100644 --- a/src/Kernel/Strand/StrandInterface.php +++ b/src/Kernel/Strand/StrandInterface.php @@ -4,6 +4,7 @@ use Evenement\EventEmitterInterface; use Exception; use Recoil\Coroutine\CoroutineInterface; +use Recoil\Kernel\KernelInterface; /** * A strand represents a user-space "thread" of execution. @@ -81,11 +82,6 @@ public function throwException(Exception $exception); */ public function suspend(); - /** - * Resume execution of this strand. - */ - public function resume(); - /** * Resume execution of this strand and send a value to the current coroutine. * diff --git a/src/PackageInfo.php b/src/PackageInfo.php index 8c8a2a1..20e2e03 100644 --- a/src/PackageInfo.php +++ b/src/PackageInfo.php @@ -3,6 +3,6 @@ class PackageInfo { - const NAME = 'Recoil'; - const VERSION = '0.2.1'; + const NAME = 'Recoil'; + const VERSION = '0.3.0'; } diff --git a/src/Recoil.php b/src/Recoil.php index 88c2ed0..9b9d3e7 100644 --- a/src/Recoil.php +++ b/src/Recoil.php @@ -1,9 +1,10 @@ readStream = $readStream; + $this->readStream = $readStream; $this->writeStream = $writeStream; } diff --git a/src/Stream/ReadableReactStream.php b/src/Stream/ReadableReactStream.php index dd82c8a..57870c4 100644 --- a/src/Stream/ReadableReactStream.php +++ b/src/Stream/ReadableReactStream.php @@ -2,11 +2,11 @@ namespace Recoil\Stream; use Exception; +use React\Stream\ReadableStreamInterface as ReadableReactStreamInterface; use Recoil\Recoil; use Recoil\Stream\Exception\StreamClosedException; use Recoil\Stream\Exception\StreamLockedException; use Recoil\Stream\Exception\StreamReadException; -use React\Stream\ReadableStreamInterface as ReadableReactStreamInterface; /** * Exposes a React readable stream as a Recoil readable stream. @@ -65,10 +65,10 @@ function ($strand) { } if (strlen($this->buffer) > $length) { - $buffer = substr($this->buffer, 0, $length); + $buffer = substr($this->buffer, 0, $length); $this->buffer = substr($this->buffer, $length); } else { - $buffer = $this->buffer; + $buffer = $this->buffer; $this->buffer = ''; } diff --git a/src/Stream/WritableReactStream.php b/src/Stream/WritableReactStream.php index 7fd62a3..7413631 100644 --- a/src/Stream/WritableReactStream.php +++ b/src/Stream/WritableReactStream.php @@ -2,11 +2,11 @@ namespace Recoil\Stream; use Exception; +use React\Stream\WritableStreamInterface as WritableReactStreamInterface; use Recoil\Recoil; use Recoil\Stream\Exception\StreamClosedException; use Recoil\Stream\Exception\StreamLockedException; use Recoil\Stream\Exception\StreamWriteException; -use React\Stream\WritableStreamInterface as WritableReactStreamInterface; /** * Exposes a React writable stream as a Recoil writable stream. diff --git a/src/Stream/WritableStream.php b/src/Stream/WritableStream.php index 1c18c97..8bcfe24 100644 --- a/src/Stream/WritableStream.php +++ b/src/Stream/WritableStream.php @@ -106,7 +106,7 @@ public function writeAll($buffer) { while ($buffer) { $bytesWritten = (yield $this->write($buffer)); - $buffer = substr($buffer, $bytesWritten); + $buffer = substr($buffer, $bytesWritten); } } diff --git a/test/src/Recoil/Channel/ExclusiveReadableChannelTestTrait.php b/test/src/Recoil/Channel/ExclusiveReadableChannelTestTrait.php index d4b15da..a728d12 100644 --- a/test/src/Recoil/Channel/ExclusiveReadableChannelTestTrait.php +++ b/test/src/Recoil/Channel/ExclusiveReadableChannelTestTrait.php @@ -1,7 +1,6 @@ eventLoop = Phake::partialMock(StreamSelectLoop::CLASS); - $this->path = __FILE__; - $this->resource = fopen($this->path, 'r'); - $this->stream = $this->createStream(); + $this->path = __FILE__; + $this->resource = fopen($this->path, 'r'); + $this->stream = $this->createStream(); } abstract public function createStream(); diff --git a/test/src/Recoil/Stream/WritableStreamTestTrait.php b/test/src/Recoil/Stream/WritableStreamTestTrait.php index 0ffdf40..21d95f7 100644 --- a/test/src/Recoil/Stream/WritableStreamTestTrait.php +++ b/test/src/Recoil/Stream/WritableStreamTestTrait.php @@ -2,20 +2,20 @@ namespace Recoil\Stream; use Exception; +use Phake; +use React\EventLoop\StreamSelectLoop; use Recoil\Recoil; use Recoil\Stream\Exception\StreamClosedException; use Recoil\Stream\Exception\StreamLockedException; -use Phake; -use React\EventLoop\StreamSelectLoop; trait WritableStreamTestTrait { public function setUp() { $this->eventLoop = Phake::partialMock(StreamSelectLoop::CLASS); - $this->path = tempnam(sys_get_temp_dir(), 'recoil-'); - $this->resource = fopen($this->path, 'w'); - $this->stream = $this->createStream(); + $this->path = tempnam(sys_get_temp_dir(), 'recoil-'); + $this->resource = fopen($this->path, 'w'); + $this->stream = $this->createStream(); } public function tearDown() diff --git a/test/suite/Channel/BidirectionalChannelAdaptorTest.php b/test/suite/Channel/BidirectionalChannelAdaptorTest.php index f9d4120..2172e19 100644 --- a/test/suite/Channel/BidirectionalChannelAdaptorTest.php +++ b/test/suite/Channel/BidirectionalChannelAdaptorTest.php @@ -1,17 +1,17 @@ readChannel = Phake::mock(ReadableChannelInterface::class); + $this->readChannel = Phake::mock(ReadableChannelInterface::class); $this->writeChannel = Phake::mock(WritableChannelInterface::class); - $this->adaptor = new BidirectionalChannelAdaptor( + $this->adaptor = new BidirectionalChannelAdaptor( $this->readChannel, $this->writeChannel ); diff --git a/test/suite/Channel/ChannelTest.php b/test/suite/Channel/ChannelTest.php index 19fc42e..20e4d33 100644 --- a/test/suite/Channel/ChannelTest.php +++ b/test/suite/Channel/ChannelTest.php @@ -1,11 +1,9 @@ channel->read()); + echo(yield $this->channel->read()); } }; - $next = 1; + $next = 1; $writer = function ($id) use (&$next) { while (true) { yield $this->channel->write($id . $next++); diff --git a/test/suite/Channel/Exception/ChannelClosedExceptionTest.php b/test/suite/Channel/Exception/ChannelClosedExceptionTest.php index 28594c2..2e3de9c 100644 --- a/test/suite/Channel/Exception/ChannelClosedExceptionTest.php +++ b/test/suite/Channel/Exception/ChannelClosedExceptionTest.php @@ -8,7 +8,7 @@ class ChannelClosedExceptionTest extends PHPUnit_Framework_TestCase { public function testException() { - $previous = new Exception(); + $previous = new Exception(); $exception = new ChannelClosedException($previous); $this->assertSame('Channel is closed.', $exception->getMessage()); diff --git a/test/suite/Channel/Exception/ChannelLockedExceptionTest.php b/test/suite/Channel/Exception/ChannelLockedExceptionTest.php index e7b57d7..92742a9 100644 --- a/test/suite/Channel/Exception/ChannelLockedExceptionTest.php +++ b/test/suite/Channel/Exception/ChannelLockedExceptionTest.php @@ -8,7 +8,7 @@ class ChannelLockedExceptionTest extends PHPUnit_Framework_TestCase { public function testException() { - $previous = new Exception(); + $previous = new Exception(); $exception = new ChannelLockedException($previous); $this->assertSame('Channel is already in use by another strand.', $exception->getMessage()); diff --git a/test/suite/Channel/ReadableStreamChannelTest.php b/test/suite/Channel/ReadableStreamChannelTest.php index b785aa4..d532dd1 100644 --- a/test/suite/Channel/ReadableStreamChannelTest.php +++ b/test/suite/Channel/ReadableStreamChannelTest.php @@ -1,10 +1,10 @@ path = tempnam(sys_get_temp_dir(), 'recoil-'); - $this->resource = fopen($this->path, 'r+'); - $this->stream = new ReadableStream($this->resource); - $this->channel = new ReadableStreamChannel($this->stream); + $this->path = tempnam(sys_get_temp_dir(), 'recoil-'); + $this->resource = fopen($this->path, 'r+'); + $this->stream = new ReadableStream($this->resource); + $this->channel = new ReadableStreamChannel($this->stream); $this->serializer = new PhpSerializer(); } diff --git a/test/suite/Channel/WritableStreamChannelTest.php b/test/suite/Channel/WritableStreamChannelTest.php index d175e20..8a42eef 100644 --- a/test/suite/Channel/WritableStreamChannelTest.php +++ b/test/suite/Channel/WritableStreamChannelTest.php @@ -1,10 +1,10 @@ path = tempnam(sys_get_temp_dir(), 'recoil-'); - $this->resource = fopen($this->path, 'w'); - $this->stream = new WritableStream($this->resource); - $this->channel = new WritableStreamChannel($this->stream); + $this->path = tempnam(sys_get_temp_dir(), 'recoil-'); + $this->resource = fopen($this->path, 'w'); + $this->stream = new WritableStream($this->resource); + $this->channel = new WritableStreamChannel($this->stream); $this->unserializer = new PhpUnserializer(); } diff --git a/test/suite/Coroutine/CoroutineAdaptorTest.php b/test/suite/Coroutine/CoroutineAdaptorTest.php index a1c2407..050ab56 100644 --- a/test/suite/Coroutine/CoroutineAdaptorTest.php +++ b/test/suite/Coroutine/CoroutineAdaptorTest.php @@ -1,13 +1,11 @@ adaptor->adapt($this->strand, $promise); $this->assertInstanceOf(PromiseCoroutine::class, $coroutine); @@ -80,7 +78,7 @@ public function testAdaptFailure() public function testAdaptProvider() { - $provider = Phake::mock(CoroutineProviderInterface::class); + $provider = Phake::mock(CoroutineProviderInterface::class); $coroutine = Phake::mock(CoroutineInterface::class); Phake::when($provider) @@ -95,7 +93,7 @@ public function testAdaptProvider() public function testAdaptNestedProvider() { - $provider = Phake::mock(CoroutineProviderInterface::class); + $provider = Phake::mock(CoroutineProviderInterface::class); $coroutine = Phake::mock(CoroutineInterface::class); Phake::when($provider) diff --git a/test/suite/Coroutine/GeneratorCoroutineTest.php b/test/suite/Coroutine/GeneratorCoroutineTest.php index 173016c..f167b41 100644 --- a/test/suite/Coroutine/GeneratorCoroutineTest.php +++ b/test/suite/Coroutine/GeneratorCoroutineTest.php @@ -2,9 +2,9 @@ namespace Recoil\Coroutine; use Exception; -use Recoil\Recoil; -use Recoil\Kernel\Kernel; use PHPUnit_Framework_TestCase; +use Recoil\Kernel\Kernel; +use Recoil\Recoil; /** * @covers Recoil\Coroutine\GeneratorCoroutine @@ -51,7 +51,7 @@ public function testResumeWithValue() $coroutine = function () { echo 1; - echo (yield Recoil::suspend( + echo(yield Recoil::suspend( function ($strand) { $strand->resumeWithValue(2); } @@ -69,7 +69,7 @@ public function testThrowAfterResumeWithValue() $coroutine = function () { echo 1; - echo (yield Recoil::suspend( + echo(yield Recoil::suspend( function ($strand) { $strand->resumeWithValue(2); } @@ -157,4 +157,78 @@ function ($strand) { $this->kernel->eventLoop()->run(); } + + /** + * @requires PHP 7 + */ + public function testGeneratorReturn() + { + $this->assertGeneratorReturn( + " + function () { + return ''; + yield; + } + " + ); + } + + /** + * @requires PHP 7 + */ + public function testGeneratorReturnOnResumeWithValue() + { + $this->assertGeneratorReturn( + " + function () { + yield; + return ''; + } + " + ); + } + + /** + * @requires PHP 7 + */ + public function testGeneratorReturnOnResumeWithException() + { + $this->assertGeneratorReturn( + " + function () { + try { + \$thrower = function () { + throw new Exception('The exception.'); + yield; + }; + + yield \$thrower(); + } catch (Exception \$e) { + return ''; + } + } + " + ); + } + + private function assertGeneratorReturn($coroutine) + { + $coroutine = eval('return ' . $coroutine . ';'); + + $result = null; + $strand = $this->kernel->execute($coroutine()); + $strand->on( + 'success', + function ($strand, $value) use (&$result) { + $result = $value; + } + ); + + $this->kernel->eventLoop()->run(); + + $this->assertSame( + '', + $result + ); + } } diff --git a/test/suite/Coroutine/PromiseCoroutineTest.php b/test/suite/Coroutine/PromiseCoroutineTest.php index 633200f..47bce7f 100644 --- a/test/suite/Coroutine/PromiseCoroutineTest.php +++ b/test/suite/Coroutine/PromiseCoroutineTest.php @@ -24,7 +24,7 @@ public function setUp() public function testFulfilledPromise() { - $value = null; + $value = null; $coroutine = function () use (&$value) { $value = (yield new PromiseCoroutine( new FulfilledPromise(123) @@ -82,11 +82,11 @@ public function testRejectedPromiseWithNonExceptionReason() public function testTerminateThenFulfill() { - $deferred = new Deferred(); - $promise = $deferred->promise(); + $deferred = new Deferred(); + $promise = $deferred->promise(); $promiseCoroutine = new PromiseCoroutine($promise); - $resumed = null; + $resumed = null; $coroutine = function () use (&$resumed, $promiseCoroutine) { $resumed = false; yield $promiseCoroutine; @@ -110,7 +110,7 @@ public function testTerminateThenFulfill() public function testTerminateThenReject() { - $cancelled = false; + $cancelled = false; $promiseCanceller = function () use (&$cancelled) { $cancelled = true; }; diff --git a/test/suite/Kernel/Api/KernelApiCallTest.php b/test/suite/Kernel/Api/KernelApiCallTest.php index 0b62023..f1e6d5f 100644 --- a/test/suite/Kernel/Api/KernelApiCallTest.php +++ b/test/suite/Kernel/Api/KernelApiCallTest.php @@ -3,16 +3,16 @@ use BadMethodCallException; use Exception; +use PHPUnit_Framework_TestCase; +use Phake; use Recoil\Kernel\Kernel; use Recoil\Recoil; -use Phake; -use PHPUnit_Framework_TestCase; class KernelApiCallTest extends PHPUnit_Framework_TestCase { public function setUp() { - $this->api = Phake::partialMock(KernelApi::class); + $this->api = Phake::partialMock(KernelApi::class); $this->kernel = new Kernel(null, $this->api); } diff --git a/test/suite/Kernel/Api/KernelApiTest.php b/test/suite/Kernel/Api/KernelApiTest.php index 1cd1b83..cede9fe 100644 --- a/test/suite/Kernel/Api/KernelApiTest.php +++ b/test/suite/Kernel/Api/KernelApiTest.php @@ -2,11 +2,11 @@ namespace Recoil\Kernel\Api; use Exception; +use PHPUnit_Framework_TestCase; use Recoil\Kernel\Exception\TimeoutException; use Recoil\Kernel\Kernel; use Recoil\Kernel\Strand\StrandInterface; use Recoil\Recoil; -use PHPUnit_Framework_TestCase; /** * @covers Recoil\Kernel\Api\KernelApi @@ -16,13 +16,13 @@ class KernelApiTest extends PHPUnit_Framework_TestCase { public function setUp() { - $this->kernel = new Kernel(); + $this->kernel = new Kernel(); $this->tolerance = 0.02; } public function testStrand() { - $strand = null; + $strand = null; $coroutine = function () use (&$strand) { $strand = (yield Recoil::strand()); }; @@ -36,7 +36,7 @@ public function testStrand() public function testKernel() { - $kernel = null; + $kernel = null; $coroutine = function () use (&$kernel) { $kernel = (yield Recoil::kernel()); }; @@ -71,7 +71,7 @@ public function testReturn() yield Recoil::return_(1); }; - echo (yield $f()); + echo(yield $f()); }; $this->kernel->execute($coroutine()); @@ -105,7 +105,7 @@ public function testFinally() $this->expectOutputString('12'); $coroutine = function () { - $strand = (yield Recoil::strand()); + $strand = (yield Recoil::strand()); $coroutine = $strand->current(); yield Recoil::finally_( @@ -192,7 +192,7 @@ public function testTerminate() public function testSleep() { $start = 0; - $end = 0; + $end = 0; $coroutine = function () use (&$start, &$end) { $start = microtime(true); @@ -238,7 +238,7 @@ public function testTimeout() }; $coroutine = function () use ($immediate) { - echo (yield Recoil::timeout(0.01, $immediate())); + echo(yield Recoil::timeout(0.01, $immediate())); }; $this->kernel->execute($coroutine()); @@ -250,7 +250,7 @@ public function testAll() { $this->expectOutputString('12345'); - $result = null; + $result = null; $coroutine = function () use (&$result) { $f = function ($value) { echo $value; @@ -332,7 +332,7 @@ public function testExecute() { $this->expectOutputString('123'); - $strand = null; + $strand = null; $coroutine = function () use (&$strand) { $f = function () { echo 3; diff --git a/test/suite/Kernel/Api/SelectTest.php b/test/suite/Kernel/Api/SelectTest.php index 59174af..8a14bc3 100644 --- a/test/suite/Kernel/Api/SelectTest.php +++ b/test/suite/Kernel/Api/SelectTest.php @@ -1,9 +1,9 @@ kernel = new Kernel(); + $this->kernel = new Kernel(); $this->tolerance = 0.02; } public function testSleep() { $start = 0; - $end = 0; + $end = 0; $coroutine = function () use (&$start, &$end) { $start = microtime(true); @@ -35,7 +34,7 @@ public function testSleep() public function testResumeWithValueBeforeTimeout() { $start = 0; - $end = 0; + $end = 0; $coroutine = function () use (&$start, &$end) { $start = microtime(true); @@ -61,7 +60,7 @@ public function testResumeWithValueBeforeTimeout() public function testResumeWithExceptionBeforeTimeout() { $start = 0; - $end = 0; + $end = 0; $coroutine = function () use (&$start, &$end) { $start = microtime(true); @@ -92,7 +91,7 @@ public function testResumeWithExceptionBeforeTimeout() public function testTerminateBeforeTimeout() { - $resumed = null; + $resumed = null; $coroutine = function () use (&$resumed) { $resumed = false; yield new Sleep(0.15); diff --git a/test/suite/Kernel/Api/TimeoutTest.php b/test/suite/Kernel/Api/TimeoutTest.php index bafc8e2..70360e2 100644 --- a/test/suite/Kernel/Api/TimeoutTest.php +++ b/test/suite/Kernel/Api/TimeoutTest.php @@ -2,10 +2,10 @@ namespace Recoil\Kernel\Api; use Exception; +use PHPUnit_Framework_TestCase; use Recoil\Kernel\Exception\TimeoutException; use Recoil\Kernel\Kernel; use Recoil\Recoil; -use PHPUnit_Framework_TestCase; class TimeoutTest extends PHPUnit_Framework_TestCase { @@ -23,7 +23,7 @@ public function testTimeout() }; $coroutine = function () use ($immediate) { - echo (yield new Timeout(0.01, $immediate())); + echo(yield new Timeout(0.01, $immediate())); }; $this->kernel->execute($coroutine()); diff --git a/test/suite/Kernel/Api/WaitAllTest.php b/test/suite/Kernel/Api/WaitAllTest.php index c19c804..f16f0c1 100644 --- a/test/suite/Kernel/Api/WaitAllTest.php +++ b/test/suite/Kernel/Api/WaitAllTest.php @@ -2,10 +2,9 @@ namespace Recoil\Kernel\Api; use Exception; +use PHPUnit_Framework_TestCase; use Recoil\Kernel\Exception\StrandTerminatedException; -use Recoil\Kernel\Kernel; use Recoil\Recoil; -use PHPUnit_Framework_TestCase; class WaitAllTest extends PHPUnit_Framework_TestCase { diff --git a/test/suite/Kernel/KernelFunctionalTest.php b/test/suite/Kernel/KernelFunctionalTest.php index 6e9ad01..56b124c 100644 --- a/test/suite/Kernel/KernelFunctionalTest.php +++ b/test/suite/Kernel/KernelFunctionalTest.php @@ -2,7 +2,6 @@ namespace Recoil\Kernel; use Exception; -use Recoil\Recoil; use InvalidArgumentException; use PHPUnit_Framework_TestCase; use React\Promise\FulfilledPromise; @@ -84,7 +83,7 @@ public function testYieldNull() */ public function testYieldPromise() { - $value = null; + $value = null; $coroutine = function () use (&$value) { $value = (yield new FulfilledPromise(123)); }; diff --git a/test/suite/Kernel/KernelTest.php b/test/suite/Kernel/KernelTest.php index 3a646c6..6b7efa8 100644 --- a/test/suite/Kernel/KernelTest.php +++ b/test/suite/Kernel/KernelTest.php @@ -1,12 +1,12 @@ resume(); + $strand->resumeWithValue(null); echo 2; return; yield; // make this closure a generator diff --git a/test/suite/Stream/BidirectionalStreamAdaptorTest.php b/test/suite/Stream/BidirectionalStreamAdaptorTest.php index 191d432..78dba7f 100644 --- a/test/suite/Stream/BidirectionalStreamAdaptorTest.php +++ b/test/suite/Stream/BidirectionalStreamAdaptorTest.php @@ -1,17 +1,17 @@ readStream = Phake::mock(ReadableStreamInterface::class); + $this->readStream = Phake::mock(ReadableStreamInterface::class); $this->writeStream = Phake::mock(WritableStreamInterface::class); - $this->adaptor = new BidirectionalStreamAdaptor( + $this->adaptor = new BidirectionalStreamAdaptor( $this->readStream, $this->writeStream ); diff --git a/test/suite/Stream/Exception/StreamClosedExceptionTest.php b/test/suite/Stream/Exception/StreamClosedExceptionTest.php index c505a66..d4bede6 100644 --- a/test/suite/Stream/Exception/StreamClosedExceptionTest.php +++ b/test/suite/Stream/Exception/StreamClosedExceptionTest.php @@ -8,7 +8,7 @@ class StreamClosedExceptionTest extends PHPUnit_Framework_TestCase { public function testException() { - $previous = new Exception(); + $previous = new Exception(); $exception = new StreamClosedException($previous); $this->assertSame('Stream is closed.', $exception->getMessage()); diff --git a/test/suite/Stream/Exception/StreamLockedExceptionTest.php b/test/suite/Stream/Exception/StreamLockedExceptionTest.php index 0e61f31..be1b90f 100644 --- a/test/suite/Stream/Exception/StreamLockedExceptionTest.php +++ b/test/suite/Stream/Exception/StreamLockedExceptionTest.php @@ -8,7 +8,7 @@ class StreamLockedExceptionTest extends PHPUnit_Framework_TestCase { public function testException() { - $previous = new Exception(); + $previous = new Exception(); $exception = new StreamLockedException($previous); $this->assertSame('Stream is already in use by another strand.', $exception->getMessage()); diff --git a/test/suite/Stream/Exception/StreamReadExceptionTest.php b/test/suite/Stream/Exception/StreamReadExceptionTest.php index 9fa2c7f..dedf421 100644 --- a/test/suite/Stream/Exception/StreamReadExceptionTest.php +++ b/test/suite/Stream/Exception/StreamReadExceptionTest.php @@ -8,7 +8,7 @@ class StreamReadExceptionTest extends PHPUnit_Framework_TestCase { public function testException() { - $previous = new Exception(); + $previous = new Exception(); $exception = new StreamReadException($previous); $this->assertSame('An error occurred while reading from the stream.', $exception->getMessage()); diff --git a/test/suite/Stream/Exception/StreamWriteExceptionTest.php b/test/suite/Stream/Exception/StreamWriteExceptionTest.php index 1d0d875..d203da0 100644 --- a/test/suite/Stream/Exception/StreamWriteExceptionTest.php +++ b/test/suite/Stream/Exception/StreamWriteExceptionTest.php @@ -8,7 +8,7 @@ class StreamWriteExceptionTest extends PHPUnit_Framework_TestCase { public function testException() { - $previous = new Exception(); + $previous = new Exception(); $exception = new StreamWriteException($previous); $this->assertSame('An error occurred while writing to the stream.', $exception->getMessage()); diff --git a/test/suite/Stream/ReadableReactStreamTest.php b/test/suite/Stream/ReadableReactStreamTest.php index fcd9a83..195d250 100644 --- a/test/suite/Stream/ReadableReactStreamTest.php +++ b/test/suite/Stream/ReadableReactStreamTest.php @@ -2,12 +2,12 @@ namespace Recoil\Stream; use Exception; +use PHPUnit_Framework_TestCase; +use Phake; +use React\Stream\Stream; use Recoil\Recoil; use Recoil\Stream\Exception\StreamClosedException; use Recoil\Stream\Exception\StreamReadException; -use Phake; -use PHPUnit_Framework_TestCase; -use React\Stream\Stream; class ReadableReactStreamTest extends PHPUnit_Framework_TestCase { diff --git a/test/suite/Stream/ReadableStreamTest.php b/test/suite/Stream/ReadableStreamTest.php index 95f9582..9691e0a 100644 --- a/test/suite/Stream/ReadableStreamTest.php +++ b/test/suite/Stream/ReadableStreamTest.php @@ -1,10 +1,10 @@