From e604abd49ab19245f20b56b293f8b5c64f03e281 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Thu, 21 Mar 2019 17:21:22 -0700 Subject: [PATCH] Fix PhanPluginDuplicateConditional* errors (#1) Change-Id: I61e4d4a60dda27f43debab71a9c02f14c1468311 --- .phan/config.php | 4 ---- includes/PHPVersionCheck.php | 1 + includes/libs/filebackend/FileBackend.php | 5 ++--- includes/specials/pagers/ProtectedPagesPager.php | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.phan/config.php b/.phan/config.php index 52d5d99442..e4ba47f265 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -104,10 +104,6 @@ $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [ // approximate error count: 1 "PhanParamTooManyInternal", // approximate error count: 2 - "PhanPluginDuplicateConditionalNullCoalescing", - // approximate error count: 1 - "PhanPluginDuplicateConditionalTernaryDuplication", - // approximate error count: 2 "PhanPluginDuplicateExpressionBinaryOp", // approximate error count: 2 "PhanTraitParentReference", diff --git a/includes/PHPVersionCheck.php b/includes/PHPVersionCheck.php index cbe63a33d4..01d5f9dac3 100644 --- a/includes/PHPVersionCheck.php +++ b/includes/PHPVersionCheck.php @@ -20,6 +20,7 @@ // phpcs:disable Generic.Arrays.DisallowLongArraySyntax,PSR2.Classes.PropertyDeclaration,MediaWiki.Usage.DirUsage // phpcs:disable Squiz.Scope.MemberVarScope.Missing,Squiz.Scope.MethodScope.Missing +// @phan-file-suppress PhanPluginDuplicateConditionalNullCoalescing /** * Check PHP Version, as well as for composer dependencies in entry points, * and display something vaguely comprehensible in the event of a totally diff --git a/includes/libs/filebackend/FileBackend.php b/includes/libs/filebackend/FileBackend.php index 19373eaef9..7bc3045c49 100644 --- a/includes/libs/filebackend/FileBackend.php +++ b/includes/libs/filebackend/FileBackend.php @@ -162,9 +162,8 @@ abstract class FileBackend implements LoggerAwareInterface { */ public function __construct( array $config ) { $this->name = $config['name']; - $this->domainId = isset( $config['domainId'] ) - ? $config['domainId'] // e.g. "my_wiki-en_" - : $config['wikiId']; // b/c alias + $this->domainId = $config['domainId'] // e.g. "my_wiki-en_" + ?? $config['wikiId']; // b/c alias if ( !preg_match( '!^[a-zA-Z0-9-_]{1,255}$!', $this->name ) ) { throw new InvalidArgumentException( "Backend name '{$this->name}' is invalid." ); } elseif ( !is_string( $this->domainId ) ) { diff --git a/includes/specials/pagers/ProtectedPagesPager.php b/includes/specials/pagers/ProtectedPagesPager.php index bc4202e2af..5583842497 100644 --- a/includes/specials/pagers/ProtectedPagesPager.php +++ b/includes/specials/pagers/ProtectedPagesPager.php @@ -49,7 +49,7 @@ class ProtectedPagesPager extends TablePager { LinkRenderer $linkRenderer ) { $this->mConds = $conds; - $this->type = ( $type ) ? $type : 'edit'; + $this->type = $type ?: 'edit'; $this->level = $level; $this->namespace = $namespace; $this->sizetype = $sizetype; -- 2.20.1