"jakub-onderka/php-parallel-lint": "0.9.2",
"jetbrains/phpstorm-stubs": "dev-master#1b9906084d6635456fcf3f3a01f0d7d5b99a578a",
"justinrainbow/json-schema": "~5.2",
- "mediawiki/mediawiki-codesniffer": "0.10.1",
+ "mediawiki/mediawiki-codesniffer": "0.11.0",
"monolog/monolog": "~1.22.1",
"nikic/php-parser": "2.1.0",
"nmred/kafka-php": "0.1.5",
return $id;
}
$hmac = MWCryptHash::hmac( $id, $secretKey, false );
- $cookieValue = $id . '!' . $hmac;
+ $cookieValue = $id . '!' . $hmac;
return $cookieValue;
}
// Long term limit. We need to balance the risk
// of somebody using this as a DoS attack to lock someone
// out of their account, and someone doing a brute force attack.
- [ 'count' => 150, 'seconds' => 60*60*48 ],
+ [ 'count' => 150, 'seconds' => 60 * 60 * 48 ],
];
/**
$newPage = !$this->mTitle->exists();
if ( $labelAsPublish ) {
- $buttonLabelKey = $newPage ? 'publishpage' : 'publishchanges';
+ $buttonLabelKey = $newPage ? 'publishpage' : 'publishchanges';
} else {
$buttonLabelKey = $newPage ? 'savearticle' : 'savechanges';
}
$logEntry->setComment( $reason );
$logEntry->setParameters( [
'4::target' => $nt->getPrefixedText(),
- '5::noredir' => $redirectContent ? '0': '1',
+ '5::noredir' => $redirectContent ? '0' : '1',
] );
$formatter = LogFormatter::newFromEntry( $logEntry );
}
public function key() {
- return $this->res ? $this->res->key(): 0;
+ return $this->res ? $this->res->key() : 0;
}
public function valid() {
$text = preg_replace_callback(
self::CHAR_REFS_REGEX,
[ 'Sanitizer', 'decodeCharReferencesCallback' ],
- $text, /* limit */ -1, $count );
+ $text,
+ -1, //limit
+ $count
+ );
if ( $count ) {
return $wgContLang->normalize( $text );
$req = $this->getRequest();
$contentType = $req->getHeader( 'content-type' );
if ( $contentType !== 'application/json'
- && $contentType !=='application/csp-report'
+ && $contentType !== 'application/csp-report'
) {
$this->error( 'wrongformat', __METHOD__ );
}
*/
private static function getProperties( $modulePrefix = '' ) {
return [
- 'timestamp' => ' timestamp - Adds timestamp for the uploaded version',
- 'user' => ' user - Adds the user who uploaded the image version',
- 'userid' => ' userid - Add the user ID that uploaded the image version',
- 'comment' => ' comment - Comment on the version',
- 'parsedcomment' => ' parsedcomment - Parse the comment on the version',
+ 'timestamp' => ' timestamp - Adds timestamp for the uploaded version',
+ 'user' => ' user - Adds the user who uploaded the image version',
+ 'userid' => ' userid - Add the user ID that uploaded the image version',
+ 'comment' => ' comment - Comment on the version',
+ 'parsedcomment' => ' parsedcomment - Parse the comment on the version',
'canonicaltitle' => ' canonicaltitle - Adds the canonical title of the image file',
- 'url' => ' url - Gives URL to the image and the description page',
- 'size' => ' size - Adds the size of the image in bytes, ' .
+ 'url' => ' url - Gives URL to the image and the description page',
+ 'size' => ' size - Adds the size of the image in bytes, ' .
'its height and its width. Page count and duration are added if applicable',
- 'dimensions' => ' dimensions - Alias for size', // B/C with Allimages
- 'sha1' => ' sha1 - Adds SHA-1 hash for the image',
- 'mime' => ' mime - Adds MIME type of the image',
- 'thumbmime' => ' thumbmime - Adds MIME type of the image thumbnail' .
+ 'dimensions' => ' dimensions - Alias for size', // B/C with Allimages
+ 'sha1' => ' sha1 - Adds SHA-1 hash for the image',
+ 'mime' => ' mime - Adds MIME type of the image',
+ 'thumbmime' => ' thumbmime - Adds MIME type of the image thumbnail' .
' (requires url and param ' . $modulePrefix . 'urlwidth)',
- 'mediatype' => ' mediatype - Adds the media type of the image',
- 'metadata' => ' metadata - Lists Exif metadata for the version of the image',
+ 'mediatype' => ' mediatype - Adds the media type of the image',
+ 'metadata' => ' metadata - Lists Exif metadata for the version of the image',
'commonmetadata' => ' commonmetadata - Lists file format generic metadata ' .
'for the version of the image',
- 'extmetadata' => ' extmetadata - Lists formatted metadata combined ' .
+ 'extmetadata' => ' extmetadata - Lists formatted metadata combined ' .
'from multiple sources. Results are HTML formatted.',
- 'archivename' => ' archivename - Adds the file name of the archive ' .
+ 'archivename' => ' archivename - Adds the file name of the archive ' .
'version for non-latest versions',
- 'bitdepth' => ' bitdepth - Adds the bit depth of the version',
- 'uploadwarning' => ' uploadwarning - Used by the Special:Upload page to ' .
+ 'bitdepth' => ' bitdepth - Adds the bit depth of the version',
+ 'uploadwarning' => ' uploadwarning - Used by the Special:Upload page to ' .
'get information about an existing file. Not intended for use outside MediaWiki core',
];
}
$watchedItemQuery = MediaWikiServices::getInstance()->getWatchedItemQueryService();
$items = $watchedItemQuery->getWatchedItemsWithRecentChangeInfo( $wlowner, $options, $startFrom );
- foreach ( $items as list ( $watchedItem, $recentChangeInfo ) ) {
+ foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) {
/** @var WatchedItem $watchedItem */
if ( is_null( $resultPageSet ) ) {
$vals = $this->extractOutputData( $watchedItem, $recentChangeInfo );
$defaultProfile = null;
foreach ( $profiles as $profile ) {
$types[] = $profile['name'];
- if ( isset ( $profile['desc-message'] ) ) {
+ if ( isset( $profile['desc-message'] ) ) {
$helpMessages[$profile['name']] = $profile['desc-message'];
}
if ( !empty( $profile['default'] ) ) {
$this->title = $groupDefinition['title'];
}
- if ( isset ( $groupDefinition['whatsThisHeader'] ) ) {
+ if ( isset( $groupDefinition['whatsThisHeader'] ) ) {
$this->whatsThisHeader = $groupDefinition['whatsThisHeader'];
$this->whatsThisBody = $groupDefinition['whatsThisBody'];
$this->whatsThisUrl = $groupDefinition['whatsThisUrl'];
'messageKeys' => [ $this->title ]
];
- if ( isset ( $this->whatsThisHeader ) ) {
+ if ( isset( $this->whatsThisHeader ) ) {
$output['whatsThisHeader'] = $this->whatsThisHeader;
$output['whatsThisBody'] = $this->whatsThisBody;
$output['whatsThisUrl'] = $this->whatsThisUrl;
if ( $rc->mAttribs['rc_log_type'] ) {
$logtitle = SpecialPage::getTitleFor( 'Log', $rc->mAttribs['rc_log_type'] );
$this->insertLog( $html, $logtitle, $rc->mAttribs['rc_log_type'] );
- $flags = $this->recentChangesFlags( [ 'unpatrolled' =>$unpatrolled,
+ $flags = $this->recentChangesFlags( [ 'unpatrolled' => $unpatrolled,
'bot' => $rc->mAttribs['rc_bot'] ], '' );
if ( $flags !== '' ) {
$html .= ' ' . $flags;
protected function getMasterDB() {
if ( !$this->dbw ) {
// Get a separate connection in autocommit mode
- $lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->newMainLB();
+ $lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->newMainLB();
$this->dbw = $lb->getConnection( DB_MASTER, [], $this->wiki );
$this->dbw->clearFlag( DBO_TRX );
}
}
// extensions -> extension.json, skins -> skin.json
- $jsonFile = substr( $directory, 0, strlen( $directory ) -1 ) . '.json';
+ $jsonFile = substr( $directory, 0, strlen( $directory ) - 1 ) . '.json';
$dh = opendir( $extDir );
$exts = [];
'type' => $installed['type'],
'licenses' => isset( $installed['license'] ) ? $installed['license'] : [],
'authors' => isset( $installed['authors'] ) ? $installed['authors'] : [],
- 'description' => isset( $installed['description'] ) ? $installed['description']: '',
+ 'description' => isset( $installed['description'] ) ? $installed['description'] : '',
];
}
'type' => $installed['type'],
'licenses' => isset( $installed['license'] ) ? $installed['license'] : [],
'authors' => isset( $installed['authors'] ) ? $installed['authors'] : [],
- 'description' => isset( $installed['description'] ) ? $installed['description']: '',
+ 'description' => isset( $installed['description'] ) ? $installed['description'] : '',
];
}
# string or an array containing the string and any flags. This mungs
# things around to match what this method should return.
if ( !is_array( $result ) ) {
- $result =[
+ $result = [
'found' => true,
'text' => $result,
];
'speculativeRevIdCallback' => null,
];
+ // @codingStandardsIgnoreStart Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfterAmp
Hooks::run( 'ParserOptionsRegister', [
&self::$defaults,
&self::$inCacheKey,
&self::$lazyOptions,
] );
+ // @codingStandardsIgnoreEnd
ksort( self::$inCacheKey );
}
$curLen = strlen( $curChar );
$count = ( $curLen > 1 ) ?
# allow the final character to repeat
- strspn( $text, $curChar[$curLen-1], $i+1 ) + 1 :
+ strspn( $text, $curChar[$curLen - 1], $i + 1 ) + 1 :
strspn( $text, $curChar, $i );
# we need to add to stack only if opening brace count is enough for one of the rules
$curLen = strlen( $curChar );
$count = ( $curLen > 1 ) ?
# allow the final character to repeat
- strspn( $text, $curChar[$curLen-1], $i+1 ) + 1 :
+ strspn( $text, $curChar[$curLen - 1], $i + 1 ) + 1 :
strspn( $text, $curChar, $i );
# we need to add to stack only if opening brace count is enough for one of the rules
/* Find all items under this entry */
$level = $stack[$max][1];
$working = [];
- for ( $i = $max -1; $i >= 0; $i-- ) {
+ for ( $i = $max - 1; $i >= 0; $i-- ) {
if ( $stack[$i][1] > $level ) {
$working[] = $stack[$i];
} else {
protected function calltreeCount( $stack, $start ) {
$level = $stack[$start][1];
$count = 0;
- for ( $i = $start -1; $i >= 0 && $stack[$i][1] > $level; $i-- ) {
+ for ( $i = $start - 1; $i >= 0 && $stack[$i][1] > $level; $i-- ) {
$count ++;
}
return $count;
* @return mixed the feature value or null if unset
*/
public function getFeatureData( $feature ) {
- if ( isset ( $this->features[$feature] ) ) {
+ if ( isset( $this->features[$feature] ) ) {
return $this->features[$feature];
}
return null;
$searchChars = parent::legalSearchChars( $type );
if ( $type === self::CHARS_ALL ) {
// " for phrase, * for wildcard
- $searchChars = "\"*" . $searchChars;
+ $searchChars = "\"*" . $searchChars;
}
return $searchChars;
}
*/
public function getLinkPath() {
$type = $this->getLinkPathType();
- return $type === null ? null: $this->getPath( $type );
+ return $type === null ? null : $this->getPath( $type );
}
/**
// Don't show a "create account" link if the user can't.
if ( $this->showCreateAccountLink() ) {
// link to the other action
- $linkTitle = $this->getTitleFor( $this->isSignup() ? 'Userlogin' :'CreateAccount' );
+ $linkTitle = $this->getTitleFor( $this->isSignup() ? 'Userlogin' : 'CreateAccount' );
$linkq = $this->getReturnToQueryStringFragment();
// Pass any language selection on to the mode switch link
if ( $this->mLanguage ) {
$formDescriptor += [
'wpDownload' => [
'type' => 'check',
- 'name' =>'wpDownload',
+ 'name' => 'wpDownload',
'id' => 'wpDownload',
'default' => $request->wasPosted() ? $request->getCheck( 'wpDownload' ) : true,
'label-message' => 'export-download',
$row .= Html::rawElement(
'td',
// Make sure js sorts it in numeric order
- [ 'data-sort-value' => $bytes ],
+ [ 'data-sort-value' => $bytes ],
$this->msg( 'mediastatistics-nbytes' )
->numParams( $bytes )
->sizeParams( $bytes )
'success' => 'revdelete-success',
'failure' => 'revdelete-failure',
'text' => 'revdelete-text-text',
- 'selected'=> 'revdelete-selected-text',
+ 'selected' => 'revdelete-selected-text',
],
'archive' => [
'check-label' => 'revdelete-hide-text',
'success' => 'revdelete-success',
'failure' => 'revdelete-failure',
'text' => 'revdelete-text-text',
- 'selected'=> 'revdelete-selected-text',
+ 'selected' => 'revdelete-selected-text',
],
'oldimage' => [
'check-label' => 'revdelete-hide-image',
'success' => 'revdelete-success',
'failure' => 'revdelete-failure',
'text' => 'revdelete-text-file',
- 'selected'=> 'revdelete-selected-file',
+ 'selected' => 'revdelete-selected-file',
],
'filearchive' => [
'check-label' => 'revdelete-hide-image',
'success' => 'revdelete-success',
'failure' => 'revdelete-failure',
'text' => 'revdelete-text-file',
- 'selected'=> 'revdelete-selected-file',
+ 'selected' => 'revdelete-selected-file',
],
'logging' => [
'check-label' => 'revdelete-hide-name',
// default string representation, for example, and would confuse comparisons.
// Misleadingly, the 'days' option supports hours too.
- $days = array_map( 'strval', [ 1/24, 2/24, 6/24, 12/24, 1, 3, 7 ] );
+ $days = array_map( 'strval', [ 1 / 24, 2 / 24, 6 / 24, 12 / 24, 1, 3, 7 ] );
$userWatchlistOption = (string)$this->getUser()->getOption( 'watchlistdays' );
// add the user preference, if it isn't available already
// Allow modification of redirect behavior
Hooks::run( 'PostLoginRedirect', [ &$returnTo, &$returnToQuery, &$type ] );
- $returnToTitle = Title::newFromText( $returnTo ) ?: Title::newMainPage();
+ $returnToTitle = Title::newFromText( $returnTo ) ?: Title::newMainPage();
if ( $wgSecureLogin && !$stickHTTPS ) {
$options = [ 'http' ];
function getPageHeader() {
list( $self ) = explode( '/', $this->getTitle()->getPrefixedDBkey() );
- $groupOptions = [ $this->msg( 'group-all' )->text() => '' ];
+ $groupOptions = [ $this->msg( 'group-all' )->text() => '' ];
foreach ( $this->getAllGroups() as $group => $groupText ) {
$groupOptions[ $groupText ] = $group;
}
$furthestBlock = null;
$furthestBlockIndex = -1;
$stackLength = $this->length();
- for ( $i = $index+1; $i < $stackLength; $i++ ) {
+ for ( $i = $index + 1; $i < $stackLength; $i++ ) {
if ( $this->node( $i )->isA( BalanceSets::$specialSet ) ) {
$furthestBlock = $this->node( $i );
$furthestBlockIndex = $i;
// Let the common ancestor be the element immediately above
// the formatting element in the stack of open elements.
- $ancestor = $this->node( $index-1 );
+ $ancestor = $this->node( $index - 1 );
// Let a bookmark note the position of the formatting
// element in the list of active formatting elements
return $this->insertToken( $token, $value, $attribs, $selfClose );
}
// "Any other start tag"
- $adjusted = ( $this->fragmentContext && $this->stack->length()===1 ) ?
+ $adjusted = ( $this->fragmentContext && $this->stack->length() === 1 ) ?
$this->fragmentContext : $this->stack->currentNode;
$this->stack->insertForeignElement(
$adjusted->namespaceURI, $value, $attribs
private function switchMode( $mode ) {
Assert::parameter(
- substr( $mode, -4 )==='Mode', '$mode', 'should end in Mode'
+ substr( $mode, -4 ) === 'Mode', '$mode', 'should end in Mode'
);
$oldMode = $this->parseMode;
$this->parseMode = $mode;
switch ( $node->localName ) {
case 'select':
$stackLength = $this->stack->length();
- for ( $j = $i + 1; $j < $stackLength-1; $j++ ) {
- $ancestor = $this->stack->node( $stackLength-$j-1 );
+ for ( $j = $i + 1; $j < $stackLength - 1; $j++ ) {
+ $ancestor = $this->stack->node( $stackLength - $j - 1 );
if ( $ancestor->isHtmlNamed( 'template' ) ) {
break;
}
$iwIconUrl = $parsed['scheme'] .
$parsed['delimiter'] .
$parsed['host'] .
- ( isset ( $parsed['port'] ) ? ':' . $parsed['port'] : '' ) .
+ ( isset( $parsed['port'] ) ? ':' . $parsed['port'] : '' ) .
'/favicon.ico';
$iwIcon = new OOUI\IconWidget( [
}
return Html::rawElement( 'div', [ 'class' => 'iw-result__title' ], $link . ' ' . $redirect ) .
- Html::rawElement( 'div', [ 'class'=> 'iw-result__content' ], $snippet );
+ Html::rawElement( 'div', [ 'class' => 'iw-result__content' ], $snippet );
}
}
* @return int[]
*/
private static function tsToIranian( $ts ) {
- $gy = substr( $ts, 0, 4 ) -1600;
- $gm = substr( $ts, 4, 2 ) -1;
- $gd = substr( $ts, 6, 2 ) -1;
+ $gy = substr( $ts, 0, 4 ) - 1600;
+ $gm = substr( $ts, 4, 2 ) - 1;
+ $gd = substr( $ts, 6, 2 ) - 1;
# Days passed from the beginning (including leap years)
$gDayNo = 365 * $gy
(int)( ( 275 * $zm ) / 9 ) + $zd + 1729777;
}
- $zl = $zjd -1948440 + 10632;
+ $zl = $zjd - 1948440 + 10632;
$zn = (int)( ( $zl - 1 ) / 10631 );
$zl = $zl - 10631 * $zn + 354;
$zj = ( (int)( ( 10985 - $zl ) / 5316 ) ) * ( (int)( ( 50 * $zl ) / 17719 ) ) +
if ( $start < 0 ) {
$start = 0;
}
- $groupedNumber = substr( $number, $start, $end -$start ) . $groupedNumber;
+ $groupedNumber = substr( $number, $start, $end - $start ) . $groupedNumber;
$end = $start;
if ( $numMatches > 1 ) {
// use the last pattern for the rest of the number
$ret = '';
foreach ( $matches as $m ) {
- $ret .= substr( $text, $mstart, $m[1] -$mstart );
+ $ret .= substr( $text, $mstart, $m[1] - $mstart );
$ret .= $this->regsConverter( $m[0], $toVariant );
$mstart = $m[1] + strlen( $m[0] );
}
$ret = $this->mTables[$toVariant]->replace( $m[0] );
$mstart = $m[1] + strlen( $m[0] );
foreach ( $matches as $m ) {
- $ret .= substr( $text, $mstart, $m[1] -$mstart );
+ $ret .= substr( $text, $mstart, $m[1] - $mstart );
$ret .= parent::translate( $m[0], $toVariant );
$mstart = $m[1] + strlen( $m[0] );
}
$dateFormats = [
'km time' => 'ម៉ោងH:i',
'km date' => 'l ទីd F ឆ្នាំY',
- 'km both' => 'ម៉ោងH:i l ទីd F ឆ្នាំY',
+ 'km both' => 'ម៉ោងH:i l ទីd F ឆ្នាំY',
];
$specialPageAliases = [
print "Found " . count( $files ) . " files in " .
count( $dirs ) . " directories\n";
- $tmpDir = wfTempDir() . '/mw-make-repo' . mt_rand( 0, 1<<31 );
+ $tmpDir = wfTempDir() . '/mw-make-repo' . mt_rand( 0, 1 << 31 );
if ( !mkdir( $tmpDir ) ) {
$this->error( 'Unable to create temporary directory', 1 );
}
do {
$finalConds = $conds;
$timestamp = $dbr->addQuotes( $timestamp );
- $finalConds []=
+ $finalConds [] =
"(cl_timestamp > $timestamp OR (cl_timestamp = $timestamp AND cl_from > $lastId))";
$res = $dbr->select( [ 'page', 'categorylinks' ],
[ 'page_id', 'cl_timestamp' ],
'ConfigFactory',
self::makeTestConfigFactoryInstantiator(
$oldConfigFactory,
- [ 'main' => $bootstrapConfig ]
+ [ 'main' => $bootstrapConfig ]
)
);
$newServices->resetServiceForTesting( 'DBLoadBalancerFactory' );
]
);
- $groupB = $this->getGroup(
+ $groupB = $this->getGroup(
[
'name' => 'groupB',
'filters' => [
*/
public function testConstructCacheSpec() {
$config = $this->createConfigMock( [ 'cache' => [
- 'class' => HashBagOStuff::class
+ 'class' => HashBagOStuff::class
] ] );
$config->expects( $this->once() )->method( 'fetchAllFromEtcd' )
->willReturn( [
$lookup = new \MediaWiki\Interwiki\ClassicInterwikiLookup(
Language::factory( 'en' ),
WANObjectCache::newEmpty(),
- 60*60,
+ 60 * 60,
false,
3,
'en'
$lookup = new \MediaWiki\Interwiki\ClassicInterwikiLookup(
Language::factory( 'en' ),
WANObjectCache::newEmpty(),
- 60*60,
+ 60 * 60,
$cdbFile,
3,
'en'
$lookup = new \MediaWiki\Interwiki\ClassicInterwikiLookup(
Language::factory( 'en' ),
WANObjectCache::newEmpty(),
- 60*60,
+ 60 * 60,
$hash,
3,
'en'
'length' => $this->getLength( $file ),
'offset' => $this->getOffset( $file ),
'width' => $targetWidth,
- 'height' => $targetHeight,
+ 'height' => $targetHeight,
'isVideo' => !$this->isAudio( $file ),
'thumbtime' => isset(
$params['thumbtime']
'start' => isset( $params['start'] ) ? $params['start'] : false,
'end' => isset( $params['end'] ) ? $params['end'] : false,
'fillwindow' => isset( $params['fillwindow'] ) ? $params['fillwindow'] : false,
- 'disablecontrols' => isset ( $params['disablecontrols'] ) ? $params['disablecontrols'] : false
+ 'disablecontrols' => isset( $params['disablecontrols'] ) ? $params['disablecontrols'] : false
];
// No thumbs for audio
}, {}, {});
",
- 'testSkipped' =>"
+ 'testSkipped' => "
mw.loader.implement( 'testSkipped', function () {
QUnit.ok( false, 'Module testSkipped was supposed to be skipped.' );
}, {}, {});
",
- 'testNotSkipped' =>"
+ 'testNotSkipped' => "
mw.loader.implement( 'testNotSkipped', function () {}, {}, {});
",
- 'testUsesSkippable' =>"
+ 'testUsesSkippable' => "
mw.loader.implement( 'testUsesSkippable', function () {}, {}, {});
",
];