Skip to content

Commit 7d3dca2

Browse files
committed
Merge branch 'develop'
* develop: specify next release add NoDiscard attributes replace innmind/time-continuum and innmind/time-warp by innmind/time bump minimum versions fix ci badge fix readme tag dependencies update dependencies add internal Watch\Implementation require php 8.4
2 parents abbd000 + 704e562 commit 7d3dca2

15 files changed

Lines changed: 98 additions & 64 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,3 @@ jobs:
1212
uses: innmind/github-workflows/.github/workflows/psalm-matrix.yml@main
1313
cs:
1414
uses: innmind/github-workflows/.github/workflows/cs.yml@main
15-
with:
16-
php-version: '8.2'

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 6.0.0 - 2026-02-07
4+
5+
### Changed
6+
7+
- Requires PHP `8.4`
8+
- Requires `innmind/server-control:~7.0`
9+
- Requires `innmind/time:~1.0`
10+
311
## 5.0.0 - 2025-05-08
412

513
### Changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# FileWatch
22

3-
[![Build Status](https://github.com/innmind/filewatch/workflows/CI/badge.svg?branch=master)](https://github.com/innmind/filewatch/actions?query=workflow%3ACI)
3+
[![CI](https://github.com/Innmind/FileWatch/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Innmind/FileWatch/actions/workflows/ci.yml)
44
[![codecov](https://codecov.io/gh/innmind/filewatch/branch/develop/graph/badge.svg)](https://codecov.io/gh/innmind/filewatch)
55
[![Type Coverage](https://shepherd.dev/github/innmind/filewatch/coverage.svg)](https://shepherd.dev/github/innmind/filewatch)
66

@@ -15,12 +15,9 @@ composer require innmind/file-watch
1515
## Usage
1616

1717
```php
18-
use Innmind\FileWatch\{
19-
Factory,
20-
Stop,
21-
};
18+
use Innmind\FileWatch\Factory;
2219
use Innmind\Server\Control\ServerFactory;
23-
use Innmind\TimeWarp\Halt\Usleep;
20+
use Innmind\TimeWarp\Halt;
2421
use Innmind\TimeContinuum\Clock;
2522
use Innmind\IO\IO;
2623
use Innmind\Url\Path;
@@ -30,9 +27,9 @@ $watch = Factory::build(
3027
ServerFactory::build(
3128
Clock::live(),
3229
IO::fromAmbientAuthority(),
33-
Usleep::new(),
30+
Halt::new(),
3431
)->processes(),
35-
Usleep::new(),
32+
Halt::new(),
3633
);
3734

3835
$count = $watch(Path::of('/to/some/file/or/folder'))(0, function(int $count, Continuation $continuation): Continuation {

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
"issues": "http://github.com/Innmind/FileWatch/issues"
1616
},
1717
"require": {
18-
"php": "~8.2",
19-
"innmind/url": "~4.0",
20-
"innmind/server-control": "~6.0",
21-
"innmind/time-warp": "~4.0",
22-
"innmind/time-continuum": "^4.1.1",
18+
"php": "~8.4",
19+
"innmind/url": "~5.0",
20+
"innmind/server-control": "~7.0",
21+
"innmind/time": "~1.0",
2322
"psr/log": "~3.0"
2423
},
2524
"autoload": {
@@ -33,7 +32,7 @@
3332
}
3433
},
3534
"require-dev": {
36-
"innmind/static-analysis": "^1.2.1",
35+
"innmind/static-analysis": "~1.3",
3736
"innmind/coding-standard": "~2.0",
3837
"innmind/black-box": "~6.1"
3938
}

psalm.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
<directory name="vendor" />
1515
</ignoreFiles>
1616
</projectFiles>
17+
<issueHandlers>
18+
<UndefinedAttributeClass errorLevel="suppress" />
19+
</issueHandlers>
1720
</psalm>

src/Continuation.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ private function __construct(
2929
*
3030
* @return self<A>
3131
*/
32+
#[\NoDiscard]
3233
public static function of(mixed $value): self
3334
{
3435
return new self(State::continue, $value);
@@ -41,6 +42,7 @@ public static function of(mixed $value): self
4142
*
4243
* @return self<U>
4344
*/
45+
#[\NoDiscard]
4446
public function continue(mixed $value): self
4547
{
4648
return new self(State::continue, $value);
@@ -53,6 +55,7 @@ public function continue(mixed $value): self
5355
*
5456
* @return self<U>
5557
*/
58+
#[\NoDiscard]
5659
public function stop(mixed $value): self
5760
{
5861
return new self(State::stop, $value);
@@ -67,6 +70,7 @@ public function stop(mixed $value): self
6770
*
6871
* @return R
6972
*/
73+
#[\NoDiscard]
7074
public function match(
7175
callable $continue,
7276
callable $stop,

src/Factory.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
namespace Innmind\FileWatch;
55

66
use Innmind\Server\Control\Server\Processes;
7-
use Innmind\TimeWarp\Halt;
8-
use Innmind\TimeContinuum\Period;
7+
use Innmind\Time\{
8+
Halt,
9+
Period,
10+
};
911

1012
final class Factory
1113
{
14+
#[\NoDiscard]
1215
public static function build(
1316
Processes $processes,
1417
Halt $halt,

src/Ping.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ private function __construct(
2121
*
2222
* @return Attempt<R|C>
2323
*/
24+
#[\NoDiscard]
2425
public function __invoke(mixed $carry, callable $ping): Attempt
2526
{
2627
return ($this->implementation)($carry, $ping);
@@ -29,6 +30,7 @@ public function __invoke(mixed $carry, callable $ping): Attempt
2930
/**
3031
* @internal
3132
*/
33+
#[\NoDiscard]
3234
public static function of(Ping\Implementation $implementation): self
3335
{
3436
return new self($implementation);

src/Ping/OutputDiff.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
Process\Output,
1111
Process\Output\Type,
1212
};
13-
use Innmind\TimeWarp\Halt;
14-
use Innmind\TimeContinuum\Period;
13+
use Innmind\Time\{
14+
Halt,
15+
Period,
16+
};
1517
use Innmind\Immutable\{
1618
Attempt,
1719
Sequence,
@@ -49,7 +51,7 @@ public function __invoke(mixed $carry, callable $ping): Attempt
4951
$result = Sequence::lazy(function() {
5052
while (true) {
5153
yield $this->output();
52-
($this->halt)($this->period);
54+
$_ = ($this->halt)($this->period)->memoize();
5355
}
5456
})
5557
->flatMap(static fn($maybe) => $maybe->match(
@@ -136,11 +138,11 @@ private function diff(Sequence $previous, Sequence $now): bool
136138
{
137139
$previous = $previous
138140
->map(static fn($chunk) => $chunk->data())
139-
->fold(new Concat)
141+
->fold(Concat::monoid)
140142
->toString();
141143
$now = $now
142144
->map(static fn($chunk) => $chunk->data())
143-
->fold(new Concat)
145+
->fold(Concat::monoid)
144146
->toString();
145147

146148
return $previous !== $now;

src/Watch.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,35 @@
44
namespace Innmind\FileWatch;
55

66
use Innmind\FileWatch\Watch\{
7+
Implementation,
78
Kind,
89
Logger,
910
Fallback,
1011
Tailf,
1112
Stat,
1213
};
1314
use Innmind\Server\Control\Server\Processes;
14-
use Innmind\TimeWarp\Halt;
15-
use Innmind\TimeContinuum\Period;
15+
use Innmind\Time\{
16+
Halt,
17+
Period,
18+
};
1619
use Innmind\Url\Path;
1720
use Psr\Log\LoggerInterface;
1821

1922
final class Watch
2023
{
2124
private function __construct(
22-
private Kind|Logger $implementation,
25+
private Implementation $implementation,
2326
) {
2427
}
2528

29+
#[\NoDiscard]
2630
public function __invoke(Path $file): Ping
2731
{
2832
return Ping::of(($this->implementation)($file));
2933
}
3034

35+
#[\NoDiscard]
3136
public static function of(
3237
Processes $processes,
3338
Halt $halt,
@@ -51,6 +56,7 @@ public static function of(
5156
);
5257
}
5358

59+
#[\NoDiscard]
5460
public static function logger(self $watch, LoggerInterface $logger): self
5561
{
5662
return new self(Logger::psr(

0 commit comments

Comments
 (0)