diff --git a/tests/phpunit/HTMLFancyCaptchaFieldTest.php b/tests/phpunit/HTMLFancyCaptchaFieldTest.php
index 662d454a9..ed546e323 100644
--- a/tests/phpunit/HTMLFancyCaptchaFieldTest.php
+++ b/tests/phpunit/HTMLFancyCaptchaFieldTest.php
@@ -51,7 +51,7 @@ class HTMLFancyCaptchaFieldTest extends MediaWikiIntegrationTestCase {
$form->trySubmit();
}
- protected function getForm( $params = [], WebRequest $request = null ) {
+ protected function getForm( $params = [], ?WebRequest $request = null ) {
if ( $request ) {
$context = new DerivativeContext( RequestContext::getMain() );
$context->setRequest( $request );