From 95a0613c96d2e8cf37f961a7b9fc5a44215f8e02 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Thu, 12 Nov 2026 23:55:50 +0100 Subject: [PATCH] Declare nullable parameters explicitly 43 parameters were implicitly nullable ('array $x = null', 'Registry $options = null', ...), which PHP 8.4 deprecates with a notice for every one of them when the file is compiled. Use ?Type; the signatures stay compatible. Co-Authored-By: Claude Opus 5.5 --- src/AbstractMediawikiObject.php | 2 +- src/Categories.php | 16 ++++++++-------- src/Http.php | 2 +- src/Images.php | 4 ++-- src/Links.php | 4 ++-- src/Mediawiki.php | 2 +- src/Pages.php | 10 +++++----- src/Search.php | 8 ++++---- src/Sites.php | 20 ++++++++++---------- src/Users.php | 10 +++++----- 10 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/AbstractMediawikiObject.php b/src/AbstractMediawikiObject.php index 63a17ce..be4c6bc 100644 --- a/src/AbstractMediawikiObject.php +++ b/src/AbstractMediawikiObject.php @@ -40,7 +40,7 @@ abstract class AbstractMediawikiObject * * @since 1.0 */ - public function __construct(Registry $options = null, Http $client = null) + public function __construct(?Registry $options = null, ?Http $client = null) { $this->options = $options ?? new Registry(); $this->client = $client ?? new Http($this->options->toArray()); diff --git a/src/Categories.php b/src/Categories.php index 511552b..5829011 100644 --- a/src/Categories.php +++ b/src/Categories.php @@ -33,11 +33,11 @@ class Categories extends AbstractMediawikiObject */ public function getCategories( array $titles, - array $clprop = null, - array $clshow = null, + ?array $clprop = null, + ?array $clshow = null, $cllimit = null, $clcontinue = false, - array $clcategories = null, + ?array $clcategories = null, $cldir = null ) { // Build the request. @@ -157,9 +157,9 @@ public function getCategoryMembers( $cmtitle = null, $cmpageid = null, $cmlimit = null, - array $cmprop = null, - array $cmnamespace = null, - array $cmtype = null, + ?array $cmprop = null, + ?array $cmnamespace = null, + ?array $cmtype = null, $cmstart = null, $cmend = null, $cmstartsortkey = null, @@ -273,7 +273,7 @@ public function enumerateCategories( $acmin = null, $acmax = null, $aclimit = null, - array $acprop = null + ?array $acprop = null ) { // Build the request. $path = '?action=query&list=allcategories'; @@ -330,7 +330,7 @@ public function enumerateCategories( * * @since 1.0 */ - public function getChangeTags(array $tgprop = null, $tglimit = null) + public function getChangeTags(?array $tgprop = null, $tglimit = null) { // Build the request. $path = '?action=query&list=tags'; diff --git a/src/Http.php b/src/Http.php index 4e85636..37f649a 100644 --- a/src/Http.php +++ b/src/Http.php @@ -27,7 +27,7 @@ class Http extends BaseHttp * * @since 12.3 */ - public function __construct($options = [], TransportInterface $transport = null) + public function __construct($options = [], ?TransportInterface $transport = null) { parent::__construct($options, $transport); diff --git a/src/Images.php b/src/Images.php index 3532651..e3b307a 100644 --- a/src/Images.php +++ b/src/Images.php @@ -100,7 +100,7 @@ public function getImagesUsed(array $titles) * @since 1.0 */ public function getImageInfo( - array $liprop = null, + ?array $liprop = null, $lilimit = null, $listart = null, $liend = null, @@ -184,7 +184,7 @@ public function enumerateImages( $aidir = null, $aisha1 = null, $aisha1base36 = null, - array $aiprop = null, + ?array $aiprop = null, $aimime = null ) { // Build the request. diff --git a/src/Links.php b/src/Links.php index f723dc4..ccb9b27 100644 --- a/src/Links.php +++ b/src/Links.php @@ -30,7 +30,7 @@ class Links extends AbstractMediawikiObject * * @since 1.0 */ - public function getLinks(array $titles, array $plnamespace = null, $pllimit = null, $plcontinue = null, array $pltitles = null, $pldir = null) + public function getLinks(array $titles, ?array $plnamespace = null, $pllimit = null, $plcontinue = null, ?array $pltitles = null, $pldir = null) { // Build the request. $path = '?action=query&prop=links'; @@ -258,7 +258,7 @@ public function enumerateLinks( $alto = null, $alprefix = null, $alunique = null, - array $alprop = null, + ?array $alprop = null, $alnamespace = null, $allimit = null ) { diff --git a/src/Mediawiki.php b/src/Mediawiki.php index 9c5f43b..3cbb626 100644 --- a/src/Mediawiki.php +++ b/src/Mediawiki.php @@ -88,7 +88,7 @@ class Mediawiki * * @since 1.0 */ - public function __construct(Registry $options = null, Http $client = null) + public function __construct(?Registry $options = null, ?Http $client = null) { $this->options = $options ?? new Registry(); $this->client = $client ?? new Http($this->options->toArray()); diff --git a/src/Pages.php b/src/Pages.php index 9226995..102b397 100644 --- a/src/Pages.php +++ b/src/Pages.php @@ -348,7 +348,7 @@ public function changeProtection($title, $protections, $expiry = null, $reason = * * @since 1.0 */ - public function getPageInfo(array $titles, array $inprop = null, array $intoken = null, $incontinue = null) + public function getPageInfo(array $titles, ?array $inprop = null, ?array $intoken = null, $incontinue = null) { // Build the request $path = '?action=query&prop=info'; @@ -419,7 +419,7 @@ public function getPageProperties(array $titles, $ppcontinue = null, $ppprop = n * * @since 1.0 */ - public function getRevisions(array $titles, array $rvprop = null, $rvparse = null, $rvlimit = null) + public function getRevisions(array $titles, ?array $rvprop = null, $rvparse = null, $rvlimit = null) { // Build the request $path = '?action=query&prop=revisions'; @@ -461,7 +461,7 @@ public function getRevisions(array $titles, array $rvprop = null, $rvparse = nul */ public function getPageTemplates( array $titles, - array $tlnamespace = null, + ?array $tlnamespace = null, $tllimit = null, $tlcontinue = null, $tltemplates = null, @@ -518,7 +518,7 @@ public function getBackLinks( $bltitle, $blpageid = null, $blcontinue = null, - array $blnamespace = null, + ?array $blnamespace = null, $blfilterredirect = null, $bllimit = null, $blredirect = null @@ -571,7 +571,7 @@ public function getBackLinks( * * @since 1.0 */ - public function getIWBackLinks($iwbltitle, $iwblprefix = null, $iwblcontinue = null, $iwbllimit = null, array $iwblprop = null) + public function getIWBackLinks($iwbltitle, $iwblprefix = null, $iwblcontinue = null, $iwbllimit = null, ?array $iwblprop = null) { // Build the request $path = '?action=query&list=iwbacklinks'; diff --git a/src/Search.php b/src/Search.php index fd021ec..828be1a 100644 --- a/src/Search.php +++ b/src/Search.php @@ -34,10 +34,10 @@ class Search extends AbstractMediawikiObject */ public function search( $srsearch, - array $srnamespace = null, + ?array $srnamespace = null, $srwhat = null, - array $srinfo = null, - array $srprop = null, + ?array $srinfo = null, + ?array $srprop = null, $srredirects = null, $sroffest = null, $srlimit = null @@ -94,7 +94,7 @@ public function search( * * @since 1.0 */ - public function openSearch($search, $limit = null, array $namespace = null, $suggest = null, $format = null) + public function openSearch($search, $limit = null, ?array $namespace = null, $suggest = null, $format = null) { // Build the request. $path = '?action=query&list=search'; diff --git a/src/Sites.php b/src/Sites.php index e5b3d82..3024961 100644 --- a/src/Sites.php +++ b/src/Sites.php @@ -30,11 +30,11 @@ class Sites extends AbstractMediawikiObject * @since 1.0 */ public function getSiteInfo( - array $siprop = null, + ?array $siprop = null, $sifilteriw = null, $sishowalldb = false, $sinumberingroup = false, - array $siinlanguagecode = null + ?array $siinlanguagecode = null ) { // Build the request. $path = '?action=query&meta=siteinfo'; @@ -85,7 +85,7 @@ public function getSiteInfo( * @since 1.0 */ public function getEvents( - array $leprop = null, + ?array $leprop = null, $letype = null, $leaction = null, $letitle = null, @@ -175,13 +175,13 @@ public function getRecentChanges( $rcstart = null, $rcend = null, $rcdir = null, - array $rcnamespace = null, + ?array $rcnamespace = null, $rcuser = null, $rcexcludeuser = null, $rctag = null, - array $rcprop = null, - array $rctoken = null, - array $rcshow = null, + ?array $rcprop = null, + ?array $rctoken = null, + ?array $rcshow = null, $rclimit = null, $rctype = null, $rctoponly = null @@ -263,13 +263,13 @@ public function getRecentChanges( * @since 1.0 */ public function getProtectedTitles( - array $ptnamespace = null, - array $ptlevel = null, + ?array $ptnamespace = null, + ?array $ptlevel = null, $ptlimit = null, $ptdir = null, $ptstart = null, $ptend = null, - array $ptprop = null + ?array $ptprop = null ) { // Build the request. $path = '?action=query&list=protectedtitles'; diff --git a/src/Users.php b/src/Users.php index 69ebffd..e031746 100644 --- a/src/Users.php +++ b/src/Users.php @@ -97,7 +97,7 @@ public function logout() * * @since 1.0 */ - public function getUserInfo(array $ususers, array $usprop = null) + public function getUserInfo(array $ususers, ?array $usprop = null) { // Build the request path. $path = '?action=query&list=users'; @@ -124,7 +124,7 @@ public function getUserInfo(array $ususers, array $usprop = null) * * @since 1.0 */ - public function getCurrentUserInfo(array $uiprop = null) + public function getCurrentUserInfo(?array $uiprop = null) { // Build the request path. $path = '?action=query&meta=userinfo'; @@ -167,9 +167,9 @@ public function getUserContribs( $ucend = null, $uccontinue = null, $ucdir = null, - array $ucnamespace = null, - array $ucprop = null, - array $ucshow = null, + ?array $ucnamespace = null, + ?array $ucprop = null, + ?array $ucshow = null, $uctag = null, $uctoponly = null ) {