diff --git a/library/think/Console.php b/library/think/Console.php index 5035958a..24b85134 100644 --- a/library/think/Console.php +++ b/library/think/Console.php @@ -740,7 +740,7 @@ class Console public static function addDefaultCommands(array $classnames) { - self::$defaultCommands[] = array_merge(self::$defaultCommands, $classnames); + self::$defaultCommands = array_merge(self::$defaultCommands, $classnames); } /** diff --git a/library/think/console/output/Null.php b/library/think/console/output/Null.php new file mode 100644 index 00000000..4e8f355c --- /dev/null +++ b/library/think/console/output/Null.php @@ -0,0 +1,109 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output; + + +use think\console\Output; + +class Null extends Output +{ + /** @noinspection PhpMissingParentConstructorInspection */ + public function __construct() + { + + } + + /** + * {@inheritdoc} + */ + public function setFormatter(Formatter $formatter) + { + // do nothing + } + + /** + * {@inheritdoc} + */ + public function getFormatter() + { + // to comply with the interface we must return a OutputFormatterInterface + return new Formatter(); + } + + /** + * {@inheritdoc} + */ + public function setDecorated($decorated) + { + // do nothing + } + + /** + * {@inheritdoc} + */ + public function isDecorated() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function setVerbosity($level) + { + // do nothing + } + + /** + * {@inheritdoc} + */ + public function getVerbosity() + { + return self::VERBOSITY_QUIET; + } + + public function isQuiet() + { + return true; + } + + public function isVerbose() + { + return false; + } + + public function isVeryVerbose() + { + return false; + } + + public function isDebug() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function writeln($messages, $options = self::OUTPUT_NORMAL) + { + // do nothing + } + + /** + * {@inheritdoc} + */ + public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL) + { + // do nothing + } +} \ No newline at end of file