Skip to content

1.1.0

Choose a tag to compare

@ExeQue ExeQue released this 22 Sep 14:29
· 11 commits to main since this release
b699d6d

An event handler takes the event first, and after it may ask for the archive it belongs to, or for anything the
container can build.

$zip->on(fn (ProcessError $e, ArchiveBuilder $zip, LoggerInterface $log) => $zip->abort());
$zip->on(fn (StreamedBytes $e, Container $app) => $app->make(ProgressStore::class)->put($e->context));

That saves closing over the builder to reach abort(), and saves a handler resolving its own dependencies.
Parameters are matched by type; anything the container cannot build and that has no default is refused when the
handler is registered rather than when it fires.

Existing handlers are unaffected. PHP passes extra arguments to a closure or a method without complaint.

Also in this release

  • The archive cannot be restructured from a handler. Entries are taken when a run starts, so one added while
    it writes would never reach the archive being produced. add() throws ArchiveFrozenException for the length
    of the run, and the builder reopens afterwards - including after an abort.
  • The event queue comes from the container, so an application can bind its own. A queue built by hand has no
    container, and a handler asking it for something throws with the name of what was missing.

Upgrading

Nothing to do for normal use. Two constructors changed for anyone building the pieces by hand rather than
resolving them: Builder takes the container as its third argument, and Pending::process() requires the
EventQueue it used to default.

Documentation