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
Aaron Piotrowski
745a95ba67
Define AMP_DEBUG through environment
2017-12-02 10:23:12 -06:00
Markus Staab
34bf671f13
Automatically add \ for buitins ( #186 )
...
Fixes #185 .
2017-11-29 13:36:50 +01:00
Aaron Piotrowski
7a05fe1316
Use static function for rethrow
2017-06-05 00:21:45 -05:00
Aaron Piotrowski
02eb0340f1
Use anonymous classes in Deferred and Emitter
2017-06-04 23:59:23 -05:00
Niklas Keller
783fe8c4f4
✅ Add asyncCoroutine and ReactPromise tests
2017-05-02 18:59:52 +02:00
Aaron Piotrowski
835e617054
More stream → iterator
...
Hopefully that's all of them…
2017-05-02 07:07:43 +02:00
Aaron Piotrowski
91c8da9fec
Replace more occurrences of stream
2017-05-02 07:07:43 +02:00
Aaron Piotrowski
f78328822c
Allow for debugging of double iterator completion
2017-05-02 07:07:43 +02:00
Aaron Piotrowski
38d53304ae
Stream → Iterator
2017-05-02 07:07:20 +02:00
Aaron Piotrowski
4935dddc84
Refactor Streams
...
Dropped original Stream interface in favor of the Iterator interface. Eliminates subscriber timing issues and simplifies Stream usage.
2017-05-02 07:04:10 +02:00
Niklas Keller
79ab41e5bf
Update php-cs-fixer to version 2 and upgrade rules
...
This also fixes the code style according to the new rules.
2017-04-24 16:22:02 +02:00
Niklas Keller
65a37484a2
Replace UnionTypeError with factory function + minor doc changes
2017-04-24 15:27:04 +02:00
Niklas Keller
70e63a3748
Fix code style according to new rules
2017-04-24 15:27:04 +02:00
Aaron Piotrowski
89570e8f6d
Move Watcher to Loop namespace
2017-04-18 09:38:16 -05:00
Niklas Keller
3a42254300
Make Watcher implement Struct
2017-04-13 18:05:59 +02:00
Niklas Keller
8caae2253f
Allow recording stacktraces to debug double resolution
2017-03-29 17:25:44 +02:00
Aaron Piotrowski
2f7e9a0746
Run returned generator as coroutine from onResolve and onEmit callbacks
2017-03-27 18:37:55 -05:00
Niklas Keller
2aa91a6c25
Rename Stream::listen to Stream::onEmit
2017-03-21 18:29:51 +01:00
Niklas Keller
ce269fa516
Rename Promise::when to Promise::onResolve, resolves #77
2017-03-21 17:23:37 +01:00
Aaron Piotrowski
a927b3cb06
Separate functions into Promise and Stream namespaces
2017-03-15 19:02:04 -05:00
Niklas Keller
77bd05b807
Fix tests and Producer React adaption
2017-03-12 22:09:19 +01:00
Aaron Piotrowski
2cc4cf9d0b
Fix use statement order
2017-03-12 12:23:48 -05:00
Aaron Piotrowski
cd4328ab48
Merge branch 'react-compatibility'
2017-03-12 11:38:48 -05:00
Pieter Hordijk
2db7bed1b6
Fixed typos an promise -> a promise
2017-03-12 17:36:07 +01:00
Aaron Piotrowski
7ad10f5d7d
Add support for React promises
2017-03-11 09:17:43 -06:00
Aaron Piotrowski
754a29e86c
Remove promise error handler
...
Exceptions thrown from when callbacks are now forwarded directly to the loop error handler.
2017-03-10 15:32:58 -06:00
Niklas Keller
0be9ae9ade
Switch from AsyncInterop\Promise to Amp\Promise
2017-03-10 21:58:46 +01:00
Niklas Keller
e64bbfb9f5
Add Loop::set, auto-wrapping, fixup things
2017-03-10 21:31:57 +01:00
Niklas Keller
f4f9008ca0
Merge amphp/amp repository into amphp/amp
2017-03-10 18:26:17 +01:00
Aaron Piotrowski
9073f6c999
Docblock cleanup
2017-02-16 22:36:32 -06:00
Aaron Piotrowski
cf5ebb1408
Better error message when emitting after resolve
2017-01-07 12:25:04 -06:00
Aaron Piotrowski
cba57dd81e
Simplify PrivatePromise and PrivateStream
2017-01-07 12:24:40 -06:00
Niklas Keller
ae69e92266
Update to promise 0.4.0 and event-loop 0.5.0, add humbug config
2017-01-07 13:47:45 +01:00
Aaron Piotrowski
210b6ff258
Observable → Stream
2017-01-03 19:10:27 -06:00
Aaron Piotrowski
5651240615
Update to promise spec v0.3
...
Dropped strict-types due to spec requiring weak types in callbacks.
2016-12-29 16:29:27 -06:00
Niklas Keller
2a65c0735b
Fix docblock for Placeholder::when
2016-12-23 23:48:24 +01:00
Aaron Piotrowski
11f1c7e7c4
Amp\lazy() → Amp\Lazy
...
Plus some tests!
2016-12-15 18:50:33 -06:00
Aaron Piotrowski
93ad513ab1
Remove dead code
...
Deferred and Postponed will never throw from the functions they define.
2016-12-15 17:34:30 -06:00
Aaron Piotrowski
f95412770b
Lazy promise bugfix
2016-11-14 14:10:44 -06:00
Aaron Piotrowski
9927ad5b4f
Awaitable → Promise
2016-11-14 13:59:21 -06:00
Aaron Piotrowski
759af93112
Missed static; remove unused import
2016-09-07 12:24:49 -05:00
Aaron Piotrowski
6e1c1db5a6
Drop special behavior when emitting an observable
2016-08-23 13:17:59 -05:00
Aaron Piotrowski
96e1178b89
Code, docblock, and comment cleanup
2016-08-17 22:25:54 -05:00
Aaron Piotrowski
d4e83490c2
Drop unsubscribing from Observable
2016-08-17 21:11:03 -05:00
Aaron Piotrowski
2317a3aa37
Unsubscribe from emitted observable if failed
2016-08-16 16:31:09 -05:00
Aaron Piotrowski
84c2572e0a
Prevent fail call after resolution
2016-08-16 13:30:32 -05:00
Aaron Piotrowski
bdc26e1e8b
Combine use statements
2016-08-16 13:07:51 -05:00
Aaron Piotrowski
dae4eb90da
Better Emitter fix; fail observable if emitted awaitable fails
2016-08-16 13:07:38 -05:00
Aaron Piotrowski
a8a5a1b3a5
Fix Emitter
2016-08-16 02:28:47 -05:00
Aaron Piotrowski
888229d667
Use strict types
2016-08-15 23:46:26 -05:00
Bob Weinand
dcf17e3f98
Optimize Producer & remove wait until first subscribe
...
Also delay first emit in Emitter until next tick
2016-08-14 16:57:17 +02:00
Aaron Piotrowski
2ff32c2d6b
Remove unnecessary default parameter values
2016-08-12 16:38:36 -05:00
Aaron Piotrowski
69ec812bc0
Require PHP 7
2016-08-11 14:52:40 -05:00
Aaron Piotrowski
658edf33f7
Use Closure::fromCallable() in 7.1
2016-08-11 13:33:51 -05:00
Aaron Piotrowski
24142496d8
Rethrow subscriber callback exceptions from loop
2016-07-19 15:13:56 -05:00
Aaron Piotrowski
bec838b693
Remove leftover exception class
...
No longer needed as Subscriber is not an awaitable.
2016-07-19 13:30:28 -05:00
Aaron Piotrowski
70123b9a44
Update Producer::resolve(); fix emitting observable
2016-07-19 13:19:44 -05:00
Aaron Piotrowski
9839343bbb
Remove default value from emit
2016-07-19 13:10:15 -05:00
Aaron Piotrowski
13a6fc59c4
Producer::init() -> private
2016-07-19 12:42:58 -05:00
Aaron Piotrowski
32b4721c5e
Subscriber no longer implements Awaitable
2016-07-19 12:40:16 -05:00
Aaron Piotrowski
90d744537e
protected -> private in internal traits
2016-07-19 12:32:43 -05:00
Aaron Piotrowski
dad93a6da0
Merge branch 'observable' into v2
2016-07-18 23:29:19 -05:00
Aaron Piotrowski
4ed8e65468
Cleaner resolution
2016-06-16 23:27:14 -05:00
Aaron Piotrowski
ae182165e5
Remove circular reference check
2016-06-14 21:53:50 -05:00
Aaron Piotrowski
f940934a0b
Update for latest standard changes
...
Plus some minor tweaks and more docs.
2016-06-07 00:18:59 -05:00
Aaron Piotrowski
666bb332e1
Fix some bugs, refactor disable/unreference
2016-06-03 10:00:29 -05:00
Aaron Piotrowski
548a9fd556
Fix bug when emitting failed awaitable and waiting for a subscriber
2016-06-02 17:05:22 -05:00
Aaron Piotrowski
cef5c90168
Drop disposable interface; rename dispose() to unsubscribe()
2016-06-02 10:42:22 -05:00
Aaron Piotrowski
055d7d4c52
Update docblocks
2016-06-01 12:18:11 -05:00
Aaron Piotrowski
cd6939db5a
Build awaitable in when()
2016-06-01 12:10:46 -05:00
Aaron Piotrowski
906d6db47a
Update docblocks
2016-06-01 11:37:12 -05:00
Aaron Piotrowski
cc431a0374
Prevent emit without subscribers
2016-05-31 23:02:59 -05:00
Aaron Piotrowski
eb49e6e8ff
Resolve emit with observable result instead of emitting
...
Emitting another observable will emit values from the emitted observable, then resolve the awaitable returned from emit with the observable result
2016-05-31 16:23:01 -05:00
Aaron Piotrowski
57e25f9354
Simpler implementation
2016-05-29 11:46:58 -05:00
Aaron Piotrowski
4a2baa670e
Subscriber model
2016-05-27 15:44:01 -05:00
Aaron Piotrowski
ca827319ec
Standard updates and more
...
Update for changes in async-interop/event-loop.
Do not invalidate delay and defer on disable.
Better watcher ID generation.
Throw if enabling invalid watcher.
2016-05-27 10:16:36 -05:00
Aaron Piotrowski
99eecc1a3f
Refactor
2016-05-26 18:20:05 -05:00
Aaron Piotrowski
a68bde6449
Eliminate watcher constructors
2016-05-25 23:21:49 -05:00
Aaron Piotrowski
b436a56869
Remove unused property
2016-05-24 12:09:52 -05:00
Aaron Piotrowski
a9362780ed
Initial commit
2016-05-24 11:47:14 -05:00
Aaron Piotrowski
ccec7acc94
Remove Exception namespace
2016-05-24 10:39:19 -05:00
Aaron Piotrowski
6d263ffb84
Drop Awaitable from namespace
2016-05-23 22:48:28 -05:00
Aaron Piotrowski
13e807d564
Throw on repeated resolution
2016-05-23 21:32:41 -05:00
Aaron Piotrowski
378990fe86
Use $exception instead of passing as callback data
...
Less code this way
2016-05-22 13:43:37 -05:00