build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0

Disable BraceNotOnOwnLine due to T347440

Change-Id: Ia591cf9cc027e7186f9e275e5048af51ac9d4923
这个提交包含在:
Umherirrender 2024-03-10 23:27:21 +01:00
父节点 3f35e549c4
当前提交 df4ae94093
共有 32 个文件被更改,包括 75 次插入64 次删除

查看文件

@ -5,6 +5,7 @@
<exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle" />
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeClassBrace.BraceNotOnOwnLine" />
</rule>
<exclude-pattern type="relative-root">./documentation/frontend/node_modules/*</exclude-pattern>
<file>.</file>

查看文件

@ -1,6 +1,6 @@
{
"require-dev": {
"mediawiki/mediawiki-codesniffer": "41.0.0",
"mediawiki/mediawiki-codesniffer": "43.0.0",
"mediawiki/mediawiki-phan-config": "0.14.0",
"mediawiki/minus-x": "1.1.1",
"php-parallel-lint/php-console-highlighter": "1.0.0",
@ -22,5 +22,10 @@
"phan": "phan -d . --long-progress-bar",
"phpcs": "phpcs -s -p --cache",
"phpcbf": "phpcbf"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}

查看文件

@ -99,6 +99,7 @@ class ApiSetMentor extends ApiBase {
}
}
/** @inheritDoc */
public function mustBePosted() {
return true;
}
@ -110,6 +111,7 @@ class ApiSetMentor extends ApiBase {
return 'csrf';
}
/** @inheritDoc */
public function isWriteMode() {
return true;
}

查看文件

@ -177,6 +177,9 @@ class HelpPanel {
self::getGrowthWikiConfig()->get( 'GEHelpPanelReadingModeNamespaces' ) );
}
/**
* @return bool
*/
public static function isHelpPanelEnabled() {
return MediaWikiServices::getInstance()->getMainConfig()->get( 'GEHelpPanelEnabled' );
}

查看文件

@ -102,7 +102,7 @@ class TipNodeRenderer {
return $item['data'];
}
return null;
}, $node->getData() ) );
}, $node->getData() ) );
return Html::rawElement( 'div', [
'class' => $this->getBaseCssClasses( $node->getType(), $tipTextVariants )
@ -191,7 +191,7 @@ class TipNodeRenderer {
'growthexperiments-quickstart-tips-tip-' . $node->getType() . '-text'
] ], $this->messageLocalizer->msg(
$this->getMessageKeyWithVariantFallback( $node )
)->parse() ) );
)->parse() ) );
}
/**

查看文件

@ -962,7 +962,7 @@ class HomepageHooks implements
$tags[] = Mentorship::MENTORSHIP_HELPPANEL_QUESTION_TAG;
}
if ( SuggestedEdits::isEnabledForAnyone( $this->config ) ) {
array_push( $tags, ...$this->taskTypeHandlerRegistry->getChangeTags() );
array_push( $tags, ...$this->taskTypeHandlerRegistry->getChangeTags() );
}
}
@ -983,7 +983,7 @@ class HomepageHooks implements
$tags[] = Mentorship::MENTORSHIP_HELPPANEL_QUESTION_TAG;
}
if ( SuggestedEdits::isEnabledForAnyone( $this->config ) ) {
array_push( $tags, ...$this->taskTypeHandlerRegistry->getChangeTags() );
array_push( $tags, ...$this->taskTypeHandlerRegistry->getChangeTags() );
}
}

查看文件

@ -95,7 +95,7 @@ class Impact extends BaseModule {
TitleFactory $titleFactory,
PageViewService $pageViewService = null
) {
parent::__construct( 'impact', $context, $wikiConfig, $experimentUserManager );
parent::__construct( 'impact', $context, $wikiConfig, $experimentUserManager );
$this->connectionProvider = $connectionProvider;
$this->isSuggestedEditsEnabledForUser = $suggestedEditsConfig['isSuggestedEditsEnabled'];
$this->isSuggestedEditsActivatedForUser = $suggestedEditsConfig['isSuggestedEditsActivated'];

查看文件

@ -65,7 +65,7 @@ class LevelingUpHooks implements
): void {
$taskTypes = $this->configurationLoader->getTaskTypes();
$pluginFields = array_map(
fn( $taskTypeId ) => VisualEditorHooks::PLUGIN_PREFIX . $taskTypeId,
fn ( $taskTypeId ) => VisualEditorHooks::PLUGIN_PREFIX . $taskTypeId,
array_keys( $taskTypes )
);
$isSuggestedEdit = count( array_intersect( $pluginFields, array_keys( $pluginData ) ) ) > 0;

查看文件

@ -91,7 +91,7 @@ class ChangeMentor {
'oldMentor' => $this->mentor,
'newMentor' => $this->newMentor,
'performer' => $this->performer,
] );
] );
if ( $this->performer->getId() === $this->newMentor->getId() ) {
$primaryLogtype = 'claimmentee';
@ -135,7 +135,7 @@ class ChangeMentor {
'mentee' => $this->mentee,
'oldMentor' => $this->mentor,
'newMentor' => $this->newMentor
] );
] );
$status = Status::newGood();
if ( !$this->getMenteeUser()->isNamed() ) {
@ -145,7 +145,7 @@ class ChangeMentor {
'mentee' => $this->mentee,
'oldMentor' => $this->mentor,
'newMentor' => $this->newMentor
] );
] );
$status->fatal( 'growthexperiments-homepage-claimmentee-no-user' );
return $status;
}
@ -156,7 +156,7 @@ class ChangeMentor {
'mentee' => $this->mentee,
'oldMentor' => $this->mentor,
'newMentor' => $this->newMentor
] );
] );
$status->fatal(
'growthexperiments-homepage-claimmentee-already-mentor',
$this->mentee->getName(),

查看文件

@ -105,7 +105,7 @@ abstract class MentorProvider {
}
try {
$mentors = array_merge( $mentors, $this->getManuallyAssignedMentors() );
} catch ( WikiConfigException $e ) {
} catch ( WikiConfigException $e ) {
}
return array_unique( $mentors );
}

查看文件

@ -159,7 +159,7 @@ class ProductionImageRecommendationApiHandler implements ImageRecommendationApiH
] );
}
if ( $knownKinds ) {
$knownSources = array_map( fn( $kind ) => self::KIND_TO_SOURCE[$kind], $knownKinds );
$knownSources = array_map( fn ( $kind ) => self::KIND_TO_SOURCE[$kind], $knownKinds );
$intersectionSources = [
ImageRecommendationImage::SOURCE_WIKIDATA_SECTION_TOPICS,
ImageRecommendationImage::SOURCE_WIKIDATA_SECTION_ALIGNMENT,

查看文件

@ -204,7 +204,7 @@ class AddLinkSubmissionHandler extends AbstractSubmissionHandler implements Subm
$status = $this->addLinkSubmissionRecorder->record( $user, $linkRecommendation, $acceptedTargets,
$rejectedTargets, $skippedTargets, $editRevId );
$status->merge(
StatusValue::newGood( [ 'warnings' => $warnings , 'logId' => $status->getValue() ] ),
StatusValue::newGood( [ 'warnings' => $warnings, 'logId' => $status->getValue() ] ),
true
);
} catch ( DBReadOnlyError $e ) {

查看文件

@ -140,9 +140,9 @@ class PageConfigurationLoader implements ConfigurationLoader {
if ( !$allTaskTypes instanceof StatusValue ) {
$taskTypes = array_filter( $allTaskTypes,
fn( TaskType $taskType ) => !$this->isDisabled( $taskType ) );
fn ( TaskType $taskType ) => !$this->isDisabled( $taskType ) );
$disabledTaskTypes = array_filter( $allTaskTypes,
fn( TaskType $taskType ) => $this->isDisabled( $taskType ) );
fn ( TaskType $taskType ) => $this->isDisabled( $taskType ) );
} else {
$taskTypes = $allTaskTypes;
$disabledTaskTypes = [];

查看文件

@ -152,7 +152,7 @@ class NewcomerTasksUserOptionsLookup {
public function filterTaskTypes( array $taskTypes, UserIdentity $user ): array {
$conversionMap = $this->getConversionMap( $user );
$taskTypes = array_filter( $taskTypes,
fn( $taskTypeId ) => !array_key_exists( $taskTypeId, $conversionMap )
fn ( $taskTypeId ) => !array_key_exists( $taskTypeId, $conversionMap )
);
return $this->filterNonExistentTaskTypes( $taskTypes );
}

查看文件

@ -126,7 +126,7 @@ class SearchStrategy {
*/
protected function validateParams( array $taskTypes, array $topics ) {
Assert::parameterElementType( TaskType::class, $taskTypes, '$taskTypes' );
Assert::parameterElementType( [ OresBasedTopic::class, MorelikeBasedTopic::class,
Assert::parameterElementType( [ OresBasedTopic::class, MorelikeBasedTopic::class,
CampaignTopic::class ], $topics, '$topics' );
}

查看文件

@ -53,7 +53,7 @@ class ImageRecommendationTaskTypeHandler extends ImageRecommendationBaseTaskType
throw new LogicException( 'impossible' );
}
$wrappedReasons = array_map(
fn( $reason ) => "<kbd>$reason</kbd>",
fn ( $reason ) => "<kbd>$reason</kbd>",
AddImageSubmissionHandler::REJECTION_REASONS
);
return $localizer->msg(

查看文件

@ -54,7 +54,7 @@ class SectionImageRecommendationTaskTypeHandler extends ImageRecommendationBaseT
throw new LogicException( 'impossible' );
}
$wrappedReasons = array_map(
fn( $reason ) => "<kbd>$reason</kbd>",
fn ( $reason ) => "<kbd>$reason</kbd>",
AddImageSubmissionHandler::REJECTION_REASONS
);
return $localizer->msg(

查看文件

@ -138,7 +138,7 @@ class FixLinkRecommendationData extends Maintenance {
$from = 0;
$this->verboseOutput( " checking topic $oresTopic...\n" );
$searchQuery = "hasrecommendation:link articletopic:$oresTopic";
// phpcs:ignore MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures
// phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
while ( $titles = $this->search( $searchQuery, $batchSize, $from, $randomize ) ) {
$this->verboseOutput( ' checking ' . count( $titles ) . " titles...\n" );
$pageIdsToCheck = $this->titlesToPageIds( $titles );
@ -171,7 +171,7 @@ class FixLinkRecommendationData extends Maintenance {
$fixing = $this->hasOption( 'dry-run' ) ? 'Would fix' : 'Fixing';
$from = null;
$fixedCount = 0;
// phpcs:ignore MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures
// phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
while ( $pageIds = $this->linkRecommendationStore->listPageIds( $this->getBatchSize(), $from ) ) {
$this->verboseOutput( ' checking ' . count( $pageIds ) . " titles...\n" );
$titlesToFix = $this->search( '-hasrecommendation:link pageid:' . implode( '|', $pageIds ),

查看文件

@ -60,7 +60,7 @@ class ApiQueryGrowthTasksTest extends ApiTestCase {
'list' => 'growthtasks',
];
list( $data ) = $this->doApiRequest( $baseParams );
[ $data ] = $this->doApiRequest( $baseParams );
$this->assertSame( 6, $data['query']['growthtasks']['totalCount'] );
$this->assertSame( 'Copyedit-1', $data['query']['growthtasks']['suggestions'][0]['title'] );
$this->assertSame( 'copyedit', $data['query']['growthtasks']['suggestions'][0]['tasktype'] );
@ -76,16 +76,16 @@ class ApiQueryGrowthTasksTest extends ApiTestCase {
$this->assertResponseContainsTitles( [ 'Copyedit-1', 'Link-1', 'Update-1', 'Copyedit-2',
'Update-2', 'Copyedit-3' ], $data );
list( $data ) = $this->doApiRequest( $baseParams + [ 'gttasktypes' => 'update|link' ] );
[ $data ] = $this->doApiRequest( $baseParams + [ 'gttasktypes' => 'update|link' ] );
$this->assertResponseContainsTitles( [ 'Link-1', 'Update-1', 'Update-2' ], $data );
$this->assertSame( 3, $data['query']['growthtasks']['totalCount'] );
list( $data ) = $this->doApiRequest( $baseParams + [ 'gtlimit' => '2', 'gtoffset' => 3 ] );
[ $data ] = $this->doApiRequest( $baseParams + [ 'gtlimit' => '2', 'gtoffset' => 3 ] );
$this->assertResponseContainsTitles( [ 'Copyedit-2', 'Update-2' ], $data );
$this->assertSame( 6, $data['query']['growthtasks']['totalCount'] );
$this->assertSame( 5, $data['continue']['gtoffset'] );
list( $data ) = $this->doApiRequest( $baseParams + [ 'gtlimit' => '2', 'gtoffset' => 4 ] );
[ $data ] = $this->doApiRequest( $baseParams + [ 'gtlimit' => '2', 'gtoffset' => 4 ] );
$this->assertResponseContainsTitles( [ 'Update-2', 'Copyedit-3' ], $data );
$this->assertSame( 6, $data['query']['growthtasks']['totalCount'] );
$this->assertArrayNotHasKey( 'continue', $data );
@ -104,7 +104,7 @@ class ApiQueryGrowthTasksTest extends ApiTestCase {
$this->setService( 'GrowthExperimentsTaskSuggesterFactory', $suggesterFactory );
$this->setService( 'GrowthExperimentsNewcomerTasksConfigurationLoader', $configurationLoader );
list( $data ) = $this->doApiRequest( [ 'action' => 'query', 'generator' => 'growthtasks' ] );
[ $data ] = $this->doApiRequest( [ 'action' => 'query', 'generator' => 'growthtasks' ] );
$pages = reset( $data['query']['pages'] );
$this->assertSame( 2, $data['growthtasks']['totalCount'] );
$this->assertSame( 0, $pages['ns'] );
@ -141,7 +141,7 @@ class ApiQueryGrowthTasksTest extends ApiTestCase {
$this->setService( 'GrowthExperimentsTaskSuggesterFactory', $suggesterFactory );
$this->setService( 'GrowthExperimentsNewcomerTasksConfigurationLoader', $configurationLoader );
list( $data ) = $this->doApiRequest( [ 'action' => 'paraminfo',
[ $data ] = $this->doApiRequest( [ 'action' => 'paraminfo',
'modules' => 'query+growthtasks' ] );
$this->assertArrayHasKey( 'paraminfo', $data );
$this->assertArrayHasKey( 0, $data['paraminfo']['modules'] );
@ -161,7 +161,7 @@ class ApiQueryGrowthTasksTest extends ApiTestCase {
StatusValue::newFatal( 'bar' ) );
$this->setService( 'GrowthExperimentsTaskSuggesterFactory', $suggesterFactory );
$this->setService( 'GrowthExperimentsNewcomerTasksConfigurationLoader', $configurationLoader );
list( $data ) = $this->doApiRequest( [ 'action' => 'paraminfo',
[ $data ] = $this->doApiRequest( [ 'action' => 'paraminfo',
'modules' => 'query+growthtasks' ] );
$this->assertArrayHasKey( 'paraminfo', $data );
}

查看文件

@ -82,7 +82,7 @@ class PraiseworthyMenteeSuggesterIntegrationTest extends MediaWikiIntegrationTes
] );
$mentor = $this->getTestSysop()->getUserIdentity();
list( $praiseworthyMentee, $otherMentee ) = $this->getNMentees( $mentor, 2 );
[ $praiseworthyMentee, $otherMentee ] = $this->getNMentees( $mentor, 2 );
$this->makeNEdits( $praiseworthyMentee, $minEdits );
$this->makeNEdits( $otherMentee, $minEdits - 1 );

查看文件

@ -33,8 +33,8 @@ class StructuredMentorWriterIntegrationTest extends MediaWikiIntegrationTestCase
* @param int $revId
*/
private function assertEditTagged( array $tags, int $revId ) {
$this->assertCount(
count( $tags ),
$this->assertSameSize(
$tags,
array_intersect(
$tags,
ChangeTags::getTags(

查看文件

@ -412,7 +412,7 @@ class ServiceImageRecommendationProviderTest extends MediaWikiIntegrationTestCas
return self::metadataFactory( 99 );
}
if ( $filename === 'InvalidMediaType.png' ) {
return self::metadataFactory( 200, MEDIATYPE_AUDIO );
return self::metadataFactory( 200, MEDIATYPE_AUDIO );
}
return self::metadataFactory( 101 );
} );
@ -424,7 +424,7 @@ class ServiceImageRecommendationProviderTest extends MediaWikiIntegrationTestCas
return self::metadataFactory( 99 );
}
if ( $suggestion['filename'] === 'InvalidMediaType.png' ) {
return self::metadataFactory( 200, MEDIATYPE_AUDIO );
return self::metadataFactory( 200, MEDIATYPE_AUDIO );
}
return self::metadataFactory( 101 );
} );

查看文件

@ -97,7 +97,7 @@ class SpecialClaimMenteeTest extends SpecialPageTestBase {
// first run of SpecialClaimMentee successfully changes the mentor
/** @var string $html */
list( $html, ) = $this->submitChangeMentor( [
[ $html, ] = $this->submitChangeMentor( [
'wpmentees' => $mentee->getName(),
], $mentorOne );
$this->assertStringContainsString( 'growthexperiments-homepage-claimmentee-success', $html );
@ -108,7 +108,7 @@ class SpecialClaimMenteeTest extends SpecialPageTestBase {
// second run of SpecialClaimMentee requires confirmation
/** @var string $html */
list( $html, ) = $this->submitChangeMentor( [
[ $html, ] = $this->submitChangeMentor( [
'wpmentees' => $mentee->getName(),
], $mentorTwo );
$this->assertStringContainsString( 'growthexperiments-homepage-claimmentee-alreadychanged', $html );
@ -119,7 +119,7 @@ class SpecialClaimMenteeTest extends SpecialPageTestBase {
// when confirmed, mentor successfully changed
/** @var string $html */
list( $html, ) = $this->submitChangeMentor( [
[ $html, ] = $this->submitChangeMentor( [
'wpmentees' => $mentee->getName(),
'wpstage' => 3,
'wpconfirm' => true,

查看文件

@ -55,7 +55,7 @@ class SpecialEditGrowthConfigTest extends SpecialPageTestBase {
$this->setMwGlobals( $configOverrides );
/** @var string $html */
list( $html, ) = $this->executeSpecialPage();
[ $html, ] = $this->executeSpecialPage();
$this->assertNotEmpty( $html );
}
}

查看文件

@ -68,7 +68,7 @@ class SpecialEnrollAsMentorTest extends SpecialPageTestBase {
$this->assertTrue( $mentorProvider->isMentor( $mentorUser ) );
/** @var FauxResponse $response */
list( , $response ) = $this->executeSpecialPage( '', null, null, $mentorUser );
[ , $response ] = $this->executeSpecialPage( '', null, null, $mentorUser );
$this->assertEquals(
SpecialPage::getTitleFor( 'MentorDashboard' )->getFullURL(),
$response->getHeader( 'Location' )
@ -83,7 +83,7 @@ class SpecialEnrollAsMentorTest extends SpecialPageTestBase {
$user = $this->getTestUser()->getUser();
/** @var string $html */
list( $html, ) = $this->executeSpecialPage( '', null, null, $user );
[ $html, ] = $this->executeSpecialPage( '', null, null, $user );
$this->assertNotEmpty( $html );
}
}

查看文件

@ -73,7 +73,7 @@ class SpecialManageMentorsTest extends SpecialPageTestBase {
* @covers ::getMentorAsHtmlRow
*/
public function testNotAuthorizedRead() {
list( $html, ) = $this->executeSpecialPage();
[ $html, ] = $this->executeSpecialPage();
$this->assertStringContainsString(
$this->mentorUser->getName(),
$html
@ -100,7 +100,7 @@ class SpecialManageMentorsTest extends SpecialPageTestBase {
*/
public function testAuthorizedRead() {
$performer = $this->getTestSysop()->getUser();
list( $html, ) = $this->executeSpecialPage( '', null, null, $performer );
[ $html, ] = $this->executeSpecialPage( '', null, null, $performer );
$this->assertStringContainsStringIgnoringCase(
$this->mentorUser->getName(),
$html
@ -158,7 +158,7 @@ class SpecialManageMentorsTest extends SpecialPageTestBase {
$this->mentorUser,
MentorStore::ROLE_PRIMARY
) );
list( $html, ) = $this->executeSpecialPage(
[ $html, ] = $this->executeSpecialPage(
'remove-mentor/' . $this->mentorUser->getId(),
new FauxRequest( [ 'wpreason' => 'foo' ], true ),
null,
@ -206,7 +206,7 @@ class SpecialManageMentorsTest extends SpecialPageTestBase {
'this is intro',
$mentorProvider->newMentorFromUserIdentity( $this->mentorUser )->getIntroText()
);
list( $html, ) = $this->executeSpecialPage(
[ $html, ] = $this->executeSpecialPage(
'edit-mentor/' . $this->mentorUser->getId(),
new FauxRequest( [
'wpmessage' => 'new intro',

查看文件

@ -49,7 +49,7 @@ class SpecialMentorDashboardTest extends SpecialPageTestBase {
$this->assertTrue( $mentorProvider->isMentor( $mentorUser ) );
/** @var string $html */
list( $html, ) = $this->executeSpecialPage( '', null, null, $mentorUser );
[ $html, ] = $this->executeSpecialPage( '', null, null, $mentorUser );
$this->assertNotEmpty( $html );
}
@ -59,7 +59,7 @@ class SpecialMentorDashboardTest extends SpecialPageTestBase {
public function testNonMentor() {
$user = $this->getTestUser()->getUser();
list( , $response ) = $this->executeSpecialPage( '', null, null, $user );
[ , $response ] = $this->executeSpecialPage( '', null, null, $user );
$this->assertEquals(
SpecialPage::getTitleFor( 'EnrollAsMentor' )->getFullURL(),
$response->getHeader( 'Location' )

查看文件

@ -84,7 +84,7 @@ class SpecialQuitMentorshipTest extends SpecialPageTestBase {
}
/** @var string $html */
list( $html, ) = $this->executeSpecialPage( '', null, null, $mentorUser );
[ $html, ] = $this->executeSpecialPage( '', null, null, $mentorUser );
$this->assertStringContainsString(
'growthexperiments-quit-mentorship-reassign-mentees-confirm',
$html
@ -125,7 +125,7 @@ class SpecialQuitMentorshipTest extends SpecialPageTestBase {
/** @var string $html */
/** @var FauxResponse $response */
list( $html, $response ) = $this->executeSpecialPage( '', $request, null, $mentorUser );
[ $html, $response ] = $this->executeSpecialPage( '', $request, null, $mentorUser );
$queueResponse = $this->getServiceContainer()->getJobRunner()->run( [
'type' => 'reassignMenteesJob',
'maxJobs' => 1,

查看文件

@ -200,8 +200,8 @@ class StructuredMentorProviderTest extends MediaWikiUnitTestCase {
->willReturnCallback( function ( $key, ...$params ) {
$message = $this->createMock( Message::class );
$message->method( 'exists' )->willReturn( true );
$message->method( 'inContentLanguage' )->will( $this->returnSelf() );
$message->method( 'params' )->will( $this->returnSelf() );
$message->method( 'inContentLanguage' )->willReturnSelf();
$message->method( 'params' )->willReturnSelf();
$message->method( 'text' )->willReturnCallback(
static function () use ( $key, $params ) {
switch ( $key ) {

查看文件

@ -92,7 +92,7 @@ class CacheDecoratorTest extends MediaWikiUnitTestCase {
'calls' => [
[
'suggest' => [
'expect' => [ $user, $taskSetFilters, 15, 0 , [ 'excludePageIds' => [] ] ],
'expect' => [ $user, $taskSetFilters, 15, 0, [ 'excludePageIds' => [] ] ],
'return' => $taskset,
],
'filter' => null,
@ -109,7 +109,7 @@ class CacheDecoratorTest extends MediaWikiUnitTestCase {
'calls' => [
[
'suggest' => [
'expect' => [ $user, $taskSetFilters, 15, 0 , [ 'excludePageIds' => [] ] ],
'expect' => [ $user, $taskSetFilters, 15, 0, [ 'excludePageIds' => [] ] ],
'return' => StatusValue::newFatal( 'error' ),
],
'filter' => null,
@ -126,7 +126,7 @@ class CacheDecoratorTest extends MediaWikiUnitTestCase {
'calls' => [
[
'suggest' => [
'expect' => [ $user, $taskSetFilters, 15, 0 , [ 'excludePageIds' => [] ] ],
'expect' => [ $user, $taskSetFilters, 15, 0, [ 'excludePageIds' => [] ] ],
'return' => $taskset,
],
'filter' => null,
@ -155,7 +155,7 @@ class CacheDecoratorTest extends MediaWikiUnitTestCase {
'calls' => [
[
'suggest' => [
'expect' => [ $user, $taskSetFilters, 15, 0 , [ 'excludePageIds' => [] ] ],
'expect' => [ $user, $taskSetFilters, 15, 0, [ 'excludePageIds' => [] ] ],
'return' => StatusValue::newFatal( 'error' ),
],
'filter' => null,
@ -167,7 +167,7 @@ class CacheDecoratorTest extends MediaWikiUnitTestCase {
],
[
'suggest' => [
'expect' => [ $user, $taskSetFilters, 15, 0 , [ 'excludePageIds' => [] ] ],
'expect' => [ $user, $taskSetFilters, 15, 0, [ 'excludePageIds' => [] ] ],
'return' => $taskset,
],
'filter' => null,
@ -184,7 +184,7 @@ class CacheDecoratorTest extends MediaWikiUnitTestCase {
'calls' => [
[
'suggest' => [
'expect' => [ $user, $taskSetFilters, 15, 0 , [ 'excludePageIds' => [] ] ],
'expect' => [ $user, $taskSetFilters, 15, 0, [ 'excludePageIds' => [] ] ],
'return' => $taskset,
],
'filter' => null,
@ -196,7 +196,7 @@ class CacheDecoratorTest extends MediaWikiUnitTestCase {
],
[
'suggest' => [
'expect' => [ $user, $taskSetFilterLinks, 15, 0 , [ 'excludePageIds' => [] ] ],
'expect' => [ $user, $taskSetFilterLinks, 15, 0, [ 'excludePageIds' => [] ] ],
'return' => $taskset2,
],
'filter' => null,
@ -213,7 +213,7 @@ class CacheDecoratorTest extends MediaWikiUnitTestCase {
'calls' => [
[
'suggest' => [
'expect' => [ $user, $taskSetFilters, 15, 0 , [ 'excludePageIds' => [] ] ],
'expect' => [ $user, $taskSetFilters, 15, 0, [ 'excludePageIds' => [] ] ],
'return' => $taskset,
],
'filter' => null,
@ -225,7 +225,7 @@ class CacheDecoratorTest extends MediaWikiUnitTestCase {
],
[
'suggest' => [
'expect' => [ $user, $taskSetFilterArt, 15, 0 , [ 'excludePageIds' => [] ] ],
'expect' => [ $user, $taskSetFilterArt, 15, 0, [ 'excludePageIds' => [] ] ],
'return' => $taskset2,
],
'filter' => null,

查看文件

@ -81,7 +81,7 @@ class RemoteSearchTaskSuggesterTest extends MediaWikiUnitTestCase {
$this->assertInstanceOf( TaskSet::class, $taskSet );
$this->assertSame( $expectedTaskSet->getOffset(), $taskSet->getOffset() );
$this->assertSame( $expectedTaskSet->getTotalCount(), $taskSet->getTotalCount() );
$this->assertCount( count( $expectedTaskSet ), $taskSet );
$this->assertSameSize( $expectedTaskSet, $taskSet );
// Responses are shuffled due to T242057 so we need order-insensitive comparison.
$expectedTaskData = $this->taskSetToArray( $expectedTaskSet );
$actualTaskData = $this->taskSetToArray( $taskSet );
@ -491,7 +491,7 @@ class RemoteSearchTaskSuggesterTest extends MediaWikiUnitTestCase {
$this->assertInstanceOf( TaskSet::class, $filteredTaskSet );
$this->assertSame( $expectedTaskSet->getOffset(), $filteredTaskSet->getOffset() );
$this->assertSame( $expectedTaskSet->getTotalCount(), $filteredTaskSet->getTotalCount() );
$this->assertCount( count( $expectedTaskSet ), $filteredTaskSet );
$this->assertSameSize( $expectedTaskSet, $filteredTaskSet );
for ( $i = 0; $i < count( $expectedTaskSet ); $i++ ) {
$expectedTask = $expectedTaskSet[$i];
$filteredTask = $filteredTaskSet[$i];

查看文件

@ -160,7 +160,7 @@ class SearchStrategyTest extends MediaWikiUnitTestCase {
}
private function assertIntersectionTopicsInQueries( $queries, $topicIds ) {
list( $query1, $query2 ) = array_values( $queries );
[ $query1, $query2 ] = array_values( $queries );
foreach ( $topicIds as $id ) {
$this->assertStringContainsString( $id, $query1->getQueryString() );
$this->assertStringContainsString( $id, $query2->getQueryString() );
@ -168,7 +168,7 @@ class SearchStrategyTest extends MediaWikiUnitTestCase {
}
private function assertTopicsInQueries( $queries, $topicIds ) {
list( $query1, $query2 ) = array_values( $queries );
[ $query1, $query2 ] = array_values( $queries );
foreach ( $topicIds as $id ) {
if ( $query1->getTopic()->getId() === $id ) {
$this->assertSame( $query1->getTopic()->getId(), $id );
@ -181,7 +181,7 @@ class SearchStrategyTest extends MediaWikiUnitTestCase {
}
private function assertTaskTypeInQueries( $queries, $taskTypes ) {
list( $query1, $query2 ) = array_values( $queries );
[ $query1, $query2 ] = array_values( $queries );
foreach ( $taskTypes as $id ) {
if ( $query1->getTaskType()->getId() === $id ) {
$this->assertSame( $query1->getTaskType()->getId(), $id );