diff --git a/README.MD b/README.MD index f730292..0c9aa1f 100644 --- a/README.MD +++ b/README.MD @@ -5,7 +5,7 @@ [![Latest Stable Version](https://poser.pugx.org/platine-php/event-dispatcher/v)](https://packagist.org/packages/platine-php/event-dispatcher) [![Latest Unstable Version](https://poser.pugx.org/platine-php/event-dispatcher/v/unstable)](https://packagist.org/packages/platine-php/event-dispatcher) [![License](https://poser.pugx.org/platine-php/event-dispatcher/license)](https://packagist.org/packages/platine-php/event-dispatcher) -[![Build Status](https://img.shields.io/travis/platine-php/event-dispatcher/develop.svg?style=flat-square)](https://travis-ci.com/platine-php/event-dispatcher) +[![Build Status](https://img.shields.io/travis/com/platine-php/event-dispatcher?style=flat-square)](https://travis-ci.com/platine-php/event-dispatcher) [![Quality Score](https://img.shields.io/scrutinizer/g/platine-php/event-dispatcher.svg?style=flat-square)](https://scrutinizer-ci.com/g/platine-php/event-dispatcher) [![Maintainability](https://api.codeclimate.com/v1/badges/43a7eda8f7e26dfca6ee/maintainability)](https://codeclimate.com/github/platine-php/event-dispatcher/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/43a7eda8f7e26dfca6ee/test_coverage)](https://codeclimate.com/github/platine-php/event-dispatcher/test_coverage) diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index 089cab9..0000000 --- a/psalm.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - diff --git a/src/CallableListener.php b/src/CallableListener.php index 45b63d1..03ad44c 100644 --- a/src/CallableListener.php +++ b/src/CallableListener.php @@ -37,7 +37,7 @@ * @author Platine Developers Team * @copyright Copyright (c) 2020 * @license http://opensource.org/licenses/MIT MIT License - * @link http://www.iacademy.cf + * @link https://www.platine-php.com * @version 1.0.0 * @filesource */ @@ -48,7 +48,6 @@ class CallableListener implements ListenerInterface { - /** * The callable * @var callable diff --git a/src/Dispatcher.php b/src/Dispatcher.php index d8df651..bdf47f2 100644 --- a/src/Dispatcher.php +++ b/src/Dispatcher.php @@ -37,7 +37,7 @@ * @author Platine Developers Team * @copyright Copyright (c) 2020 * @license http://opensource.org/licenses/MIT MIT License - * @link http://www.iacademy.cf + * @link https://www.platine-php.com * @version 1.0.0 * @filesource */ @@ -50,7 +50,6 @@ class Dispatcher implements DispatcherInterface { - /** * The list of listener * @var array @@ -60,7 +59,7 @@ class Dispatcher implements DispatcherInterface /** * {@inheritdoc} */ - public function dispatch($eventName, EventInterface $event = null): void + public function dispatch($eventName, EventInterface $event = null): EventInterface { if ($eventName instanceof EventInterface) { $event = $eventName; @@ -77,6 +76,8 @@ public function dispatch($eventName, EventInterface $event = null): void ([$listener, 'handle'])($event); } } + + return $event; } /** diff --git a/src/DispatcherInterface.php b/src/DispatcherInterface.php index 340568d..cec0d40 100644 --- a/src/DispatcherInterface.php +++ b/src/DispatcherInterface.php @@ -37,7 +37,7 @@ * @author Platine Developers Team * @copyright Copyright (c) 2020 * @license http://opensource.org/licenses/MIT MIT License - * @link http://www.iacademy.cf + * @link https://www.platine-php.com * @version 1.0.0 * @filesource */ @@ -50,7 +50,6 @@ interface DispatcherInterface { - /** * The low priority * @var int @@ -73,9 +72,9 @@ interface DispatcherInterface * Dispatches an event to all registered listeners. * @param string|EventInterface $eventName the name of event of instance of EventInterface * @param EventInterface|null $event the instance of EventInterface or null - * @return void + * @return EventInterface */ - public function dispatch($eventName, EventInterface $event = null): void; + public function dispatch($eventName, EventInterface $event = null): EventInterface; /** * Register a listener for the given event. diff --git a/src/Event.php b/src/Event.php index 79d7251..afc0515 100644 --- a/src/Event.php +++ b/src/Event.php @@ -38,7 +38,7 @@ * @author Platine Developers Team * @copyright Copyright (c) 2020 * @license http://opensource.org/licenses/MIT MIT License - * @link http://www.iacademy.cf + * @link https://www.platine-php.com * @version 1.0.0 * @filesource */ @@ -49,7 +49,6 @@ class Event implements EventInterface { - /** * The event name * @var string diff --git a/src/EventInterface.php b/src/EventInterface.php index 7f512cb..55135f5 100644 --- a/src/EventInterface.php +++ b/src/EventInterface.php @@ -37,7 +37,7 @@ * @author Platine Developers Team * @copyright Copyright (c) 2020 * @license http://opensource.org/licenses/MIT MIT License - * @link http://www.iacademy.cf + * @link https://www.platine-php.com * @version 1.0.0 * @filesource */ @@ -48,7 +48,6 @@ interface EventInterface { - /** * Get the event name * @return string diff --git a/src/Exception/DispatcherException.php b/src/Exception/DispatcherException.php index 170a598..30bed68 100644 --- a/src/Exception/DispatcherException.php +++ b/src/Exception/DispatcherException.php @@ -34,5 +34,4 @@ class DispatcherException extends \Exception { - } diff --git a/src/ListenerInterface.php b/src/ListenerInterface.php index 30c51bd..5d70ce2 100644 --- a/src/ListenerInterface.php +++ b/src/ListenerInterface.php @@ -37,7 +37,7 @@ * @author Platine Developers Team * @copyright Copyright (c) 2020 * @license http://opensource.org/licenses/MIT MIT License - * @link http://www.iacademy.cf + * @link https://www.platine-php.com * @version 1.0.0 * @filesource */ @@ -48,7 +48,6 @@ interface ListenerInterface { - /** * Handle event * @param EventInterface $event the event instance diff --git a/src/ListenerPriorityQueue.php b/src/ListenerPriorityQueue.php index d80bbf5..6a47ddd 100644 --- a/src/ListenerPriorityQueue.php +++ b/src/ListenerPriorityQueue.php @@ -37,7 +37,7 @@ * @author Platine Developers Team * @copyright Copyright (c) 2020 * @license http://opensource.org/licenses/MIT MIT License - * @link http://www.iacademy.cf + * @link https://www.platine-php.com * @version 1.0.0 * @filesource */ @@ -58,7 +58,6 @@ */ class ListenerPriorityQueue implements IteratorAggregate { - /** * The storage * @var SplObjectStorage diff --git a/src/SubscriberInterface.php b/src/SubscriberInterface.php index 168e0c0..d8fc18d 100644 --- a/src/SubscriberInterface.php +++ b/src/SubscriberInterface.php @@ -37,7 +37,7 @@ * @author Platine Developers Team * @copyright Copyright (c) 2020 * @license http://opensource.org/licenses/MIT MIT License - * @link http://www.iacademy.cf + * @link https://www.platine-php.com * @version 1.0.0 * @filesource */ @@ -48,7 +48,6 @@ interface SubscriberInterface { - /** * Return the array of event to subscribe in form of * diff --git a/tests/CallableListenerTest.php b/tests/CallableListenerTest.php index 663b8b2..152486b 100644 --- a/tests/CallableListenerTest.php +++ b/tests/CallableListenerTest.php @@ -17,7 +17,6 @@ */ class CallableListenerTest extends PlatineTestCase { - public function testConstructor(): void { $callable = 'Platine\\Test\\Fixture\\callable_listener'; diff --git a/tests/DispatcherTest.php b/tests/DispatcherTest.php index 9b85916..02b2605 100644 --- a/tests/DispatcherTest.php +++ b/tests/DispatcherTest.php @@ -22,7 +22,6 @@ */ class DispatcherTest extends PlatineTestCase { - public function testAddListenerDefault(): void { $d = new Dispatcher(); diff --git a/tests/EventTest.php b/tests/EventTest.php index d7ba828..2c78aeb 100644 --- a/tests/EventTest.php +++ b/tests/EventTest.php @@ -15,7 +15,6 @@ */ class EventTest extends PlatineTestCase { - public function testConstructor(): void { $e = new Event('foo_event'); diff --git a/tests/ListenerPriorityQueueTest.php b/tests/ListenerPriorityQueueTest.php index a714501..b633cdc 100644 --- a/tests/ListenerPriorityQueueTest.php +++ b/tests/ListenerPriorityQueueTest.php @@ -17,7 +17,6 @@ */ class ListenerPriorityQueueTest extends PlatineTestCase { - public function testConstructor(): void { //Default values diff --git a/tests/fixtures/fixtures.php b/tests/fixtures/fixtures.php index 0869437..ff07469 100644 --- a/tests/fixtures/fixtures.php +++ b/tests/fixtures/fixtures.php @@ -6,7 +6,6 @@ class EventListenerTestClass implements \Platine\Event\ListenerInterface { - public function handle(\Platine\Event\EventInterface $event) { echo $event->getName(); @@ -15,7 +14,6 @@ public function handle(\Platine\Event\EventInterface $event) class EventListenerTestClassEmpty implements \Platine\Event\ListenerInterface { - public function handle(\Platine\Event\EventInterface $event) { } @@ -23,7 +21,6 @@ public function handle(\Platine\Event\EventInterface $event) class EventListenerTestClassEventInstanceChanged implements \Platine\Event\ListenerInterface { - public function handle(\Platine\Event\EventInterface $event) { $event->setArgument('foo', 'bar'); @@ -32,7 +29,6 @@ public function handle(\Platine\Event\EventInterface $event) class EventListenerTestClassStopPropagation implements \Platine\Event\ListenerInterface { - public function handle(\Platine\Event\EventInterface $event) { $event->stopPropagation(); @@ -41,7 +37,6 @@ public function handle(\Platine\Event\EventInterface $event) class EventSubscriberTestClass implements \Platine\Event\SubscriberInterface { - public function getSubscribedEvents(): array { return array(