From a59e611ac18f83b8693e20b3f56b2ea9eb43cdf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Guti=C3=A9rrez?= Date: Sun, 3 Feb 2019 23:02:09 +0100 Subject: [PATCH] use common exceptions --- .travis.yml | 4 ++-- composer.json | 10 +++++----- src/CommandInflector.php | 2 +- .../InvalidCommandHandlerException.php | 18 ------------------ src/Exception/InvalidQueryHandlerException.php | 18 ------------------ src/Exception/QueryReturnException.php | 18 ------------------ src/QueryBus.php | 2 +- src/QueryInflector.php | 2 +- tests/Tactician/CommandInflectorTest.php | 2 +- tests/Tactician/QueryBusTest.php | 2 +- tests/Tactician/QueryInflectorTest.php | 2 +- 11 files changed, 13 insertions(+), 67 deletions(-) delete mode 100644 src/Exception/InvalidCommandHandlerException.php delete mode 100644 src/Exception/InvalidQueryHandlerException.php delete mode 100644 src/Exception/QueryReturnException.php diff --git a/.travis.yml b/.travis.yml index 10268ce..edd3ab5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ env: - COMPOSER_FLAGS="--prefer-stable --prefer-dist" php: - - 7.2 + - 7.3 - nightly matrix: @@ -22,7 +22,7 @@ matrix: - php: 7.1 env: - COMPOSER_FLAGS="--prefer-lowest --prefer-stable --prefer-dist" - - php: 7.1 + - php: 7.2 env: - TEST_VERSION=true - COMPOSER_FLAGS="--prefer-stable --prefer-dist" diff --git a/composer.json b/composer.json index d221d4b..1755ee0 100644 --- a/composer.json +++ b/composer.json @@ -27,22 +27,22 @@ "require": { "php": "^7.1", "league/tactician": "^1.0", - "phpgears/cqrs": "~0.1" + "phpgears/cqrs": "~0.2" }, "require-dev": { "brainmaestro/composer-git-hooks": "^2.1", "friendsofphp/php-cs-fixer": "^2.0", "infection/infection": "^0.9", "phpmd/phpmd": "^2.0", - "phpstan/phpstan": "^0.10", - "phpstan/phpstan-deprecation-rules": "^0.10", - "phpstan/phpstan-strict-rules": "^0.10", + "phpstan/phpstan": "^0.11", + "phpstan/phpstan-deprecation-rules": "^0.11", + "phpstan/phpstan-strict-rules": "^0.11", "phpunit/phpunit": "^6.0|^7.0", "povils/phpmnd": "^2.0", "roave/security-advisories": "dev-master", "sebastian/phpcpd": "^3.0|^4.0", "squizlabs/php_codesniffer": "^2.0", - "thecodingmachine/phpstan-strict-rules": "^0.10.1" + "thecodingmachine/phpstan-strict-rules": "^0.11" }, "suggest": { }, diff --git a/src/CommandInflector.php b/src/CommandInflector.php index 54473b7..a8c0aea 100644 --- a/src/CommandInflector.php +++ b/src/CommandInflector.php @@ -16,7 +16,7 @@ use Gears\CQRS\Command; use Gears\CQRS\CommandHandler; use Gears\CQRS\Exception\InvalidCommandException; -use Gears\CQRS\Tactician\Exception\InvalidCommandHandlerException; +use Gears\CQRS\Exception\InvalidCommandHandlerException; use League\Tactician\Handler\MethodNameInflector\MethodNameInflector; final class CommandInflector implements MethodNameInflector diff --git a/src/Exception/InvalidCommandHandlerException.php b/src/Exception/InvalidCommandHandlerException.php deleted file mode 100644 index cf1d864..0000000 --- a/src/Exception/InvalidCommandHandlerException.php +++ /dev/null @@ -1,18 +0,0 @@ - - */ - -declare(strict_types=1); - -namespace Gears\CQRS\Tactician\Exception; - -class InvalidCommandHandlerException extends \RuntimeException -{ -} diff --git a/src/Exception/InvalidQueryHandlerException.php b/src/Exception/InvalidQueryHandlerException.php deleted file mode 100644 index a64d0c9..0000000 --- a/src/Exception/InvalidQueryHandlerException.php +++ /dev/null @@ -1,18 +0,0 @@ - - */ - -declare(strict_types=1); - -namespace Gears\CQRS\Tactician\Exception; - -class InvalidQueryHandlerException extends \RuntimeException -{ -} diff --git a/src/Exception/QueryReturnException.php b/src/Exception/QueryReturnException.php deleted file mode 100644 index e31e805..0000000 --- a/src/Exception/QueryReturnException.php +++ /dev/null @@ -1,18 +0,0 @@ - - */ - -declare(strict_types=1); - -namespace Gears\CQRS\Tactician\Exception; - -class QueryReturnException extends \RuntimeException -{ -} diff --git a/src/QueryBus.php b/src/QueryBus.php index 85fb1c2..a58dbe5 100644 --- a/src/QueryBus.php +++ b/src/QueryBus.php @@ -13,9 +13,9 @@ namespace Gears\CQRS\Tactician; +use Gears\CQRS\Exception\QueryReturnException; use Gears\CQRS\Query; use Gears\CQRS\QueryBus as QueryBusInterface; -use Gears\CQRS\Tactician\Exception\QueryReturnException; use Gears\DTO\DTO; use League\Tactician\CommandBus as TacticianCommandBus; diff --git a/src/QueryInflector.php b/src/QueryInflector.php index 9b941b6..98df310 100644 --- a/src/QueryInflector.php +++ b/src/QueryInflector.php @@ -14,9 +14,9 @@ namespace Gears\CQRS\Tactician; use Gears\CQRS\Exception\InvalidQueryException; +use Gears\CQRS\Exception\InvalidQueryHandlerException; use Gears\CQRS\Query; use Gears\CQRS\QueryHandler; -use Gears\CQRS\Tactician\Exception\InvalidQueryHandlerException; use League\Tactician\Handler\MethodNameInflector\MethodNameInflector; final class QueryInflector implements MethodNameInflector diff --git a/tests/Tactician/CommandInflectorTest.php b/tests/Tactician/CommandInflectorTest.php index b2c2e49..11eb2b7 100644 --- a/tests/Tactician/CommandInflectorTest.php +++ b/tests/Tactician/CommandInflectorTest.php @@ -33,7 +33,7 @@ public function testInvalidCommand(): void } /** - * @expectedException \Gears\CQRS\Tactician\Exception\InvalidCommandHandlerException + * @expectedException \Gears\CQRS\Exception\InvalidCommandHandlerException * @expectedExceptionMessage Command handler must implement Gears\CQRS\CommandHandler interface, string given */ public function testInvalidCommandHandler(): void diff --git a/tests/Tactician/QueryBusTest.php b/tests/Tactician/QueryBusTest.php index e0ae0e6..6c0debb 100644 --- a/tests/Tactician/QueryBusTest.php +++ b/tests/Tactician/QueryBusTest.php @@ -38,7 +38,7 @@ public function testHandling(): void } /** - * @expectedException \Gears\CQRS\Tactician\Exception\QueryReturnException + * @expectedException \Gears\CQRS\Exception\QueryReturnException * @expectedExceptionMessageRegExp /^Query handler for .+\\QueryStub should return an instance of Gears\\DTO\\DTO$/ */ public function testInvalidReturn(): void diff --git a/tests/Tactician/QueryInflectorTest.php b/tests/Tactician/QueryInflectorTest.php index 4c52406..407b3b4 100644 --- a/tests/Tactician/QueryInflectorTest.php +++ b/tests/Tactician/QueryInflectorTest.php @@ -33,7 +33,7 @@ public function testInvalidCommand(): void } /** - * @expectedException \Gears\CQRS\Tactician\Exception\InvalidQueryHandlerException + * @expectedException \Gears\CQRS\Exception\InvalidQueryHandlerException * @expectedExceptionMessage Query handler must implement Gears\CQRS\QueryHandler interface, string given */ public function testInvalidCommandHandler(): void