File tree Expand file tree Collapse file tree
tests/Unit/Application/Bus Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. This projec
55
66## Unreleased
77
8+ ## [ 3.3.1] - 2025-08-10
9+
10+ ### Fixed
11+
12+ - Ensure that the ` Result ` class uses ` @template-covariant ` for its result value. This now matches the result interface,
13+ which already used template covariant.
14+
815## [ 3.3.0] - 2025-05-24
916
1017### Added
Original file line number Diff line number Diff line change 5353 " @test"
5454 ],
5555 "deptrac" : " deptrac analyse --report-uncovered --fail-on-uncovered" ,
56- "static" : " phpstan analyse -c phpstan.neon" ,
56+ "static" : " phpstan analyse -c phpstan.neon --memory-limit=256M " ,
5757 "style" : " pint --test" ,
5858 "style:fix" : " pint" ,
5959 "test" : " phpunit"
Original file line number Diff line number Diff line change 1818use CloudCreativity \Modules \Contracts \Toolkit \Result \Result as IResult ;
1919
2020/**
21- * @template TValue
21+ * @template-covariant TValue
2222 * @implements IResult<TValue>
2323 */
2424final class Result implements IResult
Original file line number Diff line number Diff line change 1616
1717class TestCommand implements Command
1818{
19+ public function __construct (public bool $ fail = false )
20+ {
21+ }
1922}
Original file line number Diff line number Diff line change 1313namespace CloudCreativity \Modules \Tests \Unit \Application \Bus ;
1414
1515use CloudCreativity \Modules \Contracts \Application \Messages \DispatchThroughMiddleware ;
16+ use CloudCreativity \Modules \Contracts \Toolkit \Identifiers \Identifier ;
17+ use CloudCreativity \Modules \Toolkit \Identifiers \Uuid ;
1618use CloudCreativity \Modules \Toolkit \Result \Result ;
1719
1820class TestCommandHandler implements DispatchThroughMiddleware
@@ -21,11 +23,15 @@ class TestCommandHandler implements DispatchThroughMiddleware
2123 * Execute the command.
2224 *
2325 * @param TestCommand $command
24- * @return Result<null>
26+ * @return Result<Identifier| null>
2527 */
2628 public function execute (TestCommand $ command ): Result
2729 {
28- return Result::ok ();
30+ if ($ command ->fail ) {
31+ return Result::fail ('It failed! ' );
32+ }
33+
34+ return Result::ok (Uuid::random ());
2935 }
3036
3137 /**
You can’t perform that action at this time.
0 commit comments