Skip to content

Releases: amphp/amp

3.0.2

10 May 21:41
v3.0.2
138801f
Compare
Choose a tag to compare

What's Changed

  • Changed Closure(mixed...) annotation to Closure(...) to support PHPStan.

Full Changelog: v3.0.1...v3.0.2

3.0.1

18 Apr 19:51
v3.0.1
ff63f10
Compare
Choose a tag to compare

What's Changed

  • Fixed compatibility of Amp\weakClosure() with changes made to closure names in PHP 8.4.

Full Changelog: v3.0.0...v3.0.1

2.6.4

21 Mar 18:55
v2.6.4
ded3d9b
Compare
Choose a tag to compare

What's Changed

  • Fix optional before required parameter deprecation

Full Changelog: v2.6.3...v2.6.4

2.6.3

21 Mar 18:48
v2.6.3
7e3560b
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.6.2...v2.6.3

3.0.0

18 Dec 17:13
v3.0.0
aaf0ec1
Compare
Choose a tag to compare

Event Loop

Amp no longer ships its own event loop. It's now based on Revolt. Revolt\EventLoop is quite similar to Amp's previous Amp\Loop. A very important difference is using float $seconds instead of int $milliseconds for timers though!

Promises

Future is a replacement for the previous Promise.
There's no need for callbacks or yield anymore!
Its await() method is based on fibers and replaces generator based coroutines / Amp\Promise\wait().

  • Renamed Amp\Deferred to Amp\DeferredFuture.
  • Removed Amp\Promise\wait(): Use Amp\Future::await() instead, which can be called in any (nested) context unlike before.
  • Removed Amp\call(): Remove the passed closure boilerplate and all yield keywords, interruption is handled via fibers now instead of generator coroutines.
  • Removed Amp\asyncCall(): Replace invocations with Amp\async(), which starts a new fiber instead of using generators.
  • Removed Amp\coroutine(): There's no direct replacement.
  • Removed Amp\asyncCoroutine(): There's no direct replacement.
  • Removed Amp\Promise\timeout(): Future::await() accepts an optional Cancellation, which can be used as a replacement.
  • Removed Amp\Promise\rethrow(): Unhandled errors are now automatically thrown into the event loop, so there's no need for that function anymore.
  • Unhandled errors can be ignored using Future::ignore() if needed, but should usually be handled in some way.
  • Removed Amp\Promise\wrap(): Use Future::finally() instead.
  • Renamed Amp\getCurrentTime() to Amp\now() returning the time in seconds instead of milliseconds.
  • Changed Amp\delay() to accept the delay in seconds now instead of milliseconds.
  • Added Amp\weakClosure() to allow a class to hold a self-referencing Closure without creating a circular reference that prevents automatic garbage collection.
  • Added Amp\trapSignal() to await one or multiple signals.

Promise Combinators

Promise combinators have been renamed:

  • Amp\Promise\race() has been renamed to Amp\Future\awaitFirst()
  • Amp\Promise\first() has been renamed to Amp\Future\awaitAny()
  • Amp\Promise\some() has been renamed to Amp\Future\awaitAnyN()
  • Amp\Promise\any() has been renamed to Amp\Future\awaitAll()
  • Amp\Promise\all() has been renamed to Amp\Future\await()

CancellationToken

  • CancellationToken has been renamed to Cancellation.
  • CancellationTokenSource has been renamed to DeferredCancellation.
  • NullCancellationToken has been renamed to NullCancellation.
  • TimeoutCancellationToken has been renamed to TimeoutCancellation.
  • CombinedCancellationToken has been renamed to CompositeCancellation.
  • SignalCancellation has been added.

Iterators

Iterators have been removed from amphp/amp as normal PHP iterators can be used with fibers now and there's no need for a separate API.
However, there's still some need for concurrent iterators, which is covered by the new amphp/pipeline library now.

Closable

Amp\Closable has been added as a new basic interface for closable resources such as streams or sockets.

Strict Types

Strict types now declared in all library files.
This will affect callbacks invoked within this library's code which use scalar types as parameters.
Functions used with Amp\async() are the most likely to be affected by this change — these functions will now be invoked within a strict-types context.

3.0.0 Beta 11

16 Dec 22:49
v3.0.0-beta.11
92e2253
Compare
Choose a tag to compare
3.0.0 Beta 11 Pre-release
Pre-release
  • Removed circular dependency on amphp/phpunit-util (#408).
  • Added stack-trace of Future creation to UnhandledFutureError which is defined only when assertions are enabled (#405).
  • Strict types now declared in all library files. This will affect callbacks invoked within this library's code which use scalar types as parameters. Functions used with Amp\async() are the most likely to be affected by this change — these functions will now be invoked within a strict-types context.

3.0.0 Beta 10

07 Nov 20:49
v3.0.0-beta.10
352d8c0
Compare
Choose a tag to compare
3.0.0 Beta 10 Pre-release
Pre-release

What's Changed

  • Allow GC of arguments during async() closure execution (#395)
  • Support revolt 1.x, declare incompatibility with revolt 0.1.x
  • Change Future::ignore() to be a fluent interface (#403)
  • Improve template types

Full Changelog: v3.0.0-beta.9...v3.0.0-beta.10

3.0.0 Beta 9

12 Jul 21:09
v3.0.0-beta.9
Compare
Choose a tag to compare
3.0.0 Beta 9 Pre-release
Pre-release
  • Fixed circular reference in async() on exceptions (#394)
  • Removed deprecated combinator functions:
    • Amp\Future\raceAmp\Future\awaitFirst
    • Amp\Future\anyAmp\Future\awaitAny
    • Amp\Future\someAmp\Future\awaitAnyN
    • Amp\Future\settleAmp\Future\awaitAll
    • Amp\Future\allAmp\Future\await

3.0.0 Beta 8

25 Jun 18:30
v3.0.0-beta.8
41764f0
Compare
Choose a tag to compare
3.0.0 Beta 8 Pre-release
Pre-release
  • Fixed weakClosure() not preserving scope when using a Closure with scope limited to a parent class (#393)
  • Fixed regression in beta 9 where CompositeCancellation would return false from isRequested() and not throw from throwIfRequested() after cancellation was requested

3.0.0 Beta 7

16 Jun 22:46
v3.0.0-beta.7
01c289e
Compare
Choose a tag to compare
3.0.0 Beta 7 Pre-release
Pre-release
  • Added SignalCancellation that triggers a cancellation when a particular signal is received by the process.
  • Fixed an issue in CombinedCancellation where subsequent cancellation of another Cancellation in the set could alter the exception used to cancel the token.