From 0203c160023c720cb292623e8dc531f3da8ed551 Mon Sep 17 00:00:00 2001 From: Fomafix Date: Thu, 10 Nov 2022 21:02:32 +0000 Subject: [PATCH] Remove phpcs exclude rules and update PHP code Add a @phan-suppress-next-line PhanSuspiciousValueComparison because of a false positive finding: includes/InputBox.php:471 PhanSuspiciousValueComparison Suspicious attempt to compare $this->mType of type 'comment' to 'comment' of type 'comment' with operator '===' Change-Id: Id14028d22c1d352a0886a7da0d94b0329a5418df --- .phpcs.xml | 5 +---- includes/InputBox.php | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index 0877ca39..eddb6dc8 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -1,9 +1,6 @@ - - - - + . diff --git a/includes/InputBox.php b/includes/InputBox.php index 84623bd2..66b826ea 100644 --- a/includes/InputBox.php +++ b/includes/InputBox.php @@ -24,32 +24,59 @@ class InputBox { /** @var Parser */ private $mParser; + /** @var string */ private $mType = ''; + /** @var int */ private $mWidth = 50; + /** @var string|null */ private $mPreload = null; + /** @var array|null */ private $mPreloadparams = null; + /** @var string|null */ private $mEditIntro = null; + /** @var string|null */ private $mUseVE = null; + /** @var string|null */ private $mSummary = null; + /** @var string|null */ private $mNosummary = null; + /** @var string|null */ private $mMinor = null; + /** @var string */ private $mPage = ''; + /** @var string */ private $mBR = 'yes'; + /** @var string */ private $mDefaultText = ''; + /** @var string */ private $mPlaceholderText = ''; + /** @var string */ private $mBGColor = 'transparent'; + /** @var string */ private $mButtonLabel = ''; + /** @var string */ private $mSearchButtonLabel = ''; + /** @var string */ private $mFullTextButton = ''; + /** @var string */ private $mLabelText = ''; + /** @var string|false */ private $mHidden = ''; + /** @var string */ private $mNamespaces = ''; + /** @var string */ private $mID = ''; + /** @var string|false */ private $mInline = false; + /** @var string */ private $mPrefix = ''; + /** @var string */ private $mDir = ''; + /** @var string */ private $mSearchFilter = ''; + /** @var string */ private $mTour = ''; + /** @var string */ private $mTextBoxAriaLabel = ''; /* Functions */ @@ -205,7 +232,8 @@ class InputBox { $checkedNS = []; // Check for valid namespaces foreach ( $namespacesArray as $userNS ) { - $userNS = trim( $userNS ); // no whitespace + // no whitespace + $userNS = trim( $userNS ); // Namespace needs to be checked if flagged with "**" if ( strpos( $userNS, '**' ) ) { @@ -221,7 +249,8 @@ class InputBox { } elseif ( isset( $nsAliases[$userNS] ) ) { $i = $nsAliases[$userNS]; } else { - continue; // Namespace not recognized, skip + // Namespace not recognized, skip + continue; } $showNamespaces[$i] = $userNS; if ( isset( $checkedNS[$userNS] ) && $checkedNS[$userNS] ) { @@ -439,6 +468,7 @@ class InputBox { if ( $this->mMinor !== null ) { $htmlOut .= Html::hidden( 'minor', $this->mMinor ); } + // @phan-suppress-next-line PhanSuspiciousValueComparison False positive if ( $this->mType === 'comment' ) { $htmlOut .= Html::hidden( 'section', 'new' ); }