Skip to content

Commit

Permalink
Merge branch 'release/0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Mar 6, 2016
2 parents bdaf23c + ec7b8f7 commit 020b5cb
Show file tree
Hide file tree
Showing 112 changed files with 2,454 additions and 2,354 deletions.
70 changes: 60 additions & 10 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,66 @@
<?php

$finder = Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__);
->in(__DIR__)
->exclude(
array(
'artifacts',
'assets',
'bower_components',
'build',
'node_modules',
'src-web',
'src-generated',
'vendor',
)
);

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',
))
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->fixers(
array(
// symfony
'blankline_after_open_tag',
'duplicate_semicolon',
'extra_empty_lines',
'include',
'join_function',
'list_commas',
'multiline_array_trailing_comma',
'namespace_no_leading_whitespace',
'new_with_braces',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'object_operator',
'operators_spaces',
'phpdoc_indent',
'phpdoc_params',
'phpdoc_short_description',
'phpdoc_to_comment',
'phpdoc_trim',
'phpdoc_type_to_var',
'phpdoc_var_without_name',
'pre_increment',
'remove_leading_slash_use',
'remove_lines_between_uses',
'return',
'self_accessor',
'single_array_no_trailing_comma',
'single_blank_line_before_namespace',
'single_quote',
'spaces_before_semicolon',
'spaces_cast',
'standardize_not_equal',
'ternary_spaces',
'trim_array_spaces',
'unary_operators_spaces',
'unused_use',
'whitespacy_lines',

// contrib
'concat_with_spaces',
'multiline_spaces_before_semicolon',
'ordered_use',
)
)
->finder($finder);
2 changes: 1 addition & 1 deletion .travis.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
eNkdkCDTTQDrKETgHn9u2Kbx1vvZFDkMxFgmwl6keoe9X4XtEsw/LSgHlE4dEscGVwEidzMJuH2ZapgB9KbqSJImKmtvJYjF1700zrWdXSqy5NeLiexwBwoQbkrnO27AwqpRnEFwJrBlEggsBcUYj8s9hRYlDKb3juEEKgdafxc=
g0uexghpfxjO1pVYCBqj/P957zCZQT1v5naWgzDtu5n2Sh1WoW00K4+jOYJ4bbIm+1O8wbzzlyOuYZMMz0xXLVzuOdoMwMhfcnI+pE/dpa4J/vs1RFqoLh4HuNx9oPErNODdmWIkeC1SpcuBeYZfYxEL6UJIWbZZq3a9BIslx88=
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ matrix:
env:
global:
- ARCHER_PUBLISH_VERSION=5.6
- secure: "eNkdkCDTTQDrKETgHn9u2Kbx1vvZFDkMxFgmwl6keoe9X4XtEsw/LSgHlE4dEscGVwEidzMJuH2ZapgB9KbqSJImKmtvJYjF1700zrWdXSqy5NeLiexwBwoQbkrnO27AwqpRnEFwJrBlEggsBcUYj8s9hRYlDKb3juEEKgdafxc="
- secure: "g0uexghpfxjO1pVYCBqj/P957zCZQT1v5naWgzDtu5n2Sh1WoW00K4+jOYJ4bbIm+1O8wbzzlyOuYZMMz0xXLVzuOdoMwMhfcnI+pE/dpa4J/vs1RFqoLh4HuNx9oPErNODdmWIkeC1SpcuBeYZfYxEL6UJIWbZZq3a9BIslx88="

install:
- ./.travis.install
Expand Down
37 changes: 26 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
# Recoil Changelog

### 0.3.0 (2015-06-26)
## 0.4.0 (2016-03-06)

* **[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)
This is the final release that will operate with PHP 5. In an effort to work
towards a production ready 1.0 release, future releases will require PHP 7.

### 0.2.1 (2014-10-16)
- **[BC]** Dropped `Interface` suffix from interfaces
- **[BC]** Renamed `ReadableStream` to `ReadablePhpStream`
- **[BC]** Renamed `WritableStream` to `WritablePhpStream`
- **[BC]** Renamed `CoroutineAdaptor` to `StandardCoroutineAdaptor`
- **[BC]** Renamed `KernelApi` to `StandardKernelApi`
- **[BC]** Renamed `Strand` to `StandardStrand`
- **[BC]** Renamed `StrandFactory` to `StandardStrandFactory`
- **[NEW]** Added support for Guzzle promises
- **[IMPROVED]** The callback given to `Recoil::suspend` is now optional

* **[IMPROVED]** Added support for cancellable promises
## 0.3.0 (2015-06-26)

### 0.2.0 (2014-09-23)
- **[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

## 0.2.0 (2014-09-23)

To faciliate several performance improvements the following backwards compatibility breaking changes have been introduced:

* **[BC]** `CoroutineInterface` no longer implements `EventEmitterInterface` - several unused events were fired every time a coroutine was called
* **[BC]** `Recoil::finalize()` now only works with generated based coroutines - this was previously implemented using the aforementioned events
- **[BC]** `CoroutineInterface` no longer implements `EventEmitterInterface` - several unused events were fired every time a coroutine was called
- **[BC]** `Recoil::finalize()` now only works with generator based coroutines - this was previously implemented using the aforementioned events

### 0.1.0 (2014-02-04)
## 0.1.0 (2014-02-04)

* Initial release
- Initial release
40 changes: 32 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ Internally, the kernel uses a [React event-loop](https://github.com/reactphp/eve
applications to execute coroutine based code alongside "conventional" React code by sharing an event-loop instance.

Coroutine control flow, the current strand, and the kernel itself can be manipulated using the *kernel API*. The
supported operations are defined in [KernelApiInterface](src/Kernel/Api/KernelApiInterface.php) (though custom kernel
implementations may provide additional operations). Inside an executing coroutine, the kernel API for the current kernel
is accessed via the [Recoil facade](src/Recoil.php).
supported operations are defined in [KernelApi](src/Kernel/Api/KernelApi.php) (though custom kernel implementations may
provide additional operations). Inside an executing coroutine, the kernel API for the current kernel is accessed via the
[Recoil facade](src/Recoil.php).

### Streams

*Streams* provide a coroutine based abstraction for [readable](src/Stream/ReadableStreamInterface.php) and [writable](src/Stream/WritableStreamInterface.php)
*Streams* provide a coroutine based abstraction for [readable](src/Stream/ReadableStream.php) and [writable](src/Stream/WritableStream.php)
data streams. The interfaces are somewhat similar to the built-in PHP stream API.

Stream operations are cooperative, that is, when reading or writing to a stream, execution of the coroutine is suspended
Expand All @@ -115,7 +115,7 @@ The [stream-file example](examples/stream-file) demonstrates using a readable st
*Channels* are stream-like objects that produce and consume PHP values rather than byte streams. Channels are intended
as the primary method for communication between strands.

Like streams there are [readable](src/Channel/ReadableChannelInterface.php) and [writable](src/Channel/WritableChannelInterface.php)
Like streams there are [readable](src/Channel/ReadableChannel.php) and [writable](src/Channel/WritableChannel.php)
variants. Some channel implementations allow for multiple concurrent read and write operations.

Both in-memory and stream-based channels are provided. Stream-based channels use a serialization protocol to encode and
Expand Down Expand Up @@ -212,7 +212,7 @@ function multiply($a, $b)
### Throwing and catching exceptions

One of the major advantages made available by coroutines is that errors can be reported using familiar exception
handling techniques. Unlike `return`, the `throw` keyword can be used in the standard way inside PHP generators.
handling techniques. The `throw` keyword can be used in the standard way inside PHP generators in both PHP version 5 and 7.

```php
function multiply($a, $b)
Expand Down Expand Up @@ -268,6 +268,30 @@ The [promise-dns example](examples/promise-dns) demonstrates using the [React DN
a promised-based API, to resolve several domain names concurrently. [This example](examples/promise-dns-react) shows the
same functionality implemented without **Recoil**.

### Callback and Events

Conventional asynchronous code uses callback functions to inform a caller when a result is available or an event occurs.
The kernel API provides `Recoil::callback()` to create a callback that executes a coroutine on its own strand.

```php
use Evenement\EventEmitter;

Recoil::run(
function () {
$eventEmitter = new EventEmitter();
$eventEmitter->on(
'hello'
(yield Recoil::callback(
function ($name) {
echo 'Hello, ' . $name . '!' . PHP_EOL;
yield Recoil::noop();
}
))
);
}
);
```

### Using an existing event-loop

In all of the examples above, the `Recoil::run()` convenience function is used to start the kernel. Internally this
Expand Down Expand Up @@ -299,7 +323,7 @@ manually.
```php
$eventLoop = new React\EventLoop\StreamSelectLoop;

$kernel = new Recoil\Kernel\Kernel($eventLoop);
$kernel = new Recoil\Kernel\StandardKernel($eventLoop);

$coroutine = function () {
echo 'Hello, world!' . PHP_EOL;
Expand All @@ -320,4 +344,4 @@ $eventLoop->run();
<!-- references -->
[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.3.0-yellow.svg?style=flat-square
[SemVer]: http://img.shields.io/:semver-0.4.0-yellow.svg?style=flat-square
15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
],
"require": {
"php": ">=5.5",
"evenement/evenement": "~2",
"icecave/repr": "~1",
"react/react": "0.4.0|~0.4.2",
"react/promise": "~2"
"evenement/evenement": "^2",
"icecave/repr": "^1",
"react/event-loop": "^0.4"
},
"require-dev": {
"icecave/archer": "~1",
"phake/phake": "2.0.0-alpha4 as v1.0.3"
"icecave/archer": "^1",
"guzzlehttp/promises": "^1",
"phake/phake": "2.0.0-alpha4 as v1.0.3",
"react/dns": "^0.4",
"react/promise": "^2",
"react/stream": "^0.4"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 020b5cb

Please sign in to comment.