Safe replacement of a lot of `!count()` with `=== []`
[lhc/web/wiklou.git] / includes / parser / Preprocessor_DOM.php
index 104cd13..3bcd012 100644 (file)
@@ -878,7 +878,7 @@ class PPDStack {
        }
 
        public function pop() {
-               if ( !count( $this->stack ) ) {
+               if ( $this->stack === [] ) {
                        throw new MWException( __METHOD__ . ': no elements remaining' );
                }
                $temp = array_pop( $this->stack );
@@ -902,7 +902,7 @@ class PPDStack {
         * @return array
         */
        public function getFlags() {
-               if ( !count( $this->stack ) ) {
+               if ( $this->stack === [] ) {
                        return [
                                'findEquals' => false,
                                'findPipe' => false,
@@ -1547,7 +1547,7 @@ class PPFrame_DOM implements PPFrame {
                if ( $level === false ) {
                        return $this->title->getPrefixedDBkey();
                } else {
-                       return isset( $this->titleCache[$level] ) ? $this->titleCache[$level] : false;
+                       return $this->titleCache[$level] ?? false;
                }
        }
 
@@ -1876,10 +1876,7 @@ class PPCustomFrame_DOM extends PPFrame_DOM {
         * @return string|bool
         */
        public function getArgument( $index ) {
-               if ( !isset( $this->args[$index] ) ) {
-                       return false;
-               }
-               return $this->args[$index];
+               return $this->args[$index] ?? false;
        }
 
        public function getArguments() {