@@ -72,7 +72,7 @@ public function set_includewarnings($includewarnings) {
72
72
}
73
73
74
74
/**
75
- * Set the files the runned is going to process.
75
+ * Set the files the runner is going to process.
76
76
*
77
77
* @param string[] $files array of full paths to files or directories.
78
78
*/
@@ -89,6 +89,24 @@ public function set_ignorepatterns($ignorepatterns) {
89
89
$ this ->config ->ignored = $ ignorepatterns ;
90
90
}
91
91
92
+ /**
93
+ * Set the verbosity for the output.
94
+ *
95
+ * @param int $verbosity How verbose the output should be. Check expected values in {@see PHP_CodeSniffer\Config}.
96
+ */
97
+ public function set_verbosity (int $ verbosity ): void {
98
+ $ this ->config ->verbosity = $ verbosity ;
99
+ }
100
+
101
+ /**
102
+ * Set if the interactive checking mode should be enabled or not.
103
+ *
104
+ * @param bool $interactive If true, will stop after each file with errors and wait for user input.
105
+ */
106
+ public function set_interactive (bool $ interactive ): void {
107
+ $ this ->config ->interactive = $ interactive ;
108
+ }
109
+
92
110
/**
93
111
* Initialise the runner, invoked by run().
94
112
*/
@@ -113,26 +131,27 @@ public function run() {
113
131
$ this ->init ();
114
132
115
133
// Create the reporter to manage all the reports from the run.
116
- $ reporter = new \PHP_CodeSniffer \Reporter ($ this ->config );
134
+ $ this -> reporter = new \PHP_CodeSniffer \Reporter ($ this ->config );
117
135
118
136
// And build the file list to iterate over.
119
137
$ todo = new \PHP_CodeSniffer \Files \FileList ($ this ->config , $ this ->ruleset );
120
138
121
139
foreach ($ todo as $ file ) {
122
140
if ($ file ->ignored === false ) {
123
141
try {
124
- $ file ->process ();
142
+ $ this ->processFile ($ file );
143
+ } catch (\PHP_CodeSniffer \Exceptions \DeepExitException $ e ) {
144
+ echo $ e ->getMessage ();
145
+ return $ e ->getCode ();
125
146
} catch (\Exception $ e ) {
126
147
$ error = 'Problem during processing; checking has been aborted. The error message was: ' .$ e ->getMessage ();
127
148
$ file ->addErrorOnLine ($ error , 1 , 'Internal.Exception ' );
128
149
}
129
- // Add results to the reporter and free memory.
130
- $ reporter ->cacheFileReport ($ file , $ this ->config );
131
150
$ file ->cleanUp ();
132
151
}
133
152
}
134
153
135
154
// Have finished, generate the final reports.
136
- $ reporter ->printReports ();
155
+ $ this -> reporter ->printReports ();
137
156
}
138
157
}
0 commit comments