Add support for PHP 8.0 and PHP 8.1 (#93)

This commit is contained in:
CosmicAlpha 2023-01-13 14:08:52 -07:00 committed by GitHub
parent aead92451c
commit e5ca418763
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 6 deletions

View file

@ -62,6 +62,13 @@ jobs:
experimental: true
stage: phpunit
# Latest MediaWiki master - PHP 8.1 (phpunit)
- mw: 'master'
php: 8.1
php-docker: 81
experimental: false
stage: phpunit
# Latest stable MediaWiki - PHP 7.4 (selenium)
- mw: 'REL1_39'
php: 7.4

View file

@ -156,7 +156,7 @@ class PortableInfoboxParserTagController {
// (see: PortableInfoboxDataService.class.php)
$infoboxes = json_decode(
self::parserOutputGetPageProperty( $parserOutput, PortableInfoboxDataService::INFOBOXES_PROPERTY_NAME ),
self::parserOutputGetPageProperty( $parserOutput, PortableInfoboxDataService::INFOBOXES_PROPERTY_NAME ) ?? '',
true
);

View file

@ -65,13 +65,13 @@ class FileNamespaceSanitizeHelper {
}
/**
* @param string $filename
* @param string|null $filename
* @param Language $contLang
*
* @return mixed
*/
public function sanitizeImageFileName( $filename, $contLang ) {
$plainText = $this->convertToPlainText( $filename );
$plainText = $this->convertToPlainText( $filename ?? '' );
$filePrefixRegex = $this->getFilePrefixRegex( $contLang );
$textLines = explode( PHP_EOL, $plainText );
@ -87,7 +87,7 @@ class FileNamespaceSanitizeHelper {
}
/**
* @param $filename
* @param string $filename
*
* @return string
*/

View file

@ -48,7 +48,7 @@ class MediaWikiParserService implements ExternalParser {
return $this->cache[$wikitext];
}
$parsed = $this->parser->recursiveTagParse( $wikitext, $this->frame );
$parsed = $this->parser->recursiveTagParse( $wikitext ?? '', $this->frame );
if ( in_array( substr( $parsed, 0, 1 ), [ '*', '#' ] ) ) {
// fix for first item list elements
$parsed = "\n" . $parsed;

View file

@ -28,7 +28,7 @@ class NodeMedia extends Node {
public static function getMarkers( $value, $ext ) {
$regex = '/' . Parser::MARKER_PREFIX . "-$ext-[A-F0-9]{8}" . Parser::MARKER_SUFFIX . '/i';
if ( preg_match_all( $regex, $value, $out ) ) {
if ( preg_match_all( $regex, $value ?? '', $out ) ) {
return $out[0];
} else {
return [];