mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RSS
synced 2024-11-27 17:10:25 +00:00
Replace isset() with null check
isset() should only be used to suppress errors, not for null check. When the variable 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: I4d3ebaf7fd3fc9613decd74fd36cc98582519a7c
This commit is contained in:
parent
5404ab51f8
commit
3f09c46cee
|
@ -30,9 +30,9 @@ class RSSParser {
|
||||||
protected $filter = [];
|
protected $filter = [];
|
||||||
/** @var string[] */
|
/** @var string[] */
|
||||||
protected $filterOut = [];
|
protected $filterOut = [];
|
||||||
/** @var string */
|
/** @var string|null */
|
||||||
protected $itemTemplate;
|
protected $itemTemplate;
|
||||||
/** @var string */
|
/** @var string|null */
|
||||||
protected $url;
|
protected $url;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $etag;
|
protected $etag;
|
||||||
|
@ -58,7 +58,7 @@ class RSSParser {
|
||||||
private $parserFactory;
|
private $parserFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var RSSData
|
* @var RSSData|null
|
||||||
*/
|
*/
|
||||||
public $rss;
|
public $rss;
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ class RSSParser {
|
||||||
* @return Status object
|
* @return Status object
|
||||||
*/
|
*/
|
||||||
public function fetch() {
|
public function fetch() {
|
||||||
if ( !isset( $this->url ) ) {
|
if ( $this->url === null ) {
|
||||||
return Status::newFatal( 'rss-fetch-nourl' );
|
return Status::newFatal( 'rss-fetch-nourl' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ class RSSParser {
|
||||||
protected function storeInCache( $key ) {
|
protected function storeInCache( $key ) {
|
||||||
global $wgRSSCacheAge;
|
global $wgRSSCacheAge;
|
||||||
|
|
||||||
if ( !isset( $this->rss ) ) {
|
if ( $this->rss === null ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ class RSSParser {
|
||||||
$renderedFeed = '';
|
$renderedFeed = '';
|
||||||
$wikitextFeed = '';
|
$wikitextFeed = '';
|
||||||
|
|
||||||
if ( isset( $this->itemTemplate ) && isset( $parser ) && isset( $frame ) ) {
|
if ( $this->itemTemplate !== null && $parser && $frame ) {
|
||||||
$headcnt = 0;
|
$headcnt = 0;
|
||||||
if ( $this->reversed ) {
|
if ( $this->reversed ) {
|
||||||
$this->rss->items = array_reverse( $this->rss->items );
|
$this->rss->items = array_reverse( $this->rss->items );
|
||||||
|
@ -427,7 +427,7 @@ class RSSParser {
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
protected function renderItem( $item, $parser ) {
|
protected function renderItem( $item, $parser ) {
|
||||||
$renderedItem = $this->itemTemplate;
|
$renderedItem = $this->itemTemplate ?? '';
|
||||||
|
|
||||||
// $info will only be an XML element name, so we're safe using it.
|
// $info will only be an XML element name, so we're safe using it.
|
||||||
// $item[$info] is handled by the XML parser --
|
// $item[$info] is handled by the XML parser --
|
||||||
|
|
Loading…
Reference in a new issue