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

Commit

Permalink
Merge branch 'hotfix/10'
Browse files Browse the repository at this point in the history
Close #10
  • Loading branch information
weierophinney committed Sep 29, 2015
2 parents f5d3956 + b501ed9 commit a6c747f
Show file tree
Hide file tree
Showing 14 changed files with 232 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/benchmarks export-ignore
/test export-ignore
/vendor export-ignore
.coveralls.yml export-ignore
Expand Down
40 changes: 37 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,49 @@

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

## 2.5.3 - TBD
## 2.6.0 - 2015-09-29

### Added

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

### Deprecated

- Nothing.
- Marked `GlobalEventManager` as deprecated; this class will be removed in
version 3.
- Marked `StaticEventManager` as deprecated; this class will be removed in
version 3.
- Marked `SharedListenerAggregateInterface` as deprecated; this interface will
be removed in version 3.
- Marked `SharedEventAggregateAwareInterface` as deprecated; this interface will
be removed in version 3.
- Marked `SharedEventManagerAwareInterface` as deprecated; this interface will
be removed in version 3.
- Marked `EventManager::setSharedManager()` as deprecated; this method will be
removed in version 3.
- Marked `EventManager::unsetSharedManager()` as deprecated; this method will be
removed in version 3.
- Marked `EventManagerInterface::` and `EventManager::getEvents()` as
deprecated; this method will be removed in version 3.
- Marked `EventManagerInterface::` and `EventManager::getListeners()` as
deprecated; this method will be removed in version 3.
- Marked `EventManagerInterface::` and `Eventmanager::setEventClass()` as
deprecated; this method is renamed to `setEventPrototype(EventInterface $event)`
in version 3.
- Marked `EventManagerInterface::` and `EventManager::attachAggregate()` as
deprecated; this method will be removed in version 3.
- Marked `EventManagerInterface::` and `EventManager::detachAggregate()` as
deprecated; this method will be removed in version 3.
- Marked `SharedEventManagerInterface::` and `SharedEventManager::getEvents()`
as deprecated; this method will be removed in version 3.

### Removed

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-master": "2.5-dev",
"dev-develop": "2.6-dev"
"dev-master": "2.6-dev",
"dev-develop": "3.0-dev"
}
},
"autoload-dev": {
Expand Down
48 changes: 47 additions & 1 deletion src/EventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public function __construct($identifiers = null)
/**
* Set the event class to utilize
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @param string $class
* @return EventManager
*/
Expand All @@ -74,6 +77,9 @@ public function setEventClass($class)
/**
* Set shared event manager
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @param SharedEventManagerInterface $sharedEventManager
* @return EventManager
*/
Expand All @@ -87,6 +93,9 @@ public function setSharedManager(SharedEventManagerInterface $sharedEventManager
/**
* Remove any shared event manager currently attached
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @return void
*/
public function unsetSharedManager()
Expand Down Expand Up @@ -212,12 +221,14 @@ public function trigger($event, $target = null, $argv = [], $callback = null)
* Triggers listeners until the provided callback evaluates the return
* value of one as true, or until all listeners have been executed.
*
* @deprecated The signature of this method will change in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/changed.md}
* for details.
* @param string|EventInterface $event
* @param string|object $target Object calling emit, or symbol describing target (such as static method name)
* @param array|ArrayAccess $argv Array of arguments; typically, should be associative
* @param callable $callback
* @return ResponseCollection
* @deprecated Please use trigger()
* @throws Exception\InvalidCallbackException if invalid callable provided
*/
public function triggerUntil($event, $target, $argv = null, $callback = null)
Expand All @@ -229,6 +240,29 @@ public function triggerUntil($event, $target, $argv = null, $callback = null)
return $this->trigger($event, $target, $argv, $callback);
}

/**
* Trigger an event instance.
*
* @param EventInterface $event
* @return ResponseCollection
*/
public function triggerEvent(EventInterface $event)
{
return $this->triggerListeners($event->getName(), $event);
}

/**
* Trigger an event instance, short-circuiting if a listener response evaluates true via the callback.
*
* @param callable $callback
* @param EventInterface $event
* @return ResponseCollection
*/
public function triggerEventUntil(callable $callback, EventInterface $event)
{
return $this->triggerListeners($event->getName(), $event, $callback);
}

/**
* Attach a listener to an event
*
Expand Down Expand Up @@ -293,6 +327,9 @@ public function attach($event, $callback = null, $priority = 1)
* one or more times, typically to attach to multiple events using local
* methods.
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @param ListenerAggregateInterface $aggregate
* @param int $priority If provided, a suggested priority for the aggregate to use
* @return mixed return value of {@link ListenerAggregateInterface::attach()}
Expand Down Expand Up @@ -343,6 +380,9 @@ public function detach($listener)
* Listener aggregates accept an EventManagerInterface instance, and call detach()
* of all previously attached listeners.
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @param ListenerAggregateInterface $aggregate
* @return mixed return value of {@link ListenerAggregateInterface::detach()}
*/
Expand All @@ -354,6 +394,9 @@ public function detachAggregate(ListenerAggregateInterface $aggregate)
/**
* Retrieve all registered events
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @return array
*/
public function getEvents()
Expand All @@ -364,6 +407,9 @@ public function getEvents()
/**
* Retrieve all listeners for a given event
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @param string $event
* @return PriorityQueue
*/
Expand Down
19 changes: 18 additions & 1 deletion src/EventManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ public function trigger($event, $target = null, $argv = [], $callback = null);
* - Passing event name, target, Event object, and callback
* - Passing event name, target, array|ArrayAccess of arguments, and callback
*
* @deprecated The signature of this method will change in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/changed.md}
* for details.
* @param string|EventInterface $event
* @param object|string $target
* @param array|object $argv
* @param callable $callback
* @return ResponseCollection
* @deprecated Please use trigger()
*/
public function triggerUntil($event, $target, $argv = null, $callback = null);

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

/**
* Retrieve a list of listeners registered to a given event
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @param string $event
* @return array|object
*/
Expand All @@ -97,6 +105,9 @@ public function clearListeners($event);
/**
* Set the event class to utilize
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @param string $class
* @return EventManagerInterface
*/
Expand Down Expand Up @@ -128,6 +139,9 @@ public function addIdentifiers($identifiers);
/**
* Attach a listener aggregate
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @param ListenerAggregateInterface $aggregate
* @param int $priority If provided, a suggested priority for the aggregate to use
* @return mixed return value of {@link ListenerAggregateInterface::attach()}
Expand All @@ -137,6 +151,9 @@ public function attachAggregate(ListenerAggregateInterface $aggregate, $priority
/**
* Detach a listener aggregate
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @param ListenerAggregateInterface $aggregate
* @return mixed return value of {@link ListenerAggregateInterface::detach()}
*/
Expand Down
4 changes: 4 additions & 0 deletions src/GlobalEventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
*
* Use the EventManager when you want to create a per-instance notification
* system for your objects.
*
* @deprecated This class is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
*/
class GlobalEventManager
{
Expand Down
4 changes: 4 additions & 0 deletions src/SharedEventAggregateAwareInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

/**
* Interface for allowing attachment of shared aggregate listeners.
*
* @deprecated This interface is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
*/
interface SharedEventAggregateAwareInterface
{
Expand Down
3 changes: 3 additions & 0 deletions src/SharedEventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ public function detachAggregate(SharedListenerAggregateInterface $aggregate)
/**
* Retrieve all registered events for a given resource
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @param string|int $id
* @return array
*/
Expand Down
13 changes: 5 additions & 8 deletions src/SharedEventManagerAwareInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@

/**
* Interface to automate setter injection for a SharedEventManagerInterface instance
*
* @deprecated This interface is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
*/
interface SharedEventManagerAwareInterface
interface SharedEventManagerAwareInterface extends SharedEventsCapableInterface
{
/**
* Inject a SharedEventManager instance
Expand All @@ -22,13 +26,6 @@ interface SharedEventManagerAwareInterface
*/
public function setSharedManager(SharedEventManagerInterface $sharedEventManager);

/**
* Get shared collections container
*
* @return SharedEventManagerInterface
*/
public function getSharedManager();

/**
* Remove any shared collections
*
Expand Down
3 changes: 3 additions & 0 deletions src/SharedEventManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public function detach($id, CallbackHandler $listener);
/**
* Retrieve all registered events for a given resource
*
* @deprecated This method is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
* @param string|int $id
* @return array
*/
Expand Down
24 changes: 24 additions & 0 deletions src/SharedEventsCapableInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zend-eventmanager for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-eventmanager/blob/master/LICENSE.md
*/

namespace Zend\EventManager;

/**
* Interface indicating that an object composes or can compose a
* SharedEventManagerInterface instance.
*/
interface SharedEventsCapableInterface
{
/**
* Retrieve the shared event manager, if composed.
*
* @return null|SharedEventManagerInterface
*/
public function getSharedManager();
}
4 changes: 4 additions & 0 deletions src/SharedListenerAggregateInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
* with a SharedEventManager, without an event name. The {@link attach()} method will
* then be called with the current SharedEventManager instance, allowing the class to
* wire up one or more listeners.
*
* @deprecated This interface is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
*/
interface SharedListenerAggregateInterface
{
Expand Down
4 changes: 4 additions & 0 deletions src/StaticEventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

/**
* Static version of EventManager
*
* @deprecated This class is deprecated with 2.6.0, and will be removed in 3.0.0.
* See {@link https://github.com/zendframework/zend-eventmanager/blob/develop/doc/book/migration/removed.md}
* for details.
*/
class StaticEventManager extends SharedEventManager
{
Expand Down
Loading

0 comments on commit a6c747f

Please sign in to comment.