From e01619b17a59c11c411b56a6c8c06a05960b32df Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Sat, 23 Mar 2019 00:10:41 +0100 Subject: [PATCH] block: Avoid use of empty() which doesn't warn on var non-existence As empty() is more tolerant and doesn't warn on variable non-existence and will go ahead and treat it as if it has the value null, it's better to use ! in this case to make sure we catch even things like typos in the variable names within the code base. Let's make sure intended checks are actually checked instead of being tolerant. Follow up on: Ibaf555fac293da46fa397ccb9, thanks @Krinkle. Change-Id: Ibc45dba373bbbb6735a9681ed07a2438d4073ee0 --- includes/block/BlockRestriction.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/block/BlockRestriction.php b/includes/block/BlockRestriction.php index 72f6eaa9b6..c5ab16f40d 100644 --- a/includes/block/BlockRestriction.php +++ b/includes/block/BlockRestriction.php @@ -73,7 +73,7 @@ class BlockRestriction { * @return bool */ public static function insert( array $restrictions ) { - if ( empty( $restrictions ) ) { + if ( !$restrictions ) { return false; } @@ -85,7 +85,7 @@ class BlockRestriction { $rows[] = $restriction->toRow(); } - if ( empty( $rows ) ) { + if ( !$rows ) { return false; } -- 2.20.1