Use explicit nullable type on parameter arguments (for PHP 8.4)

Implicitly marking parameter $... as nullable is deprecated in PHP
8.4. The explicit nullable type must be used instead.

Bug: T376276
Change-Id: I73a4ce1ecd9b4fe040e5bfd22889e783071fab0d
This commit is contained in:
Andre Klapper 2024-10-26 14:56:14 +02:00 committed by Umherirrender
parent cdb2b8804f
commit f4dd8ea227
4 changed files with 4 additions and 6 deletions

View file

@ -1,8 +1,6 @@
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="MediaWiki.Usage.NullableType.ExplicitNullableTypes" />
</rule>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
<rule ref="MediaWiki.Commenting.ClassLevelLicense">
<properties>

View file

@ -305,7 +305,7 @@ class Cite {
private function formatReferences(
Parser $parser,
string $group,
string $responsive = null
?string $responsive = null
): string {
$responsiveReferences = $this->config->get( 'CiteResponsiveReferences' );

View file

@ -28,7 +28,7 @@ class CiteTest extends \MediaWikiIntegrationTestCase {
public function testParseArguments(
array $attributes,
array $expectedValue,
string $expectedError = null
?string $expectedError = null
) {
/** @var Cite $cite */
$cite = TestingAccessWrapper::newFromObject( $this->newCite() );

View file

@ -100,7 +100,7 @@ class ErrorReporterTest extends \MediaWikiUnitTestCase {
return new ErrorReporter( $mockMessageLocalizer );
}
private function createParser( Language $language, string $expectedCategory = null ): Parser {
private function createParser( Language $language, ?string $expectedCategory = null ): Parser {
$parserOptions = $this->createMock( ParserOptions::class );
$parserOptions->method( 'getUserLangObj' )->willReturn( $language );