-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Become a PSR-14 provider #12
base: 3.4.x
Are you sure you want to change the base?
Become a PSR-14 provider #12
Commits on Feb 10, 2021
-
feat: StoppableEventInterface implementation
This patch updates the `Event` implementation to implement the PSR-14 `StoppableEventInterface`, and deprecates its `propagationIsStopped()` method in favor of the PSR-14 `isPropagationStopped()` method. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for fc5b5dc - Browse repository at this point
Copy the full SHA fc5b5dcView commit details -
feat: prefer
isPropagationStopped
overpropagationIsStopped
If the method `isPropagationStopped()` is defined, use it over the `propagationIsStopped()` method. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9d066f1 - Browse repository at this point
Copy the full SHA 9d066f1View 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. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 719b365 - Browse repository at this point
Copy the full SHA 719b365View commit details -
docs: provide comprehensive checklist for PSR-14 adoption
Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 17893fc - Browse repository at this point
Copy the full SHA 17893fcView commit details -
feat: Creates PrioritizedListenerProviderInterface
For use in getting a lookup table of priorities and associated listeners, optionally using identifiers for lookup. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 10ec82b - Browse repository at this point
Copy the full SHA 10ec82bView 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. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 368fe20 - Browse repository at this point
Copy the full SHA 368fe20View 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. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 65a410d - Browse repository at this point
Copy the full SHA 65a410dView 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. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 48c5ab5 - Browse repository at this point
Copy the full SHA 48c5ab5View 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 Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 23a7bd9 - Browse repository at this point
Copy the full SHA 23a7bd9View 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. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 625138d - Browse repository at this point
Copy the full SHA 625138dView 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. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 6051761 - Browse repository at this point
Copy the full SHA 6051761View commit details -
feat: adds a ListenerSubscriberInterface
Added to the ListenerProvider namespace. Accepts a PrioritizedListenerAttachmentInterface argument, to which it will subscribe listeners. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 84739b0 - Browse repository at this point
Copy the full SHA 84739b0View commit details -
feat: Provides AbstractListenerSubscriber and ListenerSubscriberTrait
Each implements ListenerSubscriberInterface::detach Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 109c2bc - Browse repository at this point
Copy the full SHA 109c2bcView commit details -
feat: Implement lazy listeners and lazy listener subscriber
Combines the features of LazyListener and LazyEventListener into `Laminas\EventManager\ListenerProvider\LazyListener`. `LazyListenerSubscriber` is based on `LazyListenerAggregate`, but simplifies it by having it compose `LazyListener` instances only (no creation within it). Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 00501ad - Browse repository at this point
Copy the full SHA 00501adView commit details -
feat: update EventManager to implement ListenerProviderInterface and …
…PrioritizedListenerAttachmentInterface Allows the EventManager to act as its own provider. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 046ddd2 - Browse repository at this point
Copy the full SHA 046ddd2View commit details -
feat: update EventManager to use listener providers
- Adds `Laminas\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 `Laminas\EventManager\EventManager` as follows: - It now implements the PSR-14 `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`. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 736eb02 - Browse repository at this point
Copy the full SHA 736eb02View 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. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 79b7a5c - Browse repository at this point
Copy the full SHA 79b7a5cView 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) Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for f926f4e - Browse repository at this point
Copy the full SHA f926f4eView 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. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 5567293 - Browse repository at this point
Copy the full SHA 5567293View commit details -
refactor: Make anonymous classes into actual test asset classes
Simplifies test definitions. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ce9c77a - Browse repository at this point
Copy the full SHA ce9c77aView commit details -
whitespace and long lines Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 861f30a - Browse repository at this point
Copy the full SHA 861f30aView commit details -
docs: Updated CHANGELOG for 3.4.0 release
Notes all new features, major changes, and deprecations. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4994c23 - Browse repository at this point
Copy the full SHA 4994c23View commit details -
qa: ensure tests pass, and BC breaks identified and removed
- Updates `PrioritizedListenerAttachmentInterface` to remove any BC breaks that would occur if `EventManager` implements it. - Update to use non-deprecated assertions where possible. - Fix any failing tests. - Update checklist. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 48649a9 - Browse repository at this point
Copy the full SHA 48649a9View commit details -
Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b34b921 - Browse repository at this point
Copy the full SHA b34b921View commit details -
feat: mark package as a PSR-14 implementation
Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1408376 - Browse repository at this point
Copy the full SHA 1408376View commit details -
PHPUnit 8.5 + Prophecy 1.8 was resulting in errors when lowest version was used, due to differences in how prophecy did type comparisons. Bumping versions corrects the issues. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3682715 - Browse repository at this point
Copy the full SHA 3682715View commit details -
qa: prophecy 1.12.0 is required to work with PHP 8
Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 373452e - Browse repository at this point
Copy the full SHA 373452eView commit details -
qa: resolve merge conflict in EventManagerTest
Missed previously when rebasing Signed-off-by: Matthew Weier O'Phinney <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 060fcaf - Browse repository at this point
Copy the full SHA 060fcafView commit details