From d34d890a325bbc0efda7cdd8eea677ee13104bfc Mon Sep 17 00:00:00 2001 From: Alexander Mohorev Date: Tue, 9 Jun 2015 00:10:09 +0300 Subject: [PATCH] PSR-2 if-else statement --- framework/base/Widget.php | 2 +- framework/console/controllers/CacheController.php | 2 +- framework/helpers/BaseStringHelper.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/framework/base/Widget.php b/framework/base/Widget.php index 3e3f40a925..8281902b49 100644 --- a/framework/base/Widget.php +++ b/framework/base/Widget.php @@ -98,7 +98,7 @@ class Widget extends Component implements ViewContextInterface $out = $widget->run(); } catch (\Exception $e) { // close the output buffer opened above if it has not been closed already - if(ob_get_level() > 0) { + if (ob_get_level() > 0) { ob_end_clean(); } throw $e; diff --git a/framework/console/controllers/CacheController.php b/framework/console/controllers/CacheController.php index 782a99c6fc..2fdb8f1dbd 100644 --- a/framework/console/controllers/CacheController.php +++ b/framework/console/controllers/CacheController.php @@ -150,7 +150,7 @@ class CacheController extends Controller if (!$connection instanceof \yii\db\Connection) { $this->stdout("\"$db\" component doesn't inherit \\yii\\db\\Connection.\n", Console::FG_RED); return self::EXIT_CODE_ERROR; - } else if (!$this->confirm("Flush cache schema for \"$db\" connection?")) { + } elseif (!$this->confirm("Flush cache schema for \"$db\" connection?")) { return static::EXIT_CODE_NORMAL; } diff --git a/framework/helpers/BaseStringHelper.php b/framework/helpers/BaseStringHelper.php index 674828af85..c9114404f5 100644 --- a/framework/helpers/BaseStringHelper.php +++ b/framework/helpers/BaseStringHelper.php @@ -161,7 +161,7 @@ class BaseStringHelper if ($token instanceof \HTMLPurifier_Token_Start) { //Tag begins $openTokens++; $truncated[] = $token; - } else if ($token instanceof \HTMLPurifier_Token_Text && $totalCount <= $count) { //Text + } elseif ($token instanceof \HTMLPurifier_Token_Text && $totalCount <= $count) { //Text if (false === $encoding) { $token->data = self::truncateWords($token->data, $count - $totalCount, ''); $currentCount = str_word_count($token->data); @@ -174,10 +174,10 @@ class BaseStringHelper $token->data = ' ' . $token->data; } $truncated[] = $token; - } else if ($token instanceof \HTMLPurifier_Token_End) { //Tag ends + } elseif ($token instanceof \HTMLPurifier_Token_End) { //Tag ends $openTokens--; $truncated[] = $token; - } else if ($token instanceof \HTMLPurifier_Token_Empty) { //Self contained tags, i.e. etc. + } elseif ($token instanceof \HTMLPurifier_Token_Empty) { //Self contained tags, i.e. etc. $truncated[] = $token; } if (0 === $openTokens && $totalCount >= $count) {