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: I2f17c7e8c6365795f7a54738b0e607b6f35c9df2
This commit is contained in:
Andre Klapper 2024-10-26 15:09:15 +02:00 committed by Umherirrender
parent d53a6eab3a
commit 0ac32cb375
2 changed files with 2 additions and 4 deletions

View file

@ -1,8 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<ruleset> <ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
<exclude name="MediaWiki.Usage.NullableType.ExplicitNullableTypes" />
</rule>
<file>.</file> <file>.</file>
<arg name="extensions" value="php" /> <arg name="extensions" value="php" />
<arg name="encoding" value="UTF-8" /> <arg name="encoding" value="UTF-8" />

View file

@ -71,7 +71,7 @@ class SearchResultProvideThumbnailHookHandler implements SearchResultProvideThum
* @param array &$results Placeholder for result. $pageId => SearchResultThumbnail * @param array &$results Placeholder for result. $pageId => SearchResultThumbnail
* @param int|null $size size of thumbnail height and width in points * @param int|null $size size of thumbnail height and width in points
*/ */
public function onSearchResultProvideThumbnail( array $pageIdentities, &$results, int $size = null ): void { public function onSearchResultProvideThumbnail( array $pageIdentities, &$results, ?int $size = null ): void {
$fileNamesByPageId = $this->getFileNamesByPageId( $pageIdentities ); $fileNamesByPageId = $this->getFileNamesByPageId( $pageIdentities );
$results ??= []; $results ??= [];
foreach ( $fileNamesByPageId as $pageId => $fileName ) { foreach ( $fileNamesByPageId as $pageId => $fileName ) {