From 64060aefeb6b5b6c924699d72cf732fbec7b145e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=BB=C3=B3=C5=82tak?= Date: Thu, 26 Sep 2024 12:57:01 +0200 Subject: [PATCH] PHP 8.4 depraction fixes --- src/acdhOeaw/arche/oaipmh/data/HeaderData.php | 4 ++-- src/acdhOeaw/arche/oaipmh/data/MetadataFormat.php | 4 ++-- src/acdhOeaw/arche/oaipmh/data/RepositoryInfo.php | 2 +- src/acdhOeaw/arche/oaipmh/data/SetInfo.php | 11 +++++------ 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/acdhOeaw/arche/oaipmh/data/HeaderData.php b/src/acdhOeaw/arche/oaipmh/data/HeaderData.php index 554e303..65abc14 100644 --- a/src/acdhOeaw/arche/oaipmh/data/HeaderData.php +++ b/src/acdhOeaw/arche/oaipmh/data/HeaderData.php @@ -72,9 +72,9 @@ class HeaderData { * - date - an OAI-PMH record datestamp field * - deleted - if an object is deleted (presence of a field means deletion) * - sets - a list of OAI-PMH sets a record belongs to - * @param object $src data to copy from + * @param object|null $src data to copy from */ - public function __construct(object $src = null) { + public function __construct(?object $src = null) { if ($src === null) { return; } diff --git a/src/acdhOeaw/arche/oaipmh/data/MetadataFormat.php b/src/acdhOeaw/arche/oaipmh/data/MetadataFormat.php index 1fcca9a..cb9c813 100644 --- a/src/acdhOeaw/arche/oaipmh/data/MetadataFormat.php +++ b/src/acdhOeaw/arche/oaipmh/data/MetadataFormat.php @@ -123,8 +123,8 @@ class MetadataFormat extends \stdClass { * Creates a metadata format descriptor * @param object $fields values to set in the descriptor */ - public function __construct(object $fields = null) { - foreach ($fields as $k => $v) { + public function __construct(object $fields = []) { + foreach ((array) $fields as $k => $v) { $this->$k = is_array($this->$k ?? null) ? (array) $v : $v; } } diff --git a/src/acdhOeaw/arche/oaipmh/data/RepositoryInfo.php b/src/acdhOeaw/arche/oaipmh/data/RepositoryInfo.php index f981d7e..2e0ba54 100644 --- a/src/acdhOeaw/arche/oaipmh/data/RepositoryInfo.php +++ b/src/acdhOeaw/arche/oaipmh/data/RepositoryInfo.php @@ -80,7 +80,7 @@ class RepositoryInfo { * @param object $param property values */ public function __construct(object $param) { - foreach ($param as $k => $v) { + foreach ((array) $param as $k => $v) { if (isset($this->$k)) { $this->$k = $v; } diff --git a/src/acdhOeaw/arche/oaipmh/data/SetInfo.php b/src/acdhOeaw/arche/oaipmh/data/SetInfo.php index 1b71380..b17d372 100644 --- a/src/acdhOeaw/arche/oaipmh/data/SetInfo.php +++ b/src/acdhOeaw/arche/oaipmh/data/SetInfo.php @@ -40,31 +40,30 @@ class SetInfo { * Set spec - see the OAI-PMH documentation * @var string */ - public $spec; + public string $spec; /** * Set name - see the OAI-PMH documentation * @var string */ - public $name; + public string $name; /** * Set metadata to be put inside a * @var ?DOMElement */ - public $description; + public DOMElement | null $description; /** * Creates a set descriptor object by copying provided values. * @param string $spec setSpec value * @param string $name setName value - * @param DOMElement $description XML containing setDescription + * @param DOMElement|null $description XML containing setDescription */ public function __construct(string $spec, string $name, - DOMElement $description = null) { + ?DOMElement $description = null) { $this->spec = $spec; $this->name = $name; $this->description = $description; } - }