From ae87a51b05b69c33cef363930f61121d9bb7820f Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Mon, 25 Feb 2019 13:28:37 +0100 Subject: [PATCH] actions: Improve Action class code for clarity & consistency ~ Move local variable $obj to one liner as it's redundant in this case. ~ Use === check instead of == as in order case above for the purpose of consistency. ~ Make use of single quotes for strings literals instead of double quotes. Change-Id: I69650cacb0658a7369147ea5e9933fb5585e3376 --- includes/actions/Action.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/includes/actions/Action.php b/includes/actions/Action.php index f288a5cb1f..f892c5e34e 100644 --- a/includes/actions/Action.php +++ b/includes/actions/Action.php @@ -101,8 +101,7 @@ abstract class Action implements MessageLocalizer { if ( !class_exists( $classOrCallable ) ) { return false; } - $obj = new $classOrCallable( $page, $context ); - return $obj; + return new $classOrCallable( $page, $context ); } if ( is_callable( $classOrCallable ) ) { @@ -142,7 +141,7 @@ abstract class Action implements MessageLocalizer { } else { $actionName = 'view'; } - } elseif ( $actionName == 'editredlink' ) { + } elseif ( $actionName === 'editredlink' ) { $actionName = 'edit'; } @@ -359,7 +358,7 @@ abstract class Action implements MessageLocalizer { */ protected function setHeaders() { $out = $this->getOutput(); - $out->setRobotPolicy( "noindex,nofollow" ); + $out->setRobotPolicy( 'noindex,nofollow' ); $out->setPageTitle( $this->getPageTitle() ); $out->setSubtitle( $this->getDescription() ); $out->setArticleRelated( true ); -- 2.20.1