•  
      request #13314 Tuleap EventManager should be PSR-14 compliant
    Infos
    #13314
    Manuel Vacelet (vaceletm)
    2019-05-15 11:44
    2019-04-24 17:36
    14433
    Details
    Tuleap EventManager should be PSR-14 compliant

    PSR-14 is the php standard for everything event related.

    Fortunately it's pretty close to our current standard in term of event management so gap to fill is modest and it will provide a nice de-coupling of the event management stuff implemenation (EventManager) over the fact that most (if not all) the code that uses it actually only wants to 'dispatch' stuff.

    In addition to being more "PHP ecosystem friendly" being PSR-14 compliant brings:

    • The ability to stop event propagation (it would be dead code at this point however but would help to simplify the SESSION_BEFORE_LOGIN and SESSION_AFTER_LOGIN mechanism that has been built to deal with that).
    • The ability to simplify a bit events that are being re-used:
    $event = new Stuff();
    $event_manager->processEvent($event);
    $event->getStuff();

    can be simplifyied in

    $event = $event_manager->dispatch(new Stuff());
    $event->getStuff();
    Empty
    Empty
    Empty
    • [ ] enhancement
    • [x] internal improvement
    Empty
    Stage
    Manuel Vacelet (vaceletm)
    Closed
    2019-05-15
    Attachments
    Empty
    References

    Follow-ups

    User avatar
    Thomas Gerbet (tgerbet)2019-05-15 11:44
    gerrit #14801 into Tuleap 11.1.99.66. The EventManager class now implements the Psr\EventDispatcher\EventDispatcherInterface class.

    • Status changed from Under implementation to Closed
    • Connected artifacts
    • Close date set to 2019-05-15
    User avatar

    That's not that easy, as this introduce return type on EventManager is potentially breaks all simpletests mocks on EventManger... a first refactoring is needed :miam:


    • Status changed from Under review to Under implementation