It seems like $page->getTitle() can be null; however, getUndeleteParams() does not accept null, maybe add an additional type check?
Unless you are absolutely sure that the expression can never be null because of
other conditions, we strongly recommend to add an additional type check to your
code:
/** @return stdClass|null */functionmayReturnNull(){}functiondoesNotAcceptNull(stdClass$x){}// With potential error.functionwithoutCheck(){$x=mayReturnNull();doesNotAcceptNull($x);// Potential error here.}// Safe - Alternative 1functionwithCheck1(){$x=mayReturnNull();if(!$xinstanceofstdClass){thrownew\LogicException('$x must be defined.');}doesNotAcceptNull($x);}// Safe - Alternative 2functionwithCheck2(){$x=mayReturnNull();if($xinstanceofstdClass){doesNotAcceptNull($x);}}
The method Mediawiki\DataModel\Page::getTitle() has been deprecated with message: since 0.5
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be
removed from the class and what other method or class to use instead.
Loading history...
30
)
31
);
32
33
return true;
34
}
35
36
/**
37
* @param Title $title
38
* @param array $extraParams
39
*
40
* @return array
41
*/
42
private function getUndeleteParams( Title $title, $extraParams ) {
The method Mediawiki\DataModel\Title::getTitle() has been deprecated with message: in 0.6 use getText (makes things look cleaner)
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be
removed from the class and what other method or class to use instead.
The method Mediawiki\DataModel\Title::getTitle() has been deprecated with message: in 0.6 use getText (makes things look cleaner)
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be
removed from the class and what other method or class to use instead.
Loading history...
63
'drprop' => 'token',
64
]
65
)
66
);
67
if ( array_key_exists( 'token', $response['query']['deletedrevs'][0] ) ) {
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: