Skip to content

Commit d9d24bb

Browse files
committed
update dependencies
1 parent 4926baf commit d9d24bb

32 files changed

Lines changed: 224 additions & 295 deletions

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,28 @@
22

33
## [Unreleased]
44

5+
### Changed
6+
7+
- Requires `innmind/time-continuum:^4.1.1`
8+
- Requires `innmind/server-status:~5.0`
9+
- Requires `innmind/server-control:~6.0`
10+
- Requires `innmind/filesystem:~8.1`
11+
- Requires `innmind/file-watch:~5.0`
12+
- Requires `innmind/http-transport:~8.0`
13+
- Requires `innmind/time-warp:~4.0`
14+
- Requires `innmind/io:~3.2`
15+
- Requires `innmind/immutable:~5.15`
16+
- `Innmind\OperatingSystem\Config::withHttpHeartbeat()` period is now expressed with a `Innmind\TimeContinuum\Period`
17+
518
### Fixed
619

720
- PHP `8.4` deprecations
821

22+
### Removed
23+
24+
- `Innmind\OperatingSystem\Config::useStreamCapabilities()`
25+
- `Innmind\OperatingSystem\Sockets::watch()`
26+
927
## 5.2.0 - 2024-07-14
1028

1129
### Changed

composer.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,17 @@
1616
},
1717
"require": {
1818
"php": "~8.2",
19-
"innmind/time-continuum": "~3.0",
20-
"innmind/server-status": "~4.0",
21-
"innmind/server-control": "~5.0",
22-
"innmind/filesystem": "~7.1",
23-
"innmind/socket": "~6.0",
24-
"innmind/http-transport": "~7.2",
25-
"innmind/time-warp": "~3.0",
19+
"innmind/time-continuum": "^4.1.1",
20+
"innmind/server-status": "~5.0",
21+
"innmind/server-control": "~6.0",
22+
"innmind/filesystem": "~8.1",
23+
"innmind/http-transport": "~8.0",
24+
"innmind/time-warp": "~4.0",
2625
"innmind/signals": "~3.0",
27-
"innmind/file-watch": "~4.0",
28-
"innmind/stream": "~4.0",
26+
"innmind/file-watch": "~5.0",
2927
"formal/access-layer": "~4.0",
30-
"innmind/io": "~2.7"
28+
"innmind/io": "~3.2",
29+
"innmind/immutable": "~5.15"
3130
},
3231
"autoload": {
3332
"psr-4": {
@@ -44,7 +43,7 @@
4443
"innmind/url": "~4.0",
4544
"innmind/ip": "~3.0",
4645
"innmind/static-analysis": "^1.2.1",
47-
"innmind/black-box": "~5.5",
46+
"innmind/black-box": "~6.2",
4847
"innmind/coding-standard": "~2.0"
4948
}
5049
}

src/Config.php

Lines changed: 9 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,34 @@
55

66
use Innmind\TimeContinuum\{
77
Clock,
8-
Earth,
9-
ElapsedPeriod,
8+
Period,
109
};
1110
use Innmind\Filesystem\CaseSensitivity;
1211
use Innmind\Server\Status\EnvironmentPath;
1312
use Innmind\TimeWarp\Halt;
1413
use Innmind\IO\IO;
15-
use Innmind\Stream\{
16-
Capabilities,
17-
Streams,
18-
};
1914
use Innmind\Immutable\Maybe;
2015

2116
final class Config
2217
{
2318
private Clock $clock;
2419
private CaseSensitivity $caseSensitivity;
25-
private Capabilities $streamCapabilities;
2620
private IO $io;
2721
private Halt $halt;
2822
private EnvironmentPath $path;
2923
/** @var Maybe<positive-int> */
3024
private Maybe $maxHttpConcurrency;
31-
/** @var Maybe<array{ElapsedPeriod, callable(): void}> */
25+
/** @var Maybe<array{Period, callable(): void}> */
3226
private Maybe $httpHeartbeat;
3327
private bool $disableSSLVerification;
3428

3529
/**
3630
* @param Maybe<positive-int> $maxHttpConcurrency
37-
* @param Maybe<array{ElapsedPeriod, callable(): void}> $httpHeartbeat
31+
* @param Maybe<array{Period, callable(): void}> $httpHeartbeat
3832
*/
3933
private function __construct(
4034
Clock $clock,
4135
CaseSensitivity $caseSensitivity,
42-
Capabilities $streamCapabilities,
4336
IO $io,
4437
Halt $halt,
4538
EnvironmentPath $path,
@@ -49,7 +42,6 @@ private function __construct(
4942
) {
5043
$this->clock = $clock;
5144
$this->caseSensitivity = $caseSensitivity;
52-
$this->streamCapabilities = $streamCapabilities;
5345
$this->io = $io;
5446
$this->halt = $halt;
5547
$this->path = $path;
@@ -62,18 +54,14 @@ public static function of(): self
6254
{
6355
/** @var Maybe<positive-int> */
6456
$maxHttpConcurrency = Maybe::nothing();
65-
/** @var Maybe<array{ElapsedPeriod, callable(): void}> */
57+
/** @var Maybe<array{Period, callable(): void}> */
6658
$httpHeartbeat = Maybe::nothing();
6759

6860
return new self(
69-
new Earth\Clock,
61+
Clock::live(),
7062
CaseSensitivity::sensitive,
71-
$streams = Streams::fromAmbientAuthority(),
72-
IO::of(static fn(?ElapsedPeriod $timeout) => match ($timeout) {
73-
null => $streams->watch()->waitForever(),
74-
default => $streams->watch()->timeoutAfter($timeout),
75-
}),
76-
new Halt\Usleep,
63+
IO::fromAmbientAuthority(),
64+
Halt\Usleep::new(),
7765
EnvironmentPath::of(match ($path = \getenv('PATH')) {
7866
false => '',
7967
default => $path,
@@ -92,7 +80,6 @@ public function withClock(Clock $clock): self
9280
return new self(
9381
$clock,
9482
$this->caseSensitivity,
95-
$this->streamCapabilities,
9683
$this->io,
9784
$this->halt,
9885
$this->path,
@@ -110,7 +97,6 @@ public function caseInsensitiveFilesystem(): self
11097
return new self(
11198
$this->clock,
11299
CaseSensitivity::insensitive,
113-
$this->streamCapabilities,
114100
$this->io,
115101
$this->halt,
116102
$this->path,
@@ -120,28 +106,6 @@ public function caseInsensitiveFilesystem(): self
120106
);
121107
}
122108

123-
/**
124-
* @psalm-mutation-free
125-
*/
126-
public function useStreamCapabilities(Capabilities $capabilities): self
127-
{
128-
/** @psalm-suppress ImpureMethodCall This should be solved in the next innmind/io release */
129-
return new self(
130-
$this->clock,
131-
$this->caseSensitivity,
132-
$capabilities,
133-
IO::of(static fn(?ElapsedPeriod $timeout) => match ($timeout) {
134-
null => $capabilities->watch()->waitForever(),
135-
default => $capabilities->watch()->timeoutAfter($timeout),
136-
}),
137-
$this->halt,
138-
$this->path,
139-
$this->maxHttpConcurrency,
140-
$this->httpHeartbeat,
141-
$this->disableSSLVerification,
142-
);
143-
}
144-
145109
/**
146110
* @psalm-mutation-free
147111
*/
@@ -150,7 +114,6 @@ public function haltProcessVia(Halt $halt): self
150114
return new self(
151115
$this->clock,
152116
$this->caseSensitivity,
153-
$this->streamCapabilities,
154117
$this->io,
155118
$halt,
156119
$this->path,
@@ -168,7 +131,6 @@ public function withEnvironmentPath(EnvironmentPath $path): self
168131
return new self(
169132
$this->clock,
170133
$this->caseSensitivity,
171-
$this->streamCapabilities,
172134
$this->io,
173135
$this->halt,
174136
$path,
@@ -188,7 +150,6 @@ public function limitHttpConcurrencyTo(int $max): self
188150
return new self(
189151
$this->clock,
190152
$this->caseSensitivity,
191-
$this->streamCapabilities,
192153
$this->io,
193154
$this->halt,
194155
$this->path,
@@ -203,12 +164,11 @@ public function limitHttpConcurrencyTo(int $max): self
203164
*
204165
* @param callable(): void $heartbeat
205166
*/
206-
public function withHttpHeartbeat(ElapsedPeriod $timeout, callable $heartbeat): self
167+
public function withHttpHeartbeat(Period $timeout, callable $heartbeat): self
207168
{
208169
return new self(
209170
$this->clock,
210171
$this->caseSensitivity,
211-
$this->streamCapabilities,
212172
$this->io,
213173
$this->halt,
214174
$this->path,
@@ -226,7 +186,6 @@ public function disableSSLVerification(): self
226186
return new self(
227187
$this->clock,
228188
$this->caseSensitivity,
229-
$this->streamCapabilities,
230189
$this->io,
231190
$this->halt,
232191
$this->path,
@@ -252,14 +211,6 @@ public function filesystemCaseSensitivity(): CaseSensitivity
252211
return $this->caseSensitivity;
253212
}
254213

255-
/**
256-
* @internal
257-
*/
258-
public function streamCapabilities(): Capabilities
259-
{
260-
return $this->streamCapabilities;
261-
}
262-
263214
/**
264215
* @internal
265216
*/
@@ -297,7 +248,7 @@ public function maxHttpConcurrency(): Maybe
297248
/**
298249
* @internal
299250
*
300-
* @return Maybe<array{ElapsedPeriod, callable(): void}>
251+
* @return Maybe<array{Period, callable(): void}>
301252
*/
302253
public function httpHeartbeat(): Maybe
303254
{

src/CurrentProcess/Generic.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function halt(Period $period): void
5353
#[\Override]
5454
public function memory(): Bytes
5555
{
56-
return new Bytes(\memory_get_usage());
56+
/** @psalm-suppress ArgumentTypeCoercion */
57+
return Bytes::of(\memory_get_usage());
5758
}
5859
}

src/Filesystem/Generic.php

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@
1818
Factory,
1919
Watch,
2020
};
21-
use Innmind\Stream\Bidirectional;
2221
use Innmind\Immutable\{
2322
Maybe,
23+
Attempt,
2424
Sequence,
25-
Str,
26-
Predicate\Instance,
2725
};
2826

2927
final class Generic implements Filesystem
@@ -64,7 +62,6 @@ public function mount(Path $path): Adapter
6462

6563
$adapter = Adapter\Filesystem::mount(
6664
$path,
67-
$this->config->streamCapabilities(),
6865
$this->config->io(),
6966
)
7067
->withCaseSensitivity(
@@ -116,24 +113,22 @@ public function watch(Path $path): Ping
116113
#[\Override]
117114
public function temporary(Sequence $chunks): Maybe
118115
{
119-
$temporary = $this
120-
->config
121-
->streamCapabilities()
122-
->temporary()
123-
->new();
124-
125-
$temporary = $chunks->reduce(
126-
Maybe::just($temporary),
127-
static fn(Maybe $temporary, $chunk) => Maybe::all($temporary, $chunk)->flatMap(
128-
static fn(Bidirectional $temporary, Str $chunk) => $temporary
129-
->write($chunk->toEncoding(Str\Encoding::ascii))
130-
->maybe()
131-
->keep(Instance::of(Bidirectional::class)),
132-
),
133-
);
134-
135-
return $temporary
136-
->map($this->config->io()->readable()->wrap(...))
137-
->map(Content::io(...));
116+
return Attempt::of(
117+
fn() => $this
118+
->config
119+
->io()
120+
->files()
121+
->temporary(
122+
$chunks->map(
123+
static fn($chunk) => $chunk
124+
->attempt(static fn() => new \RuntimeException('Failed to load chunk'))
125+
->unwrap(),
126+
),
127+
)
128+
->memoize() // to make sure writing the chunks has been done
129+
->map(static fn($tmp) => $tmp->read())
130+
->map(Content::io(...))
131+
->unwrap(),
132+
)->maybe();
138133
}
139134
}

src/Filesystem/Logger.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,8 @@ public function require(Path $path): Maybe
7777
#[\Override]
7878
public function watch(Path $path): Ping
7979
{
80-
return Ping\Logger::psr(
81-
$this->filesystem->watch($path),
82-
$path,
83-
$this->logger,
84-
);
80+
// todo bring back the ping logger
81+
return $this->filesystem->watch($path);
8582
}
8683

8784
#[\Override]

src/OperatingSystem/Logger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function map(callable $map): OperatingSystem
4444
#[\Override]
4545
public function clock(): TimeContinuum\Clock
4646
{
47-
return new TimeContinuum\Logger\Clock(
47+
return TimeContinuum\Clock::logger(
4848
$this->os->clock(),
4949
$this->logger,
5050
);
@@ -62,7 +62,7 @@ public function filesystem(): Filesystem
6262
#[\Override]
6363
public function status(): Status\Server
6464
{
65-
return new Status\Servers\Logger(
65+
return Status\Servers\Logger::of(
6666
$this->os->status(),
6767
$this->logger,
6868
);

src/OperatingSystem/Unix.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function control(): ServerControl
7979
{
8080
return $this->control ??= Servers\Unix::of(
8181
$this->clock(),
82-
$this->config->streamCapabilities(),
82+
$this->config->io(),
8383
$this->config->halt(),
8484
);
8585
}

src/Ports.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
namespace Innmind\OperatingSystem;
55

66
use Innmind\Url\Authority\Port;
7-
use Innmind\IO\Sockets\Server;
8-
use Innmind\Socket\Internet\Transport;
7+
use Innmind\IO\{
8+
Sockets\Servers\Server,
9+
Sockets\Internet\Transport,
10+
};
911
use Innmind\IP\IP;
1012
use Innmind\Immutable\Maybe;
1113

src/Ports/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
use Innmind\OperatingSystem\Ports;
77
use Innmind\Url\Authority\Port;
8-
use Innmind\Socket\Internet\Transport;
8+
use Innmind\IO\Sockets\Internet\Transport;
99
use Innmind\IP\IP;
1010
use Innmind\Immutable\Maybe;
1111
use Psr\Log\LoggerInterface;

0 commit comments

Comments
 (0)