diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2024-12-19 17:33:11 +0100 |
---|---|---|
committer | Umherirrender <umherirrender_de.wp@web.de> | 2024-12-19 18:15:53 +0000 |
commit | b9e38a957fdafbf9ab233e14605b44b4833b32dd (patch) | |
tree | 5ccf59f606f4a0d62212281be3214323868c2ecc /includes/api | |
parent | 1471c51a0076854148fde8e4dcb37ff8feefecc7 (diff) | |
download | mediawikicore-b9e38a957fdafbf9ab233e14605b44b4833b32dd.tar.gz mediawikicore-b9e38a957fdafbf9ab233e14605b44b4833b32dd.zip |
Replace isset() with falsy checks
isset() should only be used to suppress errors, not for null check.
When the property is always defined, there is no need to use isset.
Found by a new phan plugin (2efea9f989)
https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#isset
Change-Id: I186e799256fbaf5ee77558bd146f9418dd5eaacc
Diffstat (limited to 'includes/api')
-rw-r--r-- | includes/api/ApiBase.php | 2 | ||||
-rw-r--r-- | includes/api/ApiMain.php | 2 | ||||
-rw-r--r-- | includes/api/ApiUpload.php | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index c68dbba708b3..6ef7f8741bbe 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -732,7 +732,7 @@ abstract class ApiBase extends ContextSource { * @return IReadableDatabase */ protected function getDB() { - if ( !isset( $this->mReplicaDB ) ) { + if ( !$this->mReplicaDB ) { $this->mReplicaDB = MediaWikiServices::getInstance() ->getConnectionProvider() ->getReplicaDatabase( false, 'api' ); diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index d2c3ea5df6f2..8956e86ee018 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -1336,7 +1336,7 @@ class ApiMain extends ApiBase { * Create the printer for error output */ private function createErrorPrinter() { - if ( !isset( $this->mPrinter ) ) { + if ( !$this->mPrinter ) { $value = $this->getRequest()->getVal( 'format', self::API_DEFAULT_FORMAT ); if ( !$this->mModuleMgr->isDefined( $value, 'format' ) ) { $value = self::API_DEFAULT_FORMAT; diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 0a79fd855dd5..4576d5afbaaa 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -68,7 +68,7 @@ class ApiUpload extends ApiBase { use ApiWatchlistTrait; - /** @var UploadBase|UploadFromChunks */ + /** @var UploadBase|UploadFromChunks|null */ protected $mUpload = null; /** @var array */ @@ -124,7 +124,7 @@ class ApiUpload extends ApiBase { try { if ( !$this->selectUploadModule() ) { return; // not a true upload, but a status request or similar - } elseif ( !isset( $this->mUpload ) ) { + } elseif ( !$this->mUpload ) { $this->dieDebug( __METHOD__, 'No upload module set' ); } } catch ( UploadStashException $e ) { // XXX: don't spam exception log |