From c2f3e7493e22ea5a4e20c83a60c20fb07fc37f3b Mon Sep 17 00:00:00 2001 From: Sebastian Meyer Date: Fri, 12 Jan 2024 07:18:09 +0100 Subject: [PATCH] Fix PHPStan false-positive --- src/Middleware/ListIdentifiers.php | 8 +++++--- src/Middleware/ListSets.php | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Middleware/ListIdentifiers.php b/src/Middleware/ListIdentifiers.php index 67845e0..818a582 100644 --- a/src/Middleware/ListIdentifiers.php +++ b/src/Middleware/ListIdentifiers.php @@ -121,7 +121,7 @@ class ListIdentifiers extends Middleware } $header = $document->createElement('header'); - if ($oaiRecord->getContent() === null) { + if (!$oaiRecord->hasContent()) { $header->setAttribute('status', 'deleted'); } $baseNode->appendChild($header); @@ -137,11 +137,13 @@ class ListIdentifiers extends Middleware $header->appendChild($setSpec); } - if ($verb === 'ListRecords' && $oaiRecord->getContent() !== null) { + if ($verb === 'ListRecords' && $oaiRecord->hasContent()) { $metadata = $document->createElement('metadata'); $baseNode->appendChild($metadata); - $data = $document->importData($oaiRecord->getContent()); + /** @var string */ + $content = $oaiRecord->getContent(); + $data = $document->importData($content); $metadata->appendChild($data); } } diff --git a/src/Middleware/ListSets.php b/src/Middleware/ListSets.php index b9fc022..c36348c 100644 --- a/src/Middleware/ListSets.php +++ b/src/Middleware/ListSets.php @@ -94,8 +94,10 @@ class ListSets extends Middleware $setDescription = $document->createElement('setDescription'); $set->appendChild($setDescription); - $description = $document->importData($oaiSet->getDescription()); - $setDescription->appendChild($description); + /** @var string */ + $description = $oaiSet->getDescription(); + $data = $document->importData($description); + $setDescription->appendChild($data); } }