Skip to content

Update for simplified approach #19

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

Merged
merged 3 commits into from
Dec 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
PSR Event Dispatcher
====================

This repository holds the base interfaces related to [PSR-14](http://www.php-fig.org/psr/psr-14/).
This repository holds the interfaces related to [PSR-14](http://www.php-fig.org/psr/psr-14/).

Note that this is not an Event Dispatcher implementation of its own. It is merely interfaces that describe the components of an Event Dispatcher. See the specification for more details.

Usage
-----

We'll certainly need some stuff in here.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"php": ">=7.1.0"
"php": ">=7.2.0"
},
"autoload": {
"psr-4": {
Expand Down
21 changes: 21 additions & 0 deletions src/EventDispatcherInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);

namespace Psr\EventDispatcher;

/**
* Defines a dispatcher for events.
*/
interface EventDispatcherInterface
{
/**
* Provide all listeners with an event to process.
*
* @param object $event
* The object to process.
*
* @return object
* The Event that was passed, now modified by listeners.
*/
public function dispatch(object $event);
}
15 changes: 0 additions & 15 deletions src/EventInterface.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/ListenerProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
interface ListenerProviderInterface
{
/**
* @param EventInterface $event
* @param object $event
* An event for which to return the relevant listeners.
* @return iterable[callable]
* An iterable (array, iterator, or generator) of callables. Each
* callable MUST be type-compatible with $event.
*/
public function getListenersForEvent(EventInterface $event) : iterable;
public function getListenersForEvent(object $event) : iterable;
}
26 changes: 26 additions & 0 deletions src/StoppableEventInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);

namespace Psr\EventDispatcher;

/**
* An Event whose processing may be interrupted when the event has been handled.
*
* A Dispatcher implementation MUST check to determine if an Event
* is marked as stopped after each listener is called. If it is then it should
* return immediately without calling any further Listeners.
*/
interface StoppableEventInterface
{
/**
* Is propagation stopped?
*
* This will typically only be used by the Dispatcher to determine if the
* previous listener halted propagation.
*
* @return bool
* True if the Event is complete and no further listeners should be called.
* False to continue calling listeners.
*/
public function isPropagationStopped() : bool;
}