From 2aa21982f5a9d2f4f09dcca94f68d279eb83faba Mon Sep 17 00:00:00 2001 From: Peter van Westen Date: Tue, 2 May 2017 11:50:36 +0200 Subject: [PATCH 1/2] [5.4] Refactors if structure in parseVerbosity Refactors the `if/ifelse` statement in the `parseVerbosity` method to use early returns. This makes it more readable and removes the use of the `else` keyword. --- src/Illuminate/Console/Command.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Console/Command.php b/src/Illuminate/Console/Command.php index 0ae9662fa802..7301c69489d2 100755 --- a/src/Illuminate/Console/Command.php +++ b/src/Illuminate/Console/Command.php @@ -510,9 +510,11 @@ protected function setVerbosity($level) protected function parseVerbosity($level = null) { if (isset($this->verbosityMap[$level])) { - $level = $this->verbosityMap[$level]; - } elseif (! is_int($level)) { - $level = $this->verbosity; + return $this->verbosityMap[$level]; + } + + if (! is_int($level)) { + return $this->verbosity; } return $level; From 2b9749169f7bc5182f29f83d76d929bf9af7b8f2 Mon Sep 17 00:00:00 2001 From: Peter van Westen Date: Tue, 2 May 2017 11:51:40 +0200 Subject: [PATCH 2/2] Fixes indentation --- src/Illuminate/Console/Command.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Console/Command.php b/src/Illuminate/Console/Command.php index 7301c69489d2..b4b5ba6ea082 100755 --- a/src/Illuminate/Console/Command.php +++ b/src/Illuminate/Console/Command.php @@ -510,11 +510,11 @@ protected function setVerbosity($level) protected function parseVerbosity($level = null) { if (isset($this->verbosityMap[$level])) { - return $this->verbosityMap[$level]; + return $this->verbosityMap[$level]; } if (! is_int($level)) { - return $this->verbosity; + return $this->verbosity; } return $level;