@@ -141,7 +141,7 @@ public function testWaitUntilSpecificOutput()
141141 $ start = microtime (true );
142142
143143 $ completeOutput = '' ;
144- $ result = $ p ->waitUntil (function ($ type , $ output ) use (&$ completeOutput ) {
144+ $ result = $ p ->waitUntil (static function ($ type , $ output ) use (&$ completeOutput ) {
145145 return str_contains ($ completeOutput .= $ output , 'One more ' );
146146 });
147147 $ this ->assertTrue ($ result );
@@ -154,7 +154,7 @@ public function testWaitUntilCanReturnFalse()
154154 {
155155 $ p = $ this ->getProcess ('echo foo ' );
156156 $ p ->start ();
157- $ this ->assertFalse ($ p ->waitUntil (fn () => false ));
157+ $ this ->assertFalse ($ p ->waitUntil (static fn () => false ));
158158 }
159159
160160 public function testAllOutputIsActuallyReadOnTermination ()
@@ -191,7 +191,7 @@ public function testAllOutputIsActuallyReadOnTermination()
191191 public function testCallbacksAreExecutedWithStart ()
192192 {
193193 $ process = $ this ->getProcess ('echo foo ' );
194- $ process ->start (function ($ type , $ buffer ) use (&$ data ) {
194+ $ process ->start (static function ($ type , $ buffer ) use (&$ data ) {
195195 $ data .= $ buffer ;
196196 });
197197
@@ -209,7 +209,7 @@ public function testReadSupportIsDisabledWithoutCallback()
209209 // disabling output + not passing a callback to start() => read support disabled
210210 $ process ->disableOutput ();
211211 $ process ->start ();
212- $ process ->wait (function ($ type , $ buffer ) use (&$ data ) {
212+ $ process ->wait (static function ($ type , $ buffer ) use (&$ data ) {
213213 $ data .= $ buffer ;
214214 });
215215 }
@@ -275,7 +275,7 @@ public function testLiveStreamAsInput()
275275
276276 $ p = $ this ->getProcessForCode ('stream_copy_to_stream(STDIN, STDOUT); ' );
277277 $ p ->setInput ($ stream );
278- $ p ->start (function ($ type , $ data ) use ($ stream ) {
278+ $ p ->start (static function ($ type , $ data ) use ($ stream ) {
279279 if ('hello ' === $ data ) {
280280 fclose ($ stream );
281281 }
@@ -369,7 +369,7 @@ public function testCallbackIsExecutedForOutput()
369369 $ p = $ this ->getProcessForCode ('echo \'foo \'; ' );
370370
371371 $ called = false ;
372- $ p ->run (function ($ type , $ buffer ) use (&$ called ) {
372+ $ p ->run (static function ($ type , $ buffer ) use (&$ called ) {
373373 $ called = 'foo ' === $ buffer ;
374374 });
375375
@@ -382,7 +382,7 @@ public function testCallbackIsExecutedForOutputWheneverOutputIsDisabled()
382382 $ p ->disableOutput ();
383383
384384 $ called = false ;
385- $ p ->run (function ($ type , $ buffer ) use (&$ called ) {
385+ $ p ->run (static function ($ type , $ buffer ) use (&$ called ) {
386386 $ called = 'foo ' === $ buffer ;
387387 });
388388
@@ -1152,7 +1152,7 @@ public static function provideOutputFetchingMethods()
11521152 public function testStopTerminatesProcessCleanly ()
11531153 {
11541154 $ process = $ this ->getProcessForCode ('echo 123; sleep(42); ' );
1155- $ process ->run (function () use ($ process ) {
1155+ $ process ->run (static function () use ($ process ) {
11561156 $ process ->stop ();
11571157 });
11581158 $ this ->assertTrue (true , 'A call to stop() is not expected to cause wait() to throw a RuntimeException ' );
@@ -1161,7 +1161,7 @@ public function testStopTerminatesProcessCleanly()
11611161 public function testKillSignalTerminatesProcessCleanly ()
11621162 {
11631163 $ process = $ this ->getProcessForCode ('echo 123; sleep(43); ' );
1164- $ process ->run (function () use ($ process ) {
1164+ $ process ->run (static function () use ($ process ) {
11651165 $ process ->signal (9 ); // SIGKILL
11661166 });
11671167 $ this ->assertTrue (true , 'A call to signal() is not expected to cause wait() to throw a RuntimeException ' );
@@ -1170,7 +1170,7 @@ public function testKillSignalTerminatesProcessCleanly()
11701170 public function testTermSignalTerminatesProcessCleanly ()
11711171 {
11721172 $ process = $ this ->getProcessForCode ('echo 123; sleep(44); ' );
1173- $ process ->run (function () use ($ process ) {
1173+ $ process ->run (static function () use ($ process ) {
11741174 $ process ->signal (15 ); // SIGTERM
11751175 });
11761176 $ this ->assertTrue (true , 'A call to signal() is not expected to cause wait() to throw a RuntimeException ' );
@@ -1239,7 +1239,7 @@ public static function provideVariousIncrementals()
12391239
12401240 public function testIteratorInput ()
12411241 {
1242- $ input = function () {
1242+ $ input = static function () {
12431243 yield 'ping ' ;
12441244 yield 'pong ' ;
12451245 };
@@ -1256,7 +1256,7 @@ public function testSimpleInputStream()
12561256 $ process = $ this ->getProcessForCode ('echo \'ping \'; echo fread(STDIN, 4); echo fread(STDIN, 4); ' );
12571257 $ process ->setInput ($ input );
12581258
1259- $ process ->start (function ($ type , $ data ) use ($ input ) {
1259+ $ process ->start (static function ($ type , $ data ) use ($ input ) {
12601260 if ('ping ' === $ data ) {
12611261 $ input ->write ('pang ' );
12621262 } elseif (!$ input ->isClosed ()) {
@@ -1273,7 +1273,7 @@ public function testInputStreamWithCallable()
12731273 {
12741274 $ i = 0 ;
12751275 $ stream = fopen ('php://memory ' , 'w+ ' );
1276- $ stream = function () use ($ stream , &$ i ) {
1276+ $ stream = static function () use ($ stream , &$ i ) {
12771277 if ($ i < 3 ) {
12781278 rewind ($ stream );
12791279 fwrite ($ stream , ++$ i );
@@ -1291,7 +1291,7 @@ public function testInputStreamWithCallable()
12911291
12921292 $ process = $ this ->getProcessForCode ('echo fread(STDIN, 3); ' );
12931293 $ process ->setInput ($ input );
1294- $ process ->start (function ($ type , $ data ) use ($ input ) {
1294+ $ process ->start (static function ($ type , $ data ) use ($ input ) {
12951295 $ input ->close ();
12961296 });
12971297
@@ -1302,7 +1302,7 @@ public function testInputStreamWithCallable()
13021302 public function testInputStreamWithGenerator ()
13031303 {
13041304 $ input = new InputStream ();
1305- $ input ->onEmpty (function ($ input ) {
1305+ $ input ->onEmpty (static function ($ input ) {
13061306 yield 'pong ' ;
13071307 $ input ->close ();
13081308 });
@@ -1319,11 +1319,11 @@ public function testInputStreamOnEmpty()
13191319 {
13201320 $ i = 0 ;
13211321 $ input = new InputStream ();
1322- $ input ->onEmpty (function () use (&$ i ) { ++$ i ; });
1322+ $ input ->onEmpty (static function () use (&$ i ) { ++$ i ; });
13231323
13241324 $ process = $ this ->getProcessForCode ('echo 123; echo fread(STDIN, 1); echo 456; ' );
13251325 $ process ->setInput ($ input );
1326- $ process ->start (function ($ type , $ data ) use ($ input ) {
1326+ $ process ->start (static function ($ type , $ data ) use ($ input ) {
13271327 if ('123 ' === $ data ) {
13281328 $ input ->close ();
13291329 }
0 commit comments