[MediaWiki-commits] [Gerrit] mediawiki...TextExtracts[master]: CodeSniffer fixes
jenkins-bot has submitted this change and it was merged. Change subject: CodeSniffer fixes .. CodeSniffer fixes Change-Id: I8bdcd2250bd3163fe40ce4685eb04bffe53afdca --- M includes/ApiQueryExtracts.php M includes/ExtractFormatter.php M includes/Hooks.php M tests/phpunit/ExtractFormatterTest.php 4 files changed, 83 insertions(+), 84 deletions(-) Approvals: Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/ApiQueryExtracts.php b/includes/ApiQueryExtracts.php index ce7f70a..e704cef 100644 --- a/includes/ApiQueryExtracts.php +++ b/includes/ApiQueryExtracts.php @@ -48,7 +48,7 @@ /** * @var array */ - private $supportedContentModels = array( 'wikitext' ); + private $supportedContentModels = [ 'wikitext' ]; public function __construct( $query, $moduleName, Config $conf ) { parent::__construct( $query, $moduleName, 'ex' ); @@ -91,9 +91,9 @@ } if ( $isXml ) { - $fit = $result->addValue( array( 'query', 'pages', $id ), 'extract', array( '*' => $text ) ); + $fit = $result->addValue( [ 'query', 'pages', $id ], 'extract', [ '*' => $text ] ); } else { - $fit = $result->addValue( array( 'query', 'pages', $id ), 'extract', $text ); + $fit = $result->addValue( [ 'query', 'pages', $id ], 'extract', $text ); } if ( !$fit ) { $this->setContinueEnumParameter( 'continue', $continue + $count - 1 ); @@ -196,33 +196,33 @@ return $text; } } - $request = array( + $request = [ 'action' => 'parse', 'page' => $page->getTitle()->getPrefixedText(), 'prop' => 'text' - ); + ]; if ( $this->params['intro'] ) { $request['section'] = 0; } // in case of cache miss, render just the needed section - $api = new ApiMain( new FauxRequest( $request ) ); + $api = new ApiMain( new FauxRequest( $request ) ); try { $api->execute(); - $data = $api->getResult()->getResultData( null, array( - 'BC' => array(), - 'Types' => array(), - ) ); + $data = $api->getResult()->getResultData( null, [ + 'BC' => [], + 'Types' => [], + ] ); } catch ( UsageException $e ) { if ( $e->getCodeString() === 'nosuchsection' ) { // Looks like we tried to get the intro to a page without // sections! Lets just grab what we can get. unset( $request['section'] ); - $api = new ApiMain( new FauxRequest( $request ) ); + $api = new ApiMain( new FauxRequest( $request ) ); $api->execute(); - $data = $api->getResult()->getResultData( null, array( - 'BC' => array(), - 'Types' => array(), - ) ); + $data = $api->getResult()->getResultData( null, [ + 'BC' => [], + 'Types' => [], + ] ); } else { // Some other unexpected error - lets just report it to the user // on the off chance that is the right thing. @@ -304,7 +304,7 @@ */ private function tidy( $text ) { if ( $this->getConfig()->get( 'UseTidy' ) && !$this->params['plaintext'] ) { - $text = trim ( MWTidy::tidy( $text ) ); + $text = trim( MWTidy::tidy( $text ) ); } return $text; } @@ -312,7 +312,7 @@ private function doSections( $text ) { $text = preg_replace_callback( "/" . ExtractFormatter::SECTION_MARKER_START . '(\d)'. ExtractFormatter::SECTION_MARKER_END . "(.*?)$/m", - array( $this, 'sectionCallback' ), + [ $this, 'sectionCallback' ], $text ); return $text; @@ -336,44 +336,44 @@ } public
[MediaWiki-commits] [Gerrit] mediawiki...TextExtracts[master]: CodeSniffer fixes
MaxSem has uploaded a new change for review. https://gerrit.wikimedia.org/r/312446 Change subject: CodeSniffer fixes .. CodeSniffer fixes Change-Id: I8bdcd2250bd3163fe40ce4685eb04bffe53afdca --- M includes/ApiQueryExtracts.php M includes/ExtractFormatter.php M includes/Hooks.php M tests/phpunit/ExtractFormatterTest.php 4 files changed, 83 insertions(+), 84 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TextExtracts refs/changes/46/312446/1 diff --git a/includes/ApiQueryExtracts.php b/includes/ApiQueryExtracts.php index ce7f70a..e704cef 100644 --- a/includes/ApiQueryExtracts.php +++ b/includes/ApiQueryExtracts.php @@ -48,7 +48,7 @@ /** * @var array */ - private $supportedContentModels = array( 'wikitext' ); + private $supportedContentModels = [ 'wikitext' ]; public function __construct( $query, $moduleName, Config $conf ) { parent::__construct( $query, $moduleName, 'ex' ); @@ -91,9 +91,9 @@ } if ( $isXml ) { - $fit = $result->addValue( array( 'query', 'pages', $id ), 'extract', array( '*' => $text ) ); + $fit = $result->addValue( [ 'query', 'pages', $id ], 'extract', [ '*' => $text ] ); } else { - $fit = $result->addValue( array( 'query', 'pages', $id ), 'extract', $text ); + $fit = $result->addValue( [ 'query', 'pages', $id ], 'extract', $text ); } if ( !$fit ) { $this->setContinueEnumParameter( 'continue', $continue + $count - 1 ); @@ -196,33 +196,33 @@ return $text; } } - $request = array( + $request = [ 'action' => 'parse', 'page' => $page->getTitle()->getPrefixedText(), 'prop' => 'text' - ); + ]; if ( $this->params['intro'] ) { $request['section'] = 0; } // in case of cache miss, render just the needed section - $api = new ApiMain( new FauxRequest( $request ) ); + $api = new ApiMain( new FauxRequest( $request ) ); try { $api->execute(); - $data = $api->getResult()->getResultData( null, array( - 'BC' => array(), - 'Types' => array(), - ) ); + $data = $api->getResult()->getResultData( null, [ + 'BC' => [], + 'Types' => [], + ] ); } catch ( UsageException $e ) { if ( $e->getCodeString() === 'nosuchsection' ) { // Looks like we tried to get the intro to a page without // sections! Lets just grab what we can get. unset( $request['section'] ); - $api = new ApiMain( new FauxRequest( $request ) ); + $api = new ApiMain( new FauxRequest( $request ) ); $api->execute(); - $data = $api->getResult()->getResultData( null, array( - 'BC' => array(), - 'Types' => array(), - ) ); + $data = $api->getResult()->getResultData( null, [ + 'BC' => [], + 'Types' => [], + ] ); } else { // Some other unexpected error - lets just report it to the user // on the off chance that is the right thing. @@ -304,7 +304,7 @@ */ private function tidy( $text ) { if ( $this->getConfig()->get( 'UseTidy' ) && !$this->params['plaintext'] ) { - $text = trim ( MWTidy::tidy( $text ) ); + $text = trim( MWTidy::tidy( $text ) ); } return $text; } @@ -312,7 +312,7 @@ private function doSections( $text ) { $text = preg_replace_callback( "/" . ExtractFormatter::SECTION_MARKER_START . '(\d)'. ExtractFormatter::SECTION_MARKER_END . "(.*?)$/m", - array( $this, 'sectionCallback' ), + [ $this, 'sectionCallback' ], $text ); return