Use strict comparison with array_search

Change-Id: Id920d49701bd9436a6247763ed40df052877ad2f
This commit is contained in:
Ed Sanders 2023-07-24 18:50:00 +01:00
parent 9482ec0841
commit 1bb29faa58
2 changed files with 8 additions and 5 deletions

View file

@ -330,7 +330,7 @@ class CommentParser {
return preg_replace_callback(
'/[' . implode( '', $digits ) . ']/u',
static function ( array $m ) use ( $digits ) {
return (string)array_search( $m[0], $digits );
return (string)array_search( $m[0], $digits, true );
},
$text
);
@ -409,7 +409,8 @@ class CommentParser {
case 'xg':
$monthIdx = array_search(
$text,
$this->getMessages( $contLangVariant, Language::MONTH_GENITIVE_MESSAGES )
$this->getMessages( $contLangVariant, Language::MONTH_GENITIVE_MESSAGES ),
true
);
break;
case 'd':
@ -423,13 +424,15 @@ class CommentParser {
case 'F':
$monthIdx = array_search(
$text,
$this->getMessages( $contLangVariant, Language::MONTH_MESSAGES )
$this->getMessages( $contLangVariant, Language::MONTH_MESSAGES ),
true
);
break;
case 'M':
$monthIdx = array_search(
$text,
$this->getMessages( $contLangVariant, Language::MONTH_ABBREVIATED_MESSAGES )
$this->getMessages( $contLangVariant, Language::MONTH_ABBREVIATED_MESSAGES ),
true
);
break;
case 'm':

View file

@ -188,7 +188,7 @@ class HookUtils {
$extensionRegistry = ExtensionRegistry::getInstance();
if ( $extensionRegistry->isLoaded( 'Gadgets' ) ) {
$gadgetsRepo = GadgetRepo::singleton();
$match = array_search( $gadgetName, $gadgetsRepo->getGadgetIds() );
$match = array_search( $gadgetName, $gadgetsRepo->getGadgetIds(), true );
if ( $match !== false ) {
try {
return $gadgetsRepo->getGadget( $gadgetName )