diff --git a/composer.json b/composer.json index 1d07d54..9cadc55 100644 --- a/composer.json +++ b/composer.json @@ -20,10 +20,10 @@ "cboden/ratchet": "^0.4.1", "clue/buzz-react": "^2.5", "guzzlehttp/guzzle": "^6.3", - "illuminate/console": "5.6.*|5.7.*|5.8.*|6.*", - "illuminate/support": "5.6.*|5.7.*|5.8.*|6.*", + "illuminate/console": "5.6.*|5.7.*|5.8.*|6.*|7.*", + "illuminate/support": "5.6.*|5.7.*|5.8.*|6.*|7.*", "laravel/dusk": "^4.0|^5.0|^6.0", - "yosymfony/resource-watcher": "^1.2" + "yosymfony/resource-watcher": "^2.0" }, "require-dev": { "larapack/dd": "^1.0", diff --git a/src/Watcher.php b/src/Watcher.php index 9f4d237..72f837f 100644 --- a/src/Watcher.php +++ b/src/Watcher.php @@ -5,6 +5,7 @@ use Closure; use React\EventLoop\LoopInterface; use Symfony\Component\Finder\Finder; +use Yosymfony\ResourceWatcher\Crc32ContentHash; use Yosymfony\ResourceWatcher\ResourceCacheMemory; use Yosymfony\ResourceWatcher\ResourceWatcher; @@ -24,14 +25,13 @@ public function __construct(Finder $finder, LoopInterface $loop) public function startWatching(Closure $callback) { - $watcher = new ResourceWatcher(new ResourceCacheMemory()); - - $watcher->setFinder($this->finder); + $hashContent = new Crc32ContentHash(); + $watcher = new ResourceWatcher(new ResourceCacheMemory(), $this->finder, $hashContent); $this->loop->addPeriodicTimer(1 / 2, function () use ($watcher, $callback) { - $watcher->findChanges(); + $watcher_result = $watcher->findChanges(); - if ($watcher->hasChanges()) { + if ($watcher_result->hasChanges()) { call_user_func($callback); } });