From c2e9e6138af7d852cb6eb555b71102aba8280719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Guti=C3=A9rrez?= Date: Wed, 2 Oct 2019 00:20:03 +0200 Subject: [PATCH] update dependencies --- .scrutinizer.yml | 24 +++++++++++++------ .travis.yml | 20 +++++++++------- composer.json | 18 +++++++------- phpstan.neon | 8 ------- src/CommandInflector.php | 5 +++- src/QueryInflector.php | 5 +++- tests/Tactician/CommandBusTest.php | 2 +- .../CommandHandlerMiddlewareTest.php | 4 ++-- tests/Tactician/CommandInflectorTest.php | 20 +++++++++------- tests/Tactician/QueryBusTest.php | 18 +++++++------- .../Tactician/QueryHandlerMiddlewareTest.php | 4 ++-- tests/Tactician/QueryInflectorTest.php | 18 +++++++------- 12 files changed, 80 insertions(+), 66 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 9a9bb96..328415c 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,13 +1,24 @@ # language: php +build: + dependencies: + before: + - 'composer self-update' + - 'composer update --prefer-stable --prefer-source --no-interaction --no-progress --no-suggest' + cache: + directories: + - vendor/ + nodes: + analysis: + project_setup: + override: true + tests: + override: [php-scrutinizer-run] + filter: paths: [src/*] excluded_paths: [tests/*, vendor/*] -before_commands: - - 'composer self-update' - - 'composer update --prefer-stable --prefer-source --no-interaction --no-scripts --no-progress --no-suggest' - coding_style: php: upper_lower_casing: @@ -17,8 +28,8 @@ coding_style: true_false_null: lower spaces: around_operators: - concatenation: true - negation: false + concatenation: true + negation: false other: after_type_cast: true @@ -34,7 +45,6 @@ tools: enabled: true config: ruleset: 'unusedcode,naming,design,controversial,codesize' - php_cpd: true php_loc: true php_pdepend: true diff --git a/.travis.yml b/.travis.yml index edd3ab5..b834abe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,9 @@ env: - COMPOSER_FLAGS="--prefer-stable --prefer-dist" php: + - 7.2 - 7.3 + - 7.4snapshot - nightly matrix: @@ -22,7 +24,7 @@ matrix: - php: 7.1 env: - COMPOSER_FLAGS="--prefer-lowest --prefer-stable --prefer-dist" - - php: 7.2 + - php: 7.1 env: - TEST_VERSION=true - COMPOSER_FLAGS="--prefer-stable --prefer-dist" @@ -30,17 +32,17 @@ matrix: - php: nightly before_install: - - if [[ -z $TEST_VERSION && -f "/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini" ]]; then phpenv config-rm xdebug.ini; fi - - composer global require hirak/prestissimo - - composer self-update --stable --no-progress + - if [[ -z $TEST_VERSION && -f "/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini" ]]; then phpenv config-rm xdebug.ini; fi + - composer global require hirak/prestissimo + - composer self-update --stable --no-progress install: - - travis_retry composer update $COMPOSER_FLAGS --no-interaction --no-scripts --no-progress - - if [[ $TEST_VERSION ]]; then travis_retry composer require php-coveralls/php-coveralls $COMPOSER_FLAGS --no-interaction --no-scripts --no-progress ; fi + - travis_retry composer update $COMPOSER_FLAGS --no-interaction --no-progress + - if [[ $TEST_VERSION ]]; then travis_retry composer require php-coveralls/php-coveralls $COMPOSER_FLAGS --no-interaction --no-scripts --no-progress ; fi script: - - if [[ $TEST_VERSION ]]; then composer qa && composer report-phpunit-clover ; fi - - if [[ -z $TEST_VERSION ]]; then composer test-phpunit ; fi + - if [[ $TEST_VERSION ]]; then composer qa && composer report-phpunit-clover ; fi + - if [[ -z $TEST_VERSION ]]; then composer test-phpunit ; fi after_script: - - if [[ $TEST_VERSION ]]; then travis_retry php vendor/bin/php-coveralls --verbose ; fi + - if [[ $TEST_VERSION ]]; then travis_retry php vendor/bin/php-coveralls --verbose ; fi diff --git a/composer.json b/composer.json index 1755ee0..bb35758 100644 --- a/composer.json +++ b/composer.json @@ -27,22 +27,22 @@ "require": { "php": "^7.1", "league/tactician": "^1.0", - "phpgears/cqrs": "~0.2" + "phpgears/cqrs": "~0.3" }, "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.11", - "phpstan/phpstan-deprecation-rules": "^0.11", - "phpstan/phpstan-strict-rules": "^0.11", - "phpunit/phpunit": "^6.0|^7.0", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "~0.11.12", + "phpstan/phpstan-deprecation-rules": "~0.11.2", + "phpstan/phpstan-strict-rules": "~0.11.1", + "phpunit/phpunit": "^7.0|^8.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.11" + "sebastian/phpcpd": "^4.0", + "squizlabs/php_codesniffer": "^3.0", + "thecodingmachine/phpstan-strict-rules": "~0.11.2" }, "suggest": { }, diff --git a/phpstan.neon b/phpstan.neon index e858de2..a1c637a 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,12 +1,4 @@ -includes: - - vendor/phpstan/phpstan-strict-rules/rules.neon - - vendor/phpstan/phpstan-deprecation-rules/rules.neon - - vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon - parameters: level: max paths: - src - ignoreErrors: - - '/^Method Gears\\CQRS\\Tactician\\QueryInflector::inflect\(\) has parameter \$handler with no typehint specified\.$/' - - '/^Method Gears\\CQRS\\Tactician\\CommandInflector::inflect\(\) has parameter \$handler with no typehint specified\.$/' diff --git a/src/CommandInflector.php b/src/CommandInflector.php index a8c0aea..62b0482 100644 --- a/src/CommandInflector.php +++ b/src/CommandInflector.php @@ -22,7 +22,10 @@ final class CommandInflector implements MethodNameInflector { /** - * {@inheritdoc} + * Return the method name to call on the command handler and return it. + * + * @param mixed $command + * @param mixed $handler * * @throws InvalidCommandException * @throws InvalidCommandHandlerException diff --git a/src/QueryInflector.php b/src/QueryInflector.php index 98df310..7d5493a 100644 --- a/src/QueryInflector.php +++ b/src/QueryInflector.php @@ -22,7 +22,10 @@ final class QueryInflector implements MethodNameInflector { /** - * {@inheritdoc} + * Return the method name to call on the command handler and return it. + * + * @param mixed $command + * @param mixed $handler * * @throws InvalidQueryException * @throws InvalidQueryHandlerException diff --git a/tests/Tactician/CommandBusTest.php b/tests/Tactician/CommandBusTest.php index f4d4fa8..5430b3f 100644 --- a/tests/Tactician/CommandBusTest.php +++ b/tests/Tactician/CommandBusTest.php @@ -28,7 +28,7 @@ public function testHandling(): void $tacticianMock = $this->getMockBuilder(TacticianBus::class) ->disableOriginalConstructor() ->getMock(); - $tacticianMock->expects($this->once()) + $tacticianMock->expects(static::once()) ->method('handle'); /* @var TacticianBus $tacticianMock */ diff --git a/tests/Tactician/CommandHandlerMiddlewareTest.php b/tests/Tactician/CommandHandlerMiddlewareTest.php index 4e0cec9..53231e9 100644 --- a/tests/Tactician/CommandHandlerMiddlewareTest.php +++ b/tests/Tactician/CommandHandlerMiddlewareTest.php @@ -26,9 +26,9 @@ public function testHandling(): void $locatorMock = $this->getMockBuilder(HandlerLocator::class) ->disableOriginalConstructor() ->getMock(); - $locatorMock->expects($this->once()) + $locatorMock->expects(static::once()) ->method('getHandlerForCommand') - ->will($this->returnValue(new CommandHandlerStub())); + ->will(static::returnValue(new CommandHandlerStub())); /* @var HandlerLocator $locatorMock */ (new CommandHandlerMiddleware($locatorMock))->execute(CommandStub::instance(), 'strlen'); diff --git a/tests/Tactician/CommandInflectorTest.php b/tests/Tactician/CommandInflectorTest.php index 11eb2b7..681715b 100644 --- a/tests/Tactician/CommandInflectorTest.php +++ b/tests/Tactician/CommandInflectorTest.php @@ -13,6 +13,8 @@ namespace Gears\CQRS\Tactician\Tests; +use Gears\CQRS\Exception\InvalidCommandException; +use Gears\CQRS\Exception\InvalidCommandHandlerException; use Gears\CQRS\Tactician\CommandInflector; use Gears\CQRS\Tactician\Tests\Stub\CommandHandlerStub; use Gears\CQRS\Tactician\Tests\Stub\CommandStub; @@ -23,21 +25,21 @@ */ class CommandInflectorTest extends TestCase { - /** - * @expectedException \Gears\CQRS\Exception\InvalidCommandException - * @expectedExceptionMessage Command must implement Gears\CQRS\Command interface, string given - */ public function testInvalidCommand(): void { + $this->expectException(InvalidCommandException::class); + $this->expectExceptionMessage('Command must implement Gears\CQRS\Command interface, string given'); + (new CommandInflector())->inflect('', ''); } - /** - * @expectedException \Gears\CQRS\Exception\InvalidCommandHandlerException - * @expectedExceptionMessage Command handler must implement Gears\CQRS\CommandHandler interface, string given - */ public function testInvalidCommandHandler(): void { + $this->expectException(InvalidCommandHandlerException::class); + $this->expectExceptionMessage( + 'Command handler must implement Gears\CQRS\CommandHandler interface, string given' + ); + (new CommandInflector())->inflect(CommandStub::instance(), ''); } @@ -46,6 +48,6 @@ public function testInflect(): void $inflected = (new CommandInflector()) ->inflect(CommandStub::instance(), new CommandHandlerStub()); - $this->assertSame('handle', $inflected); + static::assertSame('handle', $inflected); } } diff --git a/tests/Tactician/QueryBusTest.php b/tests/Tactician/QueryBusTest.php index 6c0debb..63c1427 100644 --- a/tests/Tactician/QueryBusTest.php +++ b/tests/Tactician/QueryBusTest.php @@ -13,6 +13,7 @@ namespace Gears\CQRS\Tactician\Tests; +use Gears\CQRS\Exception\QueryReturnException; use Gears\CQRS\Tactician\QueryBus; use Gears\CQRS\Tactician\Tests\Stub\DTOStub; use Gears\CQRS\Tactician\Tests\Stub\QueryStub; @@ -29,26 +30,27 @@ public function testHandling(): void $tacticianMock = $this->getMockBuilder(TacticianBus::class) ->disableOriginalConstructor() ->getMock(); - $tacticianMock->expects($this->once()) + $tacticianMock->expects(static::once()) ->method('handle') - ->will($this->returnValue(DTOStub::instance())); + ->will(static::returnValue(DTOStub::instance())); /* @var TacticianBus $tacticianMock */ (new QueryBus($tacticianMock))->handle(QueryStub::instance()); } - /** - * @expectedException \Gears\CQRS\Exception\QueryReturnException - * @expectedExceptionMessageRegExp /^Query handler for .+\\QueryStub should return an instance of Gears\\DTO\\DTO$/ - */ public function testInvalidReturn(): void { + $this->expectException(QueryReturnException::class); + $this->expectExceptionMessageRegExp( + '/^Query handler for .+\\\QueryStub should return an instance of Gears\\\DTO\\\DTO$/' + ); + $tacticianMock = $this->getMockBuilder(TacticianBus::class) ->disableOriginalConstructor() ->getMock(); - $tacticianMock->expects($this->once()) + $tacticianMock->expects(static::once()) ->method('handle') - ->will($this->returnValue(false)); + ->will(static::returnValue(false)); /* @var TacticianBus $tacticianMock */ (new QueryBus($tacticianMock))->handle(QueryStub::instance()); diff --git a/tests/Tactician/QueryHandlerMiddlewareTest.php b/tests/Tactician/QueryHandlerMiddlewareTest.php index c78e392..5ab2a5f 100644 --- a/tests/Tactician/QueryHandlerMiddlewareTest.php +++ b/tests/Tactician/QueryHandlerMiddlewareTest.php @@ -26,9 +26,9 @@ public function testHandling(): void $locatorMock = $this->getMockBuilder(HandlerLocator::class) ->disableOriginalConstructor() ->getMock(); - $locatorMock->expects($this->once()) + $locatorMock->expects(static::once()) ->method('getHandlerForCommand') - ->will($this->returnValue(new QueryHandlerStub())); + ->will(static::returnValue(new QueryHandlerStub())); /* @var HandlerLocator $locatorMock */ (new QueryHandlerMiddleware($locatorMock))->execute(QueryStub::instance(), 'strlen'); diff --git a/tests/Tactician/QueryInflectorTest.php b/tests/Tactician/QueryInflectorTest.php index 407b3b4..8f1bca3 100644 --- a/tests/Tactician/QueryInflectorTest.php +++ b/tests/Tactician/QueryInflectorTest.php @@ -13,6 +13,8 @@ namespace Gears\CQRS\Tactician\Tests; +use Gears\CQRS\Exception\InvalidQueryException; +use Gears\CQRS\Exception\InvalidQueryHandlerException; use Gears\CQRS\Tactician\QueryInflector; use Gears\CQRS\Tactician\Tests\Stub\QueryHandlerStub; use Gears\CQRS\Tactician\Tests\Stub\QueryStub; @@ -23,21 +25,19 @@ */ class QueryInflectorTest extends TestCase { - /** - * @expectedException \Gears\CQRS\Exception\InvalidQueryException - * @expectedExceptionMessage Query must implement Gears\CQRS\Query interface, string given - */ public function testInvalidCommand(): void { + $this->expectException(InvalidQueryException::class); + $this->expectExceptionMessage('Query must implement Gears\CQRS\Query interface, string given'); + (new QueryInflector())->inflect('', ''); } - /** - * @expectedException \Gears\CQRS\Exception\InvalidQueryHandlerException - * @expectedExceptionMessage Query handler must implement Gears\CQRS\QueryHandler interface, string given - */ public function testInvalidCommandHandler(): void { + $this->expectException(InvalidQueryHandlerException::class); + $this->expectExceptionMessage('Query handler must implement Gears\CQRS\QueryHandler interface, string given'); + (new QueryInflector())->inflect(QueryStub::instance(), ''); } @@ -46,6 +46,6 @@ public function testInflect(): void $inflected = (new QueryInflector()) ->inflect(QueryStub::instance(), new QueryHandlerStub()); - $this->assertSame('handle', $inflected); + static::assertSame('handle', $inflected); } }