From 1f4f5b12eb687727a001030b238cb3bfed2a43e0 Mon Sep 17 00:00:00 2001 From: butschster Date: Mon, 30 May 2022 16:30:51 +0400 Subject: [PATCH] Adds support for Spiral Framework 3.0 --- composer.json | 23 +++++++++++++---------- src/Attribute/CommandHandler.php | 2 +- src/Attribute/QueryHandler.php | 2 +- src/CommandBus.php | 2 +- src/HandlersLocator.php | 6 +++--- src/QueryBus.php | 2 +- tests/app/Command/StoreUser.php | 6 +++--- tests/app/Command/UpdateUser.php | 4 ++-- tests/app/Handler/StoreUserHandler.php | 2 +- tests/app/Handler/UsersQueries.php | 2 +- tests/app/Query/FindUserById.php | 2 +- 11 files changed, 28 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index e139804..9afe02a 100644 --- a/composer.json +++ b/composer.json @@ -18,18 +18,18 @@ } ], "require": { - "php": "^8.0", - "spiral/boot": "^2.9", - "spiral/core": "^2.9", - "spiral/config": "^2.9", - "spiral/console": "^2.9", - "spiral/tokenizer": "^2.9", - "spiral/attributes": "^2.9", + "php": "^8.1", + "spiral/boot": "^3.0", + "spiral/core": "^3.0", + "spiral/config": "^3.0", + "spiral/console": "^3.0", + "spiral/tokenizer": "^3.0", + "spiral/attributes": "^3.0", "symfony/messenger": "^6.0" }, "require-dev": { - "spiral/framework": "^2.9", - "spiral/testing": "^1.0", + "spiral/framework": "^3.0", + "spiral/testing": "^2.0", "vimeo/psalm": "^4.9" }, "autoload": { @@ -48,7 +48,10 @@ "psalm": "vendor/bin/psalm --config=psalm.xml ./src" }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "spiral/composer-publish-plugin": true + } }, "extra": { "spiral": { diff --git a/src/Attribute/CommandHandler.php b/src/Attribute/CommandHandler.php index 977a3c3..2003ed5 100644 --- a/src/Attribute/CommandHandler.php +++ b/src/Attribute/CommandHandler.php @@ -7,6 +7,6 @@ use Attribute; #[Attribute(Attribute::TARGET_METHOD)] -class CommandHandler +final class CommandHandler { } diff --git a/src/Attribute/QueryHandler.php b/src/Attribute/QueryHandler.php index b8d22bd..db891e6 100644 --- a/src/Attribute/QueryHandler.php +++ b/src/Attribute/QueryHandler.php @@ -7,6 +7,6 @@ use Attribute; #[Attribute(Attribute::TARGET_METHOD)] -class QueryHandler +final class QueryHandler { } diff --git a/src/CommandBus.php b/src/CommandBus.php index 19bc059..da9f196 100644 --- a/src/CommandBus.php +++ b/src/CommandBus.php @@ -15,7 +15,7 @@ final class CommandBus implements CommandBusInterface use MessageBusExceptionTrait; public function __construct( - private MessageBusInterface $bus + private readonly MessageBusInterface $bus ) { } diff --git a/src/HandlersLocator.php b/src/HandlersLocator.php index 1eb7268..5786d2e 100644 --- a/src/HandlersLocator.php +++ b/src/HandlersLocator.php @@ -27,9 +27,9 @@ final class HandlersLocator implements HandlersLocatorInterface private bool $precessed = false; public function __construct( - private Container $container, - private ClassesInterface $classes, - private ReaderInterface $reader, + private readonly Container $container, + private readonly ClassesInterface $classes, + private readonly ReaderInterface $reader, ) { } diff --git a/src/QueryBus.php b/src/QueryBus.php index 9ad9455..4a1e9a0 100644 --- a/src/QueryBus.php +++ b/src/QueryBus.php @@ -15,7 +15,7 @@ final class QueryBus implements QueryBusInterface use MessageBusExceptionTrait; public function __construct( - private MessageBusInterface $bus + private readonly MessageBusInterface $bus ) { } diff --git a/tests/app/Command/StoreUser.php b/tests/app/Command/StoreUser.php index 68436d1..8cf8458 100644 --- a/tests/app/Command/StoreUser.php +++ b/tests/app/Command/StoreUser.php @@ -9,9 +9,9 @@ final class StoreUser implements CommandInterface { public function __construct( - public string $uuid, - public string $username, - public string $password + public readonly string $uuid, + public readonly string $username, + public readonly string $password ) { } } diff --git a/tests/app/Command/UpdateUser.php b/tests/app/Command/UpdateUser.php index bb9b4ea..385ed2e 100644 --- a/tests/app/Command/UpdateUser.php +++ b/tests/app/Command/UpdateUser.php @@ -9,8 +9,8 @@ class UpdateUser implements CommandInterface { public function __construct( - public string $username, - public string $password + public readonly string $username, + public readonly string $password ) { } } diff --git a/tests/app/Handler/StoreUserHandler.php b/tests/app/Handler/StoreUserHandler.php index 0c1adb1..adb04da 100644 --- a/tests/app/Handler/StoreUserHandler.php +++ b/tests/app/Handler/StoreUserHandler.php @@ -11,7 +11,7 @@ final class StoreUserHandler { public function __construct( - private EntityManagerInterface $entityManager + private readonly EntityManagerInterface $entityManager ) { } diff --git a/tests/app/Handler/UsersQueries.php b/tests/app/Handler/UsersQueries.php index 338b4a3..b69974e 100644 --- a/tests/app/Handler/UsersQueries.php +++ b/tests/app/Handler/UsersQueries.php @@ -10,7 +10,7 @@ final class UsersQueries { public function __construct( - private UserRepositoryInterface $users + private readonly UserRepositoryInterface $users ) { } diff --git a/tests/app/Query/FindUserById.php b/tests/app/Query/FindUserById.php index 0d1d1fa..c85dd56 100644 --- a/tests/app/Query/FindUserById.php +++ b/tests/app/Query/FindUserById.php @@ -9,7 +9,7 @@ final class FindUserById implements QueryInterface { public function __construct( - public int $id + public readonly int $id ) { } }