From eeee4cfffce5ef5dd207c11cd7ed03a1d6d0a86b Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Thu, 16 May 2024 09:42:00 +0400 Subject: [PATCH] =?UTF-8?q?renommer=20::warn()=20en=20::warning()=20pour?= =?UTF-8?q?=20la=20coh=C3=A9rence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/output/IMessenger.php | 2 +- src/output/_messenger.php | 4 ++-- src/output/std/ProxyMessenger.php | 2 +- src/output/std/StdMessenger.php | 12 ++++++------ tbin/legacy-test-console.php | 4 ++-- tbin/legacy-test-levels.php | 8 ++++---- tbin/test-console.php | 5 ++--- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/output/IMessenger.php b/src/output/IMessenger.php index 3de31a6..a82b026 100644 --- a/src/output/IMessenger.php +++ b/src/output/IMessenger.php @@ -80,7 +80,7 @@ interface IMessenger { function note($content, ?int $level=null): void; /** afficher un événément "avertissement" */ - function warn($content, ?int $level=null): void; + function warning($content, ?int $level=null): void; /** afficher un événément "erreur" */ function error($content, ?int $level=null): void; diff --git a/src/output/_messenger.php b/src/output/_messenger.php index 3a51585..3dfaf52 100644 --- a/src/output/_messenger.php +++ b/src/output/_messenger.php @@ -65,7 +65,7 @@ abstract class _messenger { static function print($content, ?int $level=null): void { static::get()->print($content, $level); } static function info($content, ?int $level=null): void { static::get()->info($content, $level); } static function note($content, ?int $level=null): void { static::get()->note($content, $level); } - static function warn($content, ?int $level=null): void { static::get()->warn($content, $level); } + static function warning($content, ?int $level=null): void { static::get()->warning($content, $level); } static function error($content, ?int $level=null): void { static::get()->error($content, $level); } static function end(bool $all=false): void { static::get()->end($all); } @@ -74,6 +74,6 @@ abstract class _messenger { static function minor($content): void { self::info($content, self::MINOR);} static function important($content): void { self::info($content, self::MAJOR);} static function attention($content): void { self::note($content, self::MAJOR);} - static function critwarn($content): void { self::warn($content, self::MAJOR);} + static function critwarning($content): void { self::warning($content, self::MAJOR);} static function criterror($content): void { self::error($content, self::MAJOR);} } diff --git a/src/output/std/ProxyMessenger.php b/src/output/std/ProxyMessenger.php index c594bfb..7711071 100644 --- a/src/output/std/ProxyMessenger.php +++ b/src/output/std/ProxyMessenger.php @@ -100,7 +100,7 @@ class ProxyMessenger implements IMessenger { function print($content, ?int $level=null): void { foreach ($this->msgs as $msg) { $msg->print($content, $level); } } function info($content, ?int $level=null): void { foreach ($this->msgs as $msg) { $msg->info($content, $level); } } function note($content, ?int $level=null): void { foreach ($this->msgs as $msg) { $msg->note($content, $level); } } - function warn($content, ?int $level=null): void { foreach ($this->msgs as $msg) { $msg->warn($content, $level); } } + function warning($content, ?int $level=null): void { foreach ($this->msgs as $msg) { $msg->warning($content, $level); } } function error($content, ?int $level=null): void { foreach ($this->msgs as $msg) { $msg->error($content, $level); } } function end(bool $all=false): void { foreach ($this->msgs as $msg) { $msg->end($all); } } } diff --git a/src/output/std/StdMessenger.php b/src/output/std/StdMessenger.php index 535e487..f762fae 100644 --- a/src/output/std/StdMessenger.php +++ b/src/output/std/StdMessenger.php @@ -40,7 +40,7 @@ class StdMessenger implements _IMessenger { "title" => [false, "TITLE!", null, "T", "", "==="], "desc" => ["DESC!", ">", ""], "error" => ["CRIT.ERROR!", "E!", ""], - "warn" => ["CRIT.WARN!", "W!", ""], + "warning" => ["CRIT.WARNING!", "W!", ""], "note" => ["ATTENTION!", "N!", ""], "info" => ["IMPORTANT!", "N!", ""], "step" => ["*", ".", ""], @@ -51,7 +51,7 @@ class StdMessenger implements _IMessenger { "title" => [false, "TITLE:", null, "T", "", "---"], "desc" => ["DESC:", ">", ""], "error" => ["ERROR:", "E", ""], - "warn" => ["WARN:", "W", ""], + "warning" => ["WARNING:", "W", ""], "note" => ["NOTE:", "N", ""], "info" => ["INFO:", "I", ""], "step" => ["*", ".", ""], @@ -62,7 +62,7 @@ class StdMessenger implements _IMessenger { "title" => [false, "title", null, "t", "", null], "desc" => ["desc", ">", ""], "error" => ["error", "E", ""], - "warn" => ["warn", "W", ""], + "warning" => ["warning", "W", ""], "note" => ["note", "N", ""], "info" => ["info", "I", ""], "step" => ["*", ".", ""], @@ -73,7 +73,7 @@ class StdMessenger implements _IMessenger { "title" => [false, "title", null, "t", "", null], "desc" => ["desc", ">", ""], "error" => ["debugE", "e", ""], - "warn" => ["debugW", "w", ""], + "warning" => ["debugW", "w", ""], "note" => ["debugN", "i", ""], "info" => ["debug", "D", ""], "step" => ["*", ".", ""], @@ -674,8 +674,8 @@ class StdMessenger implements _IMessenger { $this->_printGenericOrException($level, "note", $content, $this->getIndentLevel(), $this->err); } - function warn($content, ?int $level=null): void { - $this->_printGenericOrException($level, "warn", $content, $this->getIndentLevel(), $this->err); + function warning($content, ?int $level=null): void { + $this->_printGenericOrException($level, "warning", $content, $this->getIndentLevel(), $this->err); } function error($content, ?int $level=null): void { diff --git a/tbin/legacy-test-console.php b/tbin/legacy-test-console.php index 7746d5d..bb17844 100755 --- a/tbin/legacy-test-console.php +++ b/tbin/legacy-test-console.php @@ -79,7 +79,7 @@ Application::run(new class extends Application { msg::info("info"); msg::note("note"); - msg::warn("warn"); + msg::warning("warning"); msg::error("error"); msg::section("section", function ($msg) { @@ -206,7 +206,7 @@ Application::run(new class extends Application { $msg->info("info"); $msg->note("note"); - $msg->warn("warn"); + $msg->warn("warning"); $msg->error("error"); }); }); diff --git a/tbin/legacy-test-levels.php b/tbin/legacy-test-levels.php index 8e96cbc..a55d8db 100755 --- a/tbin/legacy-test-levels.php +++ b/tbin/legacy-test-levels.php @@ -11,28 +11,28 @@ Application::run(new class extends Application { function main() { msg::title("major", function (IMessenger $msg) { $msg->error("error", msg::MAJOR); - $msg->warn("warn", msg::MAJOR); + $msg->warning("warning", msg::MAJOR); $msg->note("note", msg::MAJOR); $msg->info("info", msg::MAJOR); $msg->info(new ValueException("exception"), msg::MAJOR); }, msg::MAJOR); msg::title("normal", function (IMessenger $msg) { $msg->error("error", msg::NORMAL); - $msg->warn("warn", msg::NORMAL); + $msg->warning("warning", msg::NORMAL); $msg->note("note", msg::NORMAL); $msg->info("info", msg::NORMAL); $msg->info(new ValueException("exception"), msg::NORMAL); }, msg::NORMAL); msg::title("minor", function (IMessenger $msg) { $msg->error("error", msg::MINOR); - $msg->warn("warn", msg::MINOR); + $msg->warning("warning", msg::MINOR); $msg->note("note", msg::MINOR); $msg->info("info", msg::MINOR); $msg->info(new ValueException("exception"), msg::MINOR); }, msg::MINOR); msg::title("debug", function (IMessenger $msg) { $msg->error("error", msg::DEBUG); - $msg->warn("warn", msg::DEBUG); + $msg->warning("warning", msg::DEBUG); $msg->note("note", msg::DEBUG); $msg->info("info", msg::DEBUG); $msg->info(new ValueException("exception"), msg::DEBUG); diff --git a/tbin/test-console.php b/tbin/test-console.php index b499987..85fef16 100755 --- a/tbin/test-console.php +++ b/tbin/test-console.php @@ -107,7 +107,7 @@ $msg->asuccess(); $msg->info("info"); $msg->note("note"); -$msg->warn("warn"); +$msg->warning("warning"); $msg->error("error"); $msg->section("section", function ($msg) { @@ -234,7 +234,7 @@ $msg->section("section", function ($msg) { $msg->info("info"); $msg->note("note"); - $msg->warn("warn"); + $msg->warn("warning"); $msg->error("error"); }); }); @@ -276,4 +276,3 @@ $msg->section("Exceptions", function ($msg) { $msg->info($u2); }); }); -