Page MenuHomePhabricator

Fix all functions that have required parameters following optional ones
Closed, ResolvedPublic

Description

In PHP 8, they would generate E_DEPRECATED like: Deprecated: Required parameter $param2 follows optional parameter $param1 in filename.php on line 123

List of all files with an issue:

AbuseFilterTest.php
Adder.php
AJAXPoll.class.php
AthenaHooks.php
Attribute.php
BouquetSkinNavigationService.php
Comment.php
Contributors.php
CreatedPagesListTestBase.php
CreateNotification.php
DataModelBackend.LBFactory.php
DataModelBackend.php
DeskMessMirroredSkinNavigationService.php
DiscussionThreading.class.php
DPLListMode.php
DynamicPageListInclude.php
Editor.php
EDUtils.php
EmailDomain.php
ExtractFeatures.php
FallbackRunnerTest.php
FixedHeaderTable.php
FlickrAPIUtils.php
GamepressSkinNavigationService.php
GraphViz.php
KeywordFeatureAssertions.php
KeywordNodeVisitorTest.php
LastUserLogin.php
MockPageUpdater.php
OfflineImportLexicon_body.php
OmegaWikiDatabaseAPI.php
owAddAnnotation.php
PageContentBuilderTest.php
PermissionsTest.php
QuizTest.php
RegexBlockData.php
RequestLoggerTest.php
SelectCategory_body.php
SportsTeams.class.php
TabberHooks.php
Tabs.php
TimelineHashTest.php
UserSystemMessage.php
view.BaseElement.php
WFForum.php
WikiArticleFeeds_body.php
WikiDataAPI.php
WikiForumGui.php
WikiPage.php
YetAnotherKeywords.php

Event Timeline

MaxSem created this task.Mar 19 2020, 11:40 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 19 2020, 11:40 AM

Change 581549 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/tools/codesniffer@master] Prohibit required parameters after optional ones

https://gerrit.wikimedia.org/r/581549

Change 581566 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/core@master] Fix optional function parameters before required ones

https://gerrit.wikimedia.org/r/581566

Reedy added a subscriber: Reedy.

Going to untag MW 1.31 (EOL June 2021), MW 1.33 (EOL June 2020) and MW 1.34 (EOL November 2020). All will (or should be; 1.33 and 1.34 definitely will be) be EOL before PHP 8.0 is released

1.35 is probably in scope being an LTS... And it doesn't seem unreasonable people will want to run 1.35 in the time it's supported on PHP 8.0

FTR, note that phan already checks for this. However, many extensions don't run phan (and it's also never executed on tests), so it's a good idea to have a PHPCS sniff for this.

Change 581549 merged by jenkins-bot:
[mediawiki/tools/codesniffer@master] Prohibit required parameters after optional ones

https://gerrit.wikimedia.org/r/581549

Change 581566 merged by jenkins-bot:
[mediawiki/core@master] phpunit: Change optional params before required params to also be required

https://gerrit.wikimedia.org/r/581566

Change 581549 merged by jenkins-bot:
[mediawiki/tools/codesniffer@master] Prohibit required parameters after optional ones

https://gerrit.wikimedia.org/r/581549

@MaxSem can this be closed as resolved?

Reedy added a comment.Apr 28 2020, 1:04 AM

Change 581549 merged by jenkins-bot:
[mediawiki/tools/codesniffer@master] Prohibit required parameters after optional ones

https://gerrit.wikimedia.org/r/581549

@MaxSem can this be closed as resolved?

FTR, note that phan already checks for this. However, many extensions don't run phan (and it's also never executed on tests), so it's a good idea to have a PHPCS sniff for this.

Reedy updated the task description. (Show Details)May 18 2020, 7:48 PM

Change 597138 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/Flow@master] Fix optional parameter before required

https://gerrit.wikimedia.org/r/597138

Change 597139 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/CirrusSearch@master] Fix optional parameter before required

https://gerrit.wikimedia.org/r/597139

Change 597142 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/Wikibase@master] Fix optional parameter before required

https://gerrit.wikimedia.org/r/597142

Change 597143 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/ProofreadPage@master] Fix optional parameter before required

https://gerrit.wikimedia.org/r/597143

Change 597144 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/Quiz@master] Fix optional parameter before required

https://gerrit.wikimedia.org/r/597144

Change 597146 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/timeline@master] Fix optional parameter before required

https://gerrit.wikimedia.org/r/597146

Change 597139 merged by jenkins-bot:
[mediawiki/extensions/CirrusSearch@master] Fix optional parameter before required

https://gerrit.wikimedia.org/r/597139

Change 597138 merged by jenkins-bot:
[mediawiki/extensions/Flow@master] Fix optional parameter before required

https://gerrit.wikimedia.org/r/597138

Change 597143 merged by jenkins-bot:
[mediawiki/extensions/ProofreadPage@master] Fix optional parameter before required

https://gerrit.wikimedia.org/r/597143

Change 597146 merged by jenkins-bot:
[mediawiki/extensions/timeline@master] Fix optional parameter before required

https://gerrit.wikimedia.org/r/597146

Change 597144 merged by jenkins-bot:
[mediawiki/extensions/Quiz@master] Fix optional parameter before required

https://gerrit.wikimedia.org/r/597144

Change 597142 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Fix optional parameter before required

https://gerrit.wikimedia.org/r/597142

Reedy closed this task as Resolved.Jul 29 2020, 12:01 AM
Reedy claimed this task.

Marking resolved