Page MenuHomePhabricator

Phan is failing for ext:WebAuthn (src/HTMLForm/WebAuthnManageForm.php:32 PhanIncompatibleRealPropertyType)
Closed, ResolvedPublic

Description

Seen for 1204049: build: Update MediaWiki requirement to 1.46 & 1205904: build: Updating eslint-config-wikimedia to 0.32.1

src/HTMLForm/WebAuthnManageForm.php:32 PhanIncompatibleRealPropertyType Declaration of \MediaWiki\Extension\WebAuthn\HTMLForm\WebAuthnManageForm::module of real type (empty union type) is incompatible with inherited property \MediaWiki\Extension\OATHAuth\HTMLForm\OATHAuthOOUIHTMLForm::module of real type \MediaWiki\Extension\OATHAuth\IModule defined at ../../extensions/OATHAuth/src/HTMLForm/OATHAuthOOUIHTMLForm.php:42

[https://integration.wikimedia.org/ci/job/mwext-php81-phan/49974/console]

Locally, git bisect says it seems to have started from 8b089d3f77 (https://gerrit.wikimedia.org/r/1201831).

Event Timeline

Change #1206403 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/WebAuthn@master] WebAuthnManageForm: Remove $module property and replace with @property

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

Why is it empty union type rather than MediaWiki\Extension\WebAuthn\Module\WebAuthn (which implements IModule so that should be a valid case of covariance)?

I guess that's not how it works:

By default, properties are neither covariant nor contravariant, hence invariant. That is, their type may not change in a child class at all. The reason for that is "get" operations must be covariant, and "set" operations must be contravariant. The only way for a property to satisfy both requirements is to be invariant.

I guess OATHAuthOOUIHTMLForm should use generics in its phpdoc?

Change #1206403 merged by jenkins-bot:

[mediawiki/extensions/WebAuthn@master] WebAuthnManageForm: Remove $module property and replace with @property

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

Krinkle assigned this task to Reedy.