mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-23 15:16:56 +00:00
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: Idcd0b50c1c01a33c4cabeed3e31828f77c3f6443
This commit is contained in:
parent
47edd9b21d
commit
5c6bc704a2
|
@ -75,7 +75,7 @@ class InputCheckFactory {
|
|||
* @return RestbaseChecker checker based on communication with restbase interface
|
||||
*/
|
||||
public function newRestbaseChecker( string $input, string $type,
|
||||
MathRestbaseInterface &$restbaseInterface = null ): RestbaseChecker {
|
||||
?MathRestbaseInterface &$restbaseInterface = null ): RestbaseChecker {
|
||||
return new RestbaseChecker(
|
||||
$input,
|
||||
$type,
|
||||
|
@ -111,7 +111,7 @@ class InputCheckFactory {
|
|||
*/
|
||||
public function newDefaultChecker( string $input,
|
||||
string $type,
|
||||
MathRestbaseInterface &$restbaseInterface = null,
|
||||
?MathRestbaseInterface &$restbaseInterface = null,
|
||||
bool $purge = false ): BaseChecker {
|
||||
switch ( $this->texVCmode ) {
|
||||
case "mathoid":
|
||||
|
|
|
@ -20,12 +20,12 @@ final class Math {
|
|||
// should not be instantiated
|
||||
}
|
||||
|
||||
public static function getMathConfig( ContainerInterface $services = null ): MathConfig {
|
||||
public static function getMathConfig( ?ContainerInterface $services = null ): MathConfig {
|
||||
return ( $services ?: MediaWikiServices::getInstance() )
|
||||
->get( 'Math.Config' );
|
||||
}
|
||||
|
||||
public static function getCheckerFactory( ContainerInterface $services = null ): InputCheckFactory {
|
||||
public static function getCheckerFactory( ?ContainerInterface $services = null ): InputCheckFactory {
|
||||
return ( $services ?: MediaWikiServices::getInstance() )
|
||||
->get( 'Math.CheckerFactory' );
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class MathWikibaseInfo {
|
|||
* @param EntityId $entityId
|
||||
* @param MathFormatter|null $mathFormatter to format math equations. Default format is HTML.
|
||||
*/
|
||||
public function __construct( EntityId $entityId, MathFormatter $mathFormatter = null ) {
|
||||
public function __construct( EntityId $entityId, ?MathFormatter $mathFormatter = null ) {
|
||||
$this->id = $entityId;
|
||||
$this->mathFormatter = $mathFormatter ?: new MathFormatter( SnakFormatter::FORMAT_HTML );
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class MathConfigTest extends TestCase {
|
|||
|
||||
private function newMathConfig(
|
||||
array $configOverrides,
|
||||
ExtensionRegistry $registry = null
|
||||
?ExtensionRegistry $registry = null
|
||||
): MathConfig {
|
||||
return new MathConfig(
|
||||
new ServiceOptions( MathConfig::CONSTRUCTOR_OPTIONS, $configOverrides + [
|
||||
|
|
|
@ -64,8 +64,8 @@ class MathWikibaseConnectorTestFactory extends MediaWikiUnitTestCase {
|
|||
public function getWikibaseConnectorWithExistingItems(
|
||||
EntityRevision $entityRevision,
|
||||
bool $storageExceptionOnQ3 = false,
|
||||
LoggerInterface $logger = null,
|
||||
EntityIdParser $parser = null
|
||||
?LoggerInterface $logger = null,
|
||||
?EntityIdParser $parser = null
|
||||
): MathWikibaseConnector {
|
||||
$revisionLookupMock = $this->createMock( EntityRevisionLookup::class );
|
||||
$revisionLookupMock->method( 'getEntityRevision' )->willReturnCallback(
|
||||
|
@ -105,12 +105,12 @@ class MathWikibaseConnectorTestFactory extends MediaWikiUnitTestCase {
|
|||
}
|
||||
|
||||
public function getWikibaseConnector(
|
||||
LanguageFactory $languageFactory = null,
|
||||
LanguageNameUtils $languageNameUtils = null,
|
||||
FallbackLabelDescriptionLookupFactory $labelDescriptionLookupFactory = null,
|
||||
EntityRevisionLookup $entityRevisionLookupMock = null,
|
||||
LoggerInterface $logger = null,
|
||||
EntityIdParser $parser = null
|
||||
?LanguageFactory $languageFactory = null,
|
||||
?LanguageNameUtils $languageNameUtils = null,
|
||||
?FallbackLabelDescriptionLookupFactory $labelDescriptionLookupFactory = null,
|
||||
?EntityRevisionLookup $entityRevisionLookupMock = null,
|
||||
?LoggerInterface $logger = null,
|
||||
?EntityIdParser $parser = null
|
||||
): MathWikibaseConnector {
|
||||
$labelDescriptionLookupFactory = $labelDescriptionLookupFactory ?:
|
||||
$this->createMock( FallbackLabelDescriptionLookupFactory::class );
|
||||
|
|
|
@ -111,9 +111,9 @@ class PopupTest extends MathWikibaseConnectorTestFactory {
|
|||
}
|
||||
|
||||
private function getPopup(
|
||||
LanguageFactory $languageFactoryMock = null,
|
||||
LanguageNameUtils $languageNameUtilsMock = null,
|
||||
Item $item = null
|
||||
?LanguageFactory $languageFactoryMock = null,
|
||||
?LanguageNameUtils $languageNameUtilsMock = null,
|
||||
?Item $item = null
|
||||
): Popup {
|
||||
$languageFactoryMock = $languageFactoryMock ?: $this->createMock( LanguageFactory::class );
|
||||
if ( !$languageNameUtilsMock ) {
|
||||
|
|
|
@ -43,7 +43,7 @@ class RenderTest extends MediaWikiUnitTestCase {
|
|||
/**
|
||||
* @dataProvider provideTestCases
|
||||
*/
|
||||
public function testRendering( string $in, string $out = null ) {
|
||||
public function testRendering( string $in, ?string $out = null ) {
|
||||
$parser = new Parser();
|
||||
|
||||
$out ??= $in;
|
||||
|
|
Loading…
Reference in a new issue