Pass phpcs-strict on various files in includes/

These files have all had treatment before, and these occurrences have either
been missed or have been introduced after.

Change-Id: I06cdab4616b5bff47c85152df28f18c861730a23
This commit is contained in:
Siebrand Mazeland 2014-04-24 21:50:01 +02:00
parent 40e04816f0
commit f994817f6b
13 changed files with 97 additions and 32 deletions

View file

@ -363,7 +363,8 @@ class ApiParse extends ApiBase {
}
if ( isset( $prop['limitreportdata'] ) ) {
$result_array['limitreportdata'] = $this->formatLimitReportData( $p_result->getLimitReportData() );
$result_array['limitreportdata'] =
$this->formatLimitReportData( $p_result->getLimitReportData() );
}
if ( isset( $prop['limitreporthtml'] ) ) {
$limitreportHtml = EditPage::getPreviewLimitReport( $p_result );
@ -488,7 +489,11 @@ class ApiParse extends ApiBase {
if ( $title ) {
$entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
// localised language name in user language (maybe set by uselang=)
$entry['langname'] = Language::fetchLanguageName( $title->getInterwiki(), $this->getLanguage()->getCode() );
$entry['langname'] = Language::fetchLanguageName(
$title->getInterwiki(),
$this->getLanguage()->getCode()
);
// native language name
$entry['autonym'] = Language::fetchLanguageName( $title->getInterwiki() );
}

View file

@ -93,8 +93,8 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase {
ApiBase::PARAM_DFLT => 10,
ApiBase::PARAM_TYPE => 'limit',
ApiBase::PARAM_MIN => 1,
ApiBase::PARAM_MAX => 100, // Non-standard value for compatibility
// with action=opensearch
// Non-standard value for compatibility with action=opensearch
ApiBase::PARAM_MAX => 100,
ApiBase::PARAM_MAX2 => 200,
),
);

View file

@ -116,7 +116,10 @@ class ApiQueryRedirects extends ApiQueryGeneratorBase {
$this->dieUsageMsg( 'show' );
}
$this->addWhereIf( "rd_fragment != $emptyString", isset( $show['fragment'] ) );
$this->addWhereIf( "rd_fragment = $emptyString OR rd_fragment IS NULL", isset( $show['!fragment'] ) );
$this->addWhereIf(
"rd_fragment = $emptyString OR rd_fragment IS NULL",
isset( $show['!fragment'] )
);
}
$map = $pageSet->getAllTitlesByNamespace();

View file

@ -222,8 +222,12 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
);
// Add item to results and see whether it fits
$fit = $apiResult->addValue( array( 'query', 'interwiki' . $this->getModuleName(), $result->getInterwikiPrefix() ),
null, $vals );
$fit = $apiResult->addValue(
array( 'query', 'interwiki' . $this->getModuleName(), $result->getInterwikiPrefix() ),
null,
$vals
);
if ( !$fit ) {
// We hit the limit. We can't really provide any meaningful
// pagination info so just bail out

View file

@ -691,7 +691,6 @@ class LocalisationCache {
global $IP;
wfProfileIn( __METHOD__ );
// This reads in the PHP i18n file with non-messages l10n data
$fileName = Language::getMessagesFileName( $code );
if ( !file_exists( $fileName ) ) {

View file

@ -16,7 +16,9 @@ class ComposerPackageModifier {
protected $versionNormalizer;
protected $versionFetcher;
public function __construct( Package $package, ComposerVersionNormalizer $versionNormalizer, MediaWikiVersionFetcher $versionFetcher ) {
public function __construct( Package $package,
ComposerVersionNormalizer $versionNormalizer, MediaWikiVersionFetcher $versionFetcher
) {
$this->package = $package;
$this->versionNormalizer = $versionNormalizer;
$this->versionFetcher = $versionFetcher;
@ -48,7 +50,10 @@ class ComposerPackageModifier {
$mvVersion = $this->versionFetcher->fetchVersion();
$mvVersion = $this->versionNormalizer->normalizeSuffix( $mvVersion );
$version = new VersionConstraint( '==', $this->versionNormalizer->normalizeLevelCount( $mvVersion ) );
$version = new VersionConstraint(
'==',
$this->versionNormalizer->normalizeLevelCount( $mvVersion )
);
$version->setPrettyString( $mvVersion );
return $version;

View file

@ -424,7 +424,9 @@ class DiffEngine {
}
$x1 = $xoff + (int)( ( $numer + ( $xlim - $xoff ) * $chunk ) / $nchunks );
// @codingStandardsIgnoreFile Ignore Squiz.WhiteSpace.SemicolonSpacing.Incorrect
for ( ; $x < $x1; $x++ ) {
// @codingStandardsIgnoreEnd
$line = $flip ? $this->yv[$x] : $this->xv[$x];
if ( empty( $ymatches[$line] ) ) {
continue;

View file

@ -135,7 +135,8 @@ class MWException extends Exception {
if ( $wgShowExceptionDetails ) {
return '<p>' . nl2br( htmlspecialchars( MWExceptionHandler::getLogMessage( $this ) ) ) .
'</p><p>Backtrace:</p><p>' . nl2br( htmlspecialchars( MWExceptionHandler::getRedactedTraceAsString( $this ) ) ) .
'</p><p>Backtrace:</p><p>' .
nl2br( htmlspecialchars( MWExceptionHandler::getRedactedTraceAsString( $this ) ) ) .
"</p>\n";
} else {
return "<div class=\"errorbox\">" .
@ -222,7 +223,9 @@ class MWException extends Exception {
echo "<!DOCTYPE html>\n" .
'<html><head>' .
// Mimick OutputPage::setPageTitle behaviour
'<title>' . htmlspecialchars( $this->msg( 'pagetitle', "$1 - $wgSitename", $this->getPageTitle() ) ) . '</title>' .
'<title>' .
htmlspecialchars( $this->msg( 'pagetitle', "$1 - $wgSitename", $this->getPageTitle() ) ) .
'</title>' .
'<style>body { font-family: sans-serif; margin: 0; padding: 0.5em 2em; }</style>' .
"</head><body>\n";

View file

@ -1458,7 +1458,6 @@ class LocalFile extends File {
wfProfileOut( __METHOD__ . '-edit' );
if ( $reupload ) {
# Delete old thumbnails
wfProfileIn( __METHOD__ . '-purge' );
@ -1911,7 +1910,9 @@ class LocalFile extends File {
$key = $this->repo->getSharedCacheKey( 'file-volatile', md5( $this->getName() ) );
if ( $key ) {
if ( $this->lastMarkedVolatile && ( time() - $this->lastMarkedVolatile ) <= self::VOLATILE_TTL ) {
if ( $this->lastMarkedVolatile
&& ( time() - $this->lastMarkedVolatile ) <= self::VOLATILE_TTL
) {
return true; // sanity
}
return ( $wgMemc->get( $key ) !== false );

View file

@ -338,8 +338,10 @@ class HTMLForm extends ContextSource {
}
if ( !$class ) {
throw new MWException( "Descriptor with no class for $fieldname: " . print_r( $descriptor, true ) );
throw new MWException( "Descriptor with no class for $fieldname: "
. print_r( $descriptor, true ) );
}
return $class;
}

View file

@ -45,7 +45,9 @@ class MssqlInstaller extends DatabaseInstaller {
'_WebWindowsAuthentication' => 'sqlauth',
);
public $minimumVersion = '9.00.1399'; // SQL Server 2005 RTM (TODO: are SQL Express version numbers different?)
// SQL Server 2005 RTM
// @todo Are SQL Express version numbers different?)
public $minimumVersion = '9.00.1399';
// These are schema-level privs
// Note: the web user will be created will full permissions if possible, this permission
@ -135,7 +137,12 @@ class MssqlInstaller extends DatabaseInstaller {
public function submitConnectForm() {
// Get variables from the request.
$newValues = $this->setVarsFromRequest( array( 'wgDBserver', 'wgDBname', 'wgDBmwschema', 'wgDBprefix' ) );
$newValues = $this->setVarsFromRequest( array(
'wgDBserver',
'wgDBname',
'wgDBmwschema',
'wgDBprefix'
) );
// Validate them.
$status = Status::newGood();
@ -163,7 +170,11 @@ class MssqlInstaller extends DatabaseInstaller {
}
// User box
$this->setVarsFromRequest( array( '_InstallUser', '_InstallPassword', '_InstallWindowsAuthentication' ) );
$this->setVarsFromRequest( array(
'_InstallUser',
'_InstallPassword',
'_InstallWindowsAuthentication'
) );
// Try to connect
$status = $this->getConnection();
@ -309,7 +320,8 @@ class MssqlInstaller extends DatabaseInstaller {
if ( $this->schemaExists( $this->getVar( 'wgDBmwschema' ) ) ) {
// wgDBmwschema is validated to only contain alphanumeric + underscore, so this is safe
$res = $conn->query( "SELECT permission_name FROM sys.fn_my_permissions( '{$this->getVar( 'wgDBmwschema' )}', 'SCHEMA' )" );
$res = $conn->query( "SELECT permission_name FROM sys.fn_my_permissions( "
. "'{$this->getVar( 'wgDBmwschema' )}', 'SCHEMA' )" );
foreach ( $res as $row ) {
$schemaPrivs[$row->permission_name] = true;
@ -320,9 +332,11 @@ class MssqlInstaller extends DatabaseInstaller {
// Now check all the grants we'll need to be doing to see if we can
foreach ( $this->webUserPrivs as $permission ) {
if ( ( isset( $schemaPrivs[$permission] ) && $schemaPrivs[$permission] )
|| ( isset( $dbPrivs[$implied[$permission][0]] ) && $dbPrivs[$implied[$permission][0]] )
|| ( isset( $serverPrivs[$implied[$permission][1]] ) && $serverPrivs[$implied[$permission][1]] ) ) {
|| ( isset( $dbPrivs[$implied[$permission][0]] )
&& $dbPrivs[$implied[$permission][0]] )
|| ( isset( $serverPrivs[$implied[$permission][1]] )
&& $serverPrivs[$implied[$permission][1]] )
) {
unset( $grantOptions[$permission] );
}
}
@ -344,8 +358,11 @@ class MssqlInstaller extends DatabaseInstaller {
} else {
$noCreateMsg = 'config-db-web-no-create-privs';
}
$wrapperStyle = $this->getVar( '_SameAccount' ) ? 'display: none' : '';
$displayStyle = $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth' ? 'display: none' : '';
$displayStyle = $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth'
? 'display: none'
: '';
$s = Html::openElement( 'fieldset' ) .
Html::element( 'legend', array(), wfMessage( 'config-db-web-account' )->text() ) .
$this->getCheckBox(
@ -390,9 +407,13 @@ class MssqlInstaller extends DatabaseInstaller {
* @return Status
*/
public function submitSettingsForm() {
$this->setVarsFromRequest(
array( 'wgDBuser', 'wgDBpassword', '_SameAccount', '_CreateDBAccount', '_WebWindowsAuthentication' )
);
$this->setVarsFromRequest( array(
'wgDBuser',
'wgDBpassword',
'_SameAccount',
'_CreateDBAccount',
'_WebWindowsAuthentication'
) );
if ( $this->getVar( '_SameAccount' ) ) {
$this->setVar( '_WebWindowsAuthentication', $this->getVar( '_InstallWindowsAuthentication' ) );
@ -408,7 +429,10 @@ class MssqlInstaller extends DatabaseInstaller {
$this->setVar( 'wgDBWindowsAuthentication', false );
}
if ( $this->getVar( '_CreateDBAccount' ) && $this->getVar( '_WebWindowsAuthentication' ) == 'sqlauth' && strval( $this->getVar( 'wgDBpassword' ) ) == '' ) {
if ( $this->getVar( '_CreateDBAccount' )
&& $this->getVar( '_WebWindowsAuthentication' ) == 'sqlauth'
&& strval( $this->getVar( 'wgDBpassword' ) ) == ''
) {
return Status::newFatal( 'config-db-password-empty', $this->getVar( 'wgDBuser' ) );
}
@ -471,13 +495,22 @@ class MssqlInstaller extends DatabaseInstaller {
$dbName = $this->getVar( 'wgDBname' );
$schemaName = $this->getVar( 'wgDBmwschema' );
if ( !$this->databaseExists( $dbName ) ) {
$conn->query( "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ), __METHOD__ );
$conn->query(
"CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ),
__METHOD__
);
$conn->selectDB( $dbName );
if ( !$this->schemaExists( $schemaName ) ) {
$conn->query( "CREATE SCHEMA " . $conn->addIdentifierQuotes( $schemaName ), __METHOD__ );
$conn->query(
"CREATE SCHEMA " . $conn->addIdentifierQuotes( $schemaName ),
__METHOD__
);
}
if ( !$this->catalogExists( $schemaName ) ) {
$conn->query( "CREATE FULLTEXT CATALOG " . $conn->addIdentifierQuotes( $schemaName ), __METHOD__ );
$conn->query(
"CREATE FULLTEXT CATALOG " . $conn->addIdentifierQuotes( $schemaName ),
__METHOD__
);
}
}
$this->setupSchemaVars();
@ -529,7 +562,9 @@ class MssqlInstaller extends DatabaseInstaller {
try {
$this->db->begin();
$this->db->selectDB( 'master' );
$logintype = $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth' ? 'FROM WINDOWS' : "WITH PASSWORD = $escPass";
$logintype = $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth'
? 'FROM WINDOWS'
: "WITH PASSWORD = $escPass";
$this->db->query( "CREATE LOGIN $escUser $logintype" );
$this->db->selectDB( $dbName );
$this->db->query( "CREATE USER $escUser FOR LOGIN $escUser WITH DEFAULT_SCHEMA = $escSchema" );
@ -603,7 +638,8 @@ class MssqlInstaller extends DatabaseInstaller {
$searchindex = $this->db->tableName( 'searchindex' );
$schema = $this->db->addIdentifierQuotes( $this->getVar( 'wgDBmwschema' ) );
try {
$this->db->query( "CREATE FULLTEXT INDEX ON $searchindex (si_title, si_text) KEY INDEX si_page ON $schema" );
$this->db->query( "CREATE FULLTEXT INDEX ON $searchindex (si_title, si_text) "
. "KEY INDEX si_page ON $schema" );
} catch ( DBQueryError $dqe ) {
$status->fatal( 'config-install-tables-failed', $dqe->getText() );
}

View file

@ -221,7 +221,9 @@ class JobQueueFederated extends JobQueue {
// Try to insert the jobs and update $partitionsTry on any failures.
// Retry to insert any remaning jobs again, ignoring the bad partitions.
$jobsLeft = $jobs;
// @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
for ( $i = $this->maxPartitionsTry; $i > 0 && count( $jobsLeft ); --$i ) {
// @codingStandardsIgnoreEnd
try {
$partitionRing->getLiveRing();
} catch ( UnexpectedValueException $e ) {

View file

@ -29,7 +29,10 @@
*
* @ingroup Media
*/
// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps
class BitmapHandler_ClientOnly extends BitmapHandler {
// @codingStandardsIgnoreEnd
/**
* @param File $image
* @param array $params