Improve type-safety

This commit is contained in:
Joshua Ramon Enslin 2020-08-27 16:14:18 +02:00 committed by Stefan Rohde-Enslin
parent 37b6c6f7ac
commit e691f517f9
2 changed files with 4 additions and 4 deletions

View File

@ -94,7 +94,7 @@ class MDConsole {
$levelColor = self::CONSOLE_LEVEL_COLORS[$level];
if (empty($link))
if ($link === "")
echo sprintf("\033[1;30;" . $levelColor . "m_____\033[0m\033[0m %-20s \033[40m::\033[0m # \033[32m%+9s\033[0m \033[40m::\033[0m 📝 %-50s \033[40m::\033[0m 📅 %+20s\n", $context, $editedNo, $additionalNote, $date);
else
echo sprintf("\033[1;30;" . $levelColor . "m_____\033[0m\033[0m %-20s \033[40m::\033[0m # \033[32m%+9s\033[0m \033[40m::\033[0m 📝 %-50s \033[40m::\033[0m 📅 %+20s \033[40m::\033[0m $link\n", $context, $editedNo, $additionalNote, $date);;
@ -109,7 +109,7 @@ class MDConsole {
final public static function setupCLI():void {
$startTime = microtime(true);
register_shutdown_function(function($startTime) {
register_shutdown_function(function($startTime):void {
$duration = microtime(true) - $startTime;

View File

@ -126,7 +126,7 @@ class MDOutputHandler {
break;
}
if (!empty($this->_context)) $contextStr = "{$this->_context}";
if ($this->_context !== "") $contextStr = "{$this->_context}";
else $contextStr = "";
// Generate the message to log.
@ -136,7 +136,7 @@ class MDOutputHandler {
file_put_contents($this->_logfile, $message, FILE_APPEND);
}
if (($this->_verbosity > 0 && in_array($statusCode, [MDConsole::STATUS_UPDATE, MDConsole::STATUS_DELETION, MDConsole::STATUS_ERROR])) || $this->_verbosity === 2) echo $message;
if (($this->_verbosity > 0 && in_array($statusCode, [MDConsole::STATUS_UPDATE, MDConsole::STATUS_DELETION, MDConsole::STATUS_ERROR], true)) || $this->_verbosity === 2) echo $message;
if ($this->_counter % 250 === 0) {
echo '―――> ' . sprintf("%1$07d", $this->_counter) . " operations processed" . PHP_EOL;