Merge "SpecialBlock: Better handle null in getTargetUserTitle"

This commit is contained in:
jenkins-bot 2022-08-02 22:32:30 +00:00 committed by Gerrit Code Review
commit 16c60f3ee8

View file

@ -709,15 +709,18 @@ class SpecialBlock extends FormSpecialPage {
/**
* Get a user page target for things like logs.
* This handles account and IP range targets.
* @param UserIdentity|string $target
* @param UserIdentity|string|null $target
* @return PageReference|null
*/
protected static function getTargetUserTitle( $target ): ?PageReference {
if ( $target instanceof UserIdentity ) {
return PageReferenceValue::localReference( NS_USER, $target->getName() );
} elseif ( IPUtils::isIPAddress( $target ) ) {
}
if ( is_string( $target ) && IPUtils::isIPAddress( $target ) ) {
return PageReferenceValue::localReference( NS_USER, $target );
}
return null;
}