fix: psalm update

This commit is contained in:
Michel Roux 2024-01-18 17:42:20 +01:00
parent 46cd766cac
commit b40f480975
5 changed files with 24 additions and 23 deletions

View File

@ -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": {

14
composer.lock generated
View File

@ -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",

View File

@ -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);
}
}

View File

@ -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('/<itunes:image\s+href="([^"]+)"/', $xmlString, $matches);
$image = $this->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(['<br>', '<br/>', '<br />'], "\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;
}

View File

@ -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,