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
This commit is contained in:
Fomafix 2022-11-10 21:02:32 +00:00
parent 81e3276a0e
commit 0203c16002
2 changed files with 33 additions and 6 deletions

View file

@ -1,9 +1,6 @@
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
</rule>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
<file>.</file>
<arg name="extensions" value="php" />
<arg name="encoding" value="UTF-8" />

View file

@ -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' );
}