Merge "SpecialBlock: Better handle null in getTargetUserTitle"
This commit is contained in:
commit
16c60f3ee8
1 changed files with 5 additions and 2 deletions
|
|
@ -709,15 +709,18 @@ class SpecialBlock extends FormSpecialPage {
|
||||||
/**
|
/**
|
||||||
* Get a user page target for things like logs.
|
* Get a user page target for things like logs.
|
||||||
* This handles account and IP range targets.
|
* This handles account and IP range targets.
|
||||||
* @param UserIdentity|string $target
|
* @param UserIdentity|string|null $target
|
||||||
* @return PageReference|null
|
* @return PageReference|null
|
||||||
*/
|
*/
|
||||||
protected static function getTargetUserTitle( $target ): ?PageReference {
|
protected static function getTargetUserTitle( $target ): ?PageReference {
|
||||||
if ( $target instanceof UserIdentity ) {
|
if ( $target instanceof UserIdentity ) {
|
||||||
return PageReferenceValue::localReference( NS_USER, $target->getName() );
|
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 PageReferenceValue::localReference( NS_USER, $target );
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue