renommer ::warn() en ::warning() pour la cohérence

This commit is contained in:
Jephté Clain 2024-05-16 09:42:00 +04:00
parent 3b5055b91a
commit eeee4cfffc
7 changed files with 18 additions and 19 deletions

View File

@ -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;

View File

@ -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);}
}

View File

@ -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); } }
}

View File

@ -40,7 +40,7 @@ class StdMessenger implements _IMessenger {
"title" => [false, "TITLE!", null, "<color @b>T", "</color>", "==="],
"desc" => ["DESC!", "<color @b>></color>", ""],
"error" => ["CRIT.ERROR!", "<color @r>E!", "</color>"],
"warn" => ["CRIT.WARN!", "<color @y>W!", "</color>"],
"warning" => ["CRIT.WARNING!", "<color @y>W!", "</color>"],
"note" => ["ATTENTION!", "<color @g>N!", "</color>"],
"info" => ["IMPORTANT!", "<color @b>N!", "</color>"],
"step" => ["*", "<color @w>.</color>", ""],
@ -51,7 +51,7 @@ class StdMessenger implements _IMessenger {
"title" => [false, "TITLE:", null, "<color @b>T</color><color b>", "</color>", "---"],
"desc" => ["DESC:", "<color @b>></color>", ""],
"error" => ["ERROR:", "<color @r>E</color><color r>", "</color>"],
"warn" => ["WARN:", "<color @y>W</color><color y>", "</color>"],
"warning" => ["WARNING:", "<color @y>W</color><color y>", "</color>"],
"note" => ["NOTE:", "<color @g>N</color>", ""],
"info" => ["INFO:", "<color @b>I</color>", ""],
"step" => ["*", "<color @w>.</color>", ""],
@ -62,7 +62,7 @@ class StdMessenger implements _IMessenger {
"title" => [false, "title", null, "<color b>t", "</color>", null],
"desc" => ["desc", "<color b>></color>", ""],
"error" => ["error", "<color r>E</color><color -r>", "</color>"],
"warn" => ["warn", "<color y>W</color><color -y>", "</color>"],
"warning" => ["warning", "<color y>W</color><color -y>", "</color>"],
"note" => ["note", "<color g>N</color>", ""],
"info" => ["info", "<color b>I</color><color w>", "</color>"],
"step" => ["*", "<color w>.</color>", ""],
@ -73,7 +73,7 @@ class StdMessenger implements _IMessenger {
"title" => [false, "title", null, "<color b>t", "</color>", null],
"desc" => ["desc", "<color b>></color>", ""],
"error" => ["debugE", "<color r>e</color><color -r>", "</color>"],
"warn" => ["debugW", "<color y>w</color><color -y>", "</color>"],
"warning" => ["debugW", "<color y>w</color><color -y>", "</color>"],
"note" => ["debugN", "<color b>i</color>", ""],
"info" => ["debug", "<color @w>D</color><color w>", "</color>"],
"step" => ["*", "<color w>.</color>", ""],
@ -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 {

View File

@ -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");
});
});

View File

@ -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);

View File

@ -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);
});
});