-
Notifications
You must be signed in to change notification settings - Fork 62
Provide duck-typed PSR-14 implementation #73
base: develop
Are you sure you want to change the base?
Provide duck-typed PSR-14 implementation #73
Commits on Apr 10, 2019
-
feat: StoppableEventInterface implementation
Since v3 still targets PHP versions prior to PHP 7.2, this patch provides a forwards-compatibility shim for the PSR-14 `StoppableEventInterface` via an additional, package-specific version that is now also implemented by default in the `Event` class.
Configuration menu - View commit details
-
Copy full SHA for 99c6446 - Browse repository at this point
Copy the full SHA 99c6446View commit details -
feat: prefer
isPropagationStopped
overpropagationIsStopped
If the method `isPropagationStopped()` is defined, use it over the `propagationIsStopped()` method.
Configuration menu - View commit details
-
Copy full SHA for f1ad8bc - Browse repository at this point
Copy the full SHA f1ad8bcView commit details -
feat: proxy to isPropagationStopped
Modifies Event::propagationIsStopped such that it now proxies to the isPropagationStopped method, and documents in the deprecation notice that this happens.
Configuration menu - View commit details
-
Copy full SHA for 4fbd54a - Browse repository at this point
Copy the full SHA 4fbd54aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9784e7b - Browse repository at this point
Copy the full SHA 9784e7bView commit details -
docs: Mark StoppableEventInterface as deprecated
Will remove in version 4.0.
Configuration menu - View commit details
-
Copy full SHA for 8b89424 - Browse repository at this point
Copy the full SHA 8b89424View commit details -
feat: ListenerProvider namespace and interface
Creates a forwards-compatibility shim for the `ListenerProviderInterface`, in a new subnamespace, `Zend\EventManager\ListenerProviderInterface`.
Configuration menu - View commit details
-
Copy full SHA for ed5fb45 - Browse repository at this point
Copy the full SHA ed5fb45View commit details -
feat: Creates PrioritizedListenerProviderInterface
For use in getting a lookup table of priorities and associated listeners, optionally using identifiers for lookup.
Configuration menu - View commit details
-
Copy full SHA for 092b8e3 - Browse repository at this point
Copy the full SHA 092b8e3View commit details -
feat: Creates PrioritizedListenerAttachmentInterface
This provides the methods necessary for attaching listeners. It does not extend PrioritizedListenerProviderInterface, as we want to be able to re-use that particular interface with shared providers, which will have a different attachment mechanism in version 3 releases.
Configuration menu - View commit details
-
Copy full SHA for 2446145 - Browse repository at this point
Copy the full SHA 2446145View commit details -
feat: Creates PrioritizedListenerProvider
New provider implements `PrioritizedListenerAttachmentInterface` and `PrioritizedListenerProviderInterface`, and will iterate attached listeners in priority order. Each iteration will take into account both the event name, if a `getName()` method is available, the event class, and any wildcard listeners, and listeners of the same priority will be returned in the order they are attached, based on those criteria.
Configuration menu - View commit details
-
Copy full SHA for 650a6f6 - Browse repository at this point
Copy the full SHA 650a6f6View commit details -
feat: Creates PrioritizedIdentifierListenerProvider
The PrioritizedIdentifierListenerProvider mimics functionality present in the SharedEventManager (and implements the SharedEventManagerInterface). Its purpose is to be a drop-in replacement for the `SharedEventManager` to allow users to start migrating to PSR-14 functionality. In the process of working on this implementation, I discovered some complexity in the data structure returned from `getListenersForEventByPriority` implementation of `PrioritizedListenerProvider` that, when mimiced in `PrioritizedIdentifierListenerProvider`, made verifying behavior difficult. In particular, it was this line: ```php $prioritizedListeners[$priority][] = $listOfListeners[0]; ``` The problem that arose is that the `$prioritizedListeners` returned were now two levels deep, which made comparisons far harder. I changed this to read: ``` $prioritizedListeners[$priority] = isset($prioritizedListeners[$priority]) ? array_merge($prioritizedListeners[$priority], $listOfListeners[0]) : $listOfListeners[0]; ``` This makes the return value far simpler, and _should_ keep speed reasonable, though I have yet to benchmark it.
Configuration menu - View commit details
-
Copy full SHA for c8b7d6a - Browse repository at this point
Copy the full SHA c8b7d6aView commit details -
feat: Creates a PrioritizedAggregateListenerProvider
This version acts like the combination of EventManager+SharedEventManager in terms of how it aggregates and resolves priority for listeners. The class aggregates a list of `PrioritizedListenerAttachmentInterface` instances (and implements the interface itself), looping over each in ordert to build up a prioritized list of all listeners from all providers. Since they are done in order, the order in which they should be attached generally is: - PrioritizedListenerProvider - PrioritizedIdentifierListenerProvider
Configuration menu - View commit details
-
Copy full SHA for 5569b4e - Browse repository at this point
Copy the full SHA 5569b4eView commit details -
refactor: Have SharedEventManager extend PrioritizedIdentifierListene…
…rProvider Doing so will allow us to use it in a PrioritizedAggregateListenerProvider within the EventManager later. Required a couple changes to tests, as PrioritizedIdentifierListenerProvider widens what are allowed as events and identifiers when retrieving listeners.
Configuration menu - View commit details
-
Copy full SHA for 64ac503 - Browse repository at this point
Copy the full SHA 64ac503View commit details -
feat: return listener from attach, attachWildcardListener methods
This is necessary to keep feature parity with current versions, but can be removed in version 4.
Configuration menu - View commit details
-
Copy full SHA for 0684663 - Browse repository at this point
Copy the full SHA 0684663View commit details -
feat: adds a ListenerSubscriberInterface
Added to the ListenerProvider namespace. Accepts a PrioritizedListenerAttachmentInterface argument, to which it will subscribe listeners.
Configuration menu - View commit details
-
Copy full SHA for 1093041 - Browse repository at this point
Copy the full SHA 1093041View commit details -
feat: Provides AbstractListenerSubscriber and ListenerSubscriberTrait
Each implements ListenerSubscriberInterface::detach
Configuration menu - View commit details
-
Copy full SHA for eef3b10 - Browse repository at this point
Copy the full SHA eef3b10View commit details -
feat: Implement lazy listeners and lazy listener subscriber
Combines the features of LazyListener and LazyEventListener into `Zend\EventManager\ListenerProvider\LazyListener`. `LazyListenerSubscriber` is based on `LazyListenerAggregate`, but simplifies it by having it compose `LazyListener` instances only (no creation within it).
Configuration menu - View commit details
-
Copy full SHA for b52c547 - Browse repository at this point
Copy the full SHA b52c547View commit details -
feat: update EventManager to implement ListenerProviderInterface and …
…PrioritizedListenerAttachmentInterface Allows the EventManager to act as its own provider.
Configuration menu - View commit details
-
Copy full SHA for efec2c0 - Browse repository at this point
Copy the full SHA efec2c0View commit details -
feat: update EventManager to use listener providers
- Adds `Zend\EventManager\EventDispatcherInterface` as a forwards compatibility shim for PSR-14. - Adds `Zend\EventManager\SharedEventManager\SharedEventManagerDecorator`, which decorates generic `SharedEventManagerInterface` instances as listener providers. - Modifies `PrioritizedAggregateListenerProvider` to accept an optional `ListenerProviderInterface $default` argument. This allows non-prioritized `SharedEventManagerInterface` instances (such as the `SharedEventManagerDecorator` in the previous item) to be fallback providers. - Modifies `Zend\EventManager\EventManager` as follows: - It now implements `EventDispatcherInterface` - It now composes a `$provider` property, and an optional `$prioritizedProvider` property. If you instantiate it per previous versions, it creates a `PrioritizedListenerProvider` instance and assigns it to the `$prioritizedProvider` property. It then checks to see if a shared manager was provided, and the type provided, to either assign the `$prioritizedProvider` as the `$provider`, or a `PrioritizedAggregateListenerProvider` that composes both the `$prioritizedProvider` and shared manager instances. - It adds a static named constructor, `createUsingListenerProvider()`, which accepts a single `ListenerProviderInterface` instance. This value is assigned to `$provider`, and, if it is a `PrioritizedListenerAttachmentInterface` instance, to the `$prioritizedProvider` property as well. - Each of the listener attachment methods (attach, detach, clearListeners, *WildcardListeners) now proxy to the composed `$prioritizedProvider`, if any. If there is none, theses methods now raise an exception. - The `getListenersForEvent()` method now proxies to the underling `$provider` property. - The `triggerListeners()` method now consumes the value of `getListenersForEvent()`. - It adds the method `dispatch($event)`, which proxies to `triggerListeners()`, and returns the `$event` it was passed. The method raises an exception of `$event` is a non-object. - Each of `trigger()`, `triggerUntil`, `triggerEvent`, `triggerEventUntil`, `getIdentifiers`, `setIdentifiers`, `addIdenitifers`, `getSharedManager`, `attach`, `detach`, `attachWildcardListener`, `detachWildcardListener`, `clearListeners`, and `getListenersForEvent` have been marked deprecated. - Updates `EventListenerIntrospectionTrait` to work with the new internals of the `EventManager`. - Updates `EventManagerTest`: - updates `getListenersForEvent()` to work with the new `EventManager` internals - Removes `testAttachShouldAddEventIfItDoesNotExist` as it was irrelevant even before the changes. - Removes the `testTriggeringAnEventWithAnEmptyNameRaisesAnException` test, as this is no longer true; you can use any object as an event now. - Modifies a few tests where they were accessing internal structures that have changed, while keeping the same assertions in place. - Adds `EventManagerWithProviderTest` to demonstrate usage when creating an `EventManager` via its `createUsingListenerProvider()` method. - Updates `EventListenerIntrospectionTraitTest` to work with the new internals of the `EventManager`.
Configuration menu - View commit details
-
Copy full SHA for c1f4cd5 - Browse repository at this point
Copy the full SHA c1f4cd5View commit details -
feat: Adds EventDispatchingInterface
Basically, a counterpart to the current EventManagerAwareInterface, but for EventDispatcherInterface composition. Also revises the Deprecations list, as we can keep EventManager as an EventDispatcherInterface implementation for 4.0.
Configuration menu - View commit details
-
Copy full SHA for cee468a - Browse repository at this point
Copy the full SHA cee468aView commit details -
feat: deprecate features that will be removed in version 4
- `EventInterface` - `EventManagerInterface` - `EventManagerAwareInterface` - `EventManagerAwareTrait` - `EventsCapableInterface` (points people to `EventDispatchingInterface`) - `SharedEventManager` - `SharedEventManagerInterface` - `SharedEventsCapableInterface` - `ListenerAggregateInterface` (points people to the `PrioritizedListenerAttachmentInterface`) - `ListenerAggregateTrait` (points people to `ListenerSubscriberTrait`) - `AbstractListenerAggregate` (points people to `AbstractListenerSubscriber` and/or `ListenerSubscriberTrait`) - `ResponseCollection` (tells people to aggregate state/results in the event itself) - `LazyListener` (points people to `ListenerProvider\LazyListener`) - `LazyEventListener` (points people to `ListenerProvider\LazyListener`) - `LazyListenerAggregate` (points people to `ListenerProvider\LazyListenerSubscriber`) - `FilterChain` and `Filter` subnamespace (this should be done in a separate component)
Configuration menu - View commit details
-
Copy full SHA for 442d09b - Browse repository at this point
Copy the full SHA 442d09bView commit details -
feat: require container-interop ^1.2
We now require ^1.2 to ensure that PSR-11 interfaces are also present, allowing new classes to typehint only on the PSR-11 interfaces. This will allow compatibility to continue as the 1.2 variants extend the PSR-11 interfaces.
Configuration menu - View commit details
-
Copy full SHA for 7dc24c8 - Browse repository at this point
Copy the full SHA 7dc24c8View commit details -
fix: Adapt assertion to work with PHP versions < 7.1
Previously, `assertInternalType('iterable')`, which only works on PHP 7.1+.
Configuration menu - View commit details
-
Copy full SHA for 441e8dd - Browse repository at this point
Copy the full SHA 441e8ddView commit details -
refactor: Make anonymous classes into actual test asset classes
Required to allow us to test against PHP 5.6.
Configuration menu - View commit details
-
Copy full SHA for df2b093 - Browse repository at this point
Copy the full SHA df2b093View commit details -
Configuration menu - View commit details
-
Copy full SHA for c367037 - Browse repository at this point
Copy the full SHA c367037View commit details -
docs: Updated CHANGELOG for zendframework#73
Notes all new features, major changes, and deprecations.
Configuration menu - View commit details
-
Copy full SHA for af36356 - Browse repository at this point
Copy the full SHA af36356View commit details -
fix: Adapt
yield from
statements to work in PHP 5.6`yield from` was introduced in PHP 7. As such, to work in PHP 5.6, we need to modify the statements to iterate over the inner generator and yield results directly.
Configuration menu - View commit details
-
Copy full SHA for 357d508 - Browse repository at this point
Copy the full SHA 357d508View commit details