Review main Abandoned

60343[WIP][FEATURE] Introduce PSR-14 based EventDispatcher as hook replacement

Benni Mack CR 0 V 0 Nightmare +2789 −255 updated 04/20/20, 20:01

Commit message

FYI: I'll keep this one open for migrating further hooks to PSR11/PSR14

The new PSR-14 standards recommendation is providing
a new OOP way to extend a framework in an interchangeable way.

There are four components to PSR-14:
- Listeners => actual code that hooks into a certain place
- Event => Any kind of object which defines what a listener can do (or just "listen")
- ListenerProvider => a flexible registration mechanism to register listeners
- Dispatcher => the main logic to be used throughout the framework

Due to its PSR-based nature, it is very close to various other EventDispatcher
systems provided by various frameworks.

For TYPO3 we decided to:
- Provide our own ListenerProvider that checks all active extensions for listeners
within EXT:my_extension/Configuration/EventListeners.php - similar to how
we've done that with PSR-15 middlewares. The ListenerProvider also uses
"makeInstance".
- Provider our own EventDispatcher which is set up at the VERY part of the
bootstrap process of TYPO3, and part of the PSR-11 Container.

The purpose of this change is to fully migrate away from
- Hooks
- Hooks that modify things
- Hooks which implement interfaces for hooks
- Signals/Slots from Extbase

and their special registration into one Object-Oriented way
on how to treat Events and Listeners.

The current change provides

1. A custom PackageListenerProvider
- with the mentioned registration concept
- which allows to do ordering based on DependencyOrderingService

2. A straightforward EventDispatcher implementation.

3. Events for all previous hooks in EXT:core.

4. Compatibility Listeners for all previous hooks, these
are usually loaded before other listeners.

5. A change to the Backend module "Configuration" to browse registered listeners

The aim for this patch is
- to be 100% compliant to the PSR-14 specification
- to change all EXT:core hooks as well to new Events (except DataHandler)
- to add further tests for the new functionality
- to add documentation for the new EventDispatcher system
- to change all EXT:core signal/slots to Events

Also, all limitations / changes need to be reflected.

Still todo:
- Add EventListeners for all existing hooks that have been migrated
- Migrate tests to use EventListeners instead of Signals/Hooks
- Add RST
- Add tests for listener provider

Review

  • Code review CR 0

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V 0

    Imported before Forger kept the single votes, the next import adds them.

Files 56

Show 36 more files