Skip to content

Commit

Permalink
Merge "Add a few strict types to help the MediaWiki CodeSniffer"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Sep 21, 2023
2 parents d42cddb + 964b4fb commit 3c53378
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion client/includes/ClientHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private static function parseEntityId( ?string $prefixedId ): ?EntityId {
* Used to propagate configuration for the linkitem feature to JavaScript.
* This is used in the "wikibase.client.linkitem.init" module.
*/
public static function getLinkitemConfiguration() {
public static function getLinkitemConfiguration(): array {
$cache = MediaWikiServices::getInstance()->getLocalServerObjectCache();
$key = $cache->makeKey(
'wikibase-client',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
use ChangesList;
use DerivativeContext;
use HamcrestPHPUnitIntegration;
use MediaWiki\CommentFormatter\CommentFormatter;
use MediaWiki\Linker\LinkRenderer;
use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\RevisionRecord;
use MediaWiki\Title\Title;
use MediaWiki\User\UserNameUtils;
use MediaWikiLangTestCase;
use RecentChange;
use RequestContext;
Expand Down Expand Up @@ -35,13 +38,10 @@
class ChangeLineFormatterTest extends MediaWikiLangTestCase {
use HamcrestPHPUnitIntegration;

protected $repoLinker;

protected $userNameUtils;

protected $linkRenderer;

protected $commentFormatter;
protected RepoLinker $repoLinker;
protected UserNameUtils $userNameUtils;
protected LinkRenderer $linkRenderer;
protected CommentFormatter $commentFormatter;

protected function setUp(): void {
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ItemPropertyIdHtmlLinkFormatterTest extends MediaWikiIntegrationTestCase {

/** @var LanguageNameLookup|MockObject */
private $languageNameLookup;

/** @var string */
protected $currentUserLanguage;
/** @var string[] List of fallback languages */
protected $fallbackChain = [];
Expand Down
6 changes: 1 addition & 5 deletions lib/tests/phpunit/SimpleCacheWithBagOStuffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,7 @@ public function testSecretCanNotBeEmpty() {
new SimpleCacheWithBagOStuff( $inner, 'prefix', '' );
}

/**
* @param $inner
* @param $key
*/
protected function spoilTheSignature( $inner, $key ) {
protected function spoilTheSignature( HashBagOStuff $inner, string $key ): void {
$value = $inner->get( $key );
list( $signature, $data ) = json_decode( $value );
$inner->set( $key, json_encode( [ 'wrong signature', $data ] ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Wikibase\Lib\Tests\Store\Sql\Terms;

use JobQueueGroup;
use MediaWikiIntegrationTestCase;
use WANObjectCache;
use Wikibase\DataModel\Entity\ItemId;
Expand Down Expand Up @@ -45,7 +46,7 @@ class DatabaseItemTermStoreWriterTest extends MediaWikiIntegrationTestCase {
/** @var Fingerprint */
private $fingerprintEmpty;

private $jobQueueMock;
private JobQueueGroup $jobQueueMock;

/** * @var MockJobQueueFactory */
private $mockJobQueueFactory;
Expand Down
2 changes: 1 addition & 1 deletion repo/includes/Content/EntityContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function getTextForSummary( $maxLength = 250 ) {
* @note This may or may not be consistent with what EntityContentCodec does.
* It it intended to be used primarily for diffing.
*/
private function getRedirectData() {
private function getRedirectData(): array {
// NOTE: keep in sync with getPatchedRedirect
$data = [];

Expand Down
2 changes: 1 addition & 1 deletion repo/includes/ParserOutput/EntityTermsViewFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private function newPlaceHolderEmittingEntityTermsView(
* This is because the objects created from this factory are assumed to
* write into ParserOutput which should not include any user-specific markup.
*/
private function newTermboxView( Language $language ) {
private function newTermboxView( Language $language ): TermboxView {
$textProvider = new MediaWikiLocalizedTextProvider( $language );
$services = MediaWikiServices::getInstance();
$repoSettings = WikibaseRepo::getSettings( $services );
Expand Down
2 changes: 1 addition & 1 deletion repo/includes/Store/Sql/PropertyInfoTableBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function setReporter( MessageReporter $reporter ) {
* Database updates a batched into multiple transactions. Do not call this
* method within an (explicit) database transaction.
*/
public function rebuildPropertyInfo() {
public function rebuildPropertyInfo(): int {
$propertyNamespace = $this->entityNamespaceLookup->getEntityNamespace(
Property::ENTITY_TYPE
);
Expand Down

0 comments on commit 3c53378

Please sign in to comment.