I'd like us to require the constructor's $context parameter in HTMLForm. It is currently allowed (but deprecated since 97056794f) to omit it.
It looks like there are still a few uses remaining:
Searching for HTMLForm(::factory|)\(\s*['",\w ]*(\$\w+|\[((?:\[(?:\[[^\]]+\]|[^\]])+\]|[^\]])+)\])\s*\) locally returns some more results, looks like the regexp is too cursed for code search:
core/tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php: 32: $form = HTMLForm::factory( 'ooui', [ 33: 'restrictions' => [ 'class' => HTMLRestrictionsField::class ], 34: ] ); extensions/BetaFeatures/tests/phpunit/HTMLFeatureFieldTest.php: 36: $form = new HTMLForm( [ 37: 'blahblahblah' => [ 38: 'class' => HTMLFeatureField::class, 39: 'label-message' => 'betafeatures-test-check-field', 40: 'desc-message' => 'betafeatures-test-feature-field', 41: 'info-link' => 'http://example.org/features', 42: 'discussion-link' => 'http://example.org/feedback', 43: ], 44: ] ); extensions/BetaFeatures/tests/phpunit/HTMLHorizontalRuleFieldTest.php: 36: $form = new HTMLForm( [ 37: 'blahblahblah' => [ 38: 'class' => HTMLHorizontalRuleField::class, 39: ], 40: ] ); extensions/ConfirmEdit/tests/phpunit/HTMLFancyCaptchaFieldTest.php: 34: $form = new HTMLForm( [ 'captchaWord' => $params ] ); extensions/ConfirmEdit/tests/phpunit/HTMLReCaptchaNoCaptchaFieldTest.php: 8: $form = new HTMLForm( [ 9: 'foo' => [ 10: 'class' => HTMLReCaptchaNoCaptchaField::class, 11: 'key' => '123', 12: ], 13: ] );
Fixes:
- https://gerrit.wikimedia.org/r/c/mediawiki/core/+/791815
- https://gerrit.wikimedia.org/r/c/mediawiki/extensions/BetaFeatures/+/791810
- https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ConfirmEdit/+/791811
Searching for "HTMLForm::__construct without $context".
Fixes: