Page MenuHomePhabricator

Enforce php strict types in extensions stewarded by Product Safety and Integrity (plus ConfirmEdit)
Closed, ResolvedPublic

Description

We should try to use declare(strict_types=1) in all of the PHP files.

This helps prevent implicit type conversion issues.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1286348 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/CheckUser@master] Add pre-commit hook enforcing declare(strict_types=1)

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

Change #1286348 abandoned by Mpostoronca:

[mediawiki/extensions/CheckUser@master] Add pre-commit hook enforcing declare(strict_types=1)

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

Change #1287877 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/ConfirmEdit@master] Add declare(strict_types=1) to all PHP files

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

MPostoronca-WMF renamed this task from Add git hook for php strict mode to Enforce php strict mode.Fri, May 15, 2:10 PM

Change #1287888 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/ConfirmEdit@master] Add declare(strict_types=1) to all PHP files

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

Change #1287877 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] Add declare(strict_types=1) to all PHP files

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

Change #1287888 abandoned by Dreamy Jazz:

[mediawiki/extensions/ConfirmEdit@master] Add declare(strict_types=1) to all PHP files

Reason:

Duplicate to I7854d9b0df2a4edd25a27065221303336cda8eae from what I can see

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

Change #1289350 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/CheckUser@master] Add declare(strict_types=1) to all PHP files

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

Change #1289350 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/CheckUser@master] Add declare(strict_types=1) to all PHP files

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

Change #1289350 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Add declare(strict_types=1) to all PHP files

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

Change #1290789 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/AntiSpoof@master] Add declare(strict_types=1) to all PHP files

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

Change #1290790 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/EmailAuth@master] Add declare(strict_types=1) to all PHP files

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

Change #1290791 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/LoginNotify@master] Add declare(strict_types=1) to all PHP files

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

Change #1290792 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/IPReputation@master] Add declare(strict_types=1) to all PHP files

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

Change #1290796 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/ReportIncident@master] Add declare(strict_types=1) to all PHP files

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

Change #1290801 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/GlobalBlocking@master] Add declare(strict_types=1) to all PHP files

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

Change #1290802 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/MediaModeration@master] Add declare(strict_types=1) to all PHP files

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

Change #1290804 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/SecurePoll@master] Add declare(strict_types=1) to all PHP files

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

Change #1290809 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/IPInfo@master] Add declare(strict_types=1) to all PHP files

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

Change #1290812 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/OATHAuth@master] Add declare(strict_types=1) to all PHP files

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

Change #1290802 merged by jenkins-bot:

[mediawiki/extensions/MediaModeration@master] Add declare(strict_types=1) to all PHP files

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

Pppery renamed this task from Enforce php strict mode to Enforce php strict types.Thu, May 21, 5:20 PM

Change #1290801 merged by jenkins-bot:

[mediawiki/extensions/GlobalBlocking@master] Add declare(strict_types=1) to all PHP files

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

Change #1290790 merged by jenkins-bot:

[mediawiki/extensions/EmailAuth@master] Add declare(strict_types=1) to all PHP files

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

Change #1290812 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] Add declare(strict_types=1) to all PHP files

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

Change #1290791 merged by jenkins-bot:

[mediawiki/extensions/LoginNotify@master] Add declare(strict_types=1) to all PHP files

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

Change #1290789 merged by jenkins-bot:

[mediawiki/extensions/AntiSpoof@master] Add declare(strict_types=1) to all PHP files

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

Change #1290792 merged by jenkins-bot:

[mediawiki/extensions/IPReputation@master] Add declare(strict_types=1) to all PHP files

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

Change #1290796 merged by jenkins-bot:

[mediawiki/extensions/ReportIncident@master] Add declare(strict_types=1) to all PHP files

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

Change #1290809 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] Add declare(strict_types=1) to all PHP files

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

(Just to clarify, is the scope of this task Product Safety and Integrity -stewarded extensions? Just asking as the tags currently present on this task seem to be PSI-stewarded exts AFAICS, w/ the exception of ConfirmEdit (CAPTCHA extension) [which is apparently stewarded by the Editing-team?])

This is intended for extensions we steward, but as we are working on hCaptcha we have touched most of ConfirmEdit (CAPTCHA extension) code and so thought we'd include it

A_smart_kitten renamed this task from Enforce php strict types to Enforce php strict types in extensions stewarded by Product Safety and Integrity (plus ConfirmEdit).Fri, May 29, 3:54 PM

Acknowledged :) Retitled for clarity. Feel free to adjust if desired

Change #1290804 merged by jenkins-bot:

[mediawiki/extensions/SecurePoll@master] Add declare(strict_types=1) to all PHP files

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

If you're thinking about adding strict_types to anything else, I would recommend against it. This ticket caused 4 production errors in SecurePoll. Not sure that's worth whatever benefit strict_types provides.

https://gerrit.wikimedia.org/r/q/is:merged+strict+repo:mediawiki/extensions/SecurePoll

It also added some non-standard phpcs rules to the phpcs config.