Skip to content

Commit

Permalink
- Code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TorbenKoehn committed May 24, 2019
1 parent 55cd772 commit 1c97aa4
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/Event/AbstractStoppableEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public function stopPropagation(): void
{
$this->propagationStopped = true;
}
}
}
2 changes: 1 addition & 1 deletion src/Event/InvalidListenerException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

final class InvalidListenerException extends \InvalidArgumentException
{
}
}
2 changes: 1 addition & 1 deletion src/Event/ListenerProvider/ChainListenerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public function getListenersForEvent(object $event): iterable
yield from $provider->getListenersForEvent($event);
}
}
}
}
2 changes: 1 addition & 1 deletion src/Event/ListenerProvider/ClassMapListenerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ public function getListenersForEvent(object $event): iterable
}
yield from $this->classMap[$className];
}
}
}
2 changes: 1 addition & 1 deletion src/Event/ListenerProvider/ReflectionListenerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ public function getListenersForEvent(object $event): iterable
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/Event/ListenerRegistryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ interface ListenerRegistryInterface
{
public function addListener(Closure $listener): void;
public function removeListener(Closure $listener): void;
}
}
2 changes: 1 addition & 1 deletion src/Event/StoppableEventInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
interface StoppableEventInterface extends \Psr\EventDispatcher\StoppableEventInterface
{
public function stopPropagation(): void;
}
}
2 changes: 1 addition & 1 deletion src/EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ public function dispatch(object $event)
}
return $event;
}
}
}
2 changes: 1 addition & 1 deletion tests/AbstractTestEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ public function setData($data): void
{
$this->data = $data;
}
}
}
27 changes: 18 additions & 9 deletions tests/Event/ListenerProvider/ReflectionListenerProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class ReflectionListenerProviderTest extends TestCase
*/
public function testConstruct(): void
{
$listener = function (TestEvent $event) {};
$listener = function (TestEvent $event) {
};
$provider = new ReflectionListenerProvider([
$listener
]);
Expand All @@ -36,7 +37,8 @@ public function testConstruct(): void
*/
public function testAddListener(): void
{
$listener = function (TestEvent $event) {};
$listener = function (TestEvent $event) {
};
$provider = new ReflectionListenerProvider();
$provider->addListener($listener);

Expand All @@ -49,7 +51,8 @@ public function testAddListener(): void
*/
public function testRemoveListener(): void
{
$listener = function (TestEvent $event) {};
$listener = function (TestEvent $event) {
};
$provider = new ReflectionListenerProvider();
$provider->addListener($listener);
self::assertEquals([$listener], iterator_to_array($provider->getListenersForEvent(new TestEvent())));
Expand All @@ -64,12 +67,18 @@ public function testRemoveListener(): void
public function testGetListenersForEvent(): void
{
$listeners = [
$listener = function (TestEvent $event) {},
$listenerAbstract = function (AbstractTestEvent $event) {},
function (\stdClass $event) {},
$listenerFinal = function (FinalTestEvent $event) {},
$listenerStoppable = function (StoppableEventInterface $event) {},
$listenerInterface = function (TestEventInterface $event) {}
$listener = function (TestEvent $event) {
},
$listenerAbstract = function (AbstractTestEvent $event) {
},
function (\stdClass $event) {
},
$listenerFinal = function (FinalTestEvent $event) {
},
$listenerStoppable = function (StoppableEventInterface $event) {
},
$listenerInterface = function (TestEventInterface $event) {
}
];
$provider = new ReflectionListenerProvider($listeners);

Expand Down
2 changes: 1 addition & 1 deletion tests/FinalTestEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
final class FinalTestEvent extends TestEvent
{

}
}
2 changes: 1 addition & 1 deletion tests/StoppableTestEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public function setData($data): void
{
$this->data = $data;
}
}
}
2 changes: 1 addition & 1 deletion tests/TestEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

class TestEvent extends AbstractTestEvent
{
}
}
2 changes: 1 addition & 1 deletion tests/TestEventInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ interface TestEventInterface
{
public function setData($data);
public function getData();
}
}

0 comments on commit 1c97aa4

Please sign in to comment.