diff --git a/composer.json b/composer.json index a5e21f69..95f2610d 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "mediawiki/mediawiki-codesniffer": "28.0.0", "jakub-onderka/php-console-highlighter": "0.3.2", "mediawiki/minus-x": "0.3.2", - "mediawiki/mediawiki-phan-config": "0.8.0" + "mediawiki/mediawiki-phan-config": "0.9.0" }, "scripts": { "fix": [ diff --git a/src/ReplaceTextJob.php b/src/ReplaceTextJob.php index 9f4482c5..ef6f3b3a 100644 --- a/src/ReplaceTextJob.php +++ b/src/ReplaceTextJob.php @@ -32,7 +32,7 @@ class ReplaceTextJob extends Job { * @param Title $title * @param array|bool $params Cannot be === true */ - function __construct( $title, $params = '' ) { + function __construct( $title, $params = [] ) { parent::__construct( 'replaceText', $title, $params ); } diff --git a/src/ReplaceTextSearch.php b/src/ReplaceTextSearch.php index a729e4df..9c9acae5 100644 --- a/src/ReplaceTextSearch.php +++ b/src/ReplaceTextSearch.php @@ -26,8 +26,8 @@ class ReplaceTextSearch { /** * @param string $search * @param array $namespaces - * @param string $category - * @param string $prefix + * @param string|null $category + * @param string|null $prefix * @param bool $use_regex * @return IResultWrapper Resulting rows */ @@ -65,7 +65,7 @@ class ReplaceTextSearch { } /** - * @param string $category + * @param string|null $category * @param array &$tables * @param array &$conds */ @@ -79,7 +79,7 @@ class ReplaceTextSearch { } /** - * @param string $prefix + * @param string|null $prefix * @param array &$conds */ public static function prefixCondition( $prefix, &$conds ) { @@ -93,6 +93,7 @@ class ReplaceTextSearch { $prefix = $title->getDbKey(); } $any = $dbr->anyString(); + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable strval makes this non-null $conds[] = 'page_title ' . $dbr->buildLike( $prefix, $any ); } @@ -114,8 +115,8 @@ class ReplaceTextSearch { /** * @param string $str * @param array $namespaces - * @param string $category - * @param string $prefix + * @param string|null $category + * @param string|null $prefix * @param bool $use_regex * @return IResultWrapper Resulting rows */ diff --git a/src/SpecialReplaceText.php b/src/SpecialReplaceText.php index 8195f817..655bc95d 100644 --- a/src/SpecialReplaceText.php +++ b/src/SpecialReplaceText.php @@ -272,10 +272,10 @@ class SpecialReplaceText extends SpecialPage { foreach ( $request->getValues() as $key => $value ) { if ( $value == '1' && $key !== 'replace' && $key !== 'use_regex' ) { if ( strpos( $key, 'move-' ) !== false ) { - $title = Title::newFromID( substr( $key, 5 ) ); + $title = Title::newFromID( (int)substr( $key, 5 ) ); $replacement_params['move_page'] = true; } else { - $title = Title::newFromID( $key ); + $title = Title::newFromID( (int)$key ); } if ( $title !== null ) { $jobs[] = new ReplaceTextJob( $title, $replacement_params );