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

Commit a6c747f

Browse files
committed
Merge branch 'hotfix/10'
Close #10
2 parents f5d3956 + b501ed9 commit a6c747f

14 files changed

+232
-18
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/benchmarks export-ignore
12
/test export-ignore
23
/vendor export-ignore
34
.coveralls.yml export-ignore

CHANGELOG.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,49 @@
22

33
All notable changes to this project will be documented in this file, in reverse chronological order by release.
44

5-
## 2.5.3 - TBD
5+
## 2.6.0 - 2015-09-29
66

77
### Added
88

9-
- Nothing.
9+
- Added `Zend\EventManager\SharedEventsCapableInterface`. This interface will
10+
largely replace `Zend\EventManager\SharedEventManagerAwareInterface` in
11+
version 3, and the latter was updated to extend it.
12+
- Added `EventManager::triggerEvent(EventInterface $event)` as a
13+
forwards-compatibility feature.
14+
- Add `EventManager::triggerEventUntil(callable $callback, EventIterface $event)`
15+
as a forwards-compatibility feature.
16+
- Adds [Athletic](https://github.com/polyfractal/athletic) benchmarks to aid in
17+
gauging performanc impact of changes; these are a development change only.
1018

1119
### Deprecated
1220

13-
- Nothing.
21+
- Marked `GlobalEventManager` as deprecated; this class will be removed in
22+
version 3.
23+
- Marked `StaticEventManager` as deprecated; this class will be removed in
24+
version 3.
25+
- Marked `SharedListenerAggregateInterface` as deprecated; this interface will
26+
be removed in version 3.
27+
- Marked `SharedEventAggregateAwareInterface` as deprecated; this interface will
28+
be removed in version 3.
29+
- Marked `SharedEventManagerAwareInterface` as deprecated; this interface will
30+
be removed in version 3.
31+
- Marked `EventManager::setSharedManager()` as deprecated; this method will be
32+
removed in version 3.
33+
- Marked `EventManager::unsetSharedManager()` as deprecated; this method will be
34+
removed in version 3.
35+
- Marked `EventManagerInterface::` and `EventManager::getEvents()` as
36+
deprecated; this method will be removed in version 3.
37+
- Marked `EventManagerInterface::` and `EventManager::getListeners()` as
38+
deprecated; this method will be removed in version 3.
39+
- Marked `EventManagerInterface::` and `Eventmanager::setEventClass()` as
40+
deprecated; this method is renamed to `setEventPrototype(EventInterface $event)`
41+
in version 3.
42+
- Marked `EventManagerInterface::` and `EventManager::attachAggregate()` as
43+
deprecated; this method will be removed in version 3.
44+
- Marked `EventManagerInterface::` and `EventManager::detachAggregate()` as
45+
deprecated; this method will be removed in version 3.
46+
- Marked `SharedEventManagerInterface::` and `SharedEventManager::getEvents()`
47+
as deprecated; this method will be removed in version 3.
1448

1549
### Removed
1650

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"prefer-stable": true,
2222
"extra": {
2323
"branch-alias": {
24-
"dev-master": "2.5-dev",
25-
"dev-develop": "2.6-dev"
24+
"dev-master": "2.6-dev",
25+
"dev-develop": "3.0-dev"
2626
}
2727
},
2828
"autoload-dev": {

src/EventManager.php

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ public function __construct($identifiers = null)
6262
/**
6363
* Set the event class to utilize
6464
*
65+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
66+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
67+
* for details.
6568
* @param string $class
6669
* @return EventManager
6770
*/
@@ -74,6 +77,9 @@ public function setEventClass($class)
7477
/**
7578
* Set shared event manager
7679
*
80+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
81+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
82+
* for details.
7783
* @param SharedEventManagerInterface $sharedEventManager
7884
* @return EventManager
7985
*/
@@ -87,6 +93,9 @@ public function setSharedManager(SharedEventManagerInterface $sharedEventManager
8793
/**
8894
* Remove any shared event manager currently attached
8995
*
96+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
97+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
98+
* for details.
9099
* @return void
91100
*/
92101
public function unsetSharedManager()
@@ -212,12 +221,14 @@ public function trigger($event, $target = null, $argv = [], $callback = null)
212221
* Triggers listeners until the provided callback evaluates the return
213222
* value of one as true, or until all listeners have been executed.
214223
*
224+
* @deprecated The signature of this method will change in 3.0.0.
225+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/changed.md}
226+
* for details.
215227
* @param string|EventInterface $event
216228
* @param string|object $target Object calling emit, or symbol describing target (such as static method name)
217229
* @param array|ArrayAccess $argv Array of arguments; typically, should be associative
218230
* @param callable $callback
219231
* @return ResponseCollection
220-
* @deprecated Please use trigger()
221232
* @throws Exception\InvalidCallbackException if invalid callable provided
222233
*/
223234
public function triggerUntil($event, $target, $argv = null, $callback = null)
@@ -229,6 +240,29 @@ public function triggerUntil($event, $target, $argv = null, $callback = null)
229240
return $this->trigger($event, $target, $argv, $callback);
230241
}
231242

243+
/**
244+
* Trigger an event instance.
245+
*
246+
* @param EventInterface $event
247+
* @return ResponseCollection
248+
*/
249+
public function triggerEvent(EventInterface $event)
250+
{
251+
return $this->triggerListeners($event->getName(), $event);
252+
}
253+
254+
/**
255+
* Trigger an event instance, short-circuiting if a listener response evaluates true via the callback.
256+
*
257+
* @param callable $callback
258+
* @param EventInterface $event
259+
* @return ResponseCollection
260+
*/
261+
public function triggerEventUntil(callable $callback, EventInterface $event)
262+
{
263+
return $this->triggerListeners($event->getName(), $event, $callback);
264+
}
265+
232266
/**
233267
* Attach a listener to an event
234268
*
@@ -293,6 +327,9 @@ public function attach($event, $callback = null, $priority = 1)
293327
* one or more times, typically to attach to multiple events using local
294328
* methods.
295329
*
330+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
331+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
332+
* for details.
296333
* @param ListenerAggregateInterface $aggregate
297334
* @param int $priority If provided, a suggested priority for the aggregate to use
298335
* @return mixed return value of {@link ListenerAggregateInterface::attach()}
@@ -343,6 +380,9 @@ public function detach($listener)
343380
* Listener aggregates accept an EventManagerInterface instance, and call detach()
344381
* of all previously attached listeners.
345382
*
383+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
384+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
385+
* for details.
346386
* @param ListenerAggregateInterface $aggregate
347387
* @return mixed return value of {@link ListenerAggregateInterface::detach()}
348388
*/
@@ -354,6 +394,9 @@ public function detachAggregate(ListenerAggregateInterface $aggregate)
354394
/**
355395
* Retrieve all registered events
356396
*
397+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
398+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
399+
* for details.
357400
* @return array
358401
*/
359402
public function getEvents()
@@ -364,6 +407,9 @@ public function getEvents()
364407
/**
365408
* Retrieve all listeners for a given event
366409
*
410+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
411+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
412+
* for details.
367413
* @param string $event
368414
* @return PriorityQueue
369415
*/

src/EventManagerInterface.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ public function trigger($event, $target = null, $argv = [], $callback = null);
4444
* - Passing event name, target, Event object, and callback
4545
* - Passing event name, target, array|ArrayAccess of arguments, and callback
4646
*
47+
* @deprecated The signature of this method will change in 3.0.0.
48+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/changed.md}
49+
* for details.
4750
* @param string|EventInterface $event
4851
* @param object|string $target
4952
* @param array|object $argv
5053
* @param callable $callback
5154
* @return ResponseCollection
52-
* @deprecated Please use trigger()
5355
*/
5456
public function triggerUntil($event, $target, $argv = null, $callback = null);
5557

@@ -74,13 +76,19 @@ public function detach($listener);
7476
/**
7577
* Get a list of events for which this collection has listeners
7678
*
79+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
80+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
81+
* for details.
7782
* @return array
7883
*/
7984
public function getEvents();
8085

8186
/**
8287
* Retrieve a list of listeners registered to a given event
8388
*
89+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
90+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
91+
* for details.
8492
* @param string $event
8593
* @return array|object
8694
*/
@@ -97,6 +105,9 @@ public function clearListeners($event);
97105
/**
98106
* Set the event class to utilize
99107
*
108+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
109+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
110+
* for details.
100111
* @param string $class
101112
* @return EventManagerInterface
102113
*/
@@ -128,6 +139,9 @@ public function addIdentifiers($identifiers);
128139
/**
129140
* Attach a listener aggregate
130141
*
142+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
143+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
144+
* for details.
131145
* @param ListenerAggregateInterface $aggregate
132146
* @param int $priority If provided, a suggested priority for the aggregate to use
133147
* @return mixed return value of {@link ListenerAggregateInterface::attach()}
@@ -137,6 +151,9 @@ public function attachAggregate(ListenerAggregateInterface $aggregate, $priority
137151
/**
138152
* Detach a listener aggregate
139153
*
154+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
155+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
156+
* for details.
140157
* @param ListenerAggregateInterface $aggregate
141158
* @return mixed return value of {@link ListenerAggregateInterface::detach()}
142159
*/

src/GlobalEventManager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
*
1818
* Use the EventManager when you want to create a per-instance notification
1919
* system for your objects.
20+
*
21+
* @deprecated This class is deprecated with 2.6.0, and will be removed in 3.0.0.
22+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
23+
* for details.
2024
*/
2125
class GlobalEventManager
2226
{

src/SharedEventAggregateAwareInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
/**
1313
* Interface for allowing attachment of shared aggregate listeners.
14+
*
15+
* @deprecated This interface is deprecated with 2.6.0, and will be removed in 3.0.0.
16+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
17+
* for details.
1418
*/
1519
interface SharedEventAggregateAwareInterface
1620
{

src/SharedEventManager.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ public function detachAggregate(SharedListenerAggregateInterface $aggregate)
123123
/**
124124
* Retrieve all registered events for a given resource
125125
*
126+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
127+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
128+
* for details.
126129
* @param string|int $id
127130
* @return array
128131
*/

src/SharedEventManagerAwareInterface.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@
1111

1212
/**
1313
* Interface to automate setter injection for a SharedEventManagerInterface instance
14+
*
15+
* @deprecated This interface is deprecated with 2.6.0, and will be removed in 3.0.0.
16+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
17+
* for details.
1418
*/
15-
interface SharedEventManagerAwareInterface
19+
interface SharedEventManagerAwareInterface extends SharedEventsCapableInterface
1620
{
1721
/**
1822
* Inject a SharedEventManager instance
@@ -22,13 +26,6 @@ interface SharedEventManagerAwareInterface
2226
*/
2327
public function setSharedManager(SharedEventManagerInterface $sharedEventManager);
2428

25-
/**
26-
* Get shared collections container
27-
*
28-
* @return SharedEventManagerInterface
29-
*/
30-
public function getSharedManager();
31-
3229
/**
3330
* Remove any shared collections
3431
*

src/SharedEventManagerInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ public function detach($id, CallbackHandler $listener);
4949
/**
5050
* Retrieve all registered events for a given resource
5151
*
52+
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
53+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
54+
* for details.
5255
* @param string|int $id
5356
* @return array
5457
*/

src/SharedEventsCapableInterface.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* Zend Framework (http://framework.zend.com/)
4+
*
5+
* @link http://github.com/zendframework/zend-eventmanager for the canonical source repository
6+
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7+
* @license https://github.com/zendframework/zend-eventmanager/blob/master/LICENSE.md
8+
*/
9+
10+
namespace Zend\EventManager;
11+
12+
/**
13+
* Interface indicating that an object composes or can compose a
14+
* SharedEventManagerInterface instance.
15+
*/
16+
interface SharedEventsCapableInterface
17+
{
18+
/**
19+
* Retrieve the shared event manager, if composed.
20+
*
21+
* @return null|SharedEventManagerInterface
22+
*/
23+
public function getSharedManager();
24+
}

src/SharedListenerAggregateInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
* with a SharedEventManager, without an event name. The {@link attach()} method will
1717
* then be called with the current SharedEventManager instance, allowing the class to
1818
* wire up one or more listeners.
19+
*
20+
* @deprecated This interface is deprecated with 2.6.0, and will be removed in 3.0.0.
21+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
22+
* for details.
1923
*/
2024
interface SharedListenerAggregateInterface
2125
{

src/StaticEventManager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
/**
1313
* Static version of EventManager
14+
*
15+
* @deprecated This class is deprecated with 2.6.0, and will be removed in 3.0.0.
16+
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
17+
* for details.
1418
*/
1519
class StaticEventManager extends SharedEventManager
1620
{

0 commit comments

Comments
 (0)