sabre/event
Lightweight PHP library for event-driven development: EventEmitter, promises, an event loop, and coroutines. Designed for building asynchronous, event-based applications. Documentation at sabre.io/event. Requires PHP 7.1.
As well as a few fixes to edge-case code flow, there are quite a lot of enhancements to the phpdoc parameter and return type declarations. You may find that code analysis tools like phpstan now find different things when you update to 6.0.1
The code changes are just code-style applied by the newer php-cs-fixer. There are no actual bug fixes, and no change to behavior.
Major version 6 implements type declarations for input parameters, function returns, variables etc. It supports PHP 7.4 and PHP 8. When you upgrade to major version 6, if you extend classes etc., then you will need to make similar type declarations in your code.
Emitter class to use the correct interface. (@felixfbecker).coroutine function now supports return in the passed generator
function. This allows you to more generally return a value. This is a BC
break as this is a feature that was only made possible with PHP 7, and
before the coroutine function would only ever return the last thing that
was yielded. If you depended on that feature, replace your last yield with
a return.WildcardEmitter which allows you to listen for events
using the * wildcard.Promise::error and Promise::all. Instead,
use Promise::otherwise and Promise\all().EventEmitter, EventEmitterTrait and EventEmitterInterface are now just
called Emitter, EmitterTrait, and EmitterInterface.Exception or
Throwable. This makes the typical case simpler and reduces special cases.Promise::all() is moved to Promise\all().Promise\all() function, there's now also Promise\race().Promise\reject() and Promise\resolve() have also been added.Also contains all the changes from the previous alpha:
Promise::error to Promise::otherwise to be consistent with
ReactPHP and Guzzle. The error method is kept for BC but will be removed
in a future version.Sabre\Event\coroutine
function.then/otherwise callbacks to trigger.wait() method. Allowing you to make a promise
synchronous and simply wait for a result (or exception) to happen.Promise::error to Promise::otherwise to be consistent with
ReactPHP and Guzzle. The error method is kept for BC but will be removed
in a future version.Sabre\Event\coroutine
function.then/otherwise callbacks to trigger.wait() method. Allowing you to make a promise
synchronous and simply wait for a result (or exception) to happen.$priority was ignored in EventEmitter::once method.EventEmitter::once.How can I help you explore Laravel packages today?