Remove a few method_exists() checks
authorMax Semenik <maxsem.wiki@gmail.com>
Sun, 10 Mar 2019 08:08:44 +0000 (00:08 -0800)
committerMax Semenik <maxsem.wiki@gmail.com>
Sun, 10 Mar 2019 08:17:12 +0000 (00:17 -0800)
These functions are present in every PHP version we support now.

Change-Id: I11add0fc9f6c3c3caff859db9c0475c4d2818577

includes/libs/rdbms/database/DatabaseMysqli.php
includes/media/SVGMetadataExtractor.php
tests/phpunit/includes/session/TestUtils.php

index d0bd1b3..1c4ed56 100644 (file)
@@ -139,11 +139,7 @@ class DatabaseMysqli extends DatabaseMysqlBase {
        protected function mysqlSetCharset( $charset ) {
                $conn = $this->getBindingHandle();
 
-               if ( method_exists( $conn, 'set_charset' ) ) {
-                       return $conn->set_charset( $charset );
-               } else {
-                       return $this->query( 'SET NAMES ' . $charset, __METHOD__ );
-               }
+               return $conn->set_charset( $charset );
        }
 
        /**
index f8b0c3c..bc5eb09 100644 (file)
@@ -226,13 +226,8 @@ class SVGReader {
                        return;
                }
                // @todo Find and store type of xml snippet. metadata['metadataType'] = "rdf"
-               if ( method_exists( $this->reader, 'readInnerXML' ) ) {
-                       $this->metadata[$metafield] = trim( $this->reader->readInnerXml() );
-               } else {
-                       throw new MWException( "The PHP XMLReader extension does not come " .
-                               "with readInnerXML() method. Your libxml is probably out of " .
-                               "date (need 2.6.20 or later)." );
-               }
+               $this->metadata[$metafield] = trim( $this->reader->readInnerXml() );
+
                $this->reader->next();
        }
 
index ef8fb4e..1d87c90 100644 (file)
@@ -85,11 +85,6 @@ class TestUtils {
         */
        public static function getDummySession( $backend = null, $index = -1, $logger = null ) {
                $rc = new \ReflectionClass( Session::class );
-               if ( !method_exists( $rc, 'newInstanceWithoutConstructor' ) ) {
-                       \PHPUnit_Framework_Assert::markTestSkipped(
-                               'ReflectionClass::newInstanceWithoutConstructor isn\'t available'
-                       );
-               }
 
                if ( $backend === null ) {
                        $backend = new DummySessionBackend;