diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4ec61c6..3b83e55 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,8 +11,7 @@ jobs: strategy: matrix: php-version: - - 7.4 - - 8.0 + - 8.1 steps: - name: Checkout source code @@ -48,7 +47,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.xml flags: unittests - fail_ci_if_error: true + fail_ci_if_error: false - name: Static Code analysys - run: composer analyse \ No newline at end of file + run: composer analyse diff --git a/composer.json b/composer.json index 74b0caf..07ac9c2 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "othercode/complex-heart", + "name": "premiervirtual/complex-heart", "description": "Domain driven design tools.", "type": "library", "license": "MIT", @@ -11,20 +11,20 @@ ], "minimum-stability": "stable", "require": { - "php": "^7.4|^8.0", + "php": "^8.1", "ext-json": "*", - "ramsey/uuid": "^4.1", - "nesbot/carbon": "^2.40", - "illuminate/collections": "^8.20", - "spatie/data-transfer-object": "^2.6", + "ramsey/uuid": "^4.7", + "nesbot/carbon": "^2.71", "lambdish/phunctional": "^2.1", - "doctrine/instantiator": "^1.4" + "doctrine/instantiator": "^2.0", + "laravel/framework": "^10.33", + "spatie/laravel-data": "^4.5" }, "require-dev": { - "mockery/mockery": "^1.4", - "phpunit/phpunit": "^9.3", - "fakerphp/faker": "^1.9.1", - "phpstan/phpstan": "^0.12.64" + "mockery/mockery": "^1.6", + "phpunit/phpunit": "^10.0", + "fakerphp/faker": "^v1.23", + "phpstan/phpstan": "^1.10" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml index 8c1a9e1..8d35df2 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,21 +1,19 @@ - - - - ./src - - - - - - - - ./tests - - - + + + + + + + + + ./tests + + + + + + ./src + + diff --git a/src/Application/DTO/DTO.php b/src/Application/DTO/DTO.php index f2aede4..5a3cfd8 100644 --- a/src/Application/DTO/DTO.php +++ b/src/Application/DTO/DTO.php @@ -4,7 +4,8 @@ namespace OtherCode\ComplexHeart\Application\DTO; -use Spatie\DataTransferObject\DataTransferObject; + +use Spatie\LaravelData\Data; /** * Class DTO @@ -16,7 +17,7 @@ * @author Unay Santisteban * @package OtherCode\ComplexHeart\Application\DTO */ -abstract class DTO extends DataTransferObject +abstract class DTO extends Data { -} \ No newline at end of file +} diff --git a/src/Domain/Traits/HasInvariants.php b/src/Domain/Traits/HasInvariants.php index 88dba1a..ce66569 100644 --- a/src/Domain/Traits/HasInvariants.php +++ b/src/Domain/Traits/HasInvariants.php @@ -46,7 +46,7 @@ trait HasInvariants */ final public static function invariants(): array { - if (empty(static::$_invariantsCache[static::class])) { + if (array_key_exists(static::class, static::$_invariantsCache) === false) { $invariants = []; foreach (get_class_methods(static::class) as $invariant) { @@ -91,6 +91,10 @@ final public static function invariants(): array */ private function check(callable $filter = null, callable $onFail = null): void { + if ($this->skipChecking()) { + return; + } + $violations = []; $invariants = filter( @@ -132,4 +136,10 @@ private function check(callable $filter = null, callable $onFail = null): void $onFail($violations); } } + + private function skipChecking(): bool + { + $key = 'COMPLEX_HEARTH_SKIP_INVARIANTS_CHECKING'; + return (bool)($_ENV[$key] ?? getenv($key)); + } } diff --git a/src/Domain/ValueObjects/ArrayValue.php b/src/Domain/ValueObjects/ArrayValue.php index 535fbed..6281b71 100644 --- a/src/Domain/ValueObjects/ArrayValue.php +++ b/src/Domain/ValueObjects/ArrayValue.php @@ -149,6 +149,7 @@ public function offsetExists($offset): bool * @param mixed $offset * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->offsetExists($offset)