Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return Types for ITitledObject::getLink() and ILinkableObject::getLink() #5157

Merged
merged 4 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions wcfsetup/install/files/lib/data/ILinkableObject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ interface ILinkableObject
{
/**
* Returns the link to the object.
*
* @return string
*/
public function getLink();
public function getLink(): string;
}
4 changes: 1 addition & 3 deletions wcfsetup/install/files/lib/data/ITitledObject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ interface ITitledObject
{
/**
* Returns the title of the object.
*
* @return string
*/
public function getTitle();
public function getTitle(): string;
}
2 changes: 1 addition & 1 deletion wcfsetup/install/files/lib/data/ad/Ad.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getLocation()
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->adName;
}
Expand Down
8 changes: 3 additions & 5 deletions wcfsetup/install/files/lib/data/article/Article.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function canPublish()
/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
if ($this->getArticleContent() !== null) {
return $this->getArticleContent()->getLink();
Expand All @@ -186,11 +186,9 @@ public function getLink()
}

/**
* Returns the article's title.
*
* @return string
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
if ($this->getArticleContent() !== null) {
return $this->getArticleContent()->getTitle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getContent()
/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
return $this->getDecoratedObject()->getLink();
}
Expand Down Expand Up @@ -104,7 +104,7 @@ public function getTime()
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->getDecoratedObject()->getTitle();
}
Expand Down
4 changes: 2 additions & 2 deletions wcfsetup/install/files/lib/data/article/FeedArticle.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ class FeedArticle extends ViewableArticle implements IFeedEntryWithEnclosure
/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
return $this->getDecoratedObject()->getLink();
}

/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->getDecoratedObject()->getTitle();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LikeableArticle extends AbstractLikeObject implements IReactionObject
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->getDecoratedObject()->getTitle();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function getPermission($permission, ?User $user = null)
/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
return LinkHandler::getInstance()->getLink('CategoryArticleList', [
'forceFrontend' => true,
Expand All @@ -118,7 +118,7 @@ public function getLink()
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return WCF::getLanguage()->get($this->title);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ArticleContent extends DatabaseObject implements ILinkableObject, IRouteCo
/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
return LinkHandler::getInstance()->getLink('Article', [
'object' => $this,
Expand All @@ -63,7 +63,7 @@ public function getLink()
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->title;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getTime()
/**
* @inheritDoc
*/
public function getLink($query = '')
public function getLink($query = ''): string
{
$parameters = [
'object' => $this->getDecoratedObject(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Attachment extends DatabaseObject implements ILinkableObject, IRouteContro
/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
// Do not use `LinkHandler::getControllerLink()` or `forceFrontend` as attachment
// links can be opened in the frontend and in the ACP.
Expand Down Expand Up @@ -246,7 +246,7 @@ public function getThumbnailLink($size = '')
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->filename;
}
Expand Down
2 changes: 1 addition & 1 deletion wcfsetup/install/files/lib/data/bbcode/BBCode.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function setAttributes(array $attributes)
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->bbcodeTag;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function getOutput($url)
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->title;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getContent()
/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
return $this->getDecoratedObject()->getLink();
}
Expand Down Expand Up @@ -104,7 +104,7 @@ public function getTime()
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->getDecoratedObject()->getTitle();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function getPermission($permission, ?User $user = null)
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return WCF::getLanguage()->get($this->title);
}
Expand Down
4 changes: 2 additions & 2 deletions wcfsetup/install/files/lib/data/comment/Comment.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function getMessage()
/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
/** @var ICommentManager $processor */
$processor = CommentHandler::getInstance()->getObjectType($this->objectTypeID)->getProcessor();
Expand All @@ -151,7 +151,7 @@ public function getLink()
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return CommentHandler::getInstance()->getObjectType($this->objectTypeID)->getProcessor()->getTitle(
$this->objectTypeID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LikeableComment extends AbstractLikeObject implements IReactionObject
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->message;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function setComment(Comment $comment)
/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
/** @var ICommentManager $processor */
$processor = CommentHandler::getInstance()->getObjectType($this->getComment()->objectTypeID)->getProcessor();
Expand All @@ -141,7 +141,7 @@ public function getLink()
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return CommentHandler::getInstance()->getObjectType($this->getComment()->objectTypeID)->getProcessor()->getTitle(
$this->getComment()->objectTypeID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class LikeableCommentResponse extends AbstractLikeObject implements IReactionObj
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->message;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ public static function generateKey()
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->getAttachment()->getTitle();
}

/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
return LinkHandler::getInstance()->getLink('ContactAttachment', [
'object' => $this->getAttachment(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __get($name)
* @inheritDoc
* @since 5.2
*/
public function getTitle()
public function getTitle(): string
{
return WCF::getLanguage()->get($this->optionTitle);
}
Expand Down
2 changes: 1 addition & 1 deletion wcfsetup/install/files/lib/data/label/Label.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __toString()
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return WCF::getLanguage()->get($this->label);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LabelGroup extends DatabaseObject implements IRouteController
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return WCF::getLanguage()->get($this->groupName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LanguageCategory extends DatabaseObject implements ITitledObject
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->languageCategory;
}
Expand Down
4 changes: 2 additions & 2 deletions wcfsetup/install/files/lib/data/media/Media.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Media extends DatabaseObject implements ILinkableObject, IRouteController,
/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
return LinkHandler::getInstance()->getLink('Media', ['object' => $this]);
}
Expand Down Expand Up @@ -182,7 +182,7 @@ public function getThumbnailLocation($size)
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->filename;
}
Expand Down
2 changes: 1 addition & 1 deletion wcfsetup/install/files/lib/data/menu/Menu.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function hasContent()
* @inheritDoc
* @since 5.2
*/
public function getTitle()
public function getTitle(): string
{
return WCF::getLanguage()->get($this->title);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MenuItem extends DatabaseObject implements ITitledObject
* @inheritDoc
* @since 5.2
*/
public function getTitle()
public function getTitle(): string
{
return WCF::getLanguage()->get($this->title);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public function setAffectedObject(IUserContent $object)
/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
return ModerationQueueManager::getInstance()->getLink($this->objectTypeID, $this->queueID);
}

/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->affectedObject === null ? '' : $this->affectedObject->getTitle();
}
Expand Down
2 changes: 1 addition & 1 deletion wcfsetup/install/files/lib/data/notice/Notice.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getConditions()
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->noticeName;
}
Expand Down
4 changes: 2 additions & 2 deletions wcfsetup/install/files/lib/data/package/Package.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Package extends DatabaseObject implements ILinkableObject, IRouteControlle
/**
* @inheritDoc
*/
public function getLink()
public function getLink(): string
{
return LinkHandler::getInstance()->getControllerLink(PackagePage::class, [
'object' => $this,
Expand All @@ -90,7 +90,7 @@ public function getLink()
/**
* @inheritDoc
*/
public function getTitle()
public function getTitle(): string
{
return $this->getName();
}
Expand Down