diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c6a5bc..5197606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 3.8.0 - 2023-09-10 + +### Deprecated + +- `Innmind\OperatingSystem\CurrentProcess::fork()` +- `Innmind\OperatingSystem\CurrentProcess::children()` +- `Innmind\OperatingSystem\CurrentProcess\Children` +- `Innmind\OperatingSystem\CurrentProcess\Child` +- `Innmind\OperatingSystem\CurrentProcess\ForkFailed` + ## 3.7.0 - 2023-02-25 ### Added diff --git a/src/Config.php b/src/Config.php index e17d16a..230151d 100644 --- a/src/Config.php +++ b/src/Config.php @@ -87,6 +87,8 @@ public function withEnvironmentPath(EnvironmentPath $path): self } /** + * @psalm-mutation-free + * * @param positive-int $max */ public function limitHttpConcurrencyTo(int $max): self diff --git a/src/CurrentProcess.php b/src/CurrentProcess.php index 0bb2f38..1c8fbed 100644 --- a/src/CurrentProcess.php +++ b/src/CurrentProcess.php @@ -22,9 +22,17 @@ interface CurrentProcess public function id(): Pid; /** + * @deprecated This method will be removed in the next major version + * @psalm-suppress DeprecatedClass + * * @return Either SideEffect represent the child side */ public function fork(): Either; + + /** + * @deprecated This method will be removed in the next major version + * @psalm-suppress DeprecatedClass + */ public function children(): Children; public function signals(): Signals; public function halt(Period $period): void; diff --git a/src/CurrentProcess/Child.php b/src/CurrentProcess/Child.php index 456a8b6..4f768c5 100644 --- a/src/CurrentProcess/Child.php +++ b/src/CurrentProcess/Child.php @@ -8,6 +8,9 @@ ExitCode, }; +/** + * @deprecated This Class will be removed in the next major version + */ final class Child { private Pid $pid; diff --git a/src/CurrentProcess/Children.php b/src/CurrentProcess/Children.php index 523623a..7806254 100644 --- a/src/CurrentProcess/Children.php +++ b/src/CurrentProcess/Children.php @@ -13,6 +13,10 @@ Maybe, }; +/** + * @deprecated This Class will be removed in the next major version + * @psalm-suppress DeprecatedClass + */ final class Children { /** @var Map, Child> */ diff --git a/src/CurrentProcess/ForkFailed.php b/src/CurrentProcess/ForkFailed.php index ef42881..41331ac 100644 --- a/src/CurrentProcess/ForkFailed.php +++ b/src/CurrentProcess/ForkFailed.php @@ -4,6 +4,7 @@ namespace Innmind\OperatingSystem\CurrentProcess; /** + * @deprecated This class will be removed in the next major version * @psalm-immutable */ final class ForkFailed diff --git a/src/CurrentProcess/Generic.php b/src/CurrentProcess/Generic.php index 17a91f7..0f30c26 100644 --- a/src/CurrentProcess/Generic.php +++ b/src/CurrentProcess/Generic.php @@ -18,7 +18,10 @@ final class Generic implements CurrentProcess { private Halt $halt; - /** @var Set */ + /** + * @psalm-suppress DeprecatedClass + * @var Set + */ private Set $children; private ?Handler $signalsHandler = null; private ?Signals\Wrapper $signals = null; @@ -26,7 +29,10 @@ final class Generic implements CurrentProcess private function __construct(Halt $halt) { $this->halt = $halt; - /** @var Set */ + /** + * @psalm-suppress DeprecatedClass + * @var Set + */ $this->children = Set::of(); } @@ -45,6 +51,7 @@ public function fork(): Either { /** * @psalm-suppress ArgumentTypeCoercion + * @psalm-suppress DeprecatedClass * @var Either */ $result = match ($pid = \pcntl_fork()) { @@ -53,6 +60,9 @@ public function fork(): Either default => Either::left(Child::of(new Pid($pid))), }; + /** + * @psalm-suppress DeprecatedClass + */ return $result ->map(function($sideEffect) { $this->children = $this->children->clear(); @@ -67,8 +77,12 @@ public function fork(): Either }); } + /** + * @psalm-suppress DeprecatedClass + */ public function children(): Children { + /** @psalm-suppress DeprecatedClass */ return Children::of(...$this->children->toList()); } @@ -89,6 +103,9 @@ public function memory(): Bytes return new Bytes(\memory_get_usage()); } + /** + * @psalm-suppress DeprecatedClass + */ private function register(Child $child): Child { $this->children = ($this->children)($child); diff --git a/src/CurrentProcess/Logger.php b/src/CurrentProcess/Logger.php index c3d8f08..9ffc0b8 100644 --- a/src/CurrentProcess/Logger.php +++ b/src/CurrentProcess/Logger.php @@ -43,6 +43,10 @@ public function fork(): Either { $this->logger->debug('Forking process'); + /** + * @psalm-suppress DeprecatedMethod + * @psalm-suppress DeprecatedClass + */ return $this ->process ->fork() @@ -58,8 +62,12 @@ public function fork(): Either }); } + /** + * @psalm-suppress DeprecatedClass + */ public function children(): Children { + /** @psalm-suppress DeprecatedMethod */ return $this->process->children(); }