TitleBlacklistPreAuthenticationProvider: Add null assert

$req can legitimately be null, so we need to add
null to the assert as well, so the code doesn't
stop immediately.

This is a follow-up for I83f9374b2f3236097860f4aecc694326b891905b

Change-Id: I85dbc1b4c1452d0671879e6cc02c5411090b1d1d
This commit is contained in:
Rafid Aslam 2018-01-03 09:37:07 +07:00
parent 56f94c4d71
commit 63ae71c8f9

View file

@ -34,9 +34,13 @@ class TitleBlacklistPreAuthenticationProvider extends AbstractPreAuthenticationP
$req = AuthenticationRequest::getRequestByClass( $reqs,
TitleBlacklistAuthenticationRequest::class );
// For phan check, to ensure that $req is instance of \TitleBlacklistAuthenticationRequest
assert( $req instanceof TitleBlacklistAuthenticationRequest );
// or null
if ( $req instanceof TitleBlacklistAuthenticationRequest ) {
$override = $req->ignoreTitleBlacklist;
} else {
$override = false;
}
$override = $req && $req->ignoreTitleBlacklist;
return TitleBlacklistHooks::testUserName( $user->getName(), $creator, $override, true );
}