Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update amphp (major) #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update amphp (major) #28

wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link

@renovate renovate bot commented Mar 17, 2023

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
amphp/amp (source) ^2.4.2 -> ^2.4.2 || ^3.0.0 age adoption passing confidence
amphp/byte-stream (source) ^1.5 -> ^1.5 || ^2.0 age adoption passing confidence
amphp/phpunit-util (source) ^2.0 -> ^2.0 || ^3.0 age adoption passing confidence

Release Notes

amphp/amp (amphp/amp)

v3.0.2: 3.0.2

Compare Source

What's Changed

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

Full Changelog: amphp/amp@v3.0.1...v3.0.2

v3.0.1: 3.0.1

Compare Source

What's Changed

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

Full Changelog: amphp/amp@v3.0.0...v3.0.1

v3.0.0: 3.0.0

Compare Source

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.

amphp/byte-stream (amphp/byte-stream)

v2.1.1: 2.1.1

Compare Source

What's Changed

  • Fixed cancellation not being forwarded to split() in splitLines().

Full Changelog: amphp/byte-stream@v2.1.0...v2.1.1

v2.1.0: 2.1.0

Compare Source

What's Changed

New Contributors

Full Changelog: amphp/byte-stream@v2.0.2...v2.1.0

v2.0.2: 2.0.2

Compare Source

  • Fixed throwing an Error when invoking getStdin(), getStdout(), and getStderr() if the corresponding STDIO stream had been previously closed. Instead, an already closed stream instance is returned.

v2.0.1: 2.0.1

Compare Source

  • Fixed ReadableResourceStream calling Suspension::resume() when destroyed, which could throw an exception when suspending from {main} and an uncaught exception was thrown from the event loop.

v2.0.0: 2.0.0

Compare Source

Initial stable release compatible with AMPHP v3 and fibers.

There are a number of renaming and compatibility breaks with 1.x versions:

  • Added interface ResourceStream
  • InputStream has been renamed to ReadableStream and now extends Amp\Closable. The read() method now supports an optional Cancellation parameter.
  • OutputStream has been renamed to WritableStream and now extends Amp\Closable. WritableStream::end() no longer accepts an optional data chunk as parameter.
  • IteratorStream has been repalced by ReadableIterableStream, which accepts any iterable of strings (particularly useful with Generator or Pipeline).
  • ResourceInputStream has been renamed to ReadableResourceStream. The read() method has an additional, optional $limit parameter to specify the maximum number of bytes to read.
  • ResourceOutputStream has been renamed to WritableResourceStream.
  • InMemoryStream has been renamed to ReadableBuffer.
  • OutputBuffer has been renamed to WritableBuffer.
  • Payload now accepts a string in addition to a ReadableStream and is final now. Payload::buffer() may only be called once.
  • Added a $limit param to Amp\ByteStream\buffer() and Payload::buffer() to set a limit on the maximum bytes that can be buffered.
  • Added BufferedReader, a helper class for reading from ReadableStream using fixed lengths or delimiters found within the stream (#​94)
  • Added Pipe.
  • Added StreamChannel implementing the Channel interface from amphp/sync.
  • The zlib streams have been moved into the Compression sub-namespace and renamed to CompressingWritableStream and DecompressingReadableStream.
  • Add CompressingReadableStream (https://github.com/amphp/byte-stream/pull/99)
  • Add DecompressingWritableStream (https://github.com/amphp/byte-stream/pull/99)
  • The base64 streams have been renamed to reflect the new interface names.
  • InputStreamChain has been renamed to ReadableStreamChain.
  • Renamed the $options param of parseLineDelimitedJson to $flags to match the json_decode function.
amphp/phpunit-util (amphp/phpunit-util)

v3.0.0: 3.0.0

Compare Source

This package has been redesigned for compatibility with AMPHP v3 and fibers. AsyncTestCase serves a similar purpose as before, providing helper methods for unit testing within an async context. Each test case is run within a unique fiber to allow suspending during the test run.

  • AsyncTestCase::setUpAsync() and tearDownAsync() have been removed. Use AsyncTestCase::setUp() and tearDown() instead, as both of these methods are now able to execute async using fibers.
  • AsyncTestCase::createCallback() now returns a Closure. Additionally, an optional parameter for expected arguments upon invocation have been added (uses InvocationMocker::with(...) to set expected arguments).

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants