Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit af36356

Browse files
committed
docs: Updated CHANGELOG for #73
Notes all new features, major changes, and deprecations.
1 parent c367037 commit af36356

File tree

2 files changed

+113
-3
lines changed

2 files changed

+113
-3
lines changed

CHANGELOG.md

Lines changed: 112 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,123 @@ All notable changes to this project will be documented in this file, in reverse
88

99
- [#72](https://github.com/zendframework/zend-eventmanager/pull/72) adds support for PHP 7.3.
1010

11+
- [#73](https://github.com/zendframework/zend-eventmanager/pull/73) adds interfaces to allow duck-typing the EventManager as a [PSR-14](https://www.php-fig.org/psr/psr-14/) event
12+
dispatcher. Full support is not provided yet as this version still supports
13+
PHP 5.6. The new interfaces include:
14+
15+
- `Zend\EventManager\EventDispatcherInterface`
16+
- `Zend\EventManager\ListenerProvider\ListenerProviderInterface`
17+
- `Zend\EventManager\StoppableEventInterface`
18+
19+
These interfaces will be removed in version 4.0, in favor of the official
20+
PSR-14 interfaces.
21+
22+
- [#73](https://github.com/zendframework/zend-eventmanager/pull/73) adds the following interfaces:
23+
- `Zend\EventManager\EventDispatchingInterface`, for indicating a class
24+
composes an `EventDispatcherInterface` instance. This interface will replace
25+
the `Zend\EventManager\EventsCapableInterface` in version 4.0.
26+
- `Zend\Expressive\ListenerProvider\PrioritizedListenerProviderInterface`,
27+
which extends the `ListenerProviderInterface`, and adds the method
28+
`getListenersForEventByPriority($event, $identifiers = [])`. This method
29+
will return a list of integer priority keys mapping to lists of callable
30+
listeners.
31+
- `Zend\Expressive\ListenerProvider\PrioritizedListenerAttachmentInterface`,
32+
which provides methods for attaching and detaching listeners with optional
33+
priority values. This interface largely replaces the various related methods
34+
in the current `EventManagerInterface`, and is for use with listener
35+
providers.
36+
- `Zend\Expressive\ListenerProvider\ListenerSubscriberInterface`, for
37+
indicating that a class can attach multiple listeners to a
38+
`PrioritizedListenerAttachmentInterface` instance. This largely replaces the
39+
current `ListenerAggregateInterface` functionality. Users should likely use
40+
the PSR-14 utility package's `DelegatingProvider` instead, however.
41+
42+
- [#73](https://github.com/zendframework/zend-eventmanager/pull/73) adds the following listener provider classes and utilities:
43+
- `AbstractListenerSubscriber` and `ListenerSubscriberTrait` can be used to
44+
provide a generic way to detach subscribers. In most cases,
45+
`ListenerSubscriberInterface` implementations should define their own logic
46+
for doing so.
47+
- `PrioritizedListenerProvider` implements `PrioritizedListenerProviderInterface`
48+
and `PrioritizedListenerAttachmentInterface` in order to provide the various
49+
listener attachment and retrieval capabilities in previous versions of the
50+
`EventManager` class.
51+
- `PrioritizedIdentifierListenerProvider` implements `PrioritizedListenerProviderInterface`
52+
and `SharedEventManagerInterface`, and provides all features of the
53+
`SharedEventManager` class from previous versions of the package.
54+
- `PrioritizedAggregateListenerProvider` implements `PrioritizedListenerProviderInterface`
55+
and accepts a list of `PrioritizedListenerProviderInterface` instances and
56+
optionally a generic `ListenerProviderInterface` instance to its
57+
constructor. When retrieving listeners, it will loop through the
58+
`PrioritizedListenerProviderInterface` instance in order, yielding from
59+
each, and then, if present, yield from the generic
60+
`ListenerProviderInterface` instance. This approach essentially replaces the
61+
listener and shared listener aggregation in previous versions of the
62+
`EventManager`.
63+
- `LazyListener` combines the functionalities of `Zend\EventManager\LazyListener`
64+
and `Zend\EventManager\LazyEventListener`. If no event or priority are
65+
provided to the constructor, than the `getEvent()` and `getPriority()`
66+
methods will each return `null`. When invoked, the listener will pull the
67+
specified service from the provided DI container, and then invoke it.
68+
- `LazyListenerSubscriber` implements `ListenerSubscriberInterface` and
69+
accepts a list of `LazyListener` instances to its constructor; any
70+
non-`LazyListener` instances or any that do not define an event will cause
71+
th constructor to raise an exception. When its `attach()` method is called,
72+
it attaches the lazy listeners based on the event an priority values it
73+
pulls from them.
74+
75+
- [#73](https://github.com/zendframework/zend-eventmanager/pull/73) adds the static method `createUsingListenerProvider()` to the `EventManager`
76+
class. This method takes a `ListenerProviderInterface`, and will then pull
77+
directly from it when triggering events. If the provider also implements
78+
`PrioritizedListenerAttachmentInterface`, the various listener attachment
79+
methods defined in `EventManager` will proxy to it.
80+
81+
- [#73](https://github.com/zendframework/zend-eventmanager/pull/73) adds the static method `createUsingListenerProvider()` to the `EventManager`
82+
1183
### Changed
1284

13-
- Nothing.
85+
- [#73](https://github.com/zendframework/zend-eventmanager/pull/73) modifies the `SharedEventManager` class to extend the new
86+
`Zend\EventManager\ListenerProvider\PrioritizedIdentifierListenerProvider` class.
87+
88+
- [#73](https://github.com/zendframework/zend-eventmanager/pull/73) modifies the `EventManager` class as follows:
89+
- It now implements each of `ListenerProviderInterface` and
90+
`PrioritizedListenerAttachmentInterface`.
91+
- If constructed normally, it will create a `PrioritizedListenerProvider`
92+
instance, and use that for all listener attachment. If a
93+
`SharedEventManagerInterface` is provided, it will create a
94+
`PrioritizedAggregateListenerProvider` using its own
95+
`PrioritizedListenerProvider` and the shared manager, and use that for
96+
fetching listeners.
97+
- Adds a `dispatch()` method as an alternative to the various `trigger*()` methods.
1498

1599
### Deprecated
16100

17-
- Nothing.
101+
- [#73](https://github.com/zendframework/zend-eventmanager/pull/73) deprecates the following interfaces and classes:
102+
- `Zend\EventManager\EventInterface`. Users should start using vanilla PHP
103+
objects that encapsulate all expected behavior for setting and retrieving
104+
values and otherwise mutating state, including how and when propagation of the
105+
event should stop.
106+
- `Zend\EventManager\EventManagerInterface`; start typehinting against the
107+
PSR-14 `EventDispatcherInterface` (or, in the meantime, the package-specific
108+
variant).
109+
- `Zend\EventManager\EventManagerAwareInterface`
110+
- `Zend\EventManager\EventManagerAwareTrait`
111+
- `Zend\EventManager\EventsCapableInterface`; start using `EventDispatchingInterface` instead.
112+
- `Zend\EventManager\SharedEventManager`; start using listener providers
113+
instead, attaching to identifiers based on event types.
114+
- `Zend\EventManager\SharedEventManagerInterface`
115+
- `Zend\EventManager\SharedEventsCapableInterface`
116+
- `Zend\EventManager\ListenerAggregateInterface`; use the new `ListenerSubscriberInterface` instead.
117+
- `Zend\EventManager\ListenerAggregateTrait`; use the new
118+
`ListenerSubscriberTrait`, or define your own detachment logic.
119+
- `Zend\EventManager\AbstractListenerAggregate`; use the new
120+
`AbstractListenerSubscriber`, or define your own detachment logic.
121+
- `Zend\EventManager\ResponseCollection`; aggregate state in the event itself,
122+
and have the event determine when propagation needs to stop.
123+
- `Zend\EventManager\LazyListener`; use `Zend\EventManager\ListenerProvider\LazyListener` instead.
124+
- `Zend\EventManager\LazyEventListener`; use `Zend\EventManager\ListenerProvider\LazyListener` instead.
125+
- `Zend\EventManager\LazyListenerAggregate`; use `Zend\EventManager\ListenerProvider\LazyListenerSubscriber` instead.
126+
- `Zend\EventManager\FilterChain` and the `Filter` subnamespace; these will
127+
move to a separate package in the future.
18128

19129
### Removed
20130

TODO-PSR-14.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
`triggerListeners`
9191
- [x] Additional utilities
9292
- [x] `EventDispatchingInterface` with a `getEventDispatcher()` method
93-
- [ ] Deprecations
93+
- [x] Deprecations
9494
- [x] `EventInterface`
9595
- [x] `EventManagerInterface`
9696
- [x] `EventManagerAwareInterface`

0 commit comments

Comments
 (0)