From: Max Semenik Date: Sun, 10 Mar 2019 08:08:44 +0000 (-0800) Subject: Remove a few method_exists() checks X-Git-Tag: 1.34.0-rc.0~2568 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=73f29466c496d8a3f3f0eddd5320a567ab0a6125;p=lhc%2Fweb%2Fwiklou.git Remove a few method_exists() checks These functions are present in every PHP version we support now. Change-Id: I11add0fc9f6c3c3caff859db9c0475c4d2818577 --- diff --git a/includes/libs/rdbms/database/DatabaseMysqli.php b/includes/libs/rdbms/database/DatabaseMysqli.php index d0bd1b3805..1c4ed56d40 100644 --- a/includes/libs/rdbms/database/DatabaseMysqli.php +++ b/includes/libs/rdbms/database/DatabaseMysqli.php @@ -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 ); } /** diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index f8b0c3c9c0..bc5eb09a4f 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -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(); } diff --git a/tests/phpunit/includes/session/TestUtils.php b/tests/phpunit/includes/session/TestUtils.php index ef8fb4ea7e..1d87c9036f 100644 --- a/tests/phpunit/includes/session/TestUtils.php +++ b/tests/phpunit/includes/session/TestUtils.php @@ -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;