diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4d3d674..f917327 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: true matrix: - php: [ 8.2, 8.3, 8.4, 8.5 ] + php: [ 8.4, 8.5 ] steps: - name: Checkout Code diff --git a/CHANGELOG.md b/CHANGELOG.md index a8cb0c5..195fc8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. This projec ### Removed +- Dropped support for PHP 8.2 and 8.3. The minimum supported version is now PHP 8.4. - Removed the deprecated `contains()` method from the `ListOfErrors` interface. Use `any()` instead. - The `first()` method on the `ListOfErrors` interface no longer accepts arguments. Use `find()` instead. diff --git a/composer.json b/composer.json index fab87ed..0616b68 100644 --- a/composer.json +++ b/composer.json @@ -17,16 +17,15 @@ }, { "name": "Christopher Gammie", - "email": "contact@gammie.co.uk" + "email": "chris@cloudcreativity.co.uk" } ], "require": { - "php": "^8.2", + "php": "^8.4", "ext-json": "*", "psr/container": "^2.0", "psr/log": "^2.0 || ^3.0", "ramsey/uuid": "^4.7", - "symfony/polyfill-php84": "^1.33", "symfony/polyfill-php85": "^1.33" }, "require-dev": { diff --git a/docs/guide/installation.md b/docs/guide/installation.md index 2970f22..126e4db 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -3,14 +3,15 @@ Install the package into your application using Composer: ```bash -composer config minimum-stability -composer require cloudcreativity/ddd-modules:^5.0 +composer config minimum-stability dev +composer require cloudcreativity/ddd-modules:^6.0 ``` ## Versions | DDD Modules | PHP | |-------------|--------| +| `6.x` | `^8.4` | | `5.x` | `^8.2` | | `4.x` | `^8.2` | | `3.x` | `^8.1` | diff --git a/pint.json b/pint.json index 5f8b563..dd76040 100644 --- a/pint.json +++ b/pint.json @@ -1,11 +1,14 @@ { "preset": "psr12", "rules": { + "array_indentation": true, "array_syntax": true, "assign_null_coalescing_to_coalesce_equal": true, + "binary_operator_spaces": true, "clean_namespace": true, "declare_strict_types": true, "list_syntax": true, + "new_expression_parentheses": true, "no_empty_phpdoc": true, "no_superfluous_elseif": true, "no_superfluous_phpdoc_tags": { diff --git a/src/Bus/Middleware/LogMessageDispatch.php b/src/Bus/Middleware/LogMessageDispatch.php index 469bb8f..70cc344 100644 --- a/src/Bus/Middleware/LogMessageDispatch.php +++ b/src/Bus/Middleware/LogMessageDispatch.php @@ -46,7 +46,7 @@ public function __invoke(Message $message, Closure $next): ?Result $this->logger->log( $this->dispatchLevel, "Bus dispatching {$name}.", - [$key => (new SanitizedMessage($message))->context()], + [$key => new SanitizedMessage($message)->context()], ); $result = $next($message); diff --git a/src/Infrastructure/OutboundEventBus/Middleware/LogOutboundEvent.php b/src/Infrastructure/OutboundEventBus/Middleware/LogOutboundEvent.php index 0b274d5..7f85e9a 100644 --- a/src/Infrastructure/OutboundEventBus/Middleware/LogOutboundEvent.php +++ b/src/Infrastructure/OutboundEventBus/Middleware/LogOutboundEvent.php @@ -36,7 +36,7 @@ public function __invoke(IntegrationEvent $event, Closure $next): void $this->log->log( $this->publishLevel, "Publishing integration event {$name}.", - $context = ['event' => (new SanitizedMessage($event))->context()], + $context = ['event' => new SanitizedMessage($event)->context()], ); $next($event); diff --git a/src/Infrastructure/Queue/Middleware/LogPushedToQueue.php b/src/Infrastructure/Queue/Middleware/LogPushedToQueue.php index 2aa65aa..691baee 100644 --- a/src/Infrastructure/Queue/Middleware/LogPushedToQueue.php +++ b/src/Infrastructure/Queue/Middleware/LogPushedToQueue.php @@ -36,7 +36,7 @@ public function __invoke(Command $command, Closure $next): null $this->log->log( $this->queueLevel, "Queuing command {$name}.", - $context = ['command' => (new SanitizedMessage($command))->context()], + $context = ['command' => new SanitizedMessage($command)->context()], ); $next($command); diff --git a/src/Toolkit/Result/Result.php b/src/Toolkit/Result/Result.php index e55db52..0556305 100644 --- a/src/Toolkit/Result/Result.php +++ b/src/Toolkit/Result/Result.php @@ -163,6 +163,6 @@ public function withMeta(array|Meta $meta): self */ public function context(): array { - return (new ContextualResult($this))->context(); + return new ContextualResult($this)->context(); } } diff --git a/tests/Unit/Application/Bus/Middleware/LogMessageDispatchTest.php b/tests/Unit/Application/Bus/Middleware/LogMessageDispatchTest.php index c71d87d..db57cd1 100644 --- a/tests/Unit/Application/Bus/Middleware/LogMessageDispatchTest.php +++ b/tests/Unit/Application/Bus/Middleware/LogMessageDispatchTest.php @@ -69,7 +69,7 @@ public function testWithDefaultLevels(): void $this->assertSame($expected, $actual); $this->assertEquals([ - [LogLevel::DEBUG, "Bus dispatching {$name}.", ['command' => (new SanitizedMessage($this->message))->context()]], + [LogLevel::DEBUG, "Bus dispatching {$name}.", ['command' => new SanitizedMessage($this->message)->context()]], [LogLevel::INFO, "Bus dispatched {$name}.", ['result' => $expected->context()]], ], $this->logs); } @@ -87,7 +87,7 @@ public function testWithCustomLevels(): void $this->assertSame($expected, $actual); $this->assertEquals([ - [LogLevel::NOTICE, "Bus dispatching {$name}.", ['command' => (new SanitizedMessage($this->message))->context()]], + [LogLevel::NOTICE, "Bus dispatching {$name}.", ['command' => new SanitizedMessage($this->message)->context()]], [LogLevel::WARNING, "Bus dispatched {$name}.", ['result' => $expected->context()]], ], $this->logs); } @@ -107,7 +107,7 @@ public function testItLogsAfterTheNextClosureIsInvoked(): void } catch (LogicException $ex) { $this->assertSame($expected, $ex); $this->assertEquals([ - [LogLevel::DEBUG, "Bus dispatching {$name}.", ['query' => (new SanitizedMessage($message))->context()]], + [LogLevel::DEBUG, "Bus dispatching {$name}.", ['query' => new SanitizedMessage($message)->context()]], ], $this->logs); } } diff --git a/tests/Unit/Toolkit/Pipeline/PipelineBuilderTest.php b/tests/Unit/Toolkit/Pipeline/PipelineBuilderTest.php index 046af2b..f46845e 100644 --- a/tests/Unit/Toolkit/Pipeline/PipelineBuilderTest.php +++ b/tests/Unit/Toolkit/Pipeline/PipelineBuilderTest.php @@ -28,7 +28,7 @@ public function test(): void $stages = ['strtoupper', 'strtolower'], ); - $actual = (new PipelineBuilder()) + $actual = new PipelineBuilder() ->add($stages[0]) ->add($stages[1]) ->build($processor); @@ -47,7 +47,7 @@ public function testServiceString(): void 'strtolower', ]); - $actual = (new PipelineBuilder($container)) + $actual = new PipelineBuilder($container) ->through(['strtoupper', 'SomeService', 'strtolower']) ->build($processor); @@ -61,7 +61,7 @@ public function testServiceStringWithoutContainer(): void $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('Cannot use a string pipe name without a pipe container.'); - (new PipelineBuilder()) + new PipelineBuilder() ->add('strtoupper') ->add('SomeService') ->add('strtolower')