Skip to content

Commit

Permalink
Feed: Fix strict types by PhpStan
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek committed Dec 13, 2020
1 parent fc06f85 commit fdec9d2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public function load(string $url): array
foreach ($rss->getElementsByTagName('item') as $node) {
/** @var \DOMElement $node */

$description = $this->hydrateDescription($this->hydrateValueToString($node, 'description'));
$description = $this->hydrateDescription((string) $this->hydrateValueToString($node, 'description'));
$feed[] = (new Post(
strip_tags($this->hydrateValueToString($node, 'title')),
strip_tags((string) $this->hydrateValueToString($node, 'title')),
(string) $description['description'],
$this->hydrateValueToString($node, 'link'),
(string) $this->hydrateValueToString($node, 'link'),
$this->hydrateValueToDateTime($node, 'pubDate')
))
->setImageStorage($this->imageStorage)
Expand Down Expand Up @@ -103,7 +103,7 @@ private function hydrateDescription(string $description): array
}

return [
'description' => html_entity_decode(preg_replace('/^<p>(.+?)<\/p>.*/', '$1', str_replace("\n", ' ', trim($description)))),
'description' => html_entity_decode((string) preg_replace('/^<p>(.+?)<\/p>.*/', '$1', str_replace("\n", ' ', trim($description)))),
'mainImageUrl' => $mainImageUrl,
];
}
Expand Down

0 comments on commit fdec9d2

Please sign in to comment.