File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414- Requires ` innmind/io:~3.2 `
1515- Requires ` innmind/immutable:~5.15 `
1616- ` Innmind\OperatingSystem\Config::withHttpHeartbeat() ` period is now expressed with a ` Innmind\TimeContinuum\Period `
17+ - ` Innmind\OperatingSystem\CurrentProcess::halt() ` now returns ` Innmind\Immutable\Attempt<Innmind\Immutable\SideEffect> `
1718
1819### Fixed
1920
Original file line number Diff line number Diff line change 77use Innmind \Server \Control \Server \Process \Pid ;
88use Innmind \Server \Status \Server \Memory \Bytes ;
99use Innmind \TimeContinuum \Period ;
10+ use Innmind \Immutable \{
11+ Attempt ,
12+ SideEffect ,
13+ };
1014
1115interface CurrentProcess
1216{
1317 public function id (): Pid ;
1418 public function signals (): Signals ;
15- public function halt (Period $ period ): void ;
19+
20+ /**
21+ * @return Attempt<SideEffect>
22+ */
23+ public function halt (Period $ period ): Attempt ;
1624 public function memory (): Bytes ;
1725}
Original file line number Diff line number Diff line change 99use Innmind \TimeContinuum \Period ;
1010use Innmind \TimeWarp \Halt ;
1111use Innmind \Signals \Handler ;
12+ use Innmind \Immutable \Attempt ;
1213
1314final class Generic implements CurrentProcess
1415{
@@ -45,9 +46,9 @@ public function signals(): Signals
4546 }
4647
4748 #[\Override]
48- public function halt (Period $ period ): void
49+ public function halt (Period $ period ): Attempt
4950 {
50- ($ this ->halt )($ period );
51+ return ($ this ->halt )($ period );
5152 }
5253
5354 #[\Override]
Original file line number Diff line number Diff line change 77use Innmind \Server \Control \Server \Process \Pid ;
88use Innmind \Server \Status \Server \Memory \Bytes ;
99use Innmind \TimeContinuum \Period ;
10+ use Innmind \Immutable \Attempt ;
1011use Psr \Log \LoggerInterface ;
1112
1213final class Logger implements CurrentProcess
@@ -49,7 +50,7 @@ public function signals(): Signals
4950 }
5051
5152 #[\Override]
52- public function halt (Period $ period ): void
53+ public function halt (Period $ period ): Attempt
5354 {
5455 $ this ->logger ->debug ('Halting current process... ' , ['period ' => [
5556 'years ' => $ period ->years (),
@@ -61,7 +62,7 @@ public function halt(Period $period): void
6162 'milliseconds ' => $ period ->milliseconds (),
6263 ]]);
6364
64- $ this ->process ->halt ($ period );
65+ return $ this ->process ->halt ($ period );
6566 }
6667
6768 #[\Override]
Original file line number Diff line number Diff line change 2222use Innmind \Immutable \{
2323 Maybe ,
2424 Attempt ,
25- SideEffect ,
2625};
2726use Formal \AccessLayer \Connection ;
2827
@@ -68,9 +67,7 @@ public function __construct(
6867 #[\Override]
6968 public function __invoke (Period $ period ): Attempt
7069 {
71- $ this ->process ->halt ($ period );
72-
73- return Attempt::result (SideEffect::identity ());
70+ return $ this ->process ->halt ($ period );
7471 }
7572 },
7673 );
Original file line number Diff line number Diff line change 1212use Innmind \Server \Status \Server \Memory \Bytes ;
1313use Innmind \TimeContinuum \Period ;
1414use Innmind \TimeWarp \Halt ;
15+ use Innmind \Immutable \SideEffect ;
1516use PHPUnit \Framework \TestCase ;
1617
1718class GenericTest extends TestCase
@@ -38,7 +39,12 @@ public function testHalt()
3839 Halt \Usleep::new (),
3940 );
4041
41- $ this ->assertNull ($ process ->halt (Period::millisecond (1 )));
42+ $ this ->assertInstanceOf (
43+ SideEffect::class,
44+ $ process
45+ ->halt (Period::millisecond (1 ))
46+ ->unwrap (),
47+ );
4248 }
4349
4450 public function testSignals ()
Original file line number Diff line number Diff line change 1111use Innmind \Server \Control \Server \Process \Pid ;
1212use Innmind \Server \Status \Server \Memory \Bytes ;
1313use Innmind \TimeContinuum \Period ;
14+ use Innmind \Immutable \{
15+ Attempt ,
16+ SideEffect ,
17+ };
1418use Psr \Log \LoggerInterface ;
1519use PHPUnit \Framework \TestCase ;
1620use Innmind \BlackBox \{
@@ -74,15 +78,21 @@ public function testHalt()
7478 $ inner
7579 ->expects ($ this ->once ())
7680 ->method ('halt ' )
77- ->with ($ period );
81+ ->with ($ period )
82+ ->willReturn (Attempt::result (SideEffect::identity ()));
7883 $ logger = $ this ->createMock (LoggerInterface::class);
7984 $ logger
8085 ->expects ($ this ->once ())
8186 ->method ('debug ' )
8287 ->with ('Halting current process... ' );
8388 $ process = Logger::psr ($ inner , $ logger );
8489
85- $ this ->assertNull ($ process ->halt ($ period ));
90+ $ this ->assertInstanceOf (
91+ SideEffect::class,
92+ $ process
93+ ->halt ($ period )
94+ ->unwrap (),
95+ );
8696 }
8797
8898 public function testMemory ()
You can’t perform that action at this time.
0 commit comments