Remove "Squiz.WhiteSpace.FunctionSpacing" from phpcs exclusions

Change-Id: I78b3315f26ab91b6b443f5b028a635552f82f5a3
This commit is contained in:
Reedy 2019-05-11 02:17:43 +01:00
parent ddd4e4dc04
commit 9f2ffdfbd4
31 changed files with 74 additions and 1 deletions

View file

@ -19,7 +19,6 @@
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.SingleSpaceBeforeSingleLineComment" />
<exclude name="Squiz.Scope.MethodScope.Missing" />
<exclude name="Squiz.WhiteSpace.FunctionSpacing" />
</rule>
<rule ref="MediaWiki.NamingConventions.PrefixedGlobalFunctions">
<properties>

View file

@ -384,6 +384,7 @@ class FormOptions implements ArrayAccess {
* @see https://www.php.net/manual/en/class.arrayaccess.php
*/
/* @{ */
/**
* Whether the option exists.
* @param string $name

View file

@ -226,6 +226,7 @@ class MediaWikiServices extends ServiceContainer {
}
/** @noinspection PhpDocSignatureInspection */
/**
* Salvages the state of any salvageable service instances in $other.
*

View file

@ -50,6 +50,7 @@ if ( !defined( 'MW_CONFIG_CALLBACK' ) ) {
define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" );
}
if ( !is_readable( MW_CONFIG_FILE ) ) {
function wfWebStartNoLocalSettings() {
# LocalSettings.php is the per-site customization file. If it does not exist
# the wiki installer needs to be launched or the generated file uploaded to
@ -58,12 +59,14 @@ if ( !defined( 'MW_CONFIG_CALLBACK' ) ) {
require_once "$IP/includes/NoLocalSettings.php";
die();
}
define( 'MW_CONFIG_CALLBACK', 'wfWebStartNoLocalSettings' );
}
}
// Custom setup for WebStart entry point
if ( !defined( 'MW_SETUP_CALLBACK' ) ) {
function wfWebStartSetup() {
// Initialise output buffering
// Check for previously set up buffers, to avoid a mix of gzip and non-gzip output.
@ -71,6 +74,7 @@ if ( !defined( 'MW_SETUP_CALLBACK' ) ) {
ob_start( 'MediaWiki\\OutputHandler::handle' );
}
}
define( 'MW_SETUP_CALLBACK', 'wfWebStartSetup' );
}

View file

@ -139,6 +139,7 @@ class HistoryAction extends FormlessAction {
}
return $year && $month && $day ? $year . '-' . $month . '-' . $day : '';
}
/**
* Print the history page for an article.
*/

View file

@ -252,6 +252,7 @@ class MWException extends Exception {
header( $header );
}
}
private static function statusHeader( $code ) {
if ( !headers_sent() ) {
HttpStatus::header( $code );

View file

@ -136,6 +136,7 @@ class MultiWriteBagOStuff extends BagOStuff {
return $value;
}
public function set( $key, $value, $exptime = 0, $flags = 0 ) {
return $this->doWrite(
$this->cacheIndexes,
@ -205,6 +206,7 @@ class MultiWriteBagOStuff extends BagOStuff {
// Only the first cache is locked
return $this->caches[0]->unlock( $key );
}
/**
* Delete objects expiring before a certain date.
*
@ -289,6 +291,7 @@ class MultiWriteBagOStuff extends BagOStuff {
public function clearLastError() {
$this->caches[0]->clearLastError();
}
/**
* Apply a write method to the backing caches specified by $indexes (in order)
*

View file

@ -548,6 +548,7 @@ class Exif {
/**#@+
* @return array
*/
/**
* Get $this->mRawExifData
* @return array

View file

@ -31,5 +31,6 @@
*/
interface Pager {
function getNavigationBar();
function getBody();
}

View file

@ -514,6 +514,7 @@ class CoreParserFunctions {
public static function numberofusers( $parser, $raw = null ) {
return self::formatRaw( SiteStats::users(), $raw, $parser->getFunctionLang() );
}
public static function numberofactiveusers( $parser, $raw = null ) {
return self::formatRaw( SiteStats::activeUsers(), $raw, $parser->getFunctionLang() );
}
@ -545,6 +546,7 @@ class CoreParserFunctions {
$parser->getFunctionLang()
);
}
public static function numberingroup( $parser, $name = '', $raw = null ) {
return self::formatRaw(
SiteStats::numberingroup( strtolower( $name ) ),
@ -569,6 +571,7 @@ class CoreParserFunctions {
}
return str_replace( '_', ' ', $t->getNsText() );
}
public static function namespacee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
@ -576,6 +579,7 @@ class CoreParserFunctions {
}
return wfUrlencode( $t->getNsText() );
}
public static function namespacenumber( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
@ -583,6 +587,7 @@ class CoreParserFunctions {
}
return $t->getNamespace();
}
public static function talkspace( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
@ -590,6 +595,7 @@ class CoreParserFunctions {
}
return str_replace( '_', ' ', $t->getTalkNsText() );
}
public static function talkspacee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
@ -597,6 +603,7 @@ class CoreParserFunctions {
}
return wfUrlencode( $t->getTalkNsText() );
}
public static function subjectspace( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
@ -604,6 +611,7 @@ class CoreParserFunctions {
}
return str_replace( '_', ' ', $t->getSubjectNsText() );
}
public static function subjectspacee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
@ -626,6 +634,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( $t->getText() );
}
public static function pagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
@ -633,6 +642,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( $t->getPartialURL() );
}
public static function fullpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
@ -640,6 +650,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( $t->getPrefixedText() );
}
public static function fullpagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
@ -647,6 +658,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( $t->getPrefixedURL() );
}
public static function subpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
@ -654,6 +666,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( $t->getSubpageText() );
}
public static function subpagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
@ -661,6 +674,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( $t->getSubpageUrlForm() );
}
public static function rootpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
@ -668,6 +682,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( $t->getRootText() );
}
public static function rootpagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
@ -675,6 +690,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( wfUrlencode( str_replace( ' ', '_', $t->getRootText() ) ) );
}
public static function basepagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
@ -682,6 +698,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( $t->getBaseText() );
}
public static function basepagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
@ -689,6 +706,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( wfUrlencode( str_replace( ' ', '_', $t->getBaseText() ) ) );
}
public static function talkpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
@ -696,6 +714,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() );
}
public static function talkpagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
@ -703,6 +722,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( $t->getTalkPage()->getPrefixedURL() );
}
public static function subjectpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
@ -710,6 +730,7 @@ class CoreParserFunctions {
}
return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedText() );
}
public static function subjectpagenamee( $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {

View file

@ -57,6 +57,7 @@ class ParserCache {
* @var string
*/
private $cacheEpoch;
/**
* Get an instance of this object
*

View file

@ -498,6 +498,7 @@ class ParserOutput extends CacheTime {
public function setNoGallery( $value ) {
$this->mNoGallery = (bool)$value;
}
public function getNoGallery() {
return $this->mNoGallery;
}
@ -628,12 +629,15 @@ class ParserOutput extends CacheTime {
public function setNewSection( $value ) {
$this->mNewSection = (bool)$value;
}
public function hideNewSection( $value ) {
$this->mHideNewSection = (bool)$value;
}
public function getHideNewSection() {
return (bool)$this->mHideNewSection;
}
public function getNewSection() {
return (bool)$this->mNewSection;
}

View file

@ -9,6 +9,7 @@ use RemexHtml\Tokenizer\Tokenizer;
*/
class RemexStripTagHandler implements TokenHandler {
private $text = '';
public function getResult() {
return $this->text;
}
@ -16,15 +17,19 @@ class RemexStripTagHandler implements TokenHandler {
function startDocument( Tokenizer $t, $fns, $fn ) {
// Do nothing.
}
function endDocument( $pos ) {
// Do nothing.
}
function error( $text, $pos ) {
// Do nothing.
}
function characters( $text, $start, $length, $sourceStart, $sourceLength ) {
$this->text .= substr( $text, $start, $length );
}
function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) {
// Inject whitespace for typical block-level tags to
// prevent merging unrelated<br>words.
@ -32,6 +37,7 @@ class RemexStripTagHandler implements TokenHandler {
$this->text .= ' ';
}
}
function endTag( $name, $sourceStart, $sourceLength ) {
// Inject whitespace for typical block-level tags to
// prevent merging unrelated<br>words.
@ -39,9 +45,11 @@ class RemexStripTagHandler implements TokenHandler {
$this->text .= ' ';
}
}
function doctype( $name, $public, $system, $quirks, $sourceStart, $sourceLength ) {
// Do nothing.
}
function comment( $text, $sourceStart, $sourceLength ) {
// Do nothing.
}

View file

@ -1190,6 +1190,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
// to include data on filters that use the unstructured UI. messageKeys is a
// special top-level value, with the value being an array of the message keys to
// send to the client.
/**
* Gets structured filter information needed by JS
*

View file

@ -162,6 +162,7 @@ class SpecialPage implements MessageLocalizer {
}
// @todo FIXME: Decide which syntax to use for this, and stick to it
/**
* Whether this special page is listed in Special:SpecialPages
* @since 1.3 (r3583)

View file

@ -23,6 +23,7 @@
class UploadChunkVerificationException extends MWException {
public $msg;
public function __construct( array $res ) {
$this->msg = wfMessage( ...$res );
parent::__construct( wfMessage( ...$res )

View file

@ -61,6 +61,7 @@ if ( !defined( 'MW_CONFIG_CALLBACK' ) && !defined( 'MW_CONFIG_FILE' ) ) {
// Custom setup for Maintenance entry point
if ( !defined( 'MW_SETUP_CALLBACK' ) ) {
function wfMaintenanceSetup() {
// phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
global $maintenance, $wgLocalisationCacheConf, $wgCacheDirectory;
@ -75,6 +76,7 @@ if ( !defined( 'MW_SETUP_CALLBACK' ) ) {
$maintenance->finalSetup();
}
define( 'MW_SETUP_CALLBACK', 'wfMaintenanceSetup' );
}

View file

@ -21,6 +21,7 @@ class RemoveInvalidEmails extends Maintenance {
$this->addOption( 'commit', 'Whether to actually update the database', false, false );
$this->setBatchSize( 500 );
}
public function execute() {
$this->commit = $this->hasOption( 'commit' );
$dbr = $this->getDB( DB_REPLICA );

View file

@ -11,6 +11,7 @@ class ValidateRegistrationFile extends Maintenance {
true
);
}
public function execute() {
$validator = new ExtensionJsonValidator( function ( $msg ) {
$this->fatalError( $msg );

View file

@ -106,6 +106,7 @@ class NoopSuppressor extends Suppressor {
public function __construct( $mode ) {
$this->mode = $mode;
}
public function suppress( $input ) {
echo "Unsupported output mode: {$this->mode}\n$input";
return true;

View file

@ -137,6 +137,7 @@ class ResourceLoaderTestModule extends ResourceLoaderModule {
public function isRaw() {
return $this->isRaw;
}
public function isKnownEmpty( ResourceLoaderContext $context ) {
return $this->isKnownEmpty;
}

View file

@ -42,15 +42,19 @@ class FormOptionsTest extends MediaWikiTestCase {
private function assertGuessBoolean( $data ) {
$this->guess( FormOptions::BOOL, $data );
}
private function assertGuessInt( $data ) {
$this->guess( FormOptions::INT, $data );
}
private function assertGuessFloat( $data ) {
$this->guess( FormOptions::FLOAT, $data );
}
private function assertGuessString( $data ) {
$this->guess( FormOptions::STRING, $data );
}
private function assertGuessArray( $data ) {
$this->guess( FormOptions::ARR, $data );
}
@ -62,6 +66,7 @@ class FormOptionsTest extends MediaWikiTestCase {
FormOptions::guessType( $data )
);
}
/* @} */
/**

View file

@ -25,6 +25,7 @@ class OutputPageTest extends MediaWikiTestCase {
parent::setUp();
ResourceLoader::clearCache();
}
protected function tearDown() {
parent::tearDown();
ResourceLoader::clearCache();

View file

@ -92,6 +92,7 @@ class JsonContentTest extends MediaWikiLangTestCase {
->disableOriginalConstructor()
->getMock();
}
private function getMockParserOptions() {
return $this->getMockBuilder( ParserOptions::class )
->disableOriginalConstructor()

View file

@ -129,6 +129,7 @@ class ResourceLoaderImageTestable extends ResourceLoaderImage {
public function massageSvgPathdata( $svg ) {
return parent::massageSvgPathdata( $svg );
}
// Stub, since we don't know if we even have a SVG handler, much less what exactly it'll output
public function rasterize( $svg ) {
return 'RASTERIZESTUB';

View file

@ -451,6 +451,7 @@ class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase {
class TestResourceLoaderWikiModule extends ResourceLoaderWikiModule {
public static $returnFetchTitleInfo = null;
protected static function fetchTitleInfo( IDatabase $db, array $pages, $fname = null ) {
$ret = self::$returnFetchTitleInfo;
self::$returnFetchTitleInfo = null;

View file

@ -400,6 +400,7 @@ class ChangesListSpecialPageTest extends AbstractChangesListSpecialPageTestCase
$user
);
}
public function testRcHidepatrolledFilter() {
$user = $this->getTestSysop()->getUser();
$this->assertConditions(

View file

@ -601,6 +601,7 @@ class NamespaceInfoTest extends MediaWikiTestCase {
* getSubject/Talk/Associated
* %{
*/
/**
* @dataProvider provideSubjectTalk
* @covers NamespaceInfo::getSubject
@ -880,6 +881,7 @@ class NamespaceInfoTest extends MediaWikiTestCase {
// No canonical namespace names
// %{
/**
* @covers NamespaceInfo::getCanonicalNamespaces
*/
@ -982,6 +984,7 @@ class NamespaceInfoTest extends MediaWikiTestCase {
// Hook namespaces
// %{
/**
* @return array Expected canonical namespaces
*/
@ -1047,6 +1050,7 @@ class NamespaceInfoTest extends MediaWikiTestCase {
// Extra namespaces
// %{
/**
* @return NamespaceInfo
*/
@ -1102,6 +1106,7 @@ class NamespaceInfoTest extends MediaWikiTestCase {
// Canonical namespace caching
// %{
/**
* @covers NamespaceInfo::getCanonicalNamespaces
*/

View file

@ -238,6 +238,7 @@ class LanguageSrTest extends LanguageClassesTestCase {
}
# #### HELPERS #####################################################
/**
*Wrapper to verify text stay the same after applying conversion
* @param string $text Text to convert

View file

@ -60,6 +60,7 @@ class LanguageUzTest extends LanguageClassesTestCase {
}
# #### HELPERS #####################################################
/**
* Wrapper to verify text stay the same after applying conversion
* @param string $text Text to convert

View file

@ -7,6 +7,7 @@ class MockSearchResult extends SearchResult {
public function isMissingRevision() {
return $this->isMissingRevision;
}
public function setMissingRevision( $isMissingRevision ) {
$this->isMissingRevision = $isMissingRevision;
return $this;