From ee582e4c703c7bdd3f250189f5d14b547a1925d4 Mon Sep 17 00:00:00 2001 From: Bas Kamer Date: Fri, 21 Oct 2022 23:22:37 +0200 Subject: [PATCH] php74+, github actions, cs --- .coveralls.yml | 4 ++-- .github/workflows/continuous-integration.yml | 11 +++++++++ .gitignore | 2 +- .laminas-ci.json | 5 ++++ .php-cs-fixer.php | 8 +++++++ .php_cs | 10 -------- composer.json | 24 ++++++++++++-------- phpunit.xml.dist | 23 ++++++------------- src/Event/ActionEvent.php | 4 ++-- src/Event/ActionEventEmitter.php | 4 ++-- src/Event/ActionEventListenerAggregate.php | 4 ++-- src/Event/DefaultActionEvent.php | 4 ++-- src/Event/DefaultListenerHandler.php | 4 ++-- src/Event/DetachAggregateHandlers.php | 4 ++-- src/Event/ListenerHandler.php | 4 ++-- src/Event/ProophActionEventEmitter.php | 4 ++-- src/Messaging/Command.php | 4 ++-- src/Messaging/DomainEvent.php | 4 ++-- src/Messaging/DomainMessage.php | 9 ++++---- src/Messaging/FQCNMessageFactory.php | 6 ++--- src/Messaging/HasMessageName.php | 4 ++-- src/Messaging/Message.php | 6 +++-- src/Messaging/MessageConverter.php | 4 ++-- src/Messaging/MessageDataAssertion.php | 4 ++-- src/Messaging/MessageFactory.php | 4 ++-- src/Messaging/NoOpMessageConverter.php | 4 ++-- src/Messaging/PayloadConstructable.php | 4 ++-- src/Messaging/PayloadTrait.php | 4 ++-- src/Messaging/Query.php | 4 ++-- tests/Event/DefaultActionEventTest.php | 4 ++-- tests/Event/ProophActionEventEmitterTest.php | 23 +++++-------------- tests/Messaging/CommandTest.php | 23 +++++++------------ tests/Messaging/DomainEventTest.php | 24 ++++++++------------ tests/Messaging/FQCNMessageFactoryTest.php | 12 ++++------ tests/Messaging/MessageDataAssertionTest.php | 7 +++--- tests/Messaging/NoOpMessageConverterTest.php | 4 ++-- tests/Messaging/QueryTest.php | 4 ++-- tests/Mock/ActionEventListenerMock.php | 4 ++-- tests/Mock/ActionListenerAggregateMock.php | 4 ++-- tests/Mock/AskSomething.php | 4 ++-- tests/Mock/DoSomething.php | 4 ++-- tests/Mock/InvalidMessage.php | 4 ++-- tests/Mock/SomethingWasDone.php | 4 ++-- 43 files changed, 147 insertions(+), 158 deletions(-) create mode 100644 .github/workflows/continuous-integration.yml create mode 100644 .laminas-ci.json create mode 100644 .php-cs-fixer.php delete mode 100644 .php_cs diff --git a/.coveralls.yml b/.coveralls.yml index 75aefc8..6379ad9 100644 --- a/.coveralls.yml +++ b/.coveralls.yml @@ -1,3 +1,3 @@ # for php-coveralls -service_name: travis-ci -coverage_clover: build/logs/clover.xml +coverage_clover: clover.xml +json_path: coveralls-upload.json diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..26c5802 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,11 @@ +name: "Continuous Integration" + +on: + pull_request: + push: + branches: + tags: + +jobs: + ci: + uses: laminas/workflow-continuous-integration/.github/workflows/continuous-integration.yml@1.x diff --git a/.gitignore b/.gitignore index 10e4e76..f454591 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ nbproject composer.lock .phpunit.result.cache -/build +.phpcs-cache diff --git a/.laminas-ci.json b/.laminas-ci.json new file mode 100644 index 0000000..ec82d30 --- /dev/null +++ b/.laminas-ci.json @@ -0,0 +1,5 @@ +{ + "additional_composer_arguments": [ + "--prefer-stable" + ] +} diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..d6d90a1 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,8 @@ +getFinder()->in(__DIR__); + +$config->setCacheFile(__DIR__ . '/.php_cs.cache'); + +return $config; diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 363296d..0000000 --- a/.php_cs +++ /dev/null @@ -1,10 +0,0 @@ -getFinder()->in(__DIR__); - -$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__; - -$config->setCacheFile($cacheDir . '/.php_cs.cache'); - -return $config; diff --git a/composer.json b/composer.json index 04a9cd0..722b8dc 100644 --- a/composer.json +++ b/composer.json @@ -21,18 +21,15 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": "^7.3.0 | ^8.0", - "ramsey/uuid" : "^3.6.0 || ^4.0", + "php": "^7.4 || ^8.0", + "ramsey/uuid": "4.2.1 || ^4.3", "beberlei/assert": "^2.7.1 || ^3.0" }, "require-dev": { - "phpunit/phpunit": "^9.0", - "prooph/php-cs-fixer-config": "^0.4", - "satooshi/php-coveralls": "^1.0", - "prooph/bookdown-template": "^0.2.3" - }, - "conflict": { - "php": "7.1.3" + "php-coveralls/php-coveralls": "^2.2", + "phpunit/phpunit": "^9.5.5", + "prooph/bookdown-template": "^0.2.3", + "prooph/php-cs-fixer-config": "^0.5" }, "autoload": { "psr-4": { @@ -43,5 +40,14 @@ "psr-4": { "ProophTest\\Common\\": "tests" } + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "cs-check": "php-cs-fixer fix -v --diff --dry-run", + "cs-fix": "php-cs-fixer fix -v --diff", + "test": "phpunit --colors=always" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index cdc5e15..d7438b6 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,21 +1,12 @@ - - - ./tests/ - - - + + - src + ./src + + + ./tests/ + diff --git a/src/Event/ActionEvent.php b/src/Event/ActionEvent.php index 062bdb1..061ed00 100644 --- a/src/Event/ActionEvent.php +++ b/src/Event/ActionEvent.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Event/ActionEventEmitter.php b/src/Event/ActionEventEmitter.php index 1a9d938..bde1277 100644 --- a/src/Event/ActionEventEmitter.php +++ b/src/Event/ActionEventEmitter.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Event/ActionEventListenerAggregate.php b/src/Event/ActionEventListenerAggregate.php index 8c46c8b..8c14ef7 100644 --- a/src/Event/ActionEventListenerAggregate.php +++ b/src/Event/ActionEventListenerAggregate.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Event/DefaultActionEvent.php b/src/Event/DefaultActionEvent.php index 4f55f6a..9d50c53 100644 --- a/src/Event/DefaultActionEvent.php +++ b/src/Event/DefaultActionEvent.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Event/DefaultListenerHandler.php b/src/Event/DefaultListenerHandler.php index a467362..540a4f7 100644 --- a/src/Event/DefaultListenerHandler.php +++ b/src/Event/DefaultListenerHandler.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Event/DetachAggregateHandlers.php b/src/Event/DetachAggregateHandlers.php index 751962d..3591e83 100644 --- a/src/Event/DetachAggregateHandlers.php +++ b/src/Event/DetachAggregateHandlers.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Event/ListenerHandler.php b/src/Event/ListenerHandler.php index d0625c7..97db08d 100644 --- a/src/Event/ListenerHandler.php +++ b/src/Event/ListenerHandler.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Event/ProophActionEventEmitter.php b/src/Event/ProophActionEventEmitter.php index fdaa0b0..bb5bb7d 100644 --- a/src/Event/ProophActionEventEmitter.php +++ b/src/Event/ProophActionEventEmitter.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Messaging/Command.php b/src/Messaging/Command.php index 33a4ff5..e2d8449 100644 --- a/src/Messaging/Command.php +++ b/src/Messaging/Command.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Messaging/DomainEvent.php b/src/Messaging/DomainEvent.php index 80a35a8..c5fc546 100644 --- a/src/Messaging/DomainEvent.php +++ b/src/Messaging/DomainEvent.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Messaging/DomainMessage.php b/src/Messaging/DomainMessage.php index c6a8bbc..1972f6b 100644 --- a/src/Messaging/DomainMessage.php +++ b/src/Messaging/DomainMessage.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -18,6 +18,7 @@ use DateTimeZone; use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; +use ReflectionClass; /** * Base class for commands, domain events and queries. All are messages but differ in their intention. @@ -50,12 +51,12 @@ public static function fromArray(array $messageData): DomainMessage { MessageDataAssertion::assert($messageData); - $messageRef = new \ReflectionClass(\get_called_class()); + $messageRef = new ReflectionClass(\get_called_class()); /** @var $message DomainMessage */ $message = $messageRef->newInstanceWithoutConstructor(); - $message->uuid = Uuid::fromString($messageData['uuid']); + $message->uuid = Uuid::fromString((string) $messageData['uuid']); $message->messageName = $messageData['message_name']; $message->metadata = $messageData['metadata']; $message->createdAt = $messageData['created_at']; diff --git a/src/Messaging/FQCNMessageFactory.php b/src/Messaging/FQCNMessageFactory.php index b51b0cd..46875fa 100644 --- a/src/Messaging/FQCNMessageFactory.php +++ b/src/Messaging/FQCNMessageFactory.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -38,7 +38,7 @@ public function createMessageFromArray(string $messageName, array $messageData): } if (! isset($messageData['uuid'])) { - $messageData['uuid'] = Uuid::uuid4()->toString(); + $messageData['uuid'] = Uuid::uuid4(); } if (! isset($messageData['created_at'])) { diff --git a/src/Messaging/HasMessageName.php b/src/Messaging/HasMessageName.php index d73ae61..48855d8 100644 --- a/src/Messaging/HasMessageName.php +++ b/src/Messaging/HasMessageName.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Messaging/Message.php b/src/Messaging/Message.php index 0955041..d1de45a 100644 --- a/src/Messaging/Message.php +++ b/src/Messaging/Message.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -19,7 +19,9 @@ interface Message extends HasMessageName { public const TYPE_COMMAND = 'command'; + public const TYPE_EVENT = 'event'; + public const TYPE_QUERY = 'query'; /** diff --git a/src/Messaging/MessageConverter.php b/src/Messaging/MessageConverter.php index 6e4cd0e..8d89736 100644 --- a/src/Messaging/MessageConverter.php +++ b/src/Messaging/MessageConverter.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Messaging/MessageDataAssertion.php b/src/Messaging/MessageDataAssertion.php index 89bb7c9..d9a7dc2 100644 --- a/src/Messaging/MessageDataAssertion.php +++ b/src/Messaging/MessageDataAssertion.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Messaging/MessageFactory.php b/src/Messaging/MessageFactory.php index 2b6f3ab..dd04da6 100644 --- a/src/Messaging/MessageFactory.php +++ b/src/Messaging/MessageFactory.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Messaging/NoOpMessageConverter.php b/src/Messaging/NoOpMessageConverter.php index 7ad00f7..aad8cf8 100644 --- a/src/Messaging/NoOpMessageConverter.php +++ b/src/Messaging/NoOpMessageConverter.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Messaging/PayloadConstructable.php b/src/Messaging/PayloadConstructable.php index 4ee235f..bcd10c1 100644 --- a/src/Messaging/PayloadConstructable.php +++ b/src/Messaging/PayloadConstructable.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Messaging/PayloadTrait.php b/src/Messaging/PayloadTrait.php index 74be753..498e7c6 100644 --- a/src/Messaging/PayloadTrait.php +++ b/src/Messaging/PayloadTrait.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Messaging/Query.php b/src/Messaging/Query.php index 6316afe..93a218a 100644 --- a/src/Messaging/Query.php +++ b/src/Messaging/Query.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Event/DefaultActionEventTest.php b/tests/Event/DefaultActionEventTest.php index bb963ce..47f3ca9 100644 --- a/tests/Event/DefaultActionEventTest.php +++ b/tests/Event/DefaultActionEventTest.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Event/ProophActionEventEmitterTest.php b/tests/Event/ProophActionEventEmitterTest.php index c929e71..e13b697 100644 --- a/tests/Event/ProophActionEventEmitterTest.php +++ b/tests/Event/ProophActionEventEmitterTest.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -22,10 +22,7 @@ class ProophActionEventEmitterTest extends TestCase { - /** - * @var ProophActionEventEmitter - */ - private $proophActionEventEmitter; + private ProophActionEventEmitter $proophActionEventEmitter; protected function setUp(): void { @@ -99,10 +96,8 @@ public function it_triggers_listeners_until_callback_returns_true(): void $this->proophActionEventEmitter->attachListener('test', $listener1); $this->proophActionEventEmitter->attachListener('test', $listener2); - $this->proophActionEventEmitter->dispatchUntil($actionEvent, function (ActionEvent $e) { - //We return true directly after first listener was triggered - return true; - }); + $this->proophActionEventEmitter->dispatchUntil($actionEvent, fn (ActionEvent $e) => //We return true directly after first listener was triggered +true); $this->assertNull($lastEvent); $this->assertSame($actionEvent, $listener1->lastEvent); @@ -256,13 +251,9 @@ public function it_returns_false_when_unattached_listener_handler_gets_detached( */ public function it_dispatches_until_whith_no_listeners_attached(): void { - $this->markTestIncomplete(); - $actionEventMock = $this->createMock(ActionEvent::class); - $this->proophActionEventEmitter->dispatchUntil($actionEventMock, function () { - return true; - }); + $this->proophActionEventEmitter->dispatchUntil($actionEventMock, fn () => true); } /** @@ -270,8 +261,6 @@ public function it_dispatches_until_whith_no_listeners_attached(): void */ public function it_attaches_to_known_event_names(): void { - $this->markTestIncomplete(); - $proophActionEventEmitter = new ProophActionEventEmitter(['foo']); $proophActionEventEmitter->attachListener('foo', function (): void { }); diff --git a/tests/Messaging/CommandTest.php b/tests/Messaging/CommandTest.php index d78f17c..53dae36 100644 --- a/tests/Messaging/CommandTest.php +++ b/tests/Messaging/CommandTest.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,6 +13,8 @@ namespace ProophTest\Common\Messaging; +use DateTimeImmutable; +use DateTimeZone; use PHPUnit\Framework\TestCase; use Prooph\Common\Messaging\Command; use Prooph\Common\Messaging\DomainMessage; @@ -22,25 +24,16 @@ class CommandTest extends TestCase { - /** - * @var Command - */ - private $command; + private Command $command; - /** - * @var \DateTimeImmutable - */ - private $createdAt; + private DateTimeImmutable $createdAt; - /** - * @var UuidInterface - */ - private $uuid; + private UuidInterface $uuid; protected function setUp(): void { $this->uuid = Uuid::uuid4(); - $this->createdAt = new \DateTimeImmutable('now', new \DateTimeZone('UTC')); + $this->createdAt = new DateTimeImmutable('now', new DateTimeZone('UTC')); $this->command = DoSomething::fromArray([ 'message_name' => 'TestCommand', diff --git a/tests/Messaging/DomainEventTest.php b/tests/Messaging/DomainEventTest.php index 49362e2..09b2910 100644 --- a/tests/Messaging/DomainEventTest.php +++ b/tests/Messaging/DomainEventTest.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,33 +13,27 @@ namespace ProophTest\Common\Messaging; +use DateTimeImmutable; +use DateTimeZone; use PHPUnit\Framework\TestCase; use Prooph\Common\Messaging\DomainEvent; use Prooph\Common\Messaging\DomainMessage; use ProophTest\Common\Mock\SomethingWasDone; use Ramsey\Uuid\Uuid; +use Ramsey\Uuid\UuidInterface; class DomainEventTest extends TestCase { - /** - * @var DomainEvent - */ - private $domainEvent; + private DomainEvent $domainEvent; - /** - * @var \DateTimeImmutable - */ - private $createdAt; + private DateTimeImmutable $createdAt; - /** - * @var Uuid - */ - private $uuid; + private UuidInterface $uuid; protected function setUp(): void { $this->uuid = Uuid::uuid4(); - $this->createdAt = new \DateTimeImmutable('now', new \DateTimeZone('UTC')); + $this->createdAt = new DateTimeImmutable('now', new DateTimeZone('UTC')); $this->domainEvent = SomethingWasDone::fromArray([ 'message_name' => 'TestDomainEvent', diff --git a/tests/Messaging/FQCNMessageFactoryTest.php b/tests/Messaging/FQCNMessageFactoryTest.php index 1075fc5..4f89229 100644 --- a/tests/Messaging/FQCNMessageFactoryTest.php +++ b/tests/Messaging/FQCNMessageFactoryTest.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,6 +13,7 @@ namespace ProophTest\Common\Messaging; +use DateTimeImmutable; use PHPUnit\Framework\TestCase; use Prooph\Common\Messaging\FQCNMessageFactory; use ProophTest\Common\Mock\DoSomething; @@ -21,10 +22,7 @@ class FQCNMessageFactoryTest extends TestCase { - /** - * @var FQCNMessageFactory - */ - private $messageFactory; + private FQCNMessageFactory $messageFactory; protected function setUp(): void { @@ -37,7 +35,7 @@ protected function setUp(): void public function it_creates_a_new_message_from_array_and_fqcn(): void { $uuid = Uuid::uuid4(); - $createdAt = new \DateTimeImmutable(); + $createdAt = new DateTimeImmutable(); $command = $this->messageFactory->createMessageFromArray(DoSomething::class, [ 'uuid' => $uuid->toString(), diff --git a/tests/Messaging/MessageDataAssertionTest.php b/tests/Messaging/MessageDataAssertionTest.php index 9f533c4..d4a1f80 100644 --- a/tests/Messaging/MessageDataAssertionTest.php +++ b/tests/Messaging/MessageDataAssertionTest.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,6 +13,7 @@ namespace ProophTest\Common\Messaging; +use InvalidArgumentException; use PHPUnit\Framework\TestCase; use Prooph\Common\Messaging\MessageDataAssertion; use Prooph\Common\Messaging\NoOpMessageConverter; @@ -43,7 +44,7 @@ public function it_asserts_message_data_returned_by_the_no_op_message_converter( */ public function it_throws_exception_if_message_data_is_invalid($messageData, $errorMessage) { - $this->expectException(\InvalidArgumentException::class); + $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage($errorMessage); MessageDataAssertion::assert($messageData); diff --git a/tests/Messaging/NoOpMessageConverterTest.php b/tests/Messaging/NoOpMessageConverterTest.php index cd6e833..9f5b424 100644 --- a/tests/Messaging/NoOpMessageConverterTest.php +++ b/tests/Messaging/NoOpMessageConverterTest.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Messaging/QueryTest.php b/tests/Messaging/QueryTest.php index 962a918..76e87e8 100644 --- a/tests/Messaging/QueryTest.php +++ b/tests/Messaging/QueryTest.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Mock/ActionEventListenerMock.php b/tests/Mock/ActionEventListenerMock.php index 103da74..9dc12cc 100644 --- a/tests/Mock/ActionEventListenerMock.php +++ b/tests/Mock/ActionEventListenerMock.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Mock/ActionListenerAggregateMock.php b/tests/Mock/ActionListenerAggregateMock.php index 9b0d653..e84c73d 100644 --- a/tests/Mock/ActionListenerAggregateMock.php +++ b/tests/Mock/ActionListenerAggregateMock.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Mock/AskSomething.php b/tests/Mock/AskSomething.php index 3f17254..18dc263 100644 --- a/tests/Mock/AskSomething.php +++ b/tests/Mock/AskSomething.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Mock/DoSomething.php b/tests/Mock/DoSomething.php index 3474bb7..5f3c82a 100644 --- a/tests/Mock/DoSomething.php +++ b/tests/Mock/DoSomething.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Mock/InvalidMessage.php b/tests/Mock/InvalidMessage.php index d80becf..cf853ad 100644 --- a/tests/Mock/InvalidMessage.php +++ b/tests/Mock/InvalidMessage.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Mock/SomethingWasDone.php b/tests/Mock/SomethingWasDone.php index acff0e6..69f6e62 100644 --- a/tests/Mock/SomethingWasDone.php +++ b/tests/Mock/SomethingWasDone.php @@ -2,8 +2,8 @@ /** * This file is part of prooph/common. - * (c) 2014-2021 Alexander Miertsch - * (c) 2015-2021 Sascha-Oliver Prolic + * (c) 2014-2022 Alexander Miertsch + * (c) 2015-2022 Sascha-Oliver Prolic * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code.