From 74faccfa264fca219e08ae9cfb60a355ec2fac39 Mon Sep 17 00:00:00 2001 From: Kevin Israel Date: Sun, 24 Aug 2014 02:52:38 -0400 Subject: [PATCH] Change case of class names to match declarations Found by running tests under a version of PHP patched to report case mismatches as E_STRICT errors. User classes: * MIMEsearchPage * MostlinkedTemplatesPage * SpecialBookSources * UnwatchedpagesPage Internal classes: * DOMXPath * stdClass * XMLReader Did not change: * testautoLoadedcamlCLASS * testautoloadedserializedclass Change-Id: Idc8caa82cd6adb7bab44b142af2b02e15f0a89ee --- includes/HtmlFormatter.php | 2 +- includes/Import.php | 18 ++++++++--------- includes/media/SVGMetadataExtractor.php | 20 +++++++++---------- includes/page/WikiPage.php | 6 +++--- includes/specialpage/QueryPage.php | 4 ++-- .../exception/MWExceptionHandlerTest.php | 2 +- .../specials/SpecialBooksourcesTest.php | 4 ++-- .../specials/SpecialMIMESearchTest.php | 4 ++-- tests/phpunit/maintenance/DumpTestCase.php | 2 +- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/includes/HtmlFormatter.php b/includes/HtmlFormatter.php index ccbfba8211..e5efb5b8ec 100644 --- a/includes/HtmlFormatter.php +++ b/includes/HtmlFormatter.php @@ -178,7 +178,7 @@ class HtmlFormatter { // CSS Classes $domElemsToRemove = array(); - $xpath = new DOMXpath( $doc ); + $xpath = new DOMXPath( $doc ); foreach ( $removals['CLASS'] as $classToRemove ) { $elements = $xpath->query( '//*[contains(@class, "' . $classToRemove . '")]' ); diff --git a/includes/Import.php b/includes/Import.php index 6f933519d6..5b86fec848 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -424,11 +424,11 @@ class WikiImporter { $buffer = ""; while ( $this->reader->read() ) { switch ( $this->reader->nodeType ) { - case XmlReader::TEXT: - case XmlReader::SIGNIFICANT_WHITESPACE: + case XMLReader::TEXT: + case XMLReader::SIGNIFICANT_WHITESPACE: $buffer .= $this->reader->value; break; - case XmlReader::END_ELEMENT: + case XMLReader::END_ELEMENT: return $buffer; } } @@ -466,7 +466,7 @@ class WikiImporter { if ( !Hooks::run( 'ImportHandleToplevelXMLTag', array( $this ) ) ) { // Do nothing - } elseif ( $tag == 'mediawiki' && $type == XmlReader::END_ELEMENT ) { + } elseif ( $tag == 'mediawiki' && $type == XMLReader::END_ELEMENT ) { break; } elseif ( $tag == 'siteinfo' ) { $this->handleSiteInfo(); @@ -516,7 +516,7 @@ class WikiImporter { 'logtitle', 'params' ); while ( $this->reader->read() ) { - if ( $this->reader->nodeType == XmlReader::END_ELEMENT && + if ( $this->reader->nodeType == XMLReader::END_ELEMENT && $this->reader->name == 'logitem' ) { break; } @@ -580,7 +580,7 @@ class WikiImporter { $badTitle = false; while ( $skip ? $this->reader->next() : $this->reader->read() ) { - if ( $this->reader->nodeType == XmlReader::END_ELEMENT && + if ( $this->reader->nodeType == XMLReader::END_ELEMENT && $this->reader->name == 'page' ) { break; } @@ -645,7 +645,7 @@ class WikiImporter { $skip = false; while ( $skip ? $this->reader->next() : $this->reader->read() ) { - if ( $this->reader->nodeType == XmlReader::END_ELEMENT && + if ( $this->reader->nodeType == XMLReader::END_ELEMENT && $this->reader->name == 'revision' ) { break; } @@ -737,7 +737,7 @@ class WikiImporter { $skip = false; while ( $skip ? $this->reader->next() : $this->reader->read() ) { - if ( $this->reader->nodeType == XmlReader::END_ELEMENT && + if ( $this->reader->nodeType == XMLReader::END_ELEMENT && $this->reader->name == 'upload' ) { break; } @@ -835,7 +835,7 @@ class WikiImporter { $info = array(); while ( $this->reader->read() ) { - if ( $this->reader->nodeType == XmlReader::END_ELEMENT && + if ( $this->reader->nodeType == XMLReader::END_ELEMENT && $this->reader->name == 'contributor' ) { break; } diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index 2a1091d81d..2037c33186 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -138,7 +138,7 @@ class SVGReader { $keepReading = $this->reader->read(); /* Skip until first element */ - while ( $keepReading && $this->reader->nodeType != XmlReader::ELEMENT ) { + while ( $keepReading && $this->reader->nodeType != XMLReader::ELEMENT ) { $keepReading = $this->reader->read(); } @@ -158,7 +158,7 @@ class SVGReader { $this->debug( "$tag" ); - if ( $isSVG && $tag == 'svg' && $type == XmlReader::END_ELEMENT + if ( $isSVG && $tag == 'svg' && $type == XMLReader::END_ELEMENT && $this->reader->depth <= $exitDepth ) { break; @@ -166,7 +166,7 @@ class SVGReader { $this->readField( $tag, 'title' ); } elseif ( $isSVG && $tag == 'desc' ) { $this->readField( $tag, 'description' ); - } elseif ( $isSVG && $tag == 'metadata' && $type == XmlReader::ELEMENT ) { + } elseif ( $isSVG && $tag == 'metadata' && $type == XMLReader::ELEMENT ) { $this->readXml( $tag, 'metadata' ); } elseif ( $isSVG && $tag == 'script' ) { // We normally do not allow scripted svgs. @@ -199,17 +199,17 @@ class SVGReader { */ private function readField( $name, $metafield = null ) { $this->debug( "Read field $metafield" ); - if ( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) { + if ( !$metafield || $this->reader->nodeType != XMLReader::ELEMENT ) { return; } $keepReading = $this->reader->read(); while ( $keepReading ) { if ( $this->reader->localName == $name && $this->reader->namespaceURI == self::NS_SVG - && $this->reader->nodeType == XmlReader::END_ELEMENT + && $this->reader->nodeType == XMLReader::END_ELEMENT ) { break; - } elseif ( $this->reader->nodeType == XmlReader::TEXT ) { + } elseif ( $this->reader->nodeType == XMLReader::TEXT ) { $this->metadata[$metafield] = trim( $this->reader->value ); } $keepReading = $this->reader->read(); @@ -224,7 +224,7 @@ class SVGReader { */ private function readXml( $metafield = null ) { $this->debug( "Read top level metadata" ); - if ( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) { + if ( !$metafield || $this->reader->nodeType != XMLReader::ELEMENT ) { return; } // @todo Find and store type of xml snippet. metadata['metadataType'] = "rdf" @@ -246,7 +246,7 @@ class SVGReader { */ private function animateFilterAndLang( $name ) { $this->debug( "animate filter for tag $name" ); - if ( $this->reader->nodeType != XmlReader::ELEMENT ) { + if ( $this->reader->nodeType != XMLReader::ELEMENT ) { return; } if ( $this->reader->isEmptyElement ) { @@ -256,11 +256,11 @@ class SVGReader { $keepReading = $this->reader->read(); while ( $keepReading ) { if ( $this->reader->localName == $name && $this->reader->depth <= $exitDepth - && $this->reader->nodeType == XmlReader::END_ELEMENT + && $this->reader->nodeType == XMLReader::END_ELEMENT ) { break; } elseif ( $this->reader->namespaceURI == self::NS_SVG - && $this->reader->nodeType == XmlReader::ELEMENT + && $this->reader->nodeType == XMLReader::ELEMENT ) { $sysLang = $this->reader->getAttribute( 'systemLanguage' ); diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 41dc8020ab..282506470c 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -50,7 +50,7 @@ class WikiPage implements Page, IDBAccessObject { public $mLatest = false; // !< Integer (false means "not loaded") /**@}}*/ - /** @var stdclass Map of cache fields (text, parser output, ect) for a proposed/new edit */ + /** @var stdClass Map of cache fields (text, parser output, ect) for a proposed/new edit */ public $mPreparedEdit = false; /** @@ -2050,7 +2050,7 @@ class WikiPage implements Page, IDBAccessObject { /** * Prepare text which is about to be saved. - * Returns a stdclass with source, pst and output members + * Returns a stdClass with source, pst and output members * * @deprecated since 1.21: use prepareContentForEdit instead. * @return object @@ -2063,7 +2063,7 @@ class WikiPage implements Page, IDBAccessObject { /** * Prepare content which is about to be saved. - * Returns a stdclass with source, pst and output members + * Returns a stdClass with source, pst and output members * * @param Content $content * @param int|null $revid diff --git a/includes/specialpage/QueryPage.php b/includes/specialpage/QueryPage.php index dd21af49fb..1ff7e3fb98 100644 --- a/includes/specialpage/QueryPage.php +++ b/includes/specialpage/QueryPage.php @@ -81,7 +81,7 @@ abstract class QueryPage extends SpecialPage { array( 'MostimagesPage', 'Mostimages' ), array( 'MostinterwikisPage', 'Mostinterwikis' ), array( 'MostlinkedCategoriesPage', 'Mostlinkedcategories' ), - array( 'MostlinkedtemplatesPage', 'Mostlinkedtemplates' ), + array( 'MostlinkedTemplatesPage', 'Mostlinkedtemplates' ), array( 'MostlinkedPage', 'Mostlinked' ), array( 'MostrevisionsPage', 'Mostrevisions' ), array( 'FewestrevisionsPage', 'Fewestrevisions' ), @@ -96,7 +96,7 @@ abstract class QueryPage extends SpecialPage { array( 'WantedFilesPage', 'Wantedfiles' ), array( 'WantedPagesPage', 'Wantedpages' ), array( 'WantedTemplatesPage', 'Wantedtemplates' ), - array( 'UnwatchedPagesPage', 'Unwatchedpages' ), + array( 'UnwatchedpagesPage', 'Unwatchedpages' ), array( 'UnusedtemplatesPage', 'Unusedtemplates' ), array( 'WithoutInterwikiPage', 'Withoutinterwiki' ), ); diff --git a/tests/phpunit/includes/exception/MWExceptionHandlerTest.php b/tests/phpunit/includes/exception/MWExceptionHandlerTest.php index dc5dc6aa32..d73f17d98f 100644 --- a/tests/phpunit/includes/exception/MWExceptionHandlerTest.php +++ b/tests/phpunit/includes/exception/MWExceptionHandlerTest.php @@ -15,7 +15,7 @@ class MWExceptionHandlerTest extends MediaWikiTestCase { $refvar = 'value'; try { $array = array( 'a', 'b' ); - $object = new StdClass(); + $object = new stdClass(); self::helperThrowAnException( $array, $object, $refvar ); } catch ( Exception $e ) { } diff --git a/tests/phpunit/includes/specials/SpecialBooksourcesTest.php b/tests/phpunit/includes/specials/SpecialBooksourcesTest.php index d341ccf128..69485a034e 100644 --- a/tests/phpunit/includes/specials/SpecialBooksourcesTest.php +++ b/tests/phpunit/includes/specials/SpecialBooksourcesTest.php @@ -27,10 +27,10 @@ class SpecialBooksourcesTest extends MediaWikiTestCase { } /** - * @covers SpecialBooksources::isValidISBN + * @covers SpecialBookSources::isValidISBN * @dataProvider provideISBNs */ public function testIsValidISBN( $isbn, $isValid ) { - $this->assertSame( $isValid, SpecialBooksources::isValidISBN( $isbn ) ); + $this->assertSame( $isValid, SpecialBookSources::isValidISBN( $isbn ) ); } } diff --git a/tests/phpunit/includes/specials/SpecialMIMESearchTest.php b/tests/phpunit/includes/specials/SpecialMIMESearchTest.php index 14d196851a..fe1c9e83b1 100644 --- a/tests/phpunit/includes/specials/SpecialMIMESearchTest.php +++ b/tests/phpunit/includes/specials/SpecialMIMESearchTest.php @@ -5,11 +5,11 @@ class SpecialMIMESearchTest extends MediaWikiTestCase { - /** @var MIMESearchPage */ + /** @var MIMEsearchPage */ private $page; function setUp() { - $this->page = new MIMESearchPage; + $this->page = new MIMEsearchPage; $context = new RequestContext(); $context->setTitle( Title::makeTitle( NS_SPECIAL, 'MIMESearch' ) ); $context->setRequest( new FauxRequest() ); diff --git a/tests/phpunit/maintenance/DumpTestCase.php b/tests/phpunit/maintenance/DumpTestCase.php index 9e62751ec8..8c76397053 100644 --- a/tests/phpunit/maintenance/DumpTestCase.php +++ b/tests/phpunit/maintenance/DumpTestCase.php @@ -19,7 +19,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { protected $exceptionFromAddDBData = null; /** - * Holds the xmlreader used for analyzing an xml dump + * Holds the XMLReader used for analyzing an XML dump * * @var XMLReader|null */ -- 2.20.1