@@ -67,6 +67,8 @@ class FixerApplication
67
67
/** @var (ExtendedPromiseInterface&CancellablePromiseInterface)|null */
68
68
private $ processInProgress ;
69
69
70
+ private bool $ fileMonitorActive = true ;
71
+
70
72
/**
71
73
* @param string[] $analysedPaths
72
74
* @param list<string> $dnsServers
@@ -119,14 +121,22 @@ public function run(
119
121
'filesCount ' => $ filesCount ,
120
122
'phpstanVersion ' => ComposerHelper::getPhpStanVersion (),
121
123
]]);
122
- $ decoder ->on ('data ' , static function (array $ data ) use (
124
+ $ decoder ->on ('data ' , function (array $ data ) use (
123
125
$ output ,
124
126
): void {
125
127
if ($ data ['action ' ] === 'webPort ' ) {
126
128
$ output ->writeln (sprintf ('Open your web browser at: <fg=cyan>http://127.0.0.1:%d</> ' , $ data ['data ' ]['port ' ]));
127
129
$ output ->writeln ('Press [Ctrl-C] to quit. ' );
128
130
return ;
129
131
}
132
+ if ($ data ['action ' ] === 'resumeFileMonitor ' ) {
133
+ $ this ->fileMonitorActive = true ;
134
+ return ;
135
+ }
136
+ if ($ data ['action ' ] === 'pauseFileMonitor ' ) {
137
+ $ this ->fileMonitorActive = false ;
138
+ return ;
139
+ }
130
140
});
131
141
132
142
$ this ->fileMonitor ->initialize (array_merge (
@@ -396,6 +406,10 @@ private function writeInfoFile(string $infoPath, string $version, string $branch
396
406
private function monitorFileChanges (LoopInterface $ loop , callable $ hasChangesCallback ): void
397
407
{
398
408
$ callback = function () use (&$ callback , $ loop , $ hasChangesCallback ): void {
409
+ if (!$ this ->fileMonitorActive ) {
410
+ $ loop ->addTimer (1.0 , $ callback );
411
+ return ;
412
+ }
399
413
$ changes = $ this ->fileMonitor ->getChanges ();
400
414
401
415
if ($ changes ->hasAnyChanges ()) {
0 commit comments