Merge "Use gettype only for debugging text"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 18 Mar 2013 18:44:59 +0000 (18:44 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 18 Mar 2013 18:44:59 +0000 (18:44 +0000)
1  2 
includes/media/Exif.php
languages/Language.php

diff --combined includes/media/Exif.php
@@@ -363,7 -363,7 +363,7 @@@ class Exif 
         * As an alternative approach, some of this could be done in the validate phase
         * if we make up our own types like Exif::DATE.
         */
 -      function collapseData( ) {
 +      function collapseData() {
  
                $this->exifGPStoNumber( 'GPSLatitude' );
                $this->exifGPStoNumber( 'GPSDestLatitude' );
         *
         * @deprecated since 1.18
         */
 -      function makeFormattedData( ) {
 +      function makeFormattedData() {
                wfDeprecated( __METHOD__, '1.18' );
                $this->mFormattedExifData = FormatMetadata::getFormattedData(
                        $this->mFilteredExifData );
         */
        private function isRational( $in ) {
                $m = array();
 -              if ( !is_array( $in ) && @preg_match( '/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/', $in, $m ) ) { # Avoid division by zero
 +              if ( !is_array( $in ) && preg_match( '/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/', $in, $m ) ) { # Avoid division by zero
                        return $this->isLong( $m[1] ) && $this->isLong( $m[2] );
                } else {
                        $this->debug( $in, __FUNCTION__, 'fed a non-fraction value' );
                }
                $type = gettype( $in );
                $class = ucfirst( __CLASS__ );
-               if ( $type === 'array' ) {
+               if ( is_array( $in ) ) {
                        $in = print_r( $in, true );
                }
  
diff --combined languages/Language.php
@@@ -349,12 -349,12 +349,12 @@@ class Language 
        public static function isValidBuiltInCode( $code ) {
  
                if ( !is_string( $code ) ) {
-                       $type = gettype( $code );
-                       if ( $type === 'object' ) {
+                       if ( is_object( $code ) ) {
                                $addmsg = " of class " . get_class( $code );
                        } else {
                                $addmsg = '';
                        }
+                       $type = gettype( $code );
                        throw new MWException( __METHOD__ . " must be passed a string, $type given$addmsg" );
                }
  
        /**
         * Resets all of the namespace caches. Mainly used for testing
         */
 -      public function resetNamespaces( ) {
 +      public function resetNamespaces() {
                $this->namespaceNames = null;
                $this->mNamespaceIds = null;
                $this->namespaceAliases = null;