From a46111d089fa39959a1526a64810f62fe28aa3d6 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 2 Jul 2024 09:55:22 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- src/output/std/ProxyMessenger.php | 2 +- src/output/std/StdMessenger.php | 11 +++++++---- tbin/legacy-test-console.php | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/output/std/ProxyMessenger.php b/src/output/std/ProxyMessenger.php index 6b61a9c..eace83c 100644 --- a/src/output/std/ProxyMessenger.php +++ b/src/output/std/ProxyMessenger.php @@ -76,11 +76,11 @@ class ProxyMessenger implements IMessenger { $useFunc = false; $untils = []; foreach ($this->msgs as $msg) { - $msg->action($content, null, $level); if ($msg instanceof _IMessenger) { $useFunc = true; $untils[] = $msg->_getActionMark(); } + $msg->action($content, null, $level); } if ($useFunc && $func !== null) { try { diff --git a/src/output/std/StdMessenger.php b/src/output/std/StdMessenger.php index 8c98649..c8e0f69 100644 --- a/src/output/std/StdMessenger.php +++ b/src/output/std/StdMessenger.php @@ -306,12 +306,12 @@ class StdMessenger implements _IMessenger { $rprefix2 = str_repeat(" ", mb_strlen($rprefix)); } if ($printContent && $printResult) { + A::ensure_array($content); if ($rcontent) { - A::ensure_array($content); $content[] = ": "; $content[] = $rcontent; } - $lines = $out->getLines(false, $content); + $lines = $out->getLines(false, ...$content); foreach ($lines as $content) { if ($linePrefix !== null) $out->write($linePrefix); $out->iprint($indentLevel, $rprefix, $content); @@ -331,7 +331,9 @@ class StdMessenger implements _IMessenger { $prefix2 = str_repeat(" ", mb_strlen($prefix)); $suffix = null; } - $lines = $out->getLines(false, $content, ":"); + A::ensure_array($content); + $content[] = ":"; + $lines = $out->getLines(false, ...$content); foreach ($lines as $content) { if ($linePrefix !== null) $out->write($linePrefix); $out->iprint($indentLevel, $prefix, $content, $suffix); @@ -399,7 +401,8 @@ class StdMessenger implements _IMessenger { $valueContent[] = $value; } } - $content = $valueContent; + if (count($valueContent) == 1) $content = $valueContent[0]; + else $content = $valueContent; } elseif ($content instanceof Throwable || $content instanceof ExceptionShadow) { $exceptions[] = $content; $content = null; diff --git a/tbin/legacy-test-console.php b/tbin/legacy-test-console.php index bb17844..f73fe84 100755 --- a/tbin/legacy-test-console.php +++ b/tbin/legacy-test-console.php @@ -206,7 +206,7 @@ Application::run(new class extends Application { $msg->info("info"); $msg->note("note"); - $msg->warn("warning"); + $msg->warning("warning"); $msg->error("error"); }); });