diff --git a/src/StratumStyle.php b/src/StratumStyle.php index f77b6b0..1a769c0 100644 --- a/src/StratumStyle.php +++ b/src/StratumStyle.php @@ -39,62 +39,87 @@ public function __construct(InputInterface $input, OutputInterface $output) } //-------------------------------------------------------------------------------------------------------------------- - public function logDebug() + /** + * Logs a message according to a format string at verbosity level OutputInterface::VERBOSITY_NORMAL. + * + * @param string $format The format string, see sprintf. + * @param mixed ...$values The values. + * + * @return void + */ + public function logDebug(string $format, mixed ...$values): void { if ($this->getVerbosity()>=OutputInterface::VERBOSITY_DEBUG) { - $args = func_get_args(); - $format = array_shift($args); - - $this->writeln(vsprintf(''.$format.'', $args)); + $this->writeln(vsprintf(''.$format.'', $values)); } } //-------------------------------------------------------------------------------------------------------------------- - public function logInfo() + /** + * Logs a message according to a format string at verbosity level OutputInterface::VERBOSITY_NORMAL. + * + * @param string $format The format string, see sprintf. + * @param mixed ...$values The values. + * + * @return void + */ + public function logInfo(string $format, mixed ...$values): void { if ($this->getVerbosity()>=OutputInterface::VERBOSITY_NORMAL) { - $args = func_get_args(); - $format = array_shift($args); - - $this->writeln(vsprintf(''.$format.'', $args)); + $this->writeln(vsprintf(''.$format.'', $values)); } } //-------------------------------------------------------------------------------------------------------------------- - public function logNote() + /** + * Logs a message according to a format string at verbosity level OutputInterface::VERBOSITY_NORMAL. + * + * @param string $format The format string, see sprintf. + * @param mixed ...$values The values. + * + * @return void + */ + public function logNote(string $format, mixed ...$values): void { if ($this->getVerbosity()>=OutputInterface::VERBOSITY_NORMAL) { - $args = func_get_args(); - $format = array_shift($args); - - $this->writeln(' ! [NOTE] '.vsprintf($format, $args).''); + $this->writeln(' ! [NOTE] '.vsprintf($format, $values).''); } } //-------------------------------------------------------------------------------------------------------------------- - public function logVerbose() + /** + * Logs a message according to a format string at verbosity level OutputInterface::VERBOSITY_VERBOSE. + * + * @param string $format The format string, see sprintf. + * @param mixed ...$values The values. + * + * @return void + */ + public function logVerbose(string $format, mixed ...$values): void { if ($this->getVerbosity()>=OutputInterface::VERBOSITY_VERBOSE) { - $args = func_get_args(); - $format = array_shift($args); - - $this->writeln(vsprintf(''.$format.'', $args)); + $this->writeln(vsprintf(''.$format.'', $values)); } } //-------------------------------------------------------------------------------------------------------------------- - public function logVeryVerbose() + /** + * Logs a message according to a format string at verbosity level OutputInterface::VERBOSITY_VERY_VERBOSE. + * + * @param string $format The format string, see sprintf. + * @param mixed ...$values The values. + * + * @return void + */ + public function logVeryVerbose(string $format, mixed ...$values): void { if ($this->getVerbosity()>=OutputInterface::VERBOSITY_VERY_VERBOSE) { - $args = func_get_args(); - $format = array_shift($args); - - $this->writeln(vsprintf(''.$format.'', $args)); + $this->writeln(vsprintf(''.$format.'', $values)); } }