* @param string $caller The method making this request, for profiling
* @param Profiler $profiler An instance of the profiler for profiling, or null
*/
- protected function __construct( $url, $options = array(), $caller = __METHOD__, $profiler = null ) {
+ protected function __construct(
+ $url, $options = array(), $caller = __METHOD__, $profiler = null
+ ) {
global $wgHTTPTimeout, $wgHTTPConnectTimeout;
$this->url = wfExpandUrl( $url, PROTO_HTTP );
}
/**
- * Returns an array with a 'capath' or 'cafile' key that is suitable to be merged into the 'ssl' sub-array of a
- * stream context options array. Uses the 'caInfo' option of the class if it is provided, otherwise uses the system
+ * Returns an array with a 'capath' or 'cafile' key
+ * that is suitable to be merged into the 'ssl' sub-array of
+ * a stream context options array.
+ * Uses the 'caInfo' option of the class if it is provided, otherwise uses the system
* default CA bundle if PHP supports that, or searches a few standard locations.
* @return array
* @throws DomainException
if ( $this->caInfo ) {
$certLocations = array( 'manual' => $this->caInfo );
} elseif ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
// Default locations, based on
// https://www.happyassassin.net/2015/01/12/a-note-about-ssltls-trusted-certificate-stores-and-platforms/
- // PHP 5.5 and older doesn't have any defaults, so we try to guess ourselves. PHP 5.6+ gets the CA location
- // from OpenSSL as long as it is not set manually, so we should leave capath/cafile empty there.
+ // PHP 5.5 and older doesn't have any defaults, so we try to guess ourselves.
+ // PHP 5.6+ gets the CA location from OpenSSL as long as it is not set manually,
+ // so we should leave capath/cafile empty there.
+ // @codingStandardsIgnoreEnd
$certLocations = array_filter( array(
getenv( 'SSL_CERT_DIR' ),
getenv( 'SSL_CERT_PATH' ),
}
/**
- * Custom error handler for dealing with fopen() errors. fopen() tends to fire multiple errors in succession, and the last one
- * is completely useless (something like "fopen: failed to open stream") so normal methods of handling errors programmatically
+ * Custom error handler for dealing with fopen() errors.
+ * fopen() tends to fire multiple errors in succession, and the last one
+ * is completely useless (something like "fopen: failed to open stream")
+ * so normal methods of handling errors programmatically
* like get_last_error() don't work.
*/
public function errorHandler( $errno, $errstr ) {
* @deprecated since 1.26 Use Language::getHumanTimestamp directly
*
* @param MWTimestamp|null $relativeTo The base timestamp to compare to (defaults to now)
- * @param User|null $user User the timestamp is being generated for (or null to use main context's user)
- * @param Language|null $lang Language to use to make the human timestamp (or null to use main context's language)
+ * @param User|null $user User the timestamp is being generated for
+ * (or null to use main context's user)
+ * @param Language|null $lang Language to use to make the human timestamp
+ * (or null to use main context's language)
* @return string Formatted timestamp
*/
- public function getHumanTimestamp( MWTimestamp $relativeTo = null, User $user = null, Language $lang = null ) {
+ public function getHumanTimestamp(
+ MWTimestamp $relativeTo = null, User $user = null, Language $lang = null
+ ) {
if ( $lang === null ) {
$lang = RequestContext::getMain()->getLanguage();
}
. "https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries\n"
. "for help on installing the required components.";
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
$longHtml = <<<HTML
- MediaWiki now also has some external dependencies that need to be installed via
- composer or from a separate git repo. Please see
- <a href="https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a>
- for help on installing the required components.
+ MediaWiki now also has some external dependencies that need to be installed via
+ composer or from a separate git repo. Please see
+ <a href="https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a>
+ for help on installing the required components.
HTML;
+ // @codingStandardsIgnoreEnd
wfGenericError( $type, $mwVersion, 'External dependencies', $shortText, $longText, $longHtml );
}
protected function checkContentModel() {
global $wgContentHandlerUseDB;
- $title = $this->getTitle(); // note: may return null for revisions that have not yet been inserted.
+ // Note: may return null for revisions that have not yet been inserted
+ $title = $this->getTitle();
$model = $this->getContentModel();
$format = $this->getContentFormat();
}
protected function getExamplesMessages() {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
'action=block&user=192.0.2.5&expiry=3%20days&reason=First%20strike&token=123ABC'
=> 'apihelp-block-example-ip-simple',
'action=block&user=Vandal&expiry=never&reason=Vandalism&nocreate=&autoblock=&noemail=&token=123ABC'
=> 'apihelp-block-example-user-complex',
);
+ // @codingStandardsIgnoreEnd
}
public function getHelpUrls() {
$lang = $langObj->getCode();
$customisedMessages = AllMessagesTablePager::getCustomisedStatuses(
- array_map( array( $langObj, 'ucfirst' ), $messages_target ), $lang, $lang != $wgContLang->getCode() );
+ array_map(
+ array( $langObj, 'ucfirst' ),
+ $messages_target
+ ),
+ $lang,
+ $lang != $wgContLang->getCode()
+ );
$customised = $params['customised'] === 'modified';
}
# at least one character of a host name (embeds EXT_LINK_URL_CLASS)
const EXT_LINK_ADDR = '(?:[0-9.]+|\\[(?i:[0-9a-f:.]+)\\]|[^][<>"\\x00-\\x20\\x7F\p{Zs}])';
# RegExp to make image URLs (embeds IPv6 part of EXT_LINK_ADDR)
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
const EXT_IMAGE_REGEX = '/^(http:\/\/|https:\/\/)((?:\\[(?i:[0-9a-f:.]+)\\])?[^][<>"\\x00-\\x20\\x7F\p{Zs}]+)
\\/([A-Za-z0-9_.,~%\\-+&;#*?!=()@\\x80-\\xFF]+)\\.((?i)gif|png|jpg|jpeg)$/Sxu';
+ // @codingStandardsIgnoreEnd
# Regular expression for a non-newline space
const SPACE_NOT_NL = '(?:\t| |&\#0*160;|&\#[Xx]0*[Aa]0;|\p{Zs})';
}
$conn = $status->value;
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
static $script =
<<<LUA
local kSlots,kSlotsNextRelease,kWakeup,kWaiting = unpack(KEYS)
end
return 1
LUA;
+ // @codingStandardsIgnoreEnd
+
try {
$conn->luaEval( $script,
array(
} elseif ( $field === 'am_title' ) {
return array( 'class' => $field );
} else {
- return array( 'lang' => wfBCP47( $this->langcode ), 'dir' => $this->lang->getDir(), 'class' => $field );
+ return array(
+ 'lang' => wfBCP47( $this->langcode ),
+ 'dir' => $this->lang->getDir(),
+ 'class' => $field
+ );
}
}
$logId = $logEntry->insert();
$logEntry->publish( $logId );
- $targetLink = Linker::link( $targetTitle, $targetTitle->getPrefixedText(), array(), array( 'redirect' => 'no' ) );
+ $targetLink = Linker::link(
+ $targetTitle,
+ $targetTitle->getPrefixedText(),
+ array(),
+ array( 'redirect' => 'no' )
+ );
$this->getOutput()->addWikiMsg( $this->msg( 'mergehistory-done' )
->rawParams( $targetLink )
# image/svg, text/xml, application/xml, and text/html, which can contain scripts
if ( $stripped == 'href' && strncasecmp( 'data:', $value, 5 ) === 0 ) {
// rfc2397 parameters. This is only slightly slower than (;[\w;]+)*.
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
$parameters = '(?>;[a-zA-Z0-9\!#$&\'*+.^_`{|}~-]+=(?>[a-zA-Z0-9\!#$&\'*+.^_`{|}~-]+|"(?>[\0-\x0c\x0e-\x21\x23-\x5b\x5d-\x7f]+|\\\\[\0-\x7f])*"))*(?:;base64)?';
+ // @codingStandardsIgnoreEnd
+
if ( !preg_match( "!^data:\s*image/(gif|jpeg|jpg|png)$parameters,!i", $value ) ) {
wfDebug( __METHOD__ . ": Found href to unwhitelisted data: uri "
. "\"<$strippedElement '$attrib'='$value'...\" in uploaded file.\n" );
}
};
- $importer = new WikiImporter( $source, ConfigFactory::getDefaultInstance()->makeConfig( 'main' ) );
+ $importer = new WikiImporter(
+ $source,
+ ConfigFactory::getDefaultInstance()->makeConfig( 'main' )
+ );
$importer->setPageOutCallback( $callback );
$importer->doImport();
}
public function getRedirectXML() {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
array(
<<< EOF
null
),
);
+ // @codingStandardsIgnoreEnd
}
/**
$importNamespaces = $siteinfo['_namespaces'];
};
- $importer = new WikiImporter( $source, ConfigFactory::getDefaultInstance()->makeConfig( 'main' ) );
+ $importer = new WikiImporter(
+ $source,
+ ConfigFactory::getDefaultInstance()->makeConfig( 'main' )
+ );
$importer->setSiteInfoCallback( $callback );
$importer->doImport();
}
public function getSiteInfoXML() {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
array(
<<< EOF
)
),
);
+ // @codingStandardsIgnoreEnd
}
}
public function provideCasesForFormatComment() {
$wikiId = 'enwiki'; // $wgConf has a fake entry for this
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
// Linker::formatComment
array(
false, false, $wikiId
)
);
+ // @codingStandardsIgnoreEnd
}
/**
}
public static function provideCasesForFormatLinksInComment() {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
array(
'foo bar <a href="/wiki/Special:BlankPage" title="Special:BlankPage">Special:BlankPage</a>',
'enwiki',
),
);
+ // @codingStandardsIgnoreEnd
}
}
private function assertNotReal() {
global $wgDBprefix;
- if ( $wgDBprefix !== MediaWikiTestCase::DB_PREFIX && $wgDBprefix !== MediaWikiTestCase::ORA_DB_PREFIX ) {
+ if ( $wgDBprefix !== MediaWikiTestCase::DB_PREFIX &&
+ $wgDBprefix !== MediaWikiTestCase::ORA_DB_PREFIX
+ ) {
throw new MWException( "Can't create user on real database" );
}
}
/**
* @dataProvider provideGetCanonicalUrl
*/
- public function testGetCanonicalUrl( $expected, $canonicalServer, $server, $path, $page, $fragmentId ) {
+ public function testGetCanonicalUrl(
+ $expected, $canonicalServer, $server, $path, $page, $fragmentId
+ ) {
$reference = new WikiReference( $canonicalServer, $path, $server );
$this->assertEquals( $expected, $reference->getCanonicalUrl( $page, $fragmentId ) );
}
);
}
- $manager = self::getManager( '||mock2', array_slice( $allModules, 0, 2 ), array( 'mock1', 'mock2' ) );
+ $manager = self::getManager(
+ '||mock2',
+ array_slice( $allModules, 0, 2 ),
+ array( 'mock1', 'mock2' )
+ );
try {
$manager->addContinueParam( $allModules[1], 'm2continue', 1 );
$this->fail( 'Expected exception not thrown' );
} catch ( UnexpectedValueException $ex ) {
$this->assertSame(
- 'Module \'mock2\' was not supposed to have been executed, but it was executed anyway',
+ 'Module \'mock2\' was not supposed to have been executed, ' .
+ 'but it was executed anyway',
$ex->getMessage(),
'Expected exception'
);
$this->fail( 'Expected exception not thrown' );
} catch ( UnexpectedValueException $ex ) {
$this->assertSame(
- 'Module \'mocklist\' called ApiContinuationManager::addContinueParam but was not passed to ApiContinuationManager::__construct',
+ 'Module \'mocklist\' called ApiContinuationManager::addContinueParam ' .
+ 'but was not passed to ApiContinuationManager::__construct',
$ex->getMessage(),
'Expected exception'
);
public function testCheckDirectApiEditingDisallowed_forNonTextContent() {
$this->setExpectedException(
'UsageException',
- 'Direct editing via API is not supported for content model testing used by Dummy:ApiEditPageTest_nonTextPageEdit'
+ 'Direct editing via API is not supported for content model ' .
+ 'testing used by Dummy:ApiEditPageTest_nonTextPageEdit'
);
$this->doApiRequestWithToken( array(
array(
'errors' => array(
'err' => array(
- array( 'code' => 'mainpage', 'message' => 'mainpage', 'params' => array( $I => 'param' ) ),
+ array(
+ 'code' => 'mainpage',
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' )
+ ),
$I => 'error',
),
),
'warnings' => array(
'string' => array(
- array( 'code' => 'mainpage', 'message' => 'mainpage', 'params' => array( $I => 'param' ) ),
+ array(
+ 'code' => 'mainpage',
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' )
+ ),
$I => 'warning',
),
),
array(
'errors' => array(
'errWithData' => array(
- array( 'code' => 'overriddenCode', 'message' => 'mainpage', 'params' => array( $I => 'param' ),
- 'overriddenData' => true ),
+ array(
+ 'code' => 'overriddenCode',
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' ),
+ 'overriddenData' => true
+ ),
$I => 'error',
),
),
'warnings' => array(
'messageWithData' => array(
- array( 'code' => 'overriddenCode', 'message' => 'mainpage', 'params' => array( $I => 'param' ),
- 'overriddenData' => true ),
+ array(
+ 'code' => 'overriddenCode',
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' ),
+ 'overriddenData' => true
+ ),
$I => 'warning',
),
'message' => array(
- array( 'code' => 'mainpage', 'message' => 'mainpage', 'params' => array( $I => 'param' ) ),
+ array(
+ 'code' => 'mainpage',
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' )
+ ),
$I => 'warning',
),
'foo' => array(
- array( 'code' => 'mainpage', 'message' => 'mainpage', 'params' => array( $I => 'param' ) ),
- array( 'code' => 'parentheses', 'message' => 'parentheses', 'params' => array( 'foobar', $I => 'param' ) ),
+ array(
+ 'code' => 'mainpage',
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' )
+ ),
+ array(
+ 'code' => 'parentheses',
+ 'message' => 'parentheses',
+ 'params' => array( 'foobar', $I => 'param' )
+ ),
$I => 'warning',
),
),
array(
'errors' => array(
'status' => array(
- array( 'code' => 'mainpage', 'message' => 'mainpage', 'params' => array( $I => 'param' ) ),
- array( 'code' => 'parentheses', 'message' => 'parentheses', 'params' => array( 'foobar', $I => 'param' ) ),
+ array(
+ 'code' => 'mainpage',
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' )
+ ),
+ array(
+ 'code' => 'parentheses',
+ 'message' => 'parentheses',
+ 'params' => array( 'foobar', $I => 'param' )
+ ),
$I => 'error',
),
),
'warnings' => array(
'status' => array(
- array( 'code' => 'mainpage', 'message' => 'mainpage', 'params' => array( $I => 'param' ) ),
- array( 'code' => 'parentheses', 'message' => 'parentheses', 'params' => array( 'foobar', $I => 'param' ) ),
- array( 'code' => 'overriddenCode', 'message' => 'mainpage', 'params' => array( $I => 'param' ),
- 'overriddenData' => true ),
+ array(
+ 'code' => 'mainpage',
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' )
+ ),
+ array(
+ 'code' => 'parentheses',
+ 'message' => 'parentheses',
+ 'params' => array( 'foobar', $I => 'param' )
+ ),
+ array(
+ 'code' => 'overriddenCode',
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' ),
+ 'overriddenData' => true
+ ),
$I => 'warning',
),
),
$I = ApiResult::META_INDEXED_TAG_NAME;
$this->assertSame(
array(
- array( 'type' => 'error', 'message' => 'mainpage', 'params' => array( $I => 'param' ) ),
- array( 'type' => 'error', 'message' => 'parentheses', 'params' => array( 'foobar', $I => 'param' ) ),
+ array(
+ 'type' => 'error',
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' )
+ ),
+ array(
+ 'type' => 'error',
+ 'message' => 'parentheses',
+ 'params' => array( 'foobar', $I => 'param' )
+ ),
$I => 'error',
),
$formatter->arrayFromStatus( $status, 'error' ),
);
$this->assertSame(
array(
- array( 'type' => 'warning', 'message' => 'mainpage', 'params' => array( $I => 'param' ) ),
- array( 'type' => 'warning', 'message' => 'parentheses', 'params' => array( 'foobar', $I => 'param' ) ),
- array( 'message' => 'mainpage', 'params' => array( $I => 'param' ), 'type' => 'warning' ),
- array( 'message' => 'mainpage', 'params' => array( $I => 'param' ), 'type' => 'warning' ),
+ array(
+ 'type' => 'warning',
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' )
+ ),
+ array(
+ 'type' => 'warning',
+ 'message' => 'parentheses',
+ 'params' => array( 'foobar', $I => 'param' )
+ ),
+ array(
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' ),
+ 'type' => 'warning'
+ ),
+ array(
+ 'message' => 'mainpage',
+ 'params' => array( $I => 'param' ),
+ 'type' => 'warning'
+ ),
$I => 'warning',
),
$formatter->arrayFromStatus( $status, 'warning' ),
* @param int $status Expected response status
* @param bool $post Request is a POST
*/
- public function testCheckConditionalRequestHeaders( $headers, $conditions, $status, $post = false ) {
+ public function testCheckConditionalRequestHeaders(
+ $headers, $conditions, $status, $post = false
+ ) {
$request = new FauxRequest( array( 'action' => 'query', 'meta' => 'siteinfo' ), $post );
$request->setHeaders( $headers );
$request->response()->statusHeader( 200 ); // Why doesn't it default?
* @param bool $isError $isError flag
* @param bool $post Request is a POST
*/
- public function testConditionalRequestHeadersOutput( $conditions, $headers, $isError = false, $post = false ) {
+ public function testConditionalRequestHeadersOutput(
+ $conditions, $headers, $isError = false, $post = false
+ ) {
$request = new FauxRequest( array( 'action' => 'query', 'meta' => 'siteinfo' ), $post );
$response = $request->response();
$moduleManager->addModules( $fooModules, 'foo' );
$moduleManager->addModules( $barModules, 'bar' );
- $this->assertEquals( 'ApiLogin', $moduleManager->getClassName( 'login' ) );
- $this->assertEquals( 'ApiLogout', $moduleManager->getClassName( 'logout' ) );
- $this->assertEquals( 'ApiFeedContributions', $moduleManager->getClassName( 'feedcontributions' ) );
- $this->assertEquals( 'ApiFeedRecentChanges', $moduleManager->getClassName( 'feedrecentchanges' ) );
- $this->assertFalse( $moduleManager->getClassName( 'nonexistentmodule' ) );
+ $this->assertEquals(
+ 'ApiLogin',
+ $moduleManager->getClassName( 'login' )
+ );
+ $this->assertEquals(
+ 'ApiLogout',
+ $moduleManager->getClassName( 'logout' )
+ );
+ $this->assertEquals(
+ 'ApiFeedContributions',
+ $moduleManager->getClassName( 'feedcontributions' )
+ );
+ $this->assertEquals(
+ 'ApiFeedRecentChanges',
+ $moduleManager->getClassName( 'feedrecentchanges' )
+ );
+ $this->assertFalse(
+ $moduleManager->getClassName( 'nonexistentmodule' )
+ );
}
-
-
}
'kvpmerge' => array(
$kvp( 'name', 'x', 'value', 'a' ),
$kvp( 'name', 'y', 'value', array( 'b', ApiResult::META_TYPE => 'array' ) ),
- array( 'name' => 'z', 'c' => 'd', ApiResult::META_TYPE => 'assoc', ApiResult::META_PRESERVE_KEYS => array( 'name' ) ),
+ array(
+ 'name' => 'z',
+ 'c' => 'd',
+ ApiResult::META_TYPE => 'assoc',
+ ApiResult::META_PRESERVE_KEYS => array( 'name' )
+ ),
ApiResult::META_TYPE => 'array',
ApiResult::META_KVP_MERGE => true,
),
'kvpmerge' => array(
$kvp( 'name', 'x', '*', 'a' ),
$kvp( 'name', 'y', '*', array( 'b', ApiResult::META_TYPE => 'array' ) ),
- array( 'name' => 'z', 'c' => 'd', ApiResult::META_TYPE => 'assoc', ApiResult::META_PRESERVE_KEYS => array( 'name' ) ),
+ array(
+ 'name' => 'z',
+ 'c' => 'd',
+ ApiResult::META_TYPE => 'assoc',
+ ApiResult::META_PRESERVE_KEYS => array( 'name' ) ),
ApiResult::META_TYPE => 'array',
ApiResult::META_KVP_MERGE => true,
),
'kvpmerge' => array(
(object)$kvp( 'name', 'x', 'value', 'a' ),
(object)$kvp( 'name', 'y', 'value', array( 'b', ApiResult::META_TYPE => 'array' ) ),
- (object)array( 'name' => 'z', 'c' => 'd', ApiResult::META_TYPE => 'assoc', ApiResult::META_PRESERVE_KEYS => array( 'name' ) ),
+ (object)array(
+ 'name' => 'z',
+ 'c' => 'd',
+ ApiResult::META_TYPE => 'assoc',
+ ApiResult::META_PRESERVE_KEYS => array( 'name' )
+ ),
ApiResult::META_TYPE => 'array',
ApiResult::META_KVP_MERGE => true,
),
protected function setUp() {
// Needs to be before setup since this gets cached
- $this->mergeMwGlobalArrayValue( 'wgGroupPermissions', array( 'sysop' => array( 'deleterevision' => true ) ) );
+ $this->mergeMwGlobalArrayValue(
+ 'wgGroupPermissions',
+ array( 'sysop' => array( 'deleterevision' => true ) )
+ );
parent::setUp();
// Make a few edits for us to play with
for ( $i = 1; $i <= 5; $i++ ) {
self::editPage( self::$page, MWCryptRand::generateHex( 10 ), 'summary' );
- $this->revs[] = Title::newFromText( self::$page )->getLatestRevID( Title::GAID_FOR_UPDATE );
+ $this->revs[] = Title::newFromText( self::$page )
+ ->getLatestRevID( Title::GAID_FOR_UPDATE );
}
}
array( array( 'fóo' ), "array ({$warning}\n 0 => 'fóo',\n)" ),
// Arrays and objects
- array( array( array() ), "array ({$warning}\n 0 => \n array (\n ),\n)" ),
- array( array( array( 1 ) ), "array ({$warning}\n 0 => \n array (\n 0 => 1,\n ),\n)" ),
- array( array( array( 'x' => 1 ) ), "array ({$warning}\n 0 => \n array (\n 'x' => 1,\n ),\n)" ),
- array( array( array( 2 => 1 ) ), "array ({$warning}\n 0 => \n array (\n 2 => 1,\n ),\n)" ),
- array( array( (object)array() ), "array ({$warning}\n 0 => \n array (\n ),\n)" ),
- array( array( array( 1, ApiResult::META_TYPE => 'assoc' ) ), "array ({$warning}\n 0 => \n array (\n 0 => 1,\n ),\n)" ),
- array( array( array( 'x' => 1, ApiResult::META_TYPE => 'array' ) ), "array ({$warning}\n 0 => \n array (\n 0 => 1,\n ),\n)" ),
- array( array( array( 'x' => 1, ApiResult::META_TYPE => 'kvp' ) ), "array ({$warning}\n 0 => \n array (\n 'x' => 1,\n ),\n)" ),
- array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCkvp', ApiResult::META_KVP_KEY_NAME => 'key' ) ),
- "array ({$warning}\n 0 => \n array (\n 0 => \n array (\n 'key' => 'x',\n '*' => 1,\n ),\n ),\n)" ),
- array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCarray' ) ), "array ({$warning}\n 0 => \n array (\n 'x' => 1,\n ),\n)" ),
- array( array( array( 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ) ), "array ({$warning}\n 0 => \n array (\n 0 => 'a',\n 1 => 'b',\n ),\n)" ),
+ array(
+ array( array() ),
+ "array ({$warning}\n 0 => \n array (\n ),\n)"
+ ),
+ array(
+ array( array( 1 ) ),
+ "array ({$warning}\n 0 => \n array (\n 0 => 1,\n ),\n)"
+ ),
+ array(
+ array( array( 'x' => 1 ) ),
+ "array ({$warning}\n 0 => \n array (\n 'x' => 1,\n ),\n)"
+ ),
+ array(
+ array( array( 2 => 1 ) ),
+ "array ({$warning}\n 0 => \n array (\n 2 => 1,\n ),\n)"
+ ),
+ array(
+ array( (object)array() ),
+ "array ({$warning}\n 0 => \n array (\n ),\n)"
+ ),
+ array(
+ array( array( 1, ApiResult::META_TYPE => 'assoc' ) ),
+ "array ({$warning}\n 0 => \n array (\n 0 => 1,\n ),\n)"
+ ),
+ array(
+ array( array( 'x' => 1, ApiResult::META_TYPE => 'array' ) ),
+ "array ({$warning}\n 0 => \n array (\n 0 => 1,\n ),\n)"
+ ),
+ array(
+ array( array( 'x' => 1, ApiResult::META_TYPE => 'kvp' ) ),
+ "array ({$warning}\n 0 => \n array (\n 'x' => 1,\n ),\n)"
+ ),
+ array(
+ array( array(
+ 'x' => 1,
+ ApiResult::META_TYPE => 'BCkvp',
+ ApiResult::META_KVP_KEY_NAME => 'key'
+ ) ),
+ "array ({$warning}\n 0 => \n array (\n 0 => \n " .
+ "array (\n 'key' => 'x',\n '*' => 1,\n ),\n ),\n)"
+ ),
+ array(
+ array( array( 'x' => 1, ApiResult::META_TYPE => 'BCarray' ) ),
+ "array ({$warning}\n 0 => \n array (\n 'x' => 1,\n ),\n)"
+ ),
+ array(
+ array( array( 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ) ),
+ "array ({$warning}\n 0 => \n array (\n 0 => 'a',\n 1 => 'b',\n ),\n)"
+ ),
// Content
array( array( 'content' => 'foo', ApiResult::META_CONTENT => 'content' ),
array( array( array( 1, ApiResult::META_TYPE => 'assoc' ) ), '[{"0":1}]' ),
array( array( array( 'x' => 1, ApiResult::META_TYPE => 'array' ) ), '[[1]]' ),
array( array( array( 'x' => 1, ApiResult::META_TYPE => 'kvp' ) ), '[{"x":1}]' ),
- array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCkvp', ApiResult::META_KVP_KEY_NAME => 'key' ) ),
- '[[{"key":"x","*":1}]]' ),
+ array(
+ array( array(
+ 'x' => 1,
+ ApiResult::META_TYPE => 'BCkvp',
+ ApiResult::META_KVP_KEY_NAME => 'key'
+ ) ),
+ '[[{"key":"x","*":1}]]'
+ ),
array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCarray' ) ), '[{"x":1}]' ),
array( array( array( 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ) ), '[["a","b"]]' ),
array( array( array( 1, ApiResult::META_TYPE => 'assoc' ) ), '[{"0":1}]' ),
array( array( array( 'x' => 1, ApiResult::META_TYPE => 'array' ) ), '[[1]]' ),
array( array( array( 'x' => 1, ApiResult::META_TYPE => 'kvp' ) ), '[{"x":1}]' ),
- array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCkvp', ApiResult::META_KVP_KEY_NAME => 'key' ) ),
- '[{"x":1}]' ),
+ array(
+ array( array(
+ 'x' => 1,
+ ApiResult::META_TYPE => 'BCkvp',
+ ApiResult::META_KVP_KEY_NAME => 'key'
+ ) ),
+ '[{"x":1}]'
+ ),
array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCarray' ) ), '[[1]]' ),
- array( array( array( 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ) ), '[{"0":"a","1":"b"}]' ),
+ array(
+ array( array(
+ 'a',
+ 'b',
+ ApiResult::META_TYPE => 'BCassoc'
+ ) ),
+ '[{"0":"a","1":"b"}]'
+ ),
// Content
array( array( 'content' => 'foo', ApiResult::META_CONTENT => 'content' ),
array( array( array( 1, ApiResult::META_TYPE => 'assoc' ) ), '' ),
array( array( array( 'x' => 1, ApiResult::META_TYPE => 'array' ) ), '' ),
array( array( array( 'x' => 1, ApiResult::META_TYPE => 'kvp' ) ), '' ),
- array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCkvp', ApiResult::META_KVP_KEY_NAME => 'key' ) ), '' ),
+ array(
+ array( array(
+ 'x' => 1,
+ ApiResult::META_TYPE => 'BCkvp',
+ ApiResult::META_KVP_KEY_NAME => 'key'
+ ) ),
+ ''
+ ),
array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCarray' ) ), '' ),
array( array( array( 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ) ), '' ),
}
public static function provideGeneralEncoding() {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
return array_merge(
self::addFormatVersion( 1, array(
// Basic types
'a:1:{s:3:"foo";s:3:"foo";}' ),
) )
);
+ // @codingStandardsIgnoreEnd
}
public function testCrossDomainMangling() {
} catch ( UsageException $ex ) {
ob_end_clean();
$this->assertSame(
- 'This response cannot be represented using format=php. See https://phabricator.wikimedia.org/T68776',
+ 'This response cannot be represented using format=php. ' .
+ 'See https://phabricator.wikimedia.org/T68776',
$ex->getMessage(),
'Expected exception'
);
protected $printerName = 'txt';
public static function provideGeneralEncoding() {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
$warning = "\n [warnings] => Array\n (\n [txt] => Array\n (\n" .
" [*] => format=txt has been deprecated. Please use format=json instead.\n" .
" )\n\n )\n";
array( array( 'foo' => 'foo', ApiResult::META_BC_SUBELEMENTS => array( 'foo' ) ),
"Array\n({$warning}\n [foo] => Array\n (\n [*] => foo\n )\n\n)\n" ),
);
+ // @codingStandardsIgnoreEnd
}
}
public static function setUpBeforeClass() {
parent::setUpBeforeClass();
$page = WikiPage::factory( Title::newFromText( 'MediaWiki:ApiFormatXmlTest.xsl' ) );
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
$page->doEditContent( new WikitextContent(
'<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />'
), 'Summary' );
+ // @codingStandardsIgnoreEnd
$page = WikiPage::factory( Title::newFromText( 'MediaWiki:ApiFormatXmlTest' ) );
$page->doEditContent( new WikitextContent( 'Bogus' ), 'Summary' );
$page = WikiPage::factory( Title::newFromText( 'ApiFormatXmlTest' ) );
}
public static function provideGeneralEncoding() {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
// Basic types
array( array( null, 'a' => null ), '<?xml version="1.0"?><api><_v _idx="0" /></api>' ),
'" type="text/xsl" ?><api />',
array( 'xslt' => 'MediaWiki:ApiFormatXmlTest.xsl' ) ),
);
+ // @codingStandardsIgnoreEnd
}
}
return $this->makeRecentChange( $attribs, $counter, $watchingUsers );
}
- public function makeLogRecentChange( $logType, $logAction, User $user, $titleText, $timestamp, $counter,
- $watchingUsers
+ public function makeLogRecentChange(
+ $logType, $logAction, User $user, $titleText, $timestamp, $counter, $watchingUsers
) {
$attribs = array_merge(
$this->getDefaultAttributes( $titleText, $timestamp ),
* Keep this in sync with CssContentTest::provideGetRedirectTarget()
*/
public static function provideMakeRedirectContent() {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
array( 'MediaWiki:MonoBook.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=MediaWiki:MonoBook.css&action=raw&ctype=text/css);" ),
array( 'User:FooBar/common.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=User:FooBar/common.css&action=raw&ctype=text/css);" ),
array( 'Gadget:FooBaz.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ),
);
+ // @codingStandardsIgnoreEnd
}
}
. '%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228%22%20height%3D'
. '%228%22%3E%0A%3Ccircle%20cx%3D%224%22%20cy%3D%224%22%20r%3D%222%22%2F%3E%0A%3C%2Fsvg%3E%0A';
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
array(
'Regular file',
'.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(http://localhost/w/images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }',
),
);
+ // @codingStandardsIgnoreEnd
}
/**
class XmlTypeCheckTest extends PHPUnit_Framework_TestCase {
const WELL_FORMED_XML = "<root><child /></root>";
const MAL_FORMED_XML = "<root><child /></error>";
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
const XML_WITH_PIH = '<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/w/index.php"?><svg><child /></svg>';
+ // @codingStandardsIgnoreEnd
/**
* @covers XMLTypeCheck::newFromString
'email' => 'chad@wikimedia.org',
),
),
- 'description' => 'Constant Database (CDB) wrapper library for PHP. Provides pure-PHP fallback when dba_* functions are absent.',
+ 'description' => 'Constant Database (CDB) wrapper library for PHP. '.
+ 'Provides pure-PHP fallback when dba_* functions are absent.',
),
'cssjanus/cssjanus' => array(
'version' => '1.1.1',
'role' => 'Developer',
),
),
- 'description' => 'The only standard solution to translate any kind of text with an avant-garde web interface within MediaWiki, including your documentation and software',
+ 'description' => 'The only standard solution to translate any kind ' .
+ 'of text with an avant-garde web interface within MediaWiki, ' .
+ 'including your documentation and software',
),
'mediawiki/universal-language-selector' => array(
'version' => '2014.12',
'type' => 'mediawiki-extension',
'licenses' => array( 'GPL-2.0+', 'MIT' ),
'authors' => array(),
- 'description' => 'The primary aim is to allow users to select a language and configure its support in an easy way. Main features are language selection, input methods and web fonts.',
+ 'description' => 'The primary aim is to allow users to select a language ' .
+ 'and configure its support in an easy way. ' .
+ 'Main features are language selection, input methods and web fonts.',
),
), $lock->getInstalledDependencies(), false, true );
}
# protect/modify
$this->assertIRCComment(
- $this->context->msg( 'modifiedarticleprotection', 'SomeTitle ' . $protectParams['4::description'] )
- ->plain() . $sep . $this->user_comment,
+ $this->context->msg(
+ 'modifiedarticleprotection',
+ 'SomeTitle ' . $protectParams['4::description']
+ )->plain() . $sep . $this->user_comment,
'protect', 'modify',
$protectParams,
$this->user_comment
),
),
array(
- 'text' => 'User protected ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)',
+ 'text' => 'User protected ProtectPage [Edit=Allow only administrators] ' .
+ '(indefinite) [Move=Allow only administrators] (indefinite)',
'api' => array(
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => false,
),
),
array(
- 'text' => 'User protected ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite) [cascading]',
+ 'text' => 'User protected ProtectPage [Edit=Allow only administrators] ' .
+ '(indefinite) [Move=Allow only administrators] (indefinite) [cascading]',
'api' => array(
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => true,
),
array(
'legacy' => true,
- 'text' => 'User protected ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite) [cascading]',
+ 'text' => 'User protected ProtectPage [edit=sysop] ' .
+ '(indefinite)[move=sysop] (indefinite) [cascading]',
'api' => array(
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => true,
),
),
array(
- 'text' => 'User changed protection level for ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)',
+ 'text' => 'User changed protection level for ProtectPage ' .
+ '[Edit=Allow only administrators] ' .
+ '(indefinite) [Move=Allow only administrators] (indefinite)',
'api' => array(
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => false,
),
),
array(
- 'text' => 'User changed protection level for ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite) [cascading]',
+ 'text' => 'User changed protection level for ProtectPage ' .
+ '[Edit=Allow only administrators] (indefinite) ' .
+ '[Move=Allow only administrators] (indefinite) [cascading]',
'api' => array(
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => true,
),
array(
'legacy' => true,
- 'text' => 'User changed protection level for ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite)',
+ 'text' => 'User changed protection level for ProtectPage ' .
+ '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'api' => array(
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => false,
),
array(
'legacy' => true,
- 'text' => 'User changed protection level for ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite) [cascading]',
+ 'text' => 'User changed protection level for ProtectPage ' .
+ '[edit=sysop] (indefinite)[move=sysop] (indefinite) [cascading]',
'api' => array(
'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)',
'cascade' => true,
$this->markTestSkipped( 'This test only works on non-Windows platforms' );
}
$user = $this->getMock( 'User' );
- $user->expects( $this->any() )->method( 'getName' )->will( $this->returnValue( 'UserName' ) );
- $user->expects( $this->any() )->method( 'getEmail' )->will( $this->returnValue( 'foo@bar.baz' ) );
- $user->expects( $this->any() )->method( 'getRealName' )->will( $this->returnValue( 'Real name' ) );
+ $user->expects( $this->any() )->method( 'getName' )->will(
+ $this->returnValue( 'UserName' )
+ );
+ $user->expects( $this->any() )->method( 'getEmail' )->will(
+ $this->returnValue( 'foo@bar.baz' )
+ );
+ $user->expects( $this->any() )->method( 'getRealName' )->will(
+ $this->returnValue( 'Real name' )
+ );
$ma = MailAddress::newFromUser( $user );
$this->assertInstanceOf( 'MailAddress', $ma );
$this->assertEquals( $expectedResult, WebPHandler::extractMetadata( $this->tempFileName ) );
}
public function provideTestExtractMetaData() {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
// Files from https://developers.google.com/speed/webp/gallery2
array( "\x52\x49\x46\x46\x90\x68\x01\x00\x57\x45\x42\x50\x56\x50\x38\x4C\x83\x68\x01\x00\x2F\x8F\x01\x4B\x10\x8D\x38\x6C\xDB\x46\x92\xE0\xE0\x82\x7B\x6C",
array( 'RIFF1234WEBPVP8 ', false ),
array( 'RIFF1234WEBPVP8L ', false ),
);
+ // @codingStandardsIgnoreEnd
}
/**
}
public function provideTestWithFileExtractMetaData() {
return array(
- array( __DIR__ . '/../../data/media/2_webp_ll.webp',
- array( 'compression' => 'lossless', 'width' => 386, 'height' => 395 ) ),
- array( __DIR__ . '/../../data/media/2_webp_a.webp',
- array( 'compression' => 'lossy', 'animated' => false, 'transparency' => true, 'width' => 386, 'height' => 395 ) ),
+ array( __DIR__ . '/../../data/media/2_webp_ll.webp',
+ array(
+ 'compression' => 'lossless',
+ 'width' => 386,
+ 'height' => 395
+ )
+ ),
+ array( __DIR__ . '/../../data/media/2_webp_a.webp',
+ array(
+ 'compression' => 'lossy',
+ 'animated' => false,
+ 'transparency' => true,
+ 'width' => 386,
+ 'height' => 395
+ )
+ ),
);
}
}
public static function providePasswordTests() {
- /** @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong */
+ // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong
return array(
array( true, ':testLargeLayeredTop:sha512:1024:512!sha512:1024:512!sha512:1024:512!sha512:1024:512!5!vnRy+2SrSA0fHt3dwhTP5g==!AVnwfZsAQjn+gULv7FSGjA==!xvHUX3WcpkeSn1lvjWcvBg==!It+OC/N9tu+d3ByHhuB0BQ==!Tb.gqUOiD.aWktVwHM.Q/O!7CcyMfXUPky5ptyATJsR2nq3vUqtnBC', 'testPassword123' ),
);
- /** @codingStandardsIgnoreEnd */
+ // @codingStandardsIgnoreEnd
}
/**
array(
array( 'wgGroupPermissions' ),
array(
- 'wgGroupPermissions' => array( 'sysop' => array( 'delete' ) ),
+ 'wgGroupPermissions' => array(
+ 'sysop' => array( 'delete' )
+ ),
),
array(
- 'GroupPermissions' => array( 'sysop' => array( 'undelete' ), 'user' => array( 'edit' ) ),
+ 'GroupPermissions' => array(
+ 'sysop' => array( 'undelete' ),
+ 'user' => array( 'edit' )
+ ),
),
array(
- 'wgGroupPermissions' => array( 'sysop' => array( 'delete', 'undelete' ), 'user' => array( 'edit' ) ),
+ 'wgGroupPermissions' => array(
+ 'sysop' => array( 'delete', 'undelete' ),
+ 'user' => array( 'edit' )
+ ),
)
)
);
}
public static function provideCheckSvgScriptCallback() {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
// html5sec SVG vectors
array(
'SVG with local urls, including filter: in style'
),
);
+ // @codingStandardsIgnoreEnd
}
}