Skip to content

Commit

Permalink
Replace deprecated is_a() with instanceof
Browse files Browse the repository at this point in the history
Function `is_a()` became deprecated with PHP 5.0.0 resulting in an `E_STRICT`
warning. Function is no longer deprecated with PHP 5.3.0, however, using any
version between 5.0.0 and 5.2.x and `E_DEPRECATED` enabled, `Strict standards`
notice is shown. This fix refactors all `is_a()` occurrences using `instanceof`
operator. For example,

  `if (is_a($this, 'SimplePie'))`

becomes

  `if ($this instanceof SimplePie)`
  • Loading branch information
davidkuridza committed Jan 11, 2012
1 parent 5b2081b commit b56b7dd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion SimplePie/Cache/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function save($data)
{
if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
{
if (is_a($data, 'SimplePie'))
if ($data instanceof SimplePie)
{
$data = $data->data;
}
Expand Down
2 changes: 1 addition & 1 deletion SimplePie/Cache/Memcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct($url, $filename, $extension)

public function save($data)
{
if (is_a($data, 'SimplePie'))
if ($data instanceof SimplePie)
{
$data = $data->data;
}
Expand Down
2 changes: 1 addition & 1 deletion SimplePie/Cache/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function save($data)
return false;
}

if (is_a($data, 'SimplePie'))
if ($data instanceof SimplePie)
{
$data = clone $data;

Expand Down
6 changes: 3 additions & 3 deletions SimplePie/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ public function set_feed_url($url)
*/
public function set_file(&$file)
{
if (is_a($file, 'SimplePie_File'))
if ($file instanceof SimplePie_File)
{
$this->feed_url = $file->url;
$this->file =& $file;
Expand Down Expand Up @@ -1558,7 +1558,7 @@ public function init()
// If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it.
if (!isset($file))
{
if (is_a($this->file, 'SimplePie_File') && $this->file->url === $this->feed_url)
if ($this->file instanceof SimplePie_File && $this->file->url === $this->feed_url)
{
$file =& $this->file;
}
Expand Down Expand Up @@ -2795,7 +2795,7 @@ public function merge_items($urls, $start = 0, $end = 0, $limit = 0)
$items = array();
foreach ($urls as $arg)
{
if (is_a($arg, 'SimplePie'))
if ($arg instanceof SimplePie)
{
$items = array_merge($items, $arg->get_items(0, $limit));
}
Expand Down

0 comments on commit b56b7dd

Please sign in to comment.