Simplify PHP by using ?? and ?:
[lhc/web/wiklou.git] / includes / CommentStore.php
index e9b08e8..1fea309 100644 (file)
@@ -138,7 +138,7 @@ class CommentStore {
         * @return string
         */
        private function getKey( $methodKey = null ) {
-               $key = $this->key !== null ? $this->key : $methodKey;
+               $key = $this->key ?? $methodKey;
                if ( $key === null ) {
                        // @codeCoverageIgnoreStart
                        throw new InvalidArgumentException( '$key should not be null' );
@@ -261,7 +261,7 @@ class CommentStore {
        private function getCommentInternal( IDatabase $db = null, $key, $row, $fallback = false ) {
                $row = (array)$row;
                if ( array_key_exists( "{$key}_text", $row ) && array_key_exists( "{$key}_data", $row ) ) {
-                       $cid = isset( $row["{$key}_cid"] ) ? $row["{$key}_cid"] : null;
+                       $cid = $row["{$key}_cid"] ?? null;
                        $text = $row["{$key}_text"];
                        $data = $row["{$key}_data"];
                } elseif ( $this->stage === MIGRATION_OLD ) {