mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 13:46:48 +00:00
Simplify code by replacing isset() with falsy check
Conditional set of variable is not easy to read. Instead set the variable to null before try/catch Reported by a new phan plugin (2efea9f989) This bypass a false positive from phan (T378271) Change-Id: I037efe8465747b8c915405f38546fc1ea4405a03
This commit is contained in:
parent
63de22357d
commit
6252afcac7
|
@ -74,16 +74,17 @@ class AbuseFilterViewHistory extends AbuseFilterView {
|
|||
$canViewProtectedVars = $this->afPermManager->canViewProtectedVariables( $this->getAuthority() );
|
||||
|
||||
if ( $filter ) {
|
||||
$filterObj = null;
|
||||
try {
|
||||
$filterObj = $this->filterLookup->getFilter( $filter, false );
|
||||
} catch ( FilterNotFoundException $_ ) {
|
||||
$filter = null;
|
||||
}
|
||||
if ( isset( $filterObj ) && $filterObj->isHidden() && !$canViewPrivate ) {
|
||||
if ( $filterObj && $filterObj->isHidden() && !$canViewPrivate ) {
|
||||
$out->addWikiMsg( 'abusefilter-history-error-hidden' );
|
||||
return;
|
||||
}
|
||||
if ( isset( $filterObj ) && $filterObj->isProtected() && !$canViewProtectedVars ) {
|
||||
if ( $filterObj && $filterObj->isProtected() && !$canViewProtectedVars ) {
|
||||
$out->addWikiMsg( 'abusefilter-history-error-protected' );
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue