This repository was archived by the owner on Jan 29, 2020. It is now read-only.
zend-eventmanager 3.0.0
·
134 commits
to master
since this release
Documenation:
Migration docs:
Added
- Migration documentation was added.
- Automated benchmarks were added.
EventManager::__construct()now accepts an optionalSharedEventManagerInterfaceinstance as the first argument, and an optional array of identifiers as the second. As identifiers have no meaning without a shared manager present, they are secondary to providing the shared manager.EventManagerInterface::trigger()changes its signature totrigger($eventName, $target = null, $argv = []); each argument has exactly one possible meaning; the$eventNamecan only be a string event name. The fourth$callbackargument is removed.EventManagerInterface::triggerUntil()changes its signature totriggerUntil(callable $callback, $eventName, $target = null, $argv = null). Each argument has exactly one meaning.EventManagerInterfaceadds two new methods for triggering providedEventInterfacearguments:triggerEvent(EventInterface $event)andtriggerEventUntil(callable $callback, EventInterface $event).EventManagerInterface::attach()anddetach()change their signatures toattach($eventName, callable $listener, $priority = 1)anddetach(callable $listener, $eventName = null), respectively. Note that$eventNamecan now only be a string event name, not an array orTraversable.EventManagerInterface::setIdentifiers()andaddIdentifiers()change their signatures to each only accept an array of identifiers.SharedEventManagerInterface::getListeners()changes signature togetListeners(array $identifiers, $eventName)and now guarantees return of an array. Note that the second argument is now required.SharedEventManagerInterface::attach()changes signature toattach($identifier, $eventName, callable $listener, $priority = 1). The$identifierand$eventNamemust be strings.SharedEventManagerInterface::detach()changes signature todetach(callable $listener, $identifier = null, $eventName = null);$identifierand$eventNamemust be strings if passed.ListenerAggregateInterface::attach()adds an optional$priority = 1argument. This was used already in v2, but not dictated by the interface.FilterInterface::attach()anddetach()have changed signature toattach(callable $callback)anddetach(callable $ilter), respectively.LazyListenerallows wrapping:- fetching a listener service from a container-interop container, and
- invoking a designated listener method with the provided event.
LazyEventListenerextendsLazyListener, and provides metadata for discovering the intended event name and priority at which to attach the lazy listener; these are consumed by:LazyListenerAggregate, which, provided a list ofLazyEventListenersand/or definitions to use to create them, acts as an aggregate for attaching a number of such listeners at once.- #20 updates the trait
Zend\EventManager\Test\EventListenerIntrospectionTraitso that the implementation will work with the v3 changes; the tests written for v2 continue to pass, allowing this trait to be used to provide compatibility testing between v2 and v3.
Deprecated
- Nothing.
Removed
GlobalEventManagerandStaticEventManagerare removed (with prejudice!).ProvidesEvents, which was previously deprecated, is removed.EventManagerInterface::setSharedManager()is removed. Shared managers are now expected to be injected during instantiation.EventManagerInterface::getEvents()andgetListeners()are removed; they had now purpose within the implementation.EventManagerInterface::setEventClass()was renamed tosetEventPrototype(), which now expects anEventInterfaceinstance. That instance will be cloned whenever a new event is created.EventManagerInterface::attachAggregate()anddetachAggregate()are removed. Users should use theattach()anddetach()methods of the aggregates themselves.SharedEventAggregateAwareInterfaceandSharedListenerAggregateInterfaceare removed. This was an undocumented and largely unused feature.SharedEventManagerAwareInterfaceis removed. A new interface,SharedEventsCapableInterfacedefines thegetSharedManager()method from the interface, andEventManagerInterfaceextends that new interface.SharedEventManagerInterface::getEvents()is removed, as it had no purpose in the implementation.ResponseCollection::setStopped()no longer implements a fluent interface.
Fixed
FilterIterator::insert()has been modified to raise an exception if the value provided is not a callable.