diff --git a/Tests/EventDispatcherTest.php b/Tests/EventDispatcherTest.php index 59f6fcb..d6d0778 100644 --- a/Tests/EventDispatcherTest.php +++ b/Tests/EventDispatcherTest.php @@ -23,12 +23,8 @@ class EventDispatcherTest extends TestCase private const postFoo = 'post.foo'; private const preBar = 'pre.bar'; - /** - * @var EventDispatcher - */ - private $dispatcher; - - private $listener; + private EventDispatcher $dispatcher; + private TestEventListener $listener; protected function setUp(): void { @@ -36,12 +32,6 @@ protected function setUp(): void $this->listener = new TestEventListener(); } - protected function tearDown(): void - { - $this->dispatcher = null; - $this->listener = null; - } - protected function createEventDispatcher() { return new EventDispatcher(); @@ -446,9 +436,9 @@ public function __invoke() class TestEventListener { - public $name; - public $preFooInvoked = false; - public $postFooInvoked = false; + public string $name; + public bool $preFooInvoked = false; + public bool $postFooInvoked = false; /* Listener methods */ @@ -473,9 +463,9 @@ public function __invoke() class TestWithDispatcher { - public $name; - public $dispatcher; - public $invoked = false; + public ?string $name = null; + public ?EventDispatcher $dispatcher = null; + public bool $invoked = false; public function foo($e, $name, $dispatcher) { diff --git a/Tests/GenericEventTest.php b/Tests/GenericEventTest.php index d13d536..15dac83 100644 --- a/Tests/GenericEventTest.php +++ b/Tests/GenericEventTest.php @@ -19,31 +19,15 @@ */ class GenericEventTest extends TestCase { - /** - * @var GenericEvent - */ - private $event; - - private $subject; + private GenericEvent $event; + private \stdClass $subject; - /** - * Prepares the environment before running a test. - */ protected function setUp(): void { $this->subject = new \stdClass(); $this->event = new GenericEvent($this->subject, ['name' => 'Event']); } - /** - * Cleans up the environment after running a test. - */ - protected function tearDown(): void - { - $this->subject = null; - $this->event = null; - } - public function testConstruct() { $this->assertEquals($this->event, new GenericEvent($this->subject, ['name' => 'Event'])); diff --git a/Tests/ImmutableEventDispatcherTest.php b/Tests/ImmutableEventDispatcherTest.php index 35bab1a..af3ec95 100644 --- a/Tests/ImmutableEventDispatcherTest.php +++ b/Tests/ImmutableEventDispatcherTest.php @@ -23,15 +23,8 @@ */ class ImmutableEventDispatcherTest extends TestCase { - /** - * @var MockObject&EventDispatcherInterface - */ - private $innerDispatcher; - - /** - * @var ImmutableEventDispatcher - */ - private $dispatcher; + private MockObject&EventDispatcherInterface $innerDispatcher; + private ImmutableEventDispatcher $dispatcher; protected function setUp(): void {