diff --git a/composer.json b/composer.json index 398e052..6dae99f 100644 --- a/composer.json +++ b/composer.json @@ -3,10 +3,10 @@ "description": "🔊 Browse, manage and listen to podcasts", "type": "project", "license": "AGPL-3.0-or-later", - "version": "1.3.0", + "version": "1.4.0", "require-dev": { "nextcloud/ocp": "^28.0.1", - "psalm/phar": "^5.19.1", + "psalm/phar": "^5.20.0", "nextcloud/coding-standard": "^1.1.1" }, "scripts": { diff --git a/composer.lock b/composer.lock index 97e124d..a653cf6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c2515a98c88eb682439f7c217ed1bb0e", + "content-hash": "1ab5db8d7848d8a3ea6bfcb7f909f0d7", "packages": [], "packages-dev": [ { @@ -146,16 +146,16 @@ }, { "name": "psalm/phar", - "version": "5.19.1", + "version": "5.20.0", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "c062e477cae7068a4cbcf3dba2a176687c5565a1" + "reference": "459eb19aa1cdf405d86d48d9529735facc82a6f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/c062e477cae7068a4cbcf3dba2a176687c5565a1", - "reference": "c062e477cae7068a4cbcf3dba2a176687c5565a1", + "url": "https://api.github.com/repos/psalm/phar/zipball/459eb19aa1cdf405d86d48d9529735facc82a6f4", + "reference": "459eb19aa1cdf405d86d48d9529735facc82a6f4", "shasum": "" }, "require": { @@ -175,9 +175,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/5.19.1" + "source": "https://github.com/psalm/phar/tree/5.20.0" }, - "time": "2024-01-17T11:52:12+00:00" + "time": "2024-01-18T12:24:24+00:00" }, { "name": "psr/clock", diff --git a/lib/Controller/OpmlController.php b/lib/Controller/OpmlController.php index a8afd38..80bd840 100644 --- a/lib/Controller/OpmlController.php +++ b/lib/Controller/OpmlController.php @@ -62,12 +62,12 @@ class OpmlController extends Controller $title = $podcast->getTitle(); $link = $podcast->getLink(); - if ($title) { + if (isset($title)) { $outline->addAttribute('text', $title); $outline->addAttribute('title', $title); } - if ($link) { + if (isset($link)) { $outline->addAttribute('htmlUrl', $link); } } diff --git a/lib/Core/EpisodeAction/EpisodeActionReader.php b/lib/Core/EpisodeAction/EpisodeActionReader.php index 755b8f1..9388a70 100644 --- a/lib/Core/EpisodeAction/EpisodeActionReader.php +++ b/lib/Core/EpisodeAction/EpisodeActionReader.php @@ -57,34 +57,34 @@ class EpisodeActionReader extends CoreEpisodeActionReader // Get episode image $image = $this->stringOrNull($item->image->url); - if (!$image && $iTunesItemChildren) { + if (!isset($image) && isset($iTunesItemChildren)) { $imageAttributes = $iTunesItemChildren->image->attributes(); - $image = $this->stringOrNull($imageAttributes ? (string) $imageAttributes->href : ''); + $image = $this->stringOrNull(isset($imageAttributes) ? (string) $imageAttributes->href : ''); } - if (!$image) { + if (!isset($image)) { $image = $this->stringOrNull($channel->image->url); } - if (!$image && $iTunesChannelChildren) { + if (!isset($image) && isset($iTunesChannelChildren)) { $imageAttributes = $iTunesChannelChildren->image->attributes(); - $image = $this->stringOrNull($imageAttributes ? (string) $imageAttributes->href : ''); + $image = $this->stringOrNull(isset($imageAttributes) ? (string) $imageAttributes->href : ''); } - if (!$image) { + if (!isset($image)) { preg_match('/stringOrNull($matches[1]); } // Get episode description $itemContent = $item->children('content', true); - if ($itemContent) { + if (isset($itemContent)) { $description = $this->stringOrNull($itemContent->encoded); } else { $description = $this->stringOrNull($item->description); } - if (!$description && $iTunesItemChildren) { + if (!isset($description) && isset($iTunesItemChildren)) { $description = $this->stringOrNull($iTunesItemChildren->summary); } @@ -92,7 +92,7 @@ class EpisodeActionReader extends CoreEpisodeActionReader $description = strip_tags(str_replace(['
', '
', '
'], "\n", $description ?? '')); // Get episode duration - if ($iTunesItemChildren) { + if (isset($iTunesItemChildren)) { $duration = $this->stringOrNull($iTunesItemChildren->duration); } else { $duration = $this->stringOrNull($item->duration); @@ -100,7 +100,7 @@ class EpisodeActionReader extends CoreEpisodeActionReader // Get episode pubDate $rawPubDate = $this->stringOrNull($item->pubDate); - $pubDate = $rawPubDate ? new \DateTime($rawPubDate) : null; + $pubDate = isset($rawPubDate) ? new \DateTime($rawPubDate) : null; $episodes[] = new EpisodeActionExtraData( $title, @@ -126,7 +126,8 @@ class EpisodeActionReader extends CoreEpisodeActionReader * @param null|\SimpleXMLElement|string $value */ private function stringOrNull($value): ?string { - if ($value) { + /** @psalm-suppress RiskyTruthyFalsyComparison */ + if (!empty($value)) { return (string) $value; } diff --git a/lib/Service/SearchProvider.php b/lib/Service/SearchProvider.php index 50760fc..9718aad 100644 --- a/lib/Service/SearchProvider.php +++ b/lib/Service/SearchProvider.php @@ -46,7 +46,7 @@ class SearchProvider implements IProvider $title = $podcast->getTitle(); $link = $podcast->getLink(); - if ($title && $link) { + if (isset($title, $link)) { $searchResults[] = new SearchResultEntry( $podcast->getImageUrl() ?? $this->urlGenerator->linkTo(Application::APP_ID, 'img/app.svg'), $title,