File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
70
70
- Fixed bug #1495 : Setting an invalid installed path breaks all commands
71
71
- Fixed bug #1496 : Squiz.Strings.DoubleQuoteUsage not unescaping dollar sign when fixing
72
72
-- Thanks to Michał Bundyra for the patch
73
+ - Fixed bug #1501 : Interactive mode is broken
73
74
</notes >
74
75
<contents >
75
76
<dir name =" /" >
Original file line number Diff line number Diff line change @@ -129,6 +129,8 @@ public function __construct(Config $config)
129
129
130
130
if ($ output === null ) {
131
131
// Using a temp file.
132
+ // This needs to be set in the constructor so that all
133
+ // child procs use the same report file when running in parallel.
132
134
$ this ->tmpFiles [$ type ] = tempnam (sys_get_temp_dir (), 'phpcs ' );
133
135
file_put_contents ($ this ->tmpFiles [$ type ], '' );
134
136
} else {
@@ -223,6 +225,7 @@ public function printReport($report)
223
225
echo $ generatedReport ;
224
226
if ($ filename !== null && file_exists ($ filename ) === true ) {
225
227
unlink ($ filename );
228
+ unset($ this ->tmpFiles [$ report ]);
226
229
}
227
230
}
228
231
@@ -265,6 +268,14 @@ public function cacheFileReport(File $phpcsFile)
265
268
266
269
if ($ report ['output ' ] === null ) {
267
270
// Using a temp file.
271
+ if (isset ($ this ->tmpFiles [$ type ]) === false ) {
272
+ // When running in interactive mode, the reporter prints the full
273
+ // report many times, which will unlink the temp file. So we need
274
+ // to create a new one if it doesn't exist.
275
+ $ this ->tmpFiles [$ type ] = tempnam (sys_get_temp_dir (), 'phpcs ' );
276
+ file_put_contents ($ this ->tmpFiles [$ type ], '' );
277
+ }
278
+
268
279
file_put_contents ($ this ->tmpFiles [$ type ], $ generatedReport , FILE_APPEND );
269
280
} else {
270
281
$ flags = FILE_APPEND ;
Original file line number Diff line number Diff line change @@ -98,9 +98,9 @@ public function runPHPCS()
98
98
// so we hard-code the full report here and when outputting.
99
99
// We also ensure parallel processing is off because we need to do one file at a time.
100
100
if ($ this ->config ->interactive === true ) {
101
- $ this ->config ->reports = array ('full ' => null );
102
- $ this ->config ->parallel = 1 ;
103
- $ this ->config ->showProcess = false ;
101
+ $ this ->config ->reports = array ('full ' => null );
102
+ $ this ->config ->parallel = 1 ;
103
+ $ this ->config ->showProgress = false ;
104
104
}
105
105
106
106
// Disable caching if we are processing STDIN as we can't be 100%
@@ -591,9 +591,6 @@ public function processFile($file)
591
591
592
592
$ this ->reporter ->cacheFileReport ($ file , $ this ->config );
593
593
594
- // Clean up the file to save (a lot of) memory.
595
- $ file ->cleanUp ();
596
-
597
594
if ($ this ->config ->interactive === true ) {
598
595
/*
599
596
Running interactively.
@@ -633,6 +630,9 @@ public function processFile($file)
633
630
}//end while
634
631
}//end if
635
632
633
+ // Clean up the file to save (a lot of) memory.
634
+ $ file ->cleanUp ();
635
+
636
636
}//end processFile()
637
637
638
638
You can’t perform that action at this time.
0 commit comments