Skip to content

Provide duck-typed PSR-14 implementation #2

@weierophinney

Description

@weierophinney

This patch provides a forwards-compatibility release that adapts zend-eventmanager to work as a PSR-14 EventDispatcher. It does so by doing the following:

  • Creating package-specific ListenerProviderInterface and EventDispatcherInterface versions that work with PHP 5.6.
  • Moving all listener aggregation into classes within a ListenerProvider subnamespace; this includes both the listener attachment previously in the EventManager instance as well as the SharedEventManager instance.
  • Renaming "listener aggregates" to "listener subscribers" in the new ListenerProvider subnamespace.
  • Adapting EventManager to consume listener providers. By default, it will create a default priority-based listener provider, and have its various listener attachment methods proxy to that provider; it then aggregates that provider with the SharedEventManager (which is itself a provider now) in order to retrieve listeners. This is done in such a way that behavior is completely backwards compatible with current usage.
    • A new named constructor, createUsingListenerProvider(), allows providing a specific listener provider for use with the EventManager. If the provider is attachment capable, the various listener attachment methods will proxy to it; otherwise, they will raise an exception.

The patch also deprecates a number of features, including:

  • Most interfaces, including the EventInterface.
  • The entire "shared event manager" concept (this can be accomplished via event object hierarchies instead)

TODO

  • Write changelog entries
  • Create documentation of new features
  • Document how to start migrating to the new features in order to prepare for version 4

Originally posted by @weierophinney at zendframework/zend-eventmanager#73

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions