Skip to content

Commit 9cae58f

Browse files
romainnorbergfreekmurze
authored andcommitted
[WIP] fix compatibility with yosymfony/resource-watcher (#101)
* fix compatibily with yosymfony/resource-watcher * adjust use statements
1 parent ca9033f commit 9cae58f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
"symfony/yaml": "^4.0|^5.0",
2525
"yosymfony/resource-watcher": "^2.0"
2626
},
27+
"conflict": {
28+
"yosymfony/resource-watcher": "<2.0"
29+
},
2730
"require-dev": {
2831
"phpunit/phpunit": "^8.0"
2932
},

src/Watcher.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
use Clue\React\Stdio\Stdio;
66
use React\EventLoop\Factory;
77
use React\Stream\ThroughStream;
8-
use Symfony\Component\Finder\Finder;
98
use Spatie\PhpUnitWatcher\Screens\Phpunit;
10-
use Yosymfony\ResourceWatcher\ResourceWatcher;
9+
use Symfony\Component\Finder\Finder;
10+
use Yosymfony\ResourceWatcher\Crc32ContentHash;
1111
use Yosymfony\ResourceWatcher\ResourceCacheMemory;
12+
use Yosymfony\ResourceWatcher\ResourceWatcher;
1213

1314
class Watcher
1415
{
@@ -39,18 +40,14 @@ public function startWatching()
3940
{
4041
$this->terminal->displayScreen(new Phpunit($this->options), false);
4142

42-
$watcher = new ResourceWatcher(new ResourceCacheMemory());
43-
44-
$watcher->setFinder($this->finder);
43+
$watcher = new ResourceWatcher(new ResourceCacheMemory(), $this->finder, new Crc32ContentHash());
4544

4645
$this->loop->addPeriodicTimer(1 / 4, function () use ($watcher) {
4746
if (! $this->terminal->isDisplayingScreen(Phpunit::class)) {
4847
return;
4948
}
5049

51-
$watcher->findChanges();
52-
53-
if ($watcher->hasChanges()) {
50+
if ($watcher->findChanges()->hasChanges()) {
5451
$this->terminal->refreshScreen();
5552
}
5653
});

0 commit comments

Comments
 (0)