Skip to content

Commit

Permalink
Merge branch 'master' into cache_expiration_time
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkarex authored Sep 25, 2024
2 parents 47d2cbc + 2a05361 commit 0e8c32e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

if (!class_exists('SimplePie'))
{
trigger_error('Autoloader not registered properly', E_USER_ERROR);
exit('Autoloader not registered properly');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.19 || ^3.8",
"mf2/mf2": "^0.5.0",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan": "~1.12.2",
"phpunit/phpunit": "^8 || ^9 || ^10",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Gzdecode.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class Gzdecode
*/
public function __set(string $name, $value)
{
trigger_error("Cannot write property $name", E_USER_ERROR);
throw new Exception("Cannot write property $name");
}

/**
Expand Down
9 changes: 3 additions & 6 deletions src/IRI.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ public function __unset(string $name)
/**
* Create a new IRI object, from a specified string
*
* @param string $iri
* @param string|null $iri
*/
public function __construct(string $iri = null)
public function __construct(?string $iri = null)
{
$this->set_iri($iri);
}
Expand Down Expand Up @@ -301,12 +301,9 @@ protected function parse_iri(string $iri)
if ($match[1] === '') {
$match['scheme'] = null;
}
if (!isset($match[3]) || $match[3] === '') {
if ($match[3] === '') {
$match['authority'] = null;
}
if (!isset($match[5])) {
$match['path'] = '';
}
if (!isset($match[6]) || $match[6] === '') {
$match['query'] = null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sanitize.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function set_registry(\SimplePie\Registry $registry)
* @param class-string<Cache> $cache_class
* @return void
*/
public function pass_cache_data(bool $enable_cache = true, string $cache_location = './cache', $cache_name_function = 'md5', string $cache_class = Cache::class, DataCache $cache = null)
public function pass_cache_data(bool $enable_cache = true, string $cache_location = './cache', $cache_name_function = 'md5', string $cache_class = Cache::class, ?DataCache $cache = null)
{
$this->enable_cache = $enable_cache;

Expand Down
5 changes: 2 additions & 3 deletions src/SimplePie.php
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,7 @@ class SimplePie
public function __construct()
{
if (version_compare(PHP_VERSION, '7.2', '<')) {
trigger_error('Please upgrade to PHP 7.2 or newer.');
die();
exit('Please upgrade to PHP 7.2 or newer.');
}

$this->set_useragent();
Expand Down Expand Up @@ -3298,7 +3297,7 @@ public function __call(string $method, array $args)
$trace = debug_backtrace();
$file = $trace[0]['file'];
$line = $trace[0]['line'];
trigger_error("Call to undefined method $class::$method() in $file on line $line", E_USER_ERROR);
throw new SimplePieException("Call to undefined method $class::$method() in $file on line $line");
}

/**
Expand Down

0 comments on commit 0e8c32e

Please sign in to comment.