Skip to content

Commit

Permalink
Upgrade wikibase codesniffer to 1.0.0
Browse files Browse the repository at this point in the history
This is the result of running composer fix; everything else is disabled
for now.

Bug: T235326
Depends-On: Ie7275ea3ea73416068a19e3c58fb7cd352c51409
Change-Id: I511b1604c31f67e3c32c43dbaa270683c7267114
  • Loading branch information
Daimona committed Oct 13, 2019
1 parent db97a11 commit 2a363ce
Show file tree
Hide file tree
Showing 214 changed files with 352 additions and 334 deletions.
20 changes: 18 additions & 2 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/wikibase/wikibase-codesniffer/Wikibase" />
<rule ref="./vendor/wikibase/wikibase-codesniffer/Wikibase">
<exclude name="PSR12.Properties.ConstantVisibility.NotFound" />
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgContLang" />
<exclude name="MediaWiki.Usage.NullableType.PHP71NullableStyle" />
<exclude name="PSR2.Classes.ClassDeclaration.InterfaceWrongIndent" />
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
<exclude name="MediaWiki.Usage.MagicConstantClosure.FoundConstantMethod" />
<exclude name="MediaWiki.Commenting.PhpunitAnnotations.ForbiddenExpectedException" />
<exclude name="MediaWiki.Commenting.PhpunitAnnotations.ForbiddenExpectedExceptionMessage" />
<exclude name="MediaWiki.Commenting.FunctionAnnotations.UnrecognizedAnnotation" />
<exclude name="Squiz.PHP.NonExecutableCode.ReturnNotRequired" />
<exclude name="Squiz.PHP.NonExecutableCode.Unreachable" />
<exclude name="PSR2.Classes.ClassDeclaration.InterfaceSameLine" />
<exclude name="PSR2.Classes.ClassDeclaration.FirstInterfaceSameLine" />
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint" />
<exclude name="PSR12.Files.ImportStatement.LeadingSlash" />
</rule>

<rule ref="Generic.Files.LineLength">
<properties>
Expand All @@ -22,7 +38,7 @@
<!-- FIXME: These files should be renamed to match their class name. -->
<exclude-pattern>build/generateAutoload\.php</exclude-pattern>
</rule>
<rule ref="MediaWiki.VariableAnalysis.ForbiddenGlobalVariables.ForbiddenGlobal$wgTitle">
<rule ref="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgTitle">
<exclude-pattern>RepoHooks\.php</exclude-pattern>
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
Expand Down
2 changes: 1 addition & 1 deletion client/includes/ChangeNotificationJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ChangeNotificationJob extends Job {
/**
* Constructs a ChangeNotificationJob representing the changes given by $changeIds.
*
* @note: the constructor's signature is dictated by Job::factory, so we'll have to
* @note the constructor's signature is dictated by Job::factory, so we'll have to
* live with it even though it's rather ugly for our use case.
*
* @see Job::factory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class WikibaseLanguageDependentLuaBindings {
* @param EntityIdParser $entityIdParser
* @param FallbackLabelDescriptionLookup $labelDescriptionLookup
*
* @note: label usage is not tracked in $usageAccumulator. This should be done inside
* @note label usage is not tracked in $usageAccumulator. This should be done inside
* the $labelDescriptionLookup or an underlying TermsLookup.
*/
public function __construct(
Expand Down
4 changes: 2 additions & 2 deletions client/includes/Store/TitleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function newFromText( $text, $defaultNamespace = \NS_MAIN ) {

/**
* @see Title::makeTitle
* @note: Use this only with values that can be assumed to be safe and already validated!
* @note Use this only with values that can be assumed to be safe and already validated!
* For unsafe values, use makeTitleSafe() instead.
*
* @param int $ns
Expand Down Expand Up @@ -86,7 +86,7 @@ public function makeTitle( $ns, $text, $fragment = '', $interwiki = '' ) {

/**
* @see Title::makeTitleSafe
* @note: If all parameters have been validated and can be assumed to be safe,
* @note If all parameters have been validated and can be assumed to be safe,
* makeTitle() can be used, which should be a little faster.
*
* @param int $ns
Expand Down
2 changes: 1 addition & 1 deletion client/maintenance/populateInterwiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected function doPopulate( array $data, $force ) {
__METHOD__
);

if ( ! $row ) {
if ( !$row ) {
$dbw->insert(
'interwiki',
[
Expand Down
2 changes: 1 addition & 1 deletion client/tests/phpunit/includes/Api/ApiClientInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ApiClientInfoTest extends \MediaWikiTestCase {
*/
protected $apiContext;

protected function setUp() {
protected function setUp() : void {
parent::setUp();

$this->apiContext = new ApiTestContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
class ApiListEntityUsageTest extends MediaWikiLangTestCase {

protected function setUp() {
protected function setUp() : void {
$this->tablesUsed[] = 'wbc_entity_usage';
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
class ApiPropsEntityUsageTest extends MediaWikiLangTestCase {

protected function setUp() {
protected function setUp() : void {
$this->tablesUsed[] = 'wbc_entity_usage';
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion client/tests/phpunit/includes/Api/DescriptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DescriptionTest extends TestCase {
*/
private $continueEnumParameter;

public function setUp() {
public function setUp() : void {
parent::setUp();
$this->resultData = [];
$this->continueEnumParameter = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class DataAccessSnakFormatterOutputFormatTest extends \PHPUnit\Framework\TestCas
/**
* Makes sure WikibaseClient uses our ClientStore mock
*/
protected function setUp() {
protected function setUp() : void {
parent::setUp();

$wikibaseClient = WikibaseClient::getDefaultInstance( 'reset' );
Expand Down Expand Up @@ -112,7 +112,7 @@ private function setUpDummyData( MockClientStore $store, $siteId ) {
$mockRepository->putEntity( $item );
}

public function tearDown() {
public function tearDown() : void {
parent::tearDown();

WikibaseClient::getDefaultInstance( 'reset' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PropertyParserFunctionIntegrationTest extends MediaWikiTestCase {
*/
private $oldAllowDataAccessInUserLanguage;

protected function setUp() {
protected function setUp() : void {
parent::setUp();

$wikibaseClient = WikibaseClient::getDefaultInstance( 'reset' );
Expand Down Expand Up @@ -76,7 +76,7 @@ private function maskPropertyLabelResolver( WikibaseClient $wikibaseClient ) {
$wikibaseClient->propertyLabelResolver = $propertyLabelResolver;
}

protected function tearDown() {
protected function tearDown() : void {
parent::tearDown();

$this->setAllowDataAccessInUserLanguage( $this->oldAllowDataAccessInUserLanguage );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class StatementsParserFunctionIntegrationTest extends MediaWikiTestCase {
*/
private $store;

protected function setUp() {
protected function setUp() : void {
parent::setUp();

$wikibaseClient = WikibaseClient::getDefaultInstance( 'reset' );
Expand Down Expand Up @@ -100,7 +100,7 @@ private function maskPropertyLabelResolver( WikibaseClient $wikibaseClient ) {
$wikibaseClient->propertyLabelResolver = $propertyLabelResolver;
}

protected function tearDown() {
protected function tearDown() : void {
parent::tearDown();

$this->setAllowDataAccessInUserLanguage( $this->oldAllowDataAccessInUserLanguage );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function getTestModules() {
];
}

protected function setUp() {
protected function setUp() : void {
parent::setUp();

$settings = WikibaseClient::getDefaultInstance()->getSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected static function getEntityAccessLimit() {
return 2;
}

protected function setUp() {
protected function setUp() : void {
parent::setUp();

$settings = WikibaseClient::getDefaultInstance()->getSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
abstract class Scribunto_LuaWikibaseLibraryTestCase extends \PHPUnit\Framework\TestCase {

protected function setUp() {
protected function setUp() : void {
$this->markTestSkipped( 'Scribunto is not available' );
}

Expand Down Expand Up @@ -133,7 +133,7 @@ public static function suite( $className ) {
return $res;
}

protected function setUp() {
protected function setUp() : void {
if ( !WikibaseSettings::isRepoEnabled() ) {
$this->markTestSkipped( "Skipping because a local wb_terms table"
. " is not available on a WikibaseClient only instance." );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function getTestModules() {
];
}

public function setUp() {
public function setUp() : void {
parent::setUp();

$mwServices = MediaWikiServices::getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ChangesListSpecialPageHookHandlersTest extends \PHPUnit\Framework\TestCase
*/
protected $oldExtensionRegistryLoaded;

public function setUp() {
public function setUp() : void {
parent::setUp();

$this->extensionRegistry = TestingAccessWrapper::newFromObject(
Expand All @@ -51,7 +51,7 @@ public function setUp() {
$this->extensionRegistry->loaded = [ 'Wikibase' ];
}

public function tearDown() {
public function tearDown() : void {
parent::tearDown();

$this->extensionRegistry->loaded = $this->oldExtensionRegistryLoaded;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
class DeletePageNoticeCreatorTest extends \MediaWikiTestCase {

protected function setUp() {
protected function setUp() : void {
parent::setUp();

$this->setUserLang( 'de' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class EchoNotificationsHandlersTest extends MediaWikiTestCase {
*/
private $namespaceChecker;

protected function setUp() {
protected function setUp() : void {
parent::setUp();
if ( !ExtensionRegistry::getInstance()->isLoaded( 'Echo' ) ) {
$this->markTestSkipped( "Echo not loaded" );
Expand Down
2 changes: 1 addition & 1 deletion client/tests/phpunit/includes/Hooks/MovePageNoticeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
class MovePageNoticeTest extends \MediaWikiTestCase {

protected function setUp() {
protected function setUp() : void {
parent::setUp();

$this->setUserLang( 'de' );
Expand Down
4 changes: 2 additions & 2 deletions client/tests/phpunit/includes/Hooks/NoLangLinkHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class NoLangLinkHandlerTest extends \PHPUnit\Framework\TestCase {
*/
private $namespacesToInclude;

protected function setUp() {
protected function setUp() : void {
$settings = WikibaseClient::getDefaultInstance()->getSettings();

$this->excludeNamespaces = $settings->getSetting( 'excludeNamespaces' );
Expand All @@ -40,7 +40,7 @@ protected function setUp() {
$settings->setSetting( 'namespaces', [] );
}

protected function tearDown() {
protected function tearDown() : void {
$settings = WikibaseClient::getDefaultInstance()->getSettings();

$settings->setSetting( 'excludeNamespaces', $this->excludeNamespaces );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class ParserClearStateHookHandlerTest extends MediaWikiTestCase {

protected function setUp() {
protected function setUp() : void {
parent::setUp();

$wikibaseClient = WikibaseClient::getDefaultInstance( 'reset' );
Expand All @@ -42,7 +42,7 @@ protected function setUp() {
);
}

protected function tearDown() {
protected function tearDown() : void {
parent::tearDown();

WikibaseClient::getDefaultInstance( 'reset' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ShortDescHandlerTest extends TestCase {
*/
private $handler;

public function setUp() {
public function setUp() : void {
parent::setUp();
$this->handler = new ShortDescHandler();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private function getTemplate( $languageUrls, &$actualLanguageUrls, &$actualWbedi
} elseif ( $name === 'wbeditlanglinks' ) {
$actualWbeditlanglinks = $val;
} else {
TestCase::fail( 'Unexpected option ' . $name . ' set.' );
TestCase::fail( 'Unexpected option ' . $name . ' set.' );
}
} ) );

Expand Down
2 changes: 1 addition & 1 deletion client/tests/phpunit/includes/LangLinkHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private function getItems() {
return $items;
}

protected function setUp() {
protected function setUp() : void {
parent::setUp();

$this->langLinkHandler = $this->getLangLinkHandler();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
class PageConnectionPresentationModelTest extends MediaWikiTestCase {

protected function setUp() {
protected function setUp() : void {
parent::setUp();
if ( !ExtensionRegistry::getInstance()->isLoaded( 'Echo' ) ) {
$this->markTestSkipped( "Echo not loaded" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ChangeLineFormatterTest extends MediaWikiLangTestCase {

protected $repoLinker;

protected function setUp() {
protected function setUp() : void {
parent::setUp();

// these are required because Linker is used in ChangeLineFormatter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
class RecentChangesDuplicateDetectorTest extends \MediaWikiTestCase {

protected function setUp() {
protected function setUp() : void {
parent::setUp();

$this->tablesUsed[] = 'recentchanges';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
class BulkSubscriptionUpdaterTest extends \MediaWikiTestCase {

protected function setUp() {
protected function setUp() : void {
if ( !WikibaseSettings::isRepoEnabled() ) {
$this->markTestSkipped( "Skipping because WikibaseClient doesn't have a local wb_changes_subscription table." );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class PagePropsEntityIdLookupTest extends \MediaWikiTestCase {

protected function setUp() {
protected function setUp() : void {
$this->tablesUsed[] = 'page_props';
parent::setUp();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class EntityUsageTableBuilderTest extends \MediaWikiTestCase {

protected function setUp() {
protected function setUp() : void {
$this->tablesUsed[] = EntityUsageTable::DEFAULT_TABLE_NAME;
$this->tablesUsed[] = 'page_props';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
class EntityUsageTableTest extends \MediaWikiTestCase {

protected function setUp() {
protected function setUp() : void {
parent::setUp();

$this->tablesUsed[] = EntityUsageTable::DEFAULT_TABLE_NAME;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
class SqlSubscriptionManagerTest extends \MediaWikiTestCase {

protected function setUp() {
protected function setUp() : void {
if ( !WikibaseSettings::isRepoEnabled() ) {
$this->markTestSkipped( 'Skipping test for SqlSubscriptionManager, '
. 'because the repo-side table wb_changes_subscription is not available.' );
Expand Down
Loading

0 comments on commit 2a363ce

Please sign in to comment.