File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -17,23 +17,26 @@ public static function php73Polyfill(Event $event)
17
17
return ;
18
18
}
19
19
20
- echo 'Removing duplicate is_countable() ... ' ;
20
+ $ io = $ event ->getIO ();
21
+ $ io ->write ('Removing duplicate is_countable() ... ' );
22
+
21
23
$ vendorDir = $ event ->getComposer ()->getConfig ()->get ('vendor-dir ' );
22
24
$ stubsFile = $ vendorDir . self ::STUBSFILE ;
23
25
24
26
$ stubs = file_get_contents ($ stubsFile );
25
27
if ($ stubs === false ) {
26
- echo 'WordPress stubs not found. ' ;
27
- return ;
28
+ $ io -> writeError ( 'WordPress stubs not found. ' ) ;
29
+ return 10 ;
28
30
}
29
31
$ fixedStubs = preg_replace ('/(\n)(function is_countable)/ ' , '$1// $2 ' , $ stubs );
30
32
31
33
$ numberOfBytes = file_put_contents ($ stubsFile , $ fixedStubs );
32
- $ message = 'OK. ' ;
33
34
if ($ numberOfBytes === false ) {
34
- $ message = 'FAILED. ' ;
35
+ $ io ->writeError ('FAILED. ' );
36
+ return 11 ;
35
37
}
36
38
37
- echo $ message . "\n" ;
39
+ $ io ->write ('OK. ' );
40
+ return 0 ;
38
41
}
39
42
}
You can’t perform that action at this time.
0 commit comments