Skip to content

Commit 6853ca9

Browse files
author
naima
committed
podcast index feed: avoid temporary variables
Signed-off-by: naima <naima.blum@podcast.de>
1 parent 52c7453 commit 6853ca9

File tree

1 file changed

+25
-37
lines changed
  • src/Reader/Extension/PodcastIndex

1 file changed

+25
-37
lines changed

src/Reader/Extension/PodcastIndex/Feed.php

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,8 @@ public function getFunding(): ?stdClass
111111
public function getPodcastIndexFunding(): ?stdClass
112112
{
113113
if (array_key_exists('funding', $this->data)) {
114-
/** @var stdClass $object */
115-
$object = $this->data['funding'];
116-
return $object;
114+
/** @psalm-var stdClass */
115+
return $this->data['funding'];
117116
}
118117

119118
$funding = null;
@@ -141,9 +140,8 @@ public function getPodcastIndexFunding(): ?stdClass
141140
public function getPodcastIndexLicense(): object|null
142141
{
143142
if (array_key_exists('license', $this->data)) {
144-
/** @var null|object{identifier: string, url: string} $object */
145-
$object = $this->data['license'];
146-
return $object;
143+
/** @psalm-var null|object{identifier: string, url: string} */
144+
return $this->data['license'];
147145
}
148146

149147
$license = null;
@@ -171,9 +169,8 @@ public function getPodcastIndexLicense(): object|null
171169
public function getPodcastIndexLocation(): object|null
172170
{
173171
if (array_key_exists('location', $this->data)) {
174-
/** @var null|object{description: string, geo?: string, osm?: string} $object */
175-
$object = $this->data['location'];
176-
return $object;
172+
/** @psalm-var null|object{description: string, geo?: string, osm?: string} */
173+
return $this->data['location'];
177174
}
178175

179176
$location = null;
@@ -202,9 +199,8 @@ public function getPodcastIndexLocation(): object|null
202199
public function getPodcastIndexImages(): object|null
203200
{
204201
if (array_key_exists('images', $this->data)) {
205-
/** @var null|object{srcset: string} $object */
206-
$object = $this->data['images'];
207-
return $object;
202+
/** @psalm-var null|object{srcset: string} */
203+
return $this->data['images'];
208204
}
209205

210206
$images = null;
@@ -231,9 +227,8 @@ public function getPodcastIndexImages(): object|null
231227
public function getPodcastIndexUpdateFrequency(): object|null
232228
{
233229
if (array_key_exists('updateFrequency', $this->data)) {
234-
/** @var null|UpdateFrequencyObject $object */
235-
$object = $this->data['updateFrequency'];
236-
return $object;
230+
/** @psalm-var null|UpdateFrequencyObject */
231+
return $this->data['updateFrequency'];
237232
}
238233

239234
$updateFrequency = null;
@@ -263,9 +258,8 @@ public function getPodcastIndexUpdateFrequency(): object|null
263258
public function getPodcastIndexPeople(): array
264259
{
265260
if (array_key_exists('people', $this->data)) {
266-
/** @var list<PersonObject> $people */
267-
$people = $this->data['people'];
268-
return $people;
261+
/** @psalm-var list<PersonObject> */
262+
return $this->data['people'];
269263
}
270264

271265
$nodeList = $this->xpath->query($this->getXpathPrefix() . '/podcast:person');
@@ -299,9 +293,8 @@ public function getPodcastIndexPeople(): array
299293
public function getPodcastIndexTrailer(): object|null
300294
{
301295
if (array_key_exists('trailer', $this->data)) {
302-
/** @var null|TrailerObject $object */
303-
$object = $this->data['trailer'];
304-
return $object;
296+
/** @psalm-var null|TrailerObject */
297+
return $this->data['trailer'];
305298
}
306299

307300
$object = null;
@@ -333,9 +326,8 @@ public function getPodcastIndexTrailer(): object|null
333326
public function getPodcastIndexGuid(): object|null
334327
{
335328
if (array_key_exists('guid', $this->data)) {
336-
/** @var null|object{value: string} $object */
337-
$object = $this->data['guid'];
338-
return $object;
329+
/** @psalm-var null|object{value: string} */
330+
return $this->data['guid'];
339331
}
340332

341333
$object = null;
@@ -362,9 +354,8 @@ public function getPodcastIndexGuid(): object|null
362354
public function getPodcastIndexMedium(): object|null
363355
{
364356
if (array_key_exists('medium', $this->data)) {
365-
/** @var null|object{value: string} $object */
366-
$object = $this->data['medium'];
367-
return $object;
357+
/** @psalm-var null|object{value: string} */
358+
return $this->data['medium'];
368359
}
369360

370361
$object = null;
@@ -391,9 +382,8 @@ public function getPodcastIndexMedium(): object|null
391382
public function getPodcastIndexBlocks(): array
392383
{
393384
if (array_key_exists('blocks', $this->data)) {
394-
/** @var list<object{value: string, id?: string}> $blocks */
395-
$blocks = $this->data['blocks'];
396-
return $blocks;
385+
/** @psalm-var list<object{value: string, id?: string}> */
386+
return $this->data['blocks'];
397387
}
398388

399389
$blocks = [];
@@ -422,9 +412,8 @@ public function getPodcastIndexBlocks(): array
422412
public function getPodcastIndexTxts(): array
423413
{
424414
if (array_key_exists('txts', $this->data)) {
425-
/** @var list<object{value: string, purpose?: string}> $txts */
426-
$txts = $this->data['txts'];
427-
return $txts;
415+
/** @psalm-var list<object{value: string, purpose?: string}> */
416+
return $this->data['txts'];
428417
}
429418

430419
$txts = [];
@@ -453,9 +442,8 @@ public function getPodcastIndexTxts(): array
453442
public function getPodcastIndexPodping(): object|null
454443
{
455444
if (array_key_exists('podping', $this->data)) {
456-
/** @var null|object{usesPodping: bool} $object */
457-
$object = $this->data['podping'];
458-
return $object;
445+
/** @psalm-var null|object{usesPodping: bool} */
446+
return $this->data['podping'];
459447
}
460448

461449
$object = null;
@@ -468,7 +456,7 @@ public function getPodcastIndexPodping(): object|null
468456

469457
$object = new stdClass();
470458

471-
$object->usesPodping = ($item->getAttribute('usesPodping') === 'true');
459+
$object->usesPodping = $item->getAttribute('usesPodping') === 'true';
472460
}
473461

474462
$this->data['podping'] = $object;

0 commit comments

Comments
 (0)