From: Siebrand Mazeland Date: Tue, 8 Mar 2016 08:04:45 +0000 (+0100) Subject: Use single quotes in API where possible X-Git-Tag: 1.31.0-rc.0~7705^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=bc0ae710e3b57def583d3f672aa116a289694913;p=lhc%2Fweb%2Fwiklou.git Use single quotes in API where possible Change-Id: I972e296f4820f78f5dfcecc27bc4912ca84a3178 --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 76fae6bbc8..ebde0136c6 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -302,7 +302,7 @@ abstract class ApiBase extends ContextSource { $qs = $k; $msg = self::escapeWikiText( $v ); if ( is_array( $msg ) ) { - $msg = join( " ", $msg ); + $msg = join( ' ', $msg ); } } @@ -711,7 +711,7 @@ abstract class ApiBase extends ContextSource { $p = $this->getModulePrefix(); $intersection = array_intersect( array_keys( array_filter( $params, - [ $this, "parameterNotEmpty" ] ) ), $required ); + [ $this, 'parameterNotEmpty' ] ) ), $required ); if ( count( $intersection ) > 1 ) { $this->dieUsage( @@ -737,7 +737,7 @@ abstract class ApiBase extends ContextSource { $p = $this->getModulePrefix(); $intersection = array_intersect( array_keys( array_filter( $params, - [ $this, "parameterNotEmpty" ] ) ), $required ); + [ $this, 'parameterNotEmpty' ] ) ), $required ); if ( count( $intersection ) > 1 ) { $this->dieUsage( @@ -760,7 +760,7 @@ abstract class ApiBase extends ContextSource { $p = $this->getModulePrefix(); $intersection = array_intersect( - array_keys( array_filter( $params, [ $this, "parameterNotEmpty" ] ) ), + array_keys( array_filter( $params, [ $this, 'parameterNotEmpty' ] ) ), $required ); @@ -917,7 +917,7 @@ abstract class ApiBase extends ContextSource { ApiBase::dieDebug( __METHOD__, "Boolean param $encParamName's default is set to '$default'. " . - "Boolean parameters must default to false." + 'Boolean parameters must default to false.' ); } @@ -942,8 +942,8 @@ abstract class ApiBase extends ContextSource { if ( $value !== null ) { $this->dieUsage( "File upload param $encParamName is not a file upload; " . - "be sure to use multipart/form-data for your POST and include " . - "a filename in the Content-Disposition header.", + 'be sure to use multipart/form-data for your POST and include ' . + 'a filename in the Content-Disposition header.', "badupload_{$encParamName}" ); } @@ -1157,7 +1157,7 @@ abstract class ApiBase extends ContextSource { if ( count( $unknown ) ) { if ( $allowMultiple ) { $s = count( $unknown ) > 1 ? 's' : ''; - $vals = implode( ", ", $unknown ); + $vals = implode( ', ', $unknown ); $this->setWarning( "Unrecognized value$s for parameter '$valueName': $vals" ); } else { $this->dieUsage( @@ -1615,15 +1615,15 @@ abstract class ApiBase extends ContextSource { ], 'badaccess-group0' => [ 'code' => 'permissiondenied', - 'info' => "Permission denied" + 'info' => 'Permission denied' ], // Generic permission denied message 'badaccess-groups' => [ 'code' => 'permissiondenied', - 'info' => "Permission denied" + 'info' => 'Permission denied' ], 'titleprotected' => [ 'code' => 'protectedtitle', - 'info' => "This title has been protected from creation" + 'info' => 'This title has been protected from creation' ], 'nocreate-loggedin' => [ 'code' => 'cantcreate', @@ -1643,15 +1643,15 @@ abstract class ApiBase extends ContextSource { ], 'confirmedittext' => [ 'code' => 'confirmemail', - 'info' => "You must confirm your email address before you can edit" + 'info' => 'You must confirm your email address before you can edit' ], 'blockedtext' => [ 'code' => 'blocked', - 'info' => "You have been blocked from editing" + 'info' => 'You have been blocked from editing' ], 'autoblockedtext' => [ 'code' => 'autoblocked', - 'info' => "Your IP address has been blocked automatically, because it was used by a blocked user" + 'info' => 'Your IP address has been blocked automatically, because it was used by a blocked user' ], // Miscellaneous interface messages @@ -1661,19 +1661,19 @@ abstract class ApiBase extends ContextSource { ], 'alreadyrolled' => [ 'code' => 'alreadyrolled', - 'info' => "The page you tried to rollback was already rolled back" + 'info' => 'The page you tried to rollback was already rolled back' ], 'cantrollback' => [ 'code' => 'onlyauthor', - 'info' => "The page you tried to rollback only has one author" + 'info' => 'The page you tried to rollback only has one author' ], 'readonlytext' => [ 'code' => 'readonly', - 'info' => "The wiki is currently in read-only mode" + 'info' => 'The wiki is currently in read-only mode' ], 'sessionfailure' => [ 'code' => 'badtoken', - 'info' => "Invalid token" ], + 'info' => 'Invalid token' ], 'cannotdelete' => [ 'code' => 'cantdelete', 'info' => "Couldn't delete \"\$1\". Maybe it was deleted already by someone else" @@ -1686,11 +1686,11 @@ abstract class ApiBase extends ContextSource { ], 'immobile_namespace' => [ 'code' => 'immobilenamespace', - 'info' => "You tried to move pages from or to a namespace that is protected from moving" + 'info' => 'You tried to move pages from or to a namespace that is protected from moving' ], 'articleexists' => [ 'code' => 'articleexists', - 'info' => "The destination article already exists and is not a redirect to the source article" + 'info' => 'The destination article already exists and is not a redirect to the source article' ], 'protectedpage' => [ 'code' => 'protectedpage', @@ -1698,11 +1698,11 @@ abstract class ApiBase extends ContextSource { ], 'hookaborted' => [ 'code' => 'hookaborted', - 'info' => "The modification you tried to make was aborted by an extension hook" + 'info' => 'The modification you tried to make was aborted by an extension hook' ], 'cantmove-titleprotected' => [ 'code' => 'protectedtitle', - 'info' => "The destination article has been protected from creation" + 'info' => 'The destination article has been protected from creation' ], 'imagenocrossnamespace' => [ 'code' => 'nonfilenamespace', @@ -1714,20 +1714,20 @@ abstract class ApiBase extends ContextSource { ], // 'badarticleerror' => shouldn't happen // 'badtitletext' => shouldn't happen - 'ip_range_invalid' => [ 'code' => 'invalidrange', 'info' => "Invalid IP range" ], + 'ip_range_invalid' => [ 'code' => 'invalidrange', 'info' => 'Invalid IP range' ], 'range_block_disabled' => [ 'code' => 'rangedisabled', - 'info' => "Blocking IP ranges has been disabled" + 'info' => 'Blocking IP ranges has been disabled' ], 'nosuchusershort' => [ 'code' => 'nosuchuser', 'info' => "The user you specified doesn't exist" ], - 'badipaddress' => [ 'code' => 'invalidip', 'info' => "Invalid IP address specified" ], - 'ipb_expiry_invalid' => [ 'code' => 'invalidexpiry', 'info' => "Invalid expiry time" ], + 'badipaddress' => [ 'code' => 'invalidip', 'info' => 'Invalid IP address specified' ], + 'ipb_expiry_invalid' => [ 'code' => 'invalidexpiry', 'info' => 'Invalid expiry time' ], 'ipb_already_blocked' => [ 'code' => 'alreadyblocked', - 'info' => "The user you tried to block was already blocked" + 'info' => 'The user you tried to block was already blocked' ], 'ipb_blocked_as_range' => [ 'code' => 'blockedasrange', @@ -1735,11 +1735,11 @@ abstract class ApiBase extends ContextSource { ], 'ipb_cant_unblock' => [ 'code' => 'cantunblock', - 'info' => "The block you specified was not found. It may have been unblocked already" + 'info' => 'The block you specified was not found. It may have been unblocked already' ], 'mailnologin' => [ 'code' => 'cantsend', - 'info' => "You are not logged in, you do not have a confirmed email address, or you are not allowed to send email to other users, so you cannot send email" + 'info' => 'You are not logged in, you do not have a confirmed email address, or you are not allowed to send email to other users, so you cannot send email' ], 'ipbblocked' => [ 'code' => 'ipbblocked', @@ -1751,23 +1751,23 @@ abstract class ApiBase extends ContextSource { ], 'usermaildisabled' => [ 'code' => 'usermaildisabled', - 'info' => "User email has been disabled" + 'info' => 'User email has been disabled' ], 'blockedemailuser' => [ 'code' => 'blockedfrommail', - 'info' => "You have been blocked from sending email" + 'info' => 'You have been blocked from sending email' ], 'notarget' => [ 'code' => 'notarget', - 'info' => "You have not specified a valid target for this action" + 'info' => 'You have not specified a valid target for this action' ], 'noemail' => [ 'code' => 'noemail', - 'info' => "The user has not specified a valid email address, or has chosen not to receive email from other users" + 'info' => 'The user has not specified a valid email address, or has chosen not to receive email from other users' ], 'rcpatroldisabled' => [ 'code' => 'patroldisabled', - 'info' => "Patrolling is disabled on this wiki" + 'info' => 'Patrolling is disabled on this wiki' ], 'markedaspatrollederror-noautopatrol' => [ 'code' => 'noautopatrol', @@ -1804,7 +1804,7 @@ abstract class ApiBase extends ContextSource { // API-specific messages 'readrequired' => [ 'code' => 'readapidenied', - 'info' => "You need read permission to use this module" + 'info' => 'You need read permission to use this module' ], 'writedisabled' => [ 'code' => 'noapiwrite', @@ -1843,7 +1843,7 @@ abstract class ApiBase extends ContextSource { ], 'unblock-notarget' => [ 'code' => 'notarget', - 'info' => "Either the id or the user parameter must be set" + 'info' => 'Either the id or the user parameter must be set' ], 'unblock-idanduser' => [ 'code' => 'idanduser', @@ -1863,7 +1863,7 @@ abstract class ApiBase extends ContextSource { ], 'createonly-exists' => [ 'code' => 'articleexists', - 'info' => "The article you tried to create has been created already" + 'info' => 'The article you tried to create has been created already' ], 'nocreate-missing' => [ 'code' => 'missingtitle', @@ -1992,17 +1992,17 @@ abstract class ApiBase extends ContextSource { 'noedit' => [ 'code' => 'noedit', 'info' => "You don't have permission to edit pages" ], 'wasdeleted' => [ 'code' => 'pagedeleted', - 'info' => "The page has been deleted since you fetched its timestamp" + 'info' => 'The page has been deleted since you fetched its timestamp' ], 'blankpage' => [ 'code' => 'emptypage', - 'info' => "Creating new, empty pages is not allowed" + 'info' => 'Creating new, empty pages is not allowed' ], - 'editconflict' => [ 'code' => 'editconflict', 'info' => "Edit conflict detected" ], - 'hashcheckfailed' => [ 'code' => 'badmd5', 'info' => "The supplied MD5 hash was incorrect" ], + 'editconflict' => [ 'code' => 'editconflict', 'info' => 'Edit conflict detected' ], + 'hashcheckfailed' => [ 'code' => 'badmd5', 'info' => 'The supplied MD5 hash was incorrect' ], 'missingtext' => [ 'code' => 'notext', - 'info' => "One of the text, appendtext, prependtext and undo parameters must be set" + 'info' => 'One of the text, appendtext, prependtext and undo parameters must be set' ], 'emptynewsection' => [ 'code' => 'emptynewsection', @@ -2024,13 +2024,13 @@ abstract class ApiBase extends ContextSource { // Messages from WikiPage::doEit(] 'edit-hook-aborted' => [ 'code' => 'edit-hook-aborted', - 'info' => "Your edit was aborted by an ArticleSave hook" + 'info' => 'Your edit was aborted by an ArticleSave hook' ], 'edit-gone-missing' => [ 'code' => 'edit-gone-missing', 'info' => "The page you tried to edit doesn't seem to exist anymore" ], - 'edit-conflict' => [ 'code' => 'editconflict', 'info' => "Edit conflict detected" ], + 'edit-conflict' => [ 'code' => 'editconflict', 'info' => 'Edit conflict detected' ], 'edit-already-exists' => [ 'code' => 'edit-already-exists', 'info' => 'It seems the page you tried to create already exist' @@ -2740,7 +2740,7 @@ abstract class ApiBase extends ContextSource { $examples ]; } - $msg .= "Example" . ( count( $examples ) > 1 ? 's' : '' ) . ":\n"; + $msg .= 'Example' . ( count( $examples ) > 1 ? 's' : '' ) . ":\n"; foreach ( $examples as $k => $v ) { if ( is_numeric( $k ) ) { $msg .= " $v\n"; @@ -2750,7 +2750,7 @@ abstract class ApiBase extends ContextSource { } else { $msgExample = " $v"; } - $msgExample .= ":"; + $msgExample .= ':'; $msg .= wordwrap( $msgExample, 100, "\n" ) . "\n $k\n"; } } @@ -2766,7 +2766,7 @@ abstract class ApiBase extends ContextSource { * @return string */ private function indentExampleText( $item ) { - return " " . $item; + return ' ' . $item; } /** @@ -2849,7 +2849,7 @@ abstract class ApiBase extends ContextSource { if ( isset( $paramSettings[self::PARAM_REQUIRED] ) && $paramSettings[self::PARAM_REQUIRED] ) { - $desc .= $paramPrefix . "This parameter is required"; + $desc .= $paramPrefix . 'This parameter is required'; } $type = isset( $paramSettings[self::PARAM_TYPE] ) @@ -2925,7 +2925,7 @@ abstract class ApiBase extends ContextSource { } break; case 'upload': - $desc .= $paramPrefix . "Must be posted as a file upload using multipart/form-data"; + $desc .= $paramPrefix . 'Must be posted as a file upload using multipart/form-data'; break; } } @@ -2939,8 +2939,8 @@ abstract class ApiBase extends ContextSource { if ( !$isArray || $isArray && count( $type ) > self::LIMIT_SML1 ) { - $desc .= $paramPrefix . "Maximum number of values " . - self::LIMIT_SML1 . " (" . self::LIMIT_SML2 . " for bots)"; + $desc .= $paramPrefix . 'Maximum number of values ' . + self::LIMIT_SML1 . ' (' . self::LIMIT_SML2 . ' for bots)'; } } } diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index f32bab0fcd..08aba9482e 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -335,7 +335,7 @@ class ApiEditPage extends ApiBase { $section = $params['section']; if ( !preg_match( '/^((T-)?\d+|new)$/', $section ) ) { $this->dieUsage( "The section parameter must be a valid section id or 'new'", - "invalidsection" ); + 'invalidsection' ); } $content = $pageObj->getContent(); if ( $section !== '0' && $section != 'new' diff --git a/includes/api/ApiExpandTemplates.php b/includes/api/ApiExpandTemplates.php index 6611a09d0b..286fe887c3 100644 --- a/includes/api/ApiExpandTemplates.php +++ b/includes/api/ApiExpandTemplates.php @@ -158,7 +158,7 @@ class ApiExpandTemplates extends ApiBase { !isset( $prop['jsconfigvars'] ) && !isset( $prop['encodedjsconfigvars'] ) ) { $this->setWarning( "Property 'modules' was set but not 'jsconfigvars' " . "or 'encodedjsconfigvars'. Configuration variables are necessary " . - "for proper module usage." ); + 'for proper module usage.' ); } } } diff --git a/includes/api/ApiFeedContributions.php b/includes/api/ApiFeedContributions.php index dacf828f25..e28b0684d5 100644 --- a/includes/api/ApiFeedContributions.php +++ b/includes/api/ApiFeedContributions.php @@ -173,7 +173,7 @@ class ApiFeedContributions extends ApiBase { return '

' . htmlspecialchars( $revision->getUserText() ) . $msg . htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) . - "

\n
\n
" . $html . "
"; + "

\n
\n
" . $html . '
'; } return ''; diff --git a/includes/api/ApiImageRotate.php b/includes/api/ApiImageRotate.php index b309149eac..2b9935341b 100644 --- a/includes/api/ApiImageRotate.php +++ b/includes/api/ApiImageRotate.php @@ -111,9 +111,9 @@ class ApiImageRotate extends ApiBase { $tmpFile = TempFSFile::factory( 'rotate_', $ext ); $dstPath = $tmpFile->getPath(); $err = $handler->rotate( $file, [ - "srcPath" => $srcPath, - "dstPath" => $dstPath, - "rotation" => $rotation + 'srcPath' => $srcPath, + 'dstPath' => $dstPath, + 'rotation' => $rotation ] ); if ( !$err ) { $comment = wfMessage( diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 9e5681984c..d59151adfe 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -978,7 +978,7 @@ class ApiMain extends ApiBase { if ( $module->needsToken() === true ) { throw new MWException( "Module '{$module->getModuleName()}' must be updated for the new token handling. " . - "See documentation for ApiBase::needsToken for details." + 'See documentation for ApiBase::needsToken for details.' ); } if ( $module->needsToken() ) { @@ -1174,7 +1174,7 @@ class ApiMain extends ApiBase { $this->dieUsageMsg( 'writerequired' ); } elseif ( $this->getRequest()->getHeader( 'Promise-Non-Write-API-Action' ) ) { $this->dieUsage( - "Promise-Non-Write-API-Action HTTP header cannot be sent to write API modules", + 'Promise-Non-Write-API-Action HTTP header cannot be sent to write API modules', 'promised-nonwrite-api' ); } @@ -1771,7 +1771,7 @@ class ApiMain extends ApiBase { ->inLanguage( 'en' ) ->text(); $groups = User::getGroupsWithPermission( $right ); - $msg .= "* " . $right . " *\n $rightsMsg" . + $msg .= '* ' . $right . " *\n $rightsMsg" . "\nGranted to:\n " . str_replace( '*', 'all', implode( ', ', $groups ) ) . "\n\n"; } diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index 304b2d6ecf..effa520a2d 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -358,7 +358,7 @@ class ApiOpenSearch extends ApiBase { $ns = implode( '|', SearchEngine::defaultNamespaces() ); if ( !$ns ) { - $ns = "0"; + $ns = '0'; } switch ( $type ) { diff --git a/includes/api/ApiOptions.php b/includes/api/ApiOptions.php index 1dde9c2226..e51d46d91a 100644 --- a/includes/api/ApiOptions.php +++ b/includes/api/ApiOptions.php @@ -99,19 +99,19 @@ class ApiOptions extends ApiBase { case 'userjs': // Allow non-default preferences prefixed with 'userjs-', to be set by user scripts if ( strlen( $key ) > 255 ) { - $validation = "key too long (no more than 255 bytes allowed)"; - } elseif ( preg_match( "/[^a-zA-Z0-9_-]/", $key ) !== 0 ) { - $validation = "invalid key (only a-z, A-Z, 0-9, _, - allowed)"; + $validation = 'key too long (no more than 255 bytes allowed)'; + } elseif ( preg_match( '/[^a-zA-Z0-9_-]/', $key ) !== 0 ) { + $validation = 'invalid key (only a-z, A-Z, 0-9, _, - allowed)'; } else { $validation = true; } break; case 'special': - $validation = "cannot be set by this module"; + $validation = 'cannot be set by this module'; break; case 'unused': default: - $validation = "not a valid preference"; + $validation = 'not a valid preference'; break; } if ( $validation === true ) { diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 1441a45eef..6bab762aff 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -595,22 +595,22 @@ class ApiPageSet extends ApiBase { 'special', 'missingIds', 'missingRevIds', 'missingTitles', 'interwikiTitles' ] ) { $result = []; - if ( in_array( "invalidTitles", $invalidChecks ) ) { + if ( in_array( 'invalidTitles', $invalidChecks ) ) { self::addValues( $result, $this->getInvalidTitlesAndReasons(), 'invalid' ); } - if ( in_array( "special", $invalidChecks ) ) { + if ( in_array( 'special', $invalidChecks ) ) { self::addValues( $result, $this->getSpecialTitles(), 'special', 'title' ); } - if ( in_array( "missingIds", $invalidChecks ) ) { + if ( in_array( 'missingIds', $invalidChecks ) ) { self::addValues( $result, $this->getMissingPageIDs(), 'missing', 'pageid' ); } - if ( in_array( "missingRevIds", $invalidChecks ) ) { + if ( in_array( 'missingRevIds', $invalidChecks ) ) { self::addValues( $result, $this->getMissingRevisionIDs(), 'missing', 'revid' ); } - if ( in_array( "missingTitles", $invalidChecks ) ) { + if ( in_array( 'missingTitles', $invalidChecks ) ) { self::addValues( $result, $this->getMissingTitles(), 'missing' ); } - if ( in_array( "interwikiTitles", $invalidChecks ) ) { + if ( in_array( 'interwikiTitles', $invalidChecks ) ) { self::addValues( $result, $this->getInterwikiTitlesAsResult() ); } diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 872876dfcc..16bf8309aa 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -72,7 +72,7 @@ class ApiParse extends ApiBase { $this->section = $params['section']; if ( !preg_match( '/^((T-)?\d+|new)$/', $this->section ) ) { $this->dieUsage( - "The section parameter must be a valid section id or 'new'", "invalidsection" + 'The section parameter must be a valid section id or "new"', 'invalidsection' ); } } else { @@ -390,9 +390,9 @@ class ApiParse extends ApiBase { if ( isset( $prop['modules'] ) && !isset( $prop['jsconfigvars'] ) && !isset( $prop['encodedjsconfigvars'] ) ) { - $this->setWarning( "Property 'modules' was set but not 'jsconfigvars' " . - "or 'encodedjsconfigvars'. Configuration variables are necessary " . - "for proper module usage." ); + $this->setWarning( 'Property "modules" was set but not "jsconfigvars" ' . + 'or "encodedjsconfigvars". Configuration variables are necessary ' . + 'for proper module usage.' ); } if ( isset( $prop['indicators'] ) ) { @@ -428,7 +428,7 @@ class ApiParse extends ApiBase { if ( isset( $prop['parsetree'] ) || $params['generatexml'] ) { if ( $this->content->getModel() != CONTENT_MODEL_WIKITEXT ) { - $this->dieUsage( "parsetree is only supported for wikitext content", "notwikitext" ); + $this->dieUsage( 'parsetree is only supported for wikitext content', 'notwikitext' ); } $wgParser->startExternalParse( $titleObj, $popts, Parser::OT_PREPROCESS ); @@ -545,10 +545,10 @@ class ApiParse extends ApiBase { // Not cached (save or load) $section = $content->getSection( $this->section ); if ( $section === false ) { - $this->dieUsage( "There is no section {$this->section} in " . $what, 'nosuchsection' ); + $this->dieUsage( "There is no section {$this->section} in $what", 'nosuchsection' ); } if ( $section === null ) { - $this->dieUsage( "Sections are not supported by " . $what, 'nosuchsection' ); + $this->dieUsage( "Sections are not supported by $what", 'nosuchsection' ); $section = false; } diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index 6890046c97..cd2dd3d7b5 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -308,7 +308,7 @@ class ApiQueryImageInfo extends ApiQueryBase { foreach ( $paramList as $name => $value ) { if ( !$h->validateParam( $name, $value ) ) { - $this->dieUsage( "Invalid value for {$p}urlparam ($name=$value)", "urlparam" ); + $this->dieUsage( "Invalid value for {$p}urlparam ($name=$value)", 'urlparam' ); } } diff --git a/includes/api/ApiQueryRevisionsBase.php b/includes/api/ApiQueryRevisionsBase.php index c12393da94..b73a3410eb 100644 --- a/includes/api/ApiQueryRevisionsBase.php +++ b/includes/api/ApiQueryRevisionsBase.php @@ -294,9 +294,9 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase { $vals['parsetree'] = $xml; } else { $vals['badcontentformatforparsetree'] = true; - $this->setWarning( "Conversion to XML is supported for wikitext only, " . + $this->setWarning( 'Conversion to XML is supported for wikitext only, ' . $title->getPrefixedDBkey() . - " uses content model " . $content->getModel() ); + ' uses content model ' . $content->getModel() ); } } } @@ -315,9 +315,9 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase { ParserOptions::newFromContext( $this->getContext() ) ); } else { - $this->setWarning( "Template expansion is supported for wikitext only, " . + $this->setWarning( 'Template expansion is supported for wikitext only, ' . $title->getPrefixedDBkey() . - " uses content model " . $content->getModel() ); + ' uses content model ' . $content->getModel() ); $vals['badcontentformat'] = true; $text = false; } diff --git a/includes/api/ApiQueryStashImageInfo.php b/includes/api/ApiQueryStashImageInfo.php index 51f486295c..6d1540b72e 100644 --- a/includes/api/ApiQueryStashImageInfo.php +++ b/includes/api/ApiQueryStashImageInfo.php @@ -42,7 +42,7 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { $result = $this->getResult(); if ( !$params['filekey'] && !$params['sessionkey'] ) { - $this->dieUsage( "One of filekey or sessionkey must be supplied", 'nofilekey' ); + $this->dieUsage( 'One of filekey or sessionkey must be supplied', 'nofilekey' ); } // Alias sessionkey to filekey, but give an existing filekey precedence. @@ -62,9 +62,9 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { } // @todo Update exception handling here to understand current getFile exceptions } catch ( UploadStashFileNotFoundException $e ) { - $this->dieUsage( "File not found: " . $e->getMessage(), "invalidsessiondata" ); + $this->dieUsage( 'File not found: ' . $e->getMessage(), 'invalidsessiondata' ); } catch ( UploadStashBadPathException $e ) { - $this->dieUsage( "Bad path: " . $e->getMessage(), "invalidsessiondata" ); + $this->dieUsage( 'Bad path: ' . $e->getMessage(), 'invalidsessiondata' ); } } diff --git a/includes/api/ApiResult.php b/includes/api/ApiResult.php index f70bbe7fef..a5f22c3fc4 100644 --- a/includes/api/ApiResult.php +++ b/includes/api/ApiResult.php @@ -340,7 +340,7 @@ class ApiResult implements ApiSerializable { $value = $value->serializeForApiResult(); if ( is_object( $value ) ) { throw new UnexpectedValueException( - get_class( $oldValue ) . "::serializeForApiResult() returned an object of class " . + get_class( $oldValue ) . '::serializeForApiResult() returned an object of class ' . get_class( $value ) ); } @@ -351,7 +351,7 @@ class ApiResult implements ApiSerializable { return self::validateValue( $value ); } catch ( Exception $ex ) { throw new UnexpectedValueException( - get_class( $oldValue ) . "::serializeForApiResult() returned an invalid value: " . + get_class( $oldValue ) . '::serializeForApiResult() returned an invalid value: ' . $ex->getMessage(), 0, $ex @@ -372,7 +372,7 @@ class ApiResult implements ApiSerializable { } $value = $tmp; } elseif ( is_float( $value ) && !is_finite( $value ) ) { - throw new InvalidArgumentException( "Cannot add non-finite floats to ApiResult" ); + throw new InvalidArgumentException( 'Cannot add non-finite floats to ApiResult' ); } elseif ( is_string( $value ) ) { $value = $wgContLang->normalize( $value ); } elseif ( $value !== null && !is_scalar( $value ) ) { @@ -538,7 +538,7 @@ class ApiResult implements ApiSerializable { ) { throw new RuntimeException( "Attempting to set content element as $name when " . $arr[self::META_CONTENT] . - " is already set as the content element" + ' is already set as the content element' ); } $arr[self::META_CONTENT] = $name; diff --git a/includes/api/ApiStashEdit.php b/includes/api/ApiStashEdit.php index d8562b0d33..46be4b0cdd 100644 --- a/includes/api/ApiStashEdit.php +++ b/includes/api/ApiStashEdit.php @@ -50,7 +50,7 @@ class ApiStashEdit extends ApiBase { if ( !ContentHandler::getForModelID( $params['contentmodel'] ) ->isSupportedFormat( $params['contentformat'] ) ) { - $this->dieUsage( "Unsupported content model/format", 'badmodelformat' ); + $this->dieUsage( 'Unsupported content model/format', 'badmodelformat' ); } // Trim and fix newlines so the key SHA1's match (see RequestContext::getText()) @@ -77,7 +77,7 @@ class ApiStashEdit extends ApiBase { $baseRev->getId() ); if ( !$editContent ) { - $this->dieUsage( "Could not merge updated section.", 'replacefailed' ); + $this->dieUsage( 'Could not merge updated section.', 'replacefailed' ); } if ( $currentRev->getId() == $baseRev->getId() ) { // Base revision was still the latest; nothing to merge diff --git a/includes/api/ApiTokens.php b/includes/api/ApiTokens.php index 63bae9d42b..4940394fe8 100644 --- a/includes/api/ApiTokens.php +++ b/includes/api/ApiTokens.php @@ -32,9 +32,9 @@ class ApiTokens extends ApiBase { public function execute() { $this->setWarning( - "action=tokens has been deprecated. Please use action=query&meta=tokens instead." + 'action=tokens has been deprecated. Please use action=query&meta=tokens instead.' ); - $this->logFeatureUsage( "action=tokens" ); + $this->logFeatureUsage( 'action=tokens' ); $params = $this->extractRequestParams(); $res = [ diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 79e88c6ca4..0eecaa1cdb 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -542,7 +542,7 @@ class ApiUpload extends ApiBase { ]; ApiResult::setIndexedTagName( $extradata['allowed'], 'ext' ); - $msg = "Filetype not permitted: "; + $msg = 'Filetype not permitted: '; if ( isset( $verification['blacklistedExt'] ) ) { $msg .= join( ', ', $verification['blacklistedExt'] ); $extradata['blacklisted'] = array_values( $verification['blacklistedExt'] ); @@ -664,7 +664,7 @@ class ApiUpload extends ApiBase { $this->dieUsage( 'No such filekey: ' . $e->getMessage(), 'stashnosuchfilekey' ); break; default: - $this->dieUsage( $exceptionType . ": " . $e->getMessage(), 'stasherror' ); + $this->dieUsage( $exceptionType . ': ' . $e->getMessage(), 'stasherror' ); break; } } @@ -714,7 +714,7 @@ class ApiUpload extends ApiBase { if ( $this->mParams['async'] ) { $progress = UploadBase::getSessionStatus( $this->getUser(), $this->mParams['filekey'] ); if ( $progress && $progress['result'] === 'Poll' ) { - $this->dieUsage( "Upload from stash already in progress.", 'publishfailed' ); + $this->dieUsage( 'Upload from stash already in progress.', 'publishfailed' ); } UploadBase::setSessionStatus( $this->getUser(), diff --git a/includes/api/ApiWatch.php b/includes/api/ApiWatch.php index 4e5e000115..f09fdcb063 100644 --- a/includes/api/ApiWatch.php +++ b/includes/api/ApiWatch.php @@ -80,7 +80,7 @@ class ApiWatch extends ApiBase { if ( $extraParams ) { $p = $this->getModulePrefix(); $this->dieUsage( - "The parameter {$p}title can not be used with " . implode( ", ", $extraParams ), + "The parameter {$p}title can not be used with " . implode( ', ', $extraParams ), 'invalidparammix' ); }