diff --git a/classes/file/PublicFileManager.php b/classes/file/PublicFileManager.php index f000880e04..ae23890535 100644 --- a/classes/file/PublicFileManager.php +++ b/classes/file/PublicFileManager.php @@ -24,7 +24,7 @@ class PublicFileManager extends PKPPublicFileManager /** * @copydoc PKPPublicFileManager::getContextFilesPath() */ - public function getContextFilesPath($contextId) + public function getContextFilesPath(int $contextId) { return Config::getVar('files', 'public_files_dir') . '/contexts/' . (int) $contextId; } diff --git a/classes/oai/ops/OAIDAO.php b/classes/oai/ops/OAIDAO.php index bfbbd4549d..ef02d74ddf 100644 --- a/classes/oai/ops/OAIDAO.php +++ b/classes/oai/ops/OAIDAO.php @@ -58,16 +58,11 @@ public function __construct() /** * Cached function to get a server * - * @param int $serverId - * * @return object */ - public function &getServer($serverId) + public function getServer(int $serverId) { - if (!isset($this->serverCache[$serverId])) { - $this->serverCache[$serverId] = $this->serverDao->getById($serverId); - } - return $this->serverCache[$serverId]; + return $this->serverCache[$serverId] ??= $this->serverDao->getById($serverId); } /** @@ -92,14 +87,14 @@ public function &getSection($sectionId) /** * Return hierarchy of OAI sets (servers plus server sections). * - * @param int $serverId * @param int $offset * @param int $total * * @return array OAISet + * * @hook OAIDAO::getServerSets [[$this, $serverId, $offset, $limit, $total, &$sets]] */ - public function &getServerSets($serverId, $offset, $limit, &$total) + public function &getServerSets(int $serverId, $offset, $limit, &$total) { if (isset($serverId)) { $servers = [$this->serverDao->getById($serverId)]; diff --git a/classes/oai/ops/ServerOAI.php b/classes/oai/ops/ServerOAI.php index 3a2e4690f3..4f2434d7a9 100644 --- a/classes/oai/ops/ServerOAI.php +++ b/classes/oai/ops/ServerOAI.php @@ -38,8 +38,7 @@ class ServerOAI extends OAI /** @var Server associated server object */ public $server; - /** @var int|null Server ID; null if no server */ - public $serverId; + public ?int $serverId; /** @var OAIDAO DAO for retrieving OAI records/tokens from database */ public $dao; @@ -182,6 +181,7 @@ public function record($identifier) /** * @copydoc OAI::records() + * * @hook ServerOAI::records [[$this, $from, $until, $set, $offset, $limit, &$total, &$records]] */ public function records($metadataPrefix, $from, $until, $set, $offset, $limit, &$total) @@ -201,6 +201,7 @@ public function records($metadataPrefix, $from, $until, $set, $offset, $limit, & /** * @copydoc OAI::identifiers() + * * @hook ServerOAI::identifiers [[$this, $from, $until, $set, $offset, $limit, &$total, &$records]] */ public function identifiers($metadataPrefix, $from, $until, $set, $offset, $limit, &$total) @@ -220,6 +221,7 @@ public function identifiers($metadataPrefix, $from, $until, $set, $offset, $limi /** * @copydoc OAI::sets() + * * @hook ServerOAI::sets [[$this, $offset, $limit, &$total, &$sets]] */ public function sets($offset, $limit, &$total) diff --git a/classes/publication/Publication.php b/classes/publication/Publication.php index 353f98ba12..342fcc6a77 100644 --- a/classes/publication/Publication.php +++ b/classes/publication/Publication.php @@ -30,11 +30,9 @@ class Publication extends PKPPublication /** * Get the URL to a localized cover image * - * @param int $contextId - * * @return string */ - public function getLocalizedCoverImageUrl($contextId) + public function getLocalizedCoverImageUrl(int $contextId) { $coverImage = $this->getLocalizedData('coverImage'); diff --git a/classes/section/Section.php b/classes/section/Section.php index f6892181b3..ca149d8e73 100644 --- a/classes/section/Section.php +++ b/classes/section/Section.php @@ -36,7 +36,7 @@ public function getAbbrev(?string $locale): string|array|null return $this->getData('abbrev', $locale); } - public function setAbbrev(string|array $abbrev, string $locale = null): void + public function setAbbrev(string|array $abbrev, ?string $locale = null): void { $this->setData('abbrev', $abbrev, $locale); } @@ -51,7 +51,7 @@ public function getPolicy(?string $locale): string|array|null return $this->getData('policy', $locale); } - public function setPolicy(string|array $policy, string $locale = null): void + public function setPolicy(string|array $policy, ?string $locale = null): void { $this->setData('policy', $policy, $locale); } @@ -186,7 +186,7 @@ public function getIdentifyType(?string $locale): string|array|null /** * Set string identifying type of items in this section. */ - public function setIdentifyType(string|array $identifyType, string $locale = null): void + public function setIdentifyType(string|array $identifyType, ?string $locale = null): void { $this->setData('identifyType', $identifyType, $locale); } @@ -230,7 +230,7 @@ public function getDescription(?string $locale): string|array|null /** * Set series description. */ - public function setDescription(string|array $description, string $locale = null): void + public function setDescription(string|array $description, ?string $locale = null): void { $this->setData('description', $description, $locale); } diff --git a/classes/server/ServerDAO.php b/classes/server/ServerDAO.php index 33ca32ac14..1d93d6d2f1 100644 --- a/classes/server/ServerDAO.php +++ b/classes/server/ServerDAO.php @@ -77,12 +77,11 @@ public function getTitles($enabledOnly = false) /** * Delete the public IDs of all publishing objects in a server. * - * @param int $serverId * @param string $pubIdType One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see ). */ - public function deleteAllPubIds($serverId, $pubIdType) + public function deleteAllPubIds(int $serverId, $pubIdType) { Repo::galley()->dao->deleteAllPubIds($serverId, $pubIdType); Repo::submissionFile()->dao->deleteAllPubIds($serverId, $pubIdType); @@ -93,7 +92,6 @@ public function deleteAllPubIds($serverId, $pubIdType) * Check whether the given public ID exists for any publishing * object in a server. * - * @param int $serverId * @param string $pubIdType One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see ). @@ -106,7 +104,7 @@ public function deleteAllPubIds($serverId, $pubIdType) * @return bool */ public function anyPubIdExists( - $serverId, + int $serverId, $pubIdType, $pubId, $assocType = MetadataTypeDescription::ASSOC_TYPE_ANY, diff --git a/classes/submission/DAO.php b/classes/submission/DAO.php index 37bbba8013..41a3baa0d3 100644 --- a/classes/submission/DAO.php +++ b/classes/submission/DAO.php @@ -46,7 +46,7 @@ public function deleteById(int $id): int * * @return DAOResultFactory */ - public function getExportable($contextId, $pubIdType = null, $title = null, $author = null, $issueId = null, $pubIdSettingName = null, $pubIdSettingValue = null, $rangeInfo = null) + public function getExportable(int $contextId, $pubIdType = null, $title = null, $author = null, $issueId = null, $pubIdSettingName = null, $pubIdSettingValue = null, $rangeInfo = null) { $q = DB::table('submissions', 's') ->leftJoin('publications AS p', 's.current_publication_id', '=', 'p.publication_id')