From: Tim Düsterhus Date: Fri, 5 Aug 2022 07:37:04 +0000 (+0200) Subject: Add types to SearchIndexManager where easily possible X-Git-Tag: 6.0.0_Alpha_1~1075^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=db4325a863919ee1eea073b8ab8ac1fab377584e;p=GitHub%2FWoltLab%2FWCF.git Add types to SearchIndexManager where easily possible Parameter types to delete() and reset() could not be added, because they violate LSP unless the interface is modified as well / modified first. --- diff --git a/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php b/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php index 1cd1596cb8..474ac94c4d 100644 --- a/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php +++ b/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php @@ -52,11 +52,9 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager /** * Returns the id of the object type with the given name. * - * @param string $objectType - * @return int * @throws SystemException */ - public function getObjectTypeID($objectType) + public function getObjectTypeID(string $objectType): int { if (!isset($this->availableObjectTypes[$objectType])) { throw new SystemException("unknown object type '" . $objectType . "'"); @@ -68,11 +66,9 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager /** * Returns the the object type with the given name. * - * @param string $objectType - * @return ObjectType * @throws SystemException */ - public function getObjectType($objectType) + public function getObjectType(string $objectType): ObjectType { if (!isset($this->availableObjectTypes[$objectType])) { throw new SystemException("unknown object type '" . $objectType . "'"); @@ -83,10 +79,8 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager /** * Returns the search index manager object. - * - * @return ISearchIndexManager */ - protected function getSearchIndexManager() + protected function getSearchIndexManager(): ISearchIndexManager { if ($this->searchIndexManager === null) { $className = ''; @@ -121,7 +115,7 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager $username, $languageID = null, $metaData = '' - ) { + ): void { // strip html; remove whitespace from beginning and end of the message $message = StringUtil::trim(StringUtil::stripHTML($message)); @@ -132,7 +126,7 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager /** * @inheritDoc */ - public function delete($objectType, array $objectIDs) + public function delete($objectType, array $objectIDs): void { $this->getSearchIndexManager()->delete($objectType, $objectIDs); } @@ -140,7 +134,7 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager /** * @inheritDoc */ - public function reset($objectType) + public function reset($objectType): void { $this->getSearchIndexManager()->reset($objectType); } @@ -148,7 +142,7 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager /** * @inheritDoc */ - public function createSearchIndices() + public function createSearchIndices(): void { $this->getSearchIndexManager()->createSearchIndices(); } @@ -156,7 +150,7 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager /** * @inheritDoc */ - public function beginBulkOperation() + public function beginBulkOperation(): void { $this->getSearchIndexManager()->beginBulkOperation(); } @@ -164,7 +158,7 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager /** * @inheritDoc */ - public function commitBulkOperation() + public function commitBulkOperation(): void { $this->getSearchIndexManager()->commitBulkOperation(); } @@ -173,9 +167,8 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager * Returns the database table name for the object type's search index. * * @param mixed $objectType - * @return string */ - public static function getTableName($objectType) + public static function getTableName(string $objectType): string { if (\is_string($objectType)) { $objectType = self::getInstance()->getObjectType($objectType);