Understanding PromiseCombinators

Dealing with an aysnchronous event emitter means we have to deal with resolving Promises as a critical component of the library. We expose the ability to tightly control how the Promises associated with your event listeners are handled through the use of the PromiseCombinator enum.

Labrador Kennel's usage of an enum is defined by the cspray/yape library which provides code generation tools to create type-safe enums in PHP.

If you have not already done so we highly recommend taking a look over Amp's Promise Combinators documentation as the PromiseCombinator enum is an encapsulation of this logic and functionality.

By default all Promises generated by event listeners are resolved using the Amp\Promise\all strategy. If you desire different Promise resolution when emitting events you can pass a PromiseCombinator as the second argument to EventEmitter::emit(). With this you're able to have complete, flexible control over how event resolution is handled within your application.