diff --git a/config/phpstan/phpstan.neon b/config/phpstan/phpstan.neon index 816ab4bf..cd07e7b6 100644 --- a/config/phpstan/phpstan.neon +++ b/config/phpstan/phpstan.neon @@ -10,8 +10,12 @@ parameters: # Ignore errors caused by no type hints on class properties, as that's not available till PHP 7.4 - '#Property .+? has no typehint specified.#' + + # Ignore errors caused by missing phpdoc strings for arrays + - '#Method .+? has parameter .+? with no value type specified in iterable type array.#' level: 7 paths: - %rootDir%/../../../lib - %rootDir%/../../../www + - %rootDir%/../../../scripts diff --git a/lib/Library.php b/lib/Library.php index 03087e07..a0ecff2f 100644 --- a/lib/Library.php +++ b/lib/Library.php @@ -1,5 +1,6 @@ registerXPathNamespace('dc', 'http://purl.org/dc/elements/1.1/'); $xml->registerXPathNamespace('schema', 'http://schema.org/'); - $feedEntry = $xml->xpath('/feed/entry[id="' . $this->Id . '"]/updated')[0]; + $feedEntry = ($xml->xpath('/feed/entry[id="' . $this->Id . '"]/updated') ?? [])[0]; $feedEntry[0] = $updatedTimestamp; - file_put_contents(WEB_ROOT . '/opds/index.xml', str_replace(" ns=", " xmlns=", $xml->asXml())); + file_put_contents(WEB_ROOT . '/opds/index.xml', str_replace(" ns=", " xmlns=", $xml->asXml() ?? '')); exec('se clean ' . WEB_ROOT . '/opds/index.xml'); } } diff --git a/scripts/generate-rss.php b/scripts/generate-rss.php index 69f3384a..da32efce 100644 --- a/scripts/generate-rss.php +++ b/scripts/generate-rss.php @@ -1,4 +1,10 @@