Aaron Piotrowski
1b30909215
Remove succeed() and fail()
2020-10-04 10:22:51 -05:00
Aaron Piotrowski
0eceb48fad
Refactor internal traits as classes
...
Trait tests should test Deferred and Emitter instead, will update with other tests.
2020-09-26 23:14:17 -05:00
Aaron Piotrowski
d48e6bd5d2
Add more class and return types
...
More PHP 7.1 to 8 types added.
2020-09-24 22:17:13 -05:00
Aaron Piotrowski
8e4cc1bbd1
Refactor Pipeline for async/await
2020-09-24 22:14:58 -05:00
Aaron Piotrowski
5f6db028ab
Initial fiber support
2020-09-24 12:53:32 -05:00
Aaron Piotrowski
9a13937fef
Make explicit disposal fail pending promises
...
Destruction of the pipeline does not fail pending promises, but calling dispose() now will.
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
657614c036
Dispose after all pending promises are fulfilled
...
Allows continue() to be called, then dispose(), but the pipeline is not actually disposed until those pending promises are fulfilled.
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
5e521daa16
Rename to Pipeline
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
52d50a5b6d
Revert adding onDisposal() and onCompletion()
...
This largely reverts 6ab9048e717bb1f69f418d82e697a968721115c0.
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
dd0f01f4db
Add onDisposal() and onCompletion() to Stream
...
onCompletion callbacks are invoked if complete() or fail() is called before the stream is disposed.
onDisposal callbacks are invoked if the stream is disposed before being completed or failed.
Forbid failing a stream with DisposedException.
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
42d8ce764b
Add StreamSource::onDisposal()
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
217c31c5ce
Add Promise\succeed() and Promise\fail()
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
ee76c97c51
Add StreamSource::isDisposed()
2020-09-24 12:53:30 -05:00
Aaron Piotrowski
0ddf9a656e
Add Deferred::isResolved() and StreamSource::isComplete()
2020-09-24 12:53:30 -05:00
Aaron Piotrowski
5d0adebaa2
Add isDebugEnabled function
2020-09-24 12:53:30 -05:00
Aaron Piotrowski
f4cc591988
Feedback update
2020-09-24 12:53:30 -05:00
Aaron Piotrowski
b64b3affc9
Rename yield() to emit()
2020-09-24 12:53:30 -05:00
Aaron Piotrowski
66f0deb563
Drop YieldedValue
2020-09-24 12:53:29 -05:00
Aaron Piotrowski
dae252aea0
Rethrow exceptions from destructors
2020-09-24 12:53:29 -05:00
Aaron Piotrowski
8df006b011
Remove unnecessary internal interface
...
Switched Yielder trait to a concrete class YieldSource.
2020-09-24 12:53:29 -05:00
Aaron Piotrowski
d496c9db24
Resolve promise with YieldedValue
...
A suggested alternative to resolving with [$yieldedValue] since static analysis (specifically Psalm) doesn't play well with that API.
Will revert if Psalm changes or we decide to resolve with [$yieldedValue] anyway.
2020-09-24 12:53:29 -05:00
Aaron Piotrowski
57924690fe
Remove key
2020-09-24 12:53:29 -05:00
Aaron Piotrowski
704f87ccc8
Use separate objects for stream ops
2020-09-24 12:53:28 -05:00
Aaron Piotrowski
3755155e51
Add callback to transform()
...
Suggestion for an apply()-like method.
2020-09-24 12:53:28 -05:00
Aaron Piotrowski
1b4863b7b3
Don't re-wrap stream
2020-09-24 12:53:28 -05:00
Aaron Piotrowski
6283d9bbb7
Intial stream transformations
2020-09-24 12:53:28 -05:00
Aaron Piotrowski
12c97b2561
Add explicit dispose() method to Stream
2020-09-24 12:53:28 -05:00
Aaron Piotrowski
96007f11aa
Add Streams
2020-09-24 12:53:27 -05:00
Niklas Keller
c34b679142
Remove psalm-suppress for fixed psalm bugs
2020-03-29 14:24:09 +02:00
Niklas Keller
885cd68828
Increase psalm error level to level 3
2020-03-28 21:55:44 +01:00
Niklas Keller
0e04422dcb
Increase psalm error level to level 4
2020-03-28 20:27:42 +01:00
Niklas Keller
603ce25299
Fix invalid types in doc comments
...
We're on the way to psalm error level 4, but there are still some remaining issues.
2020-03-28 14:32:53 +01:00
Niklas Keller
71d7f5674c
Increase psalm error level to level 5
2020-03-28 14:25:39 +01:00
Niklas Keller
a75164b66b
Add psalm static analysis on level 6
...
This also fixes mixed types in some cases.
2020-03-28 12:23:46 +01:00
Aaron Piotrowski
a726db92a5
Only create deferred for backpressure if necessary
2019-09-21 18:30:14 +02:00
Niklas Keller
c45cd5a3a9
Fix backpressure release
...
Previously, backpressure was only released once advance() was called
again. This means the last backpressure item was never free'd in case
the caller knows there are no more items to consume and didn't call
advance() the last time.
2019-09-21 18:30:14 +02:00
Niklas Keller
f824f0df1d
Ignore code coverage for getCurrentTime on 32 bit
2019-05-31 20:42:02 +02:00
Niklas Keller
72a0db5cdc
Warn if time is about to overflow on 32 bit
2019-05-31 20:15:22 +02:00
Niklas Keller
8b38da2f9c
Support 32-bit platforms
2019-05-31 12:59:23 -05:00
Aaron Piotrowski
5316e741b7
Different approach for 32-bit support
...
Prior version made time run backwards… oops.
2019-05-31 12:48:03 -05:00
Aaron Piotrowski
a4fd818e13
Swap sign of returned time on 32-bit systems
2019-05-31 11:40:56 -05:00
Niklas Keller
944a2dd29d
Move Coroutine::__destruct to Placeholder
2019-05-31 11:38:02 -05:00
Niklas Keller
c12828081f
Fix exceptions bubbling from Coroutine::__destruct
...
This has been an edge case potentially hiding some exceptions. The tests have been refactored to error if the loop has watchers leaking from one test to another test.
2019-05-31 11:38:02 -05:00
Niklas Keller
5622edba37
Implement monotonic timer using PHP 7.3's hrtime()
2018-12-10 20:07:11 +01:00
Niklas Keller
fa3fe1d20b
Apply PSR-2
2018-06-18 20:00:01 +02:00
Niklas Keller
5dac863f37
Don't record stack traces in case of AMP_DEBUG not being set ( #218 )
...
Fixes #217 .
2018-04-26 00:32:31 +02:00
Aaron Piotrowski
992d6e9b39
Return named classes
...
Better for var_dump and stack traces.
2018-01-27 19:47:46 +01:00
Niklas Keller
0cb033084a
Fix formatStacktrace notice
2017-12-07 18:23:19 +01:00
Aaron Piotrowski
4ef9af6dff
Check against "false"
2017-12-02 11:15:06 -06:00
Aaron Piotrowski
e3b0b9a0c7
Update backtrace formatting
2017-12-02 11:14:49 -06:00