@@ -128,7 +128,7 @@ public function options()
128128 */
129129 public function confirm ($ question , $ default = false )
130130 {
131- return $ this ->output ->confirm ($ question , $ default );
131+ return $ this ->output ? ->confirm($ question , $ default );
132132 }
133133
134134 /**
@@ -140,7 +140,7 @@ public function confirm($question, $default = false)
140140 */
141141 public function ask ($ question , $ default = null )
142142 {
143- return $ this ->output ->ask ($ question , $ default );
143+ return $ this ->output ? ->ask($ question , $ default );
144144 }
145145
146146 /**
@@ -172,7 +172,7 @@ public function askWithCompletion($question, $choices, $default = null)
172172 ? $ question ->setAutocompleterCallback ($ choices )
173173 : $ question ->setAutocompleterValues ($ choices );
174174
175- return $ this ->output ->askQuestion ($ question );
175+ return $ this ->output ? ->askQuestion($ question );
176176 }
177177
178178 /**
@@ -188,7 +188,7 @@ public function secret($question, $fallback = true)
188188
189189 $ question ->setHidden (true )->setHiddenFallback ($ fallback );
190190
191- return $ this ->output ->askQuestion ($ question );
191+ return $ this ->output ? ->askQuestion($ question );
192192 }
193193
194194 /**
@@ -206,7 +206,7 @@ public function choice($question, array $choices, $default = null, $attempts = n
206206
207207 $ question ->setMaxAttempts ($ attempts )->setMultiselect ($ multiple );
208208
209- return $ this ->output ->askQuestion ($ question );
209+ return $ this ->output ? ->askQuestion($ question );
210210 }
211211
212212 /**
@@ -241,7 +241,7 @@ public function table($headers, $rows, $tableStyle = 'default', array $columnSty
241241 */
242242 public function withProgressBar ($ totalSteps , Closure $ callback )
243243 {
244- $ bar = $ this ->output ->createProgressBar (
244+ $ bar = $ this ->output ? ->createProgressBar(
245245 is_iterable ($ totalSteps ) ? count ($ totalSteps ) : $ totalSteps
246246 );
247247
@@ -286,7 +286,7 @@ public function line($string, $style = null, $verbosity = null)
286286 {
287287 $ styled = $ style ? "< {$ style }> {$ string }</ {$ style }> " : $ string ;
288288
289- $ this ->output ->writeln ($ styled , $ this ->parseVerbosity ($ verbosity ));
289+ $ this ->output ? ->writeln($ styled , $ this ->parseVerbosity ($ verbosity ));
290290 }
291291
292292 /**
@@ -330,10 +330,10 @@ public function error($string, $verbosity = null)
330330 */
331331 public function warn ($ string , $ verbosity = null )
332332 {
333- if (! $ this ->output ->getFormatter ()->hasStyle ('warning ' )) {
333+ if (! $ this ->output ? ->getFormatter()->hasStyle ('warning ' )) {
334334 $ style = new OutputFormatterStyle ('yellow ' );
335335
336- $ this ->output ->getFormatter ()->setStyle ('warning ' , $ style );
336+ $ this ->output ? ->getFormatter()->setStyle ('warning ' , $ style );
337337 }
338338
339339 $ this ->line ($ string , 'warning ' , $ verbosity );
@@ -364,7 +364,7 @@ public function alert($string, $verbosity = null)
364364 */
365365 public function newLine ($ count = 1 )
366366 {
367- $ this ->output ->newLine ($ count );
367+ $ this ->output ? ->newLine($ count );
368368
369369 return $ this ;
370370 }
0 commit comments