block: Avoid use of is_null() PHP function where necessary
authorDerick Alangi <alangiderick@gmail.com>
Fri, 11 Jan 2019 15:49:44 +0000 (16:49 +0100)
committerDerick Alangi <alangiderick@gmail.com>
Fri, 11 Jan 2019 15:49:44 +0000 (16:49 +0100)
WRT performance, is_null() is a few nanoseconds slower than === null
due to function call overhead. Also, I personally think using the
identical check on null is slightly more readable than using is_null().

Change-Id: I83cd7a6ca49acc548a7f46b2c37dfa189889bd19

includes/block/BlockRestriction.php

index 5fe9650..3baa063 100644 (file)
@@ -38,7 +38,7 @@ class BlockRestriction {
         * @return Restriction[]
         */
        public static function loadByBlockId( $blockId, IDatabase $db = null ) {
-               if ( is_null( $blockId ) || $blockId === [] ) {
+               if ( $blockId === null || $blockId === [] ) {
                        return [];
                }