From f39ea23bb099773bfec89204a61a0dadb679658c Mon Sep 17 00:00:00 2001 From: Zoilo Mora Date: Tue, 28 Jul 2020 14:14:29 +0200 Subject: [PATCH] feat: Update of dependencies and Code standard --- composer.json | 42 ++++++++++++------------- docker-compose.yml | 1 + phpcs.xml.dist | 2 +- src/StatusChangeNotAllowedException.php | 10 ++---- src/StatusMachine.php | 11 ++++--- 5 files changed, 32 insertions(+), 34 deletions(-) diff --git a/composer.json b/composer.json index 1455113..e37c378 100644 --- a/composer.json +++ b/composer.json @@ -1,24 +1,24 @@ { - "name": "pccomponentes/simple-state-machine", - "description": "Simple State Machine", - "license": "MIT", - "type": "library", - "authors": [ - { - "name": "Zoilo Mora", - "email": "zoilo.mora@pccomponentes.com" + "name": "pccomponentes/simple-state-machine", + "description": "Simple State Machine", + "license": "MIT", + "type": "library", + "authors": [ + { + "name": "Zoilo Mora", + "email": "zoilo.mora@pccomponentes.com" + } + ], + "autoload": { + "psr-4": { + "PcComponentes\\SimpleStateMachine\\": "src/" + } + }, + "require": { + "php": "^7.4", + "pccomponentes/ddd": "^2.0" + }, + "require-dev": { + "pccomponentes/coding-standard": "^1.1" } - ], - "autoload": { - "psr-4": { - "PcComponentes\\SimpleStateMachine\\": "src/" - } - }, - "require": { - "php": "^7.4", - "pccomponentes/ddd": "^1.2" - }, - "require-dev": { - "pccomponentes/coding-standard": "^1.0" - } } diff --git a/docker-compose.yml b/docker-compose.yml index 091e801..994fa68 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,3 +4,4 @@ services: build: . volumes: - .:/var/app + - ~/.composer:/.composer diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 36aac30..91c02f8 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,5 +1,5 @@ src - + diff --git a/src/StatusChangeNotAllowedException.php b/src/StatusChangeNotAllowedException.php index 52fe365..8d79613 100644 --- a/src/StatusChangeNotAllowedException.php +++ b/src/StatusChangeNotAllowedException.php @@ -3,14 +3,10 @@ namespace PcComponentes\SimpleStateMachine; -use Pccomponentes\Ddd\Domain\Model\ValueObject\StringValueObject; -use Pccomponentes\Ddd\Domain\Model\ValueObject\Uuid; +use PcComponentes\Ddd\Domain\Model\ValueObject\StringValueObject; +use PcComponentes\Ddd\Domain\Model\ValueObject\Uuid; interface StatusChangeNotAllowedException { - public static function from( - Uuid $id, - StringValueObject $currentStatus, - StringValueObject $newStatus - ): self; + public static function from(Uuid $id, StringValueObject $currentStatus, StringValueObject $newStatus): self; } diff --git a/src/StatusMachine.php b/src/StatusMachine.php index 4d55bf1..163e086 100644 --- a/src/StatusMachine.php +++ b/src/StatusMachine.php @@ -3,8 +3,8 @@ namespace PcComponentes\SimpleStateMachine; -use Pccomponentes\Ddd\Domain\Model\ValueObject\StringValueObject; -use Pccomponentes\Ddd\Domain\Model\ValueObject\Uuid; +use PcComponentes\Ddd\Domain\Model\ValueObject\StringValueObject; +use PcComponentes\Ddd\Domain\Model\ValueObject\Uuid; trait StatusMachine { @@ -32,7 +32,8 @@ private function canChangeStatus(StringValueObject $status): bool { return \in_array( $status->value(), - $this->currentAllowedStatusChanges() + $this->currentAllowedStatusChanges(), + true, ); } @@ -52,8 +53,8 @@ private function assertValidClassException(string $class): void \sprintf( 'The %s class does not implement the %s interface', $class, - StatusChangeNotAllowedException::class - ) + StatusChangeNotAllowedException::class, + ), ); } }