From 3005e6f4a4060879a09674dae907aaf495692192 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 26 Mar 2016 16:01:59 +0100 Subject: [PATCH] Fix property-read tag issues --- .../lib/data/acp/session/ACPSession.class.php | 9 +- .../acp/session/log/ACPSessionLog.class.php | 17 ++-- .../files/lib/data/bbcode/BBCode.class.php | 22 ++--- .../install/files/lib/data/box/Box.class.php | 2 +- .../files/lib/data/comment/Comment.class.php | 28 +++--- .../response/CommentResponse.class.php | 30 +++---- .../files/lib/data/cronjob/Cronjob.class.php | 8 +- .../data/language/item/LanguageItem.class.php | 8 +- .../lib/data/like/object/LikeObject.class.php | 22 ++--- .../queue/ModerationQueue.class.php | 18 ++-- .../PackageInstallationPlugin.class.php | 10 +-- .../queue/PackageInstallationQueue.class.php | 8 +- .../server/PackageUpdateServer.class.php | 45 +++++----- .../files/lib/data/session/Session.class.php | 13 ++- .../files/lib/data/smiley/Smiley.class.php | 10 +-- .../files/lib/data/user/User.class.php | 89 ++++++++++--------- 16 files changed, 173 insertions(+), 166 deletions(-) diff --git a/wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php b/wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php index 3f30b6546e..d9237cac02 100644 --- a/wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php +++ b/wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php @@ -6,7 +6,7 @@ use wcf\data\DatabaseObject; * Represents an ACP session. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.acp.session @@ -24,20 +24,21 @@ use wcf\data\DatabaseObject; * @property-read integer $parentObjectID * @property-read string $objectType * @property-read integer $objectID + * @property-read string $sessionVariables */ class ACPSession extends DatabaseObject { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'acp_session'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexIsIdentity + * @inheritDoc */ protected static $databaseTableIndexIsIdentity = false; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'sessionID'; diff --git a/wcfsetup/install/files/lib/data/acp/session/log/ACPSessionLog.class.php b/wcfsetup/install/files/lib/data/acp/session/log/ACPSessionLog.class.php index 72a5506818..fec50de475 100644 --- a/wcfsetup/install/files/lib/data/acp/session/log/ACPSessionLog.class.php +++ b/wcfsetup/install/files/lib/data/acp/session/log/ACPSessionLog.class.php @@ -8,33 +8,34 @@ use wcf\util\UserUtil; * Represents a session log entry. * * @author Marcel Werk - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf - * @subpackage data.log + * @subpackage data.acp.session.log * @category Community Framework * * @property-read integer $sessionLogID * @property-read string $sessionID * @property-read integer|null $userID - * @property-read string ipAddress - * @property-read string $hostName + * @property-read string $ipAddress + * @property-read string $hostname + * @property-read string $userAgent * @property-read integer $time * @property-read integer $lastActivityTime */ class ACPSessionLog extends DatabaseObject { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'acp_session_log'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'sessionLogID'; /** - * @see \wcf\data\DatabaseObject::__construct() + * @inheritDoc */ public function __construct($id, array $row = null, DatabaseObject $object = null) { if ($id !== null) { @@ -46,7 +47,7 @@ class ACPSessionLog extends DatabaseObject { ON (user_table.userID = acp_session_log.userID) WHERE acp_session_log.sessionLogID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($id)); + $statement->execute([$id]); $row = $statement->fetchArray(); } else if ($object !== null) { diff --git a/wcfsetup/install/files/lib/data/bbcode/BBCode.class.php b/wcfsetup/install/files/lib/data/bbcode/BBCode.class.php index 1c667bc4c3..55c5126916 100644 --- a/wcfsetup/install/files/lib/data/bbcode/BBCode.class.php +++ b/wcfsetup/install/files/lib/data/bbcode/BBCode.class.php @@ -1,6 +1,8 @@ * @package com.woltlab.wcf * @subpackage data.bbcode * @category Community Framework * * @property-read integer $bbcodeID - * @property-read string $bbCodeTag + * @property-read string $bbcodeTag * @property-read integer $packageID * @property-read string $htmlOpen * @property-read string $htmlClose @@ -30,24 +32,24 @@ use wcf\system\WCF; */ class BBCode extends ProcessibleDatabaseObject implements IRouteController { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'bbcode'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'bbcodeID'; /** - * @see \wcf\data\ProcessibleDatabaseObject::$processorInterface + * @inheritDoc */ - protected static $processorInterface = 'wcf\system\bbcode\IBBCode'; + protected static $processorInterface = IBBCode::class; /** * Returns the attributes of this bbcode. * - * @return array<\wcf\data\bbcode\attribute\BBCodeAttribute> + * @return BBCodeAttribute[] */ public function getAttributes() { if ($this->attributes === null) { @@ -58,7 +60,7 @@ class BBCode extends ProcessibleDatabaseObject implements IRouteController { } /** - * @see \wcf\data\ITitledObject::getTitle() + * @inheritDoc */ public function getTitle() { return $this->bbcodeTag; @@ -68,7 +70,7 @@ class BBCode extends ProcessibleDatabaseObject implements IRouteController { * Returns BBCode object with the given tag. * * @param string $tag - * @return \wcf\data\bbcode\BBCode + * @return BBCode */ public static function getBBCodeByTag($tag) { $sql = "SELECT * @@ -88,7 +90,7 @@ class BBCode extends ProcessibleDatabaseObject implements IRouteController { * existent, false is returned. * * @param string $bbcodeTag - * @param array $allowedBBCodeTags + * @param string[] $allowedBBCodeTags * @return boolean */ public static function isAllowedBBCode($bbcodeTag, array $allowedBBCodeTags) { diff --git a/wcfsetup/install/files/lib/data/box/Box.class.php b/wcfsetup/install/files/lib/data/box/Box.class.php index 8ad0101dfb..5e153aa984 100644 --- a/wcfsetup/install/files/lib/data/box/Box.class.php +++ b/wcfsetup/install/files/lib/data/box/Box.class.php @@ -30,7 +30,7 @@ use wcf\util\StringUtil; * @property-read integer $showHeader * @property-read integer $originIsSystem * @property-read integer $packageID - * @property-read integer $className + * @property-read string $className * @property-read integer|null $menuID */ class Box extends DatabaseObject { diff --git a/wcfsetup/install/files/lib/data/comment/Comment.class.php b/wcfsetup/install/files/lib/data/comment/Comment.class.php index 8ccc61aed5..d263fb25d5 100644 --- a/wcfsetup/install/files/lib/data/comment/Comment.class.php +++ b/wcfsetup/install/files/lib/data/comment/Comment.class.php @@ -11,13 +11,13 @@ use wcf\util\StringUtil; * Represents a comment. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.comment * @category Community Framework * - * @property-read integer $comment + * @property-read integer $commentID * @property-read integer $objectTypeID * @property-read integer $objectID * @property-read integer $time @@ -31,77 +31,77 @@ class Comment extends DatabaseObject implements IMessage { use TUserContent; /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'comment'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'commentID'; /** * Returns a list of response ids. * - * @return array + * @return integer[] */ public function getResponseIDs() { if ($this->responseIDs === null || $this->responseIDs == '') { - return array(); + return []; } $responseIDs = @unserialize($this->responseIDs); if ($responseIDs === false) { - return array(); + return []; } return $responseIDs; } /** - * @see \wcf\data\IMessage::getFormattedMessage() + * @inheritDoc */ public function getFormattedMessage() { return SimpleMessageParser::getInstance()->parse($this->message); } /** - * @see \wcf\data\IMessage::getExcerpt() + * @inheritDoc */ public function getExcerpt($maxLength = 255) { return StringUtil::truncateHTML($this->getFormattedMessage(), $maxLength); } /** - * @see \wcf\data\IMessage::getMessage() + * @inheritDoc */ public function getMessage() { return $this->message; } /** - * @see \wcf\data\ILinkableObject::getLink() + * @inheritDoc */ public function getLink() { return CommentHandler::getInstance()->getObjectType($this->objectTypeID)->getProcessor()->getLink($this->objectTypeID, $this->objectID); } /** - * @see \wcf\data\ITitledObject::getTitle() + * @inheritDoc */ public function getTitle() { return CommentHandler::getInstance()->getObjectType($this->objectTypeID)->getProcessor()->getTitle($this->objectTypeID, $this->objectID); } /** - * @see \wcf\data\IMessage::isVisible() + * @inheritDoc */ public function isVisible() { return true; } /** - * @see \wcf\data\IMessage::__toString() + * @inheritDoc */ public function __toString() { return $this->getFormattedMessage(); diff --git a/wcfsetup/install/files/lib/data/comment/response/CommentResponse.class.php b/wcfsetup/install/files/lib/data/comment/response/CommentResponse.class.php index 524b63c3eb..4b307f60d8 100644 --- a/wcfsetup/install/files/lib/data/comment/response/CommentResponse.class.php +++ b/wcfsetup/install/files/lib/data/comment/response/CommentResponse.class.php @@ -12,7 +12,7 @@ use wcf\util\StringUtil; * Represents a comment response. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.comment.response @@ -22,30 +22,30 @@ use wcf\util\StringUtil; * @property-read integer $commentID * @property-read integer $time * @property-read integer|null $userID - * @property-read integer $username - * @property-read integer $message + * @property-read string $username + * @property-read string $message */ class CommentResponse extends DatabaseObject implements IMessage { use TUserContent; /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'comment_response'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'responseID'; /** * comment object - * @var \wcf\data\comment\Comment + * @var Comment */ protected $comment = null; /** - * @see \wcf\data\IMessage::getFormattedMessage() + * @inheritDoc */ public function getFormattedMessage() { return SimpleMessageParser::getInstance()->parse($this->message); @@ -54,7 +54,7 @@ class CommentResponse extends DatabaseObject implements IMessage { /** * Returns comment object related to this response. * - * @return \wcf\data\comment\Comment + * @return Comment */ public function getComment() { if ($this->comment === null) { @@ -67,7 +67,7 @@ class CommentResponse extends DatabaseObject implements IMessage { /** * Sets related comment object. * - * @param \wcf\data\comment\Comment + * @param Comment */ public function setComment(Comment $comment) { if ($this->commentID == $comment->commentID) { @@ -76,42 +76,42 @@ class CommentResponse extends DatabaseObject implements IMessage { } /** - * @see \wcf\data\IMessage::getExcerpt() + * @inheritDoc */ public function getExcerpt($maxLength = 255) { return StringUtil::truncateHTML($this->getFormattedMessage(), $maxLength); } /** - * @see \wcf\data\IMessage::getMessage() + * @inheritDoc */ public function getMessage() { return $this->message; } /** - * @see \wcf\data\ILinkableObject::getLink() + * @inheritDoc */ public function getLink() { return CommentHandler::getInstance()->getObjectType($this->getComment()->objectTypeID)->getProcessor()->getLink($this->getComment()->objectTypeID, $this->getComment()->objectID); } /** - * @see \wcf\data\ITitledObject::getTitle() + * @inheritDoc */ public function getTitle() { return CommentHandler::getInstance()->getObjectType($this->getComment()->objectTypeID)->getProcessor()->getTitle($this->getComment()->objectTypeID, $this->getComment()->objectID, true); } /** - * @see \wcf\data\IMessage::isVisible() + * @inheritDoc */ public function isVisible() { return true; } /** - * @see \wcf\data\IMessage::__toString() + * @inheritDoc */ public function __toString() { return $this->getFormattedMessage(); diff --git a/wcfsetup/install/files/lib/data/cronjob/Cronjob.class.php b/wcfsetup/install/files/lib/data/cronjob/Cronjob.class.php index aa8d97c829..bbefebcba9 100644 --- a/wcfsetup/install/files/lib/data/cronjob/Cronjob.class.php +++ b/wcfsetup/install/files/lib/data/cronjob/Cronjob.class.php @@ -8,7 +8,7 @@ use wcf\util\CronjobUtil; * Represents a cronjob. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.cronjob @@ -16,7 +16,7 @@ use wcf\util\CronjobUtil; * * @property-read integer $cronjobID * @property-read string $className - * @property-read string $packageID + * @property-read integer $packageID * @property-read string $cronjobName * @property-read string $description * @property-read string $startMinute @@ -38,12 +38,12 @@ class Cronjob extends DatabaseObject { use TDatabaseObjectOptions; /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'cronjob'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'cronjobID'; diff --git a/wcfsetup/install/files/lib/data/language/item/LanguageItem.class.php b/wcfsetup/install/files/lib/data/language/item/LanguageItem.class.php index 168b8e9f81..e765c60c3d 100644 --- a/wcfsetup/install/files/lib/data/language/item/LanguageItem.class.php +++ b/wcfsetup/install/files/lib/data/language/item/LanguageItem.class.php @@ -6,7 +6,7 @@ use wcf\data\DatabaseObject; * Represents a language item. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.language.item @@ -20,16 +20,16 @@ use wcf\data\DatabaseObject; * @property-read integer $languageUseCustomValue * @property-read integer $languageItemOriginIsSystem * @property-read integer $languageCategoryID - * @property-read integer $packageID + * @property-read integer|null $packageID */ class LanguageItem extends DatabaseObject { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'language_item'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'languageItemID'; } diff --git a/wcfsetup/install/files/lib/data/like/object/LikeObject.class.php b/wcfsetup/install/files/lib/data/like/object/LikeObject.class.php index d6defa8064..d36935f0c9 100644 --- a/wcfsetup/install/files/lib/data/like/object/LikeObject.class.php +++ b/wcfsetup/install/files/lib/data/like/object/LikeObject.class.php @@ -9,7 +9,7 @@ use wcf\system\WCF; * Represents a liked object. * * @author Marcel Werk - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.like.object @@ -18,7 +18,7 @@ use wcf\system\WCF; * @property-read integer $likeObjectID * @property-read integer $objectTypeID * @property-read integer $objectID - * @property-read integer $objectUserID + * @property-read integer|null $objectUserID * @property-read integer $likes * @property-read integer $dislikes * @property-read integer $cumulativeLikes @@ -26,29 +26,29 @@ use wcf\system\WCF; */ class LikeObject extends DatabaseObject { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'like_object'; /** - * @see \wcf\data\DatabaseObject::$databaseIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'likeObjectID'; /** * liked object - * @var \wcf\data\like\object\ILikeObject + * @var ILikeObject */ protected $likedObject = null; /** * list of users who liked this object - * @var array<\wcf\data\user\User> + * @var User[] */ protected $users = array(); /** - * @see \wcf\data\DatabaseObject::handleData(); + * @inheritDoc */ protected function handleData($data) { parent::handleData($data); @@ -69,7 +69,7 @@ class LikeObject extends DatabaseObject { /** * Gets the first 3 users who liked this object. * - * @return array<\wcf\data\user\User> + * @return User[] */ public function getUsers() { return $this->users; @@ -78,7 +78,7 @@ class LikeObject extends DatabaseObject { /** * Returns the liked object. * - * @return \wcf\data\like\object\ILikeObject + * @return ILikeObject */ public function getLikedObject() { if ($this->likedObject === null) { @@ -91,7 +91,7 @@ class LikeObject extends DatabaseObject { /** * Sets the liked object. * - * @param \wcf\data\like\object\ILikeObject $likeObject + * @param ILikeObject $likeObject */ public function setLikedObject(ILikeObject $likedObject) { $this->likedObject = $likedObject; @@ -102,7 +102,7 @@ class LikeObject extends DatabaseObject { * * @param integer $objectTypeID * @param integer $objectID - * @return \wcf\data\like\object\LikeObject + * @return LikeObject */ public static function getLikeObject($objectTypeID, $objectID) { $sql = "SELECT * diff --git a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueue.class.php b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueue.class.php index 5154d31267..4f3b50e90a 100644 --- a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueue.class.php +++ b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueue.class.php @@ -8,7 +8,7 @@ use wcf\system\WCF; * Represents a moderation queue entry. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.moderation.queue @@ -24,16 +24,16 @@ use wcf\system\WCF; * @property-read integer $status * @property-read integer $comments * @property-read integer $lastChangeTime - * @property-read string $additionalData + * @property-read array $additionalData */ class ModerationQueue extends DatabaseObject { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'moderation_queue'; /** - * @see \wcf\data\DatabaseObject::$databaseIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'queueID'; @@ -45,7 +45,7 @@ class ModerationQueue extends DatabaseObject { const STATUS_CONFIRMED = 4; /** - * @see \wcf\data\IStorableObject::__get() + * @inheritDoc */ public function __get($name) { $value = parent::__get($name); @@ -61,14 +61,14 @@ class ModerationQueue extends DatabaseObject { } /** - * @see \wcf\data\DatabaseObject::handleData() + * @inheritDoc */ protected function handleData($data) { parent::handleData($data); $this->data['additionalData'] = @unserialize($this->data['additionalData']); if (!is_array($this->data['additionalData'])) { - $this->data['additionalData'] = array(); + $this->data['additionalData'] = []; } } @@ -83,10 +83,10 @@ class ModerationQueue extends DatabaseObject { WHERE queueID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->queueID, WCF::getUser()->userID - )); + ]); $row = $statement->fetchArray(); return ($row !== false && $row['isAffected']); diff --git a/wcfsetup/install/files/lib/data/package/installation/plugin/PackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/data/package/installation/plugin/PackageInstallationPlugin.class.php index 859561e70d..61c7d3d1a9 100644 --- a/wcfsetup/install/files/lib/data/package/installation/plugin/PackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/data/package/installation/plugin/PackageInstallationPlugin.class.php @@ -6,30 +6,30 @@ use wcf\data\DatabaseObject; * Represents a package installation plugin. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.package.installation.plugin * @category Community Framework * * @property-read string $pluginName - * @property-read integer $packageID + * @property-read integer|null $packageID * @property-read integer $priority * @property-read string $className */ class PackageInstallationPlugin extends DatabaseObject { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'package_installation_plugin'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'pluginName'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexIsIdentity + * @inheritDoc */ protected static $databaseTableIndexIsIdentity = false; } diff --git a/wcfsetup/install/files/lib/data/package/installation/queue/PackageInstallationQueue.class.php b/wcfsetup/install/files/lib/data/package/installation/queue/PackageInstallationQueue.class.php index d90999ce80..504ba82c06 100644 --- a/wcfsetup/install/files/lib/data/package/installation/queue/PackageInstallationQueue.class.php +++ b/wcfsetup/install/files/lib/data/package/installation/queue/PackageInstallationQueue.class.php @@ -7,7 +7,7 @@ use wcf\system\WCF; * Represents a package installation queue. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.package.installation.queue @@ -19,7 +19,7 @@ use wcf\system\WCF; * @property-read integer $userID * @property-read string $package * @property-read string $packageName - * @property-read integer $packageID + * @property-read integer|null $packageID * @property-read string $archive * @property-read string $action * @property-read integer $done @@ -27,12 +27,12 @@ use wcf\system\WCF; */ class PackageInstallationQueue extends DatabaseObject { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'package_installation_queue'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'queueID'; diff --git a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php index c2c5ac1a2a..a9d191ed31 100644 --- a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php +++ b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php @@ -10,7 +10,7 @@ use wcf\util\FileUtil; * Represents a package update server. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.package.update.server @@ -25,16 +25,15 @@ use wcf\util\FileUtil; * @property-read string $status * @property-read string $errorMessage * @property-read string $apiVersion - * @property-read array $metaData */ class PackageUpdateServer extends DatabaseObject { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'package_update_server'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'packageUpdateServerID'; @@ -42,10 +41,10 @@ class PackageUpdateServer extends DatabaseObject { * API meta data * @var array */ - protected $metaData = array(); + protected $metaData = []; /** - * @see \wcf\data\DatabaseObject::handleData() + * @inheritDoc */ protected function handleData($data) { if (!empty($data['metaData'])) { @@ -63,14 +62,14 @@ class PackageUpdateServer extends DatabaseObject { /** * Returns all active update package servers sorted by hostname. * - * @param array $packageUpdateServerIDs - * @return array $servers + * @param integer[] $packageUpdateServerIDs + * @return PackageUpdateServer[] */ - public static function getActiveUpdateServers(array $packageUpdateServerIDs = array()) { + public static function getActiveUpdateServers(array $packageUpdateServerIDs = []) { $list = new PackageUpdateServerList(); - $list->getConditionBuilder()->add("isDisabled = ?", array(0)); + $list->getConditionBuilder()->add("isDisabled = ?", [0]); if (!empty($packageUpdateServerIDs)) { - $list->getConditionBuilder()->add("packageUpdateServerID IN (?)", array($packageUpdateServerIDs)); + $list->getConditionBuilder()->add("packageUpdateServerID IN (?)", [$packageUpdateServerIDs]); } $list->readObjects(); @@ -78,10 +77,10 @@ class PackageUpdateServer extends DatabaseObject { } /** - * Validates a server url. + * Returns true if the given server url is valid. * * @param string $serverURL - * @return boolean validates + * @return boolean */ public static function isValidServerURL($serverURL) { if (trim($serverURL)) { @@ -99,18 +98,18 @@ class PackageUpdateServer extends DatabaseObject { } /** - * Gets stored auth data of this update server. + * Returns stored auth data of this update server. * - * @return array $authData + * @return string[] */ public function getAuthData() { - $authData = array(); + $authData = []; // database data if ($this->loginUsername != '' && $this->loginPassword != '') { - $authData = array( + $authData = [ 'username' => $this->loginUsername, 'password' => $this->loginPassword - ); + ]; } // session data @@ -133,21 +132,21 @@ class PackageUpdateServer extends DatabaseObject { public static function storeAuthData($packageUpdateServerID, $username, $password, $saveCredentials = false) { $packageUpdateAuthData = @unserialize(WCF::getSession()->getVar('packageUpdateAuthData')); if ($packageUpdateAuthData === null || !is_array($packageUpdateAuthData)) { - $packageUpdateAuthData = array(); + $packageUpdateAuthData = []; } - $packageUpdateAuthData[$packageUpdateServerID] = array( + $packageUpdateAuthData[$packageUpdateServerID] = [ 'username' => $username, 'password' => $password - ); + ]; WCF::getSession()->register('packageUpdateAuthData', serialize($packageUpdateAuthData)); if ($saveCredentials) { - $serverAction = new PackageUpdateServerAction(array($packageUpdateServerID), 'update', array('data' => array( + $serverAction = new PackageUpdateServerAction([$packageUpdateServerID], 'update', ['data' => [ 'loginUsername' => $username, 'loginPassword' => $password - ))); + ]]); $serverAction->executeAction(); } } diff --git a/wcfsetup/install/files/lib/data/session/Session.class.php b/wcfsetup/install/files/lib/data/session/Session.class.php index 4ab4d5ac86..4f13771a57 100644 --- a/wcfsetup/install/files/lib/data/session/Session.class.php +++ b/wcfsetup/install/files/lib/data/session/Session.class.php @@ -7,28 +7,27 @@ use wcf\system\WCF; * Represents a session. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.session * @category Community Framework * - * @property-read string $sessionVariables * @property-read string $spiderID */ class Session extends ACPSession { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'session'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'sessionID'; /** - * @see \wcf\data\acp\session\ACPSession::supportsPersistentLogins() + * @inheritDoc */ public static function supportsPersistentLogins() { return true; @@ -46,14 +45,14 @@ class Session extends ACPSession { * is no such session. * * @param integer $userID - * @return \wcf\data\session\Session + * @return Session */ public static function getSessionByUserID($userID) { $sql = "SELECT * FROM ".static::getDatabaseTableName()." WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($userID)); + $statement->execute([$userID]); $row = $statement->fetchArray(); if ($row === false) { diff --git a/wcfsetup/install/files/lib/data/smiley/Smiley.class.php b/wcfsetup/install/files/lib/data/smiley/Smiley.class.php index 1f6b255522..bc028c01d9 100644 --- a/wcfsetup/install/files/lib/data/smiley/Smiley.class.php +++ b/wcfsetup/install/files/lib/data/smiley/Smiley.class.php @@ -8,7 +8,7 @@ use wcf\util\StringUtil; * Represents a smiley. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.smiley @@ -21,16 +21,16 @@ use wcf\util\StringUtil; * @property-read string $smileyTitle * @property-read string $smileyCode * @property-read string $aliases - * @property-read integer $smileyID + * @property-read integer $showOrder */ class Smiley extends DatabaseObject { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'smiley'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'smileyID'; @@ -46,7 +46,7 @@ class Smiley extends DatabaseObject { /** * Returns all aliases for this smiley. * - * @return array + * @return string[] */ public function getAliases() { if (!$this->aliases) return array(); diff --git a/wcfsetup/install/files/lib/data/user/User.class.php b/wcfsetup/install/files/lib/data/user/User.class.php index 9a73dde2cc..51e2a13eff 100644 --- a/wcfsetup/install/files/lib/data/user/User.class.php +++ b/wcfsetup/install/files/lib/data/user/User.class.php @@ -15,7 +15,7 @@ use wcf\util\PasswordUtil; * Represents a user. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.user @@ -27,7 +27,7 @@ use wcf\util\PasswordUtil; * @property-read string $password * @property-read string $accessToken * @property-read integer $languageID - * @property-read integer $registrationDate + * @property-read string $registrationDate * @property-read integer $styleID * @property-read integer $banned * @property-read string $banReason @@ -67,18 +67,18 @@ use wcf\util\PasswordUtil; */ final class User extends DatabaseObject implements IRouteController, IUserContent { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'user'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'userID'; /** * list of group ids - * @var array + * @var integer[] */ protected $groupIDs = null; @@ -90,7 +90,7 @@ final class User extends DatabaseObject implements IRouteController, IUserConten /** * list of language ids - * @var array + * @var integer[] */ protected $languageIDs = null; @@ -102,12 +102,12 @@ final class User extends DatabaseObject implements IRouteController, IUserConten /** * list of user options - * @var array + * @var string[] */ protected static $userOptions = null; /** - * @see \wcf\data\DatabaseObject::__construct() + * @inheritDoc */ public function __construct($id, $row = null, DatabaseObject $object = null) { if ($id !== null) { @@ -117,11 +117,11 @@ final class User extends DatabaseObject implements IRouteController, IUserConten ON (user_option_value.userID = user_table.userID) WHERE user_table.userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($id)); + $statement->execute([$id]); $row = $statement->fetchArray(); // enforce data type 'array' - if ($row === false) $row = array(); + if ($row === false) $row = []; } else if ($object !== null) { $row = $object->data; @@ -162,9 +162,9 @@ final class User extends DatabaseObject implements IRouteController, IUserConten // create new password hash, either different encryption or different blowfish cost factor if ($rebuild && $isValid) { $userEditor = new UserEditor($this); - $userEditor->update(array( + $userEditor->update([ 'password' => $password - )); + ]); } return $isValid; @@ -188,13 +188,13 @@ final class User extends DatabaseObject implements IRouteController, IUserConten * Returns an array with all the groups in which the actual user is a member. * * @param boolean $skipCache - * @return array $groupIDs + * @return integer[] */ public function getGroupIDs($skipCache = false) { if ($this->groupIDs === null || $skipCache) { if (!$this->userID) { // user is a guest, use default guest group - $this->groupIDs = UserGroup::getGroupIDsByType(array(UserGroup::GUESTS, UserGroup::EVERYONE)); + $this->groupIDs = UserGroup::getGroupIDsByType([UserGroup::GUESTS, UserGroup::EVERYONE]); } else { // get group ids @@ -202,12 +202,12 @@ final class User extends DatabaseObject implements IRouteController, IUserConten // cache does not exist or is outdated if ($data === null || $skipCache) { - $this->groupIDs = array(); + $this->groupIDs = []; $sql = "SELECT groupID FROM wcf".WCF_N."_user_to_group WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->userID)); + $statement->execute([$this->userID]); while ($row = $statement->fetchArray()) { $this->groupIDs[] = $row['groupID']; } @@ -231,11 +231,11 @@ final class User extends DatabaseObject implements IRouteController, IUserConten /** * Returns a list of language ids for this user. * - * @return array + * @return integer[] */ public function getLanguageIDs() { if ($this->languageIDs === null) { - $this->languageIDs = array(); + $this->languageIDs = []; if ($this->userID) { // get language ids @@ -247,7 +247,7 @@ final class User extends DatabaseObject implements IRouteController, IUserConten FROM wcf".WCF_N."_user_to_language WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->userID)); + $statement->execute([$this->userID]); while ($row = $statement->fetchArray()) { $this->languageIDs[] = $row['languageID']; } @@ -287,7 +287,7 @@ final class User extends DatabaseObject implements IRouteController, IUserConten * Gets all user options from cache. */ protected static function getUserOptionCache() { - self::$userOptions = UserOptionCacheBuilder::getInstance()->getData(array(), 'options'); + self::$userOptions = UserOptionCacheBuilder::getInstance()->getData([], 'options'); } /** @@ -310,7 +310,7 @@ final class User extends DatabaseObject implements IRouteController, IUserConten } /** - * @see \wcf\data\DatabaseObject::__get() + * @inheritDoc */ public function __get($name) { $value = parent::__get($name); @@ -322,7 +322,7 @@ final class User extends DatabaseObject implements IRouteController, IUserConten * Returns the user with the given username. * * @param string $username - * @return \wcf\data\user\User + * @return User */ public static function getUserByUsername($username) { $sql = "SELECT user_option_value.*, user_table.* @@ -331,9 +331,9 @@ final class User extends DatabaseObject implements IRouteController, IUserConten ON (user_option_value.userID = user_table.userID) WHERE user_table.username = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($username)); + $statement->execute([$username]); $row = $statement->fetchArray(); - if (!$row) $row = array(); + if (!$row) $row = []; return new User(null, $row); } @@ -342,7 +342,7 @@ final class User extends DatabaseObject implements IRouteController, IUserConten * Returns the user with the given email. * * @param string $email - * @return \wcf\data\user\User + * @return User */ public static function getUserByEmail($email) { $sql = "SELECT user_option_value.*, user_table.* @@ -351,9 +351,9 @@ final class User extends DatabaseObject implements IRouteController, IUserConten ON (user_option_value.userID = user_table.userID) WHERE user_table.email = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($email)); + $statement->execute([$email]); $row = $statement->fetchArray(); - if (!$row) $row = array(); + if (!$row) $row = []; return new User(null, $row); } @@ -362,7 +362,7 @@ final class User extends DatabaseObject implements IRouteController, IUserConten * Returns the user with the given authData. * * @param string $authData - * @return \wcf\data\user\User + * @return User */ public static function getUserByAuthData($authData) { $sql = "SELECT user_option_value.*, user_table.* @@ -371,9 +371,9 @@ final class User extends DatabaseObject implements IRouteController, IUserConten ON (user_option_value.userID = user_table.userID) WHERE user_table.authData = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($authData)); + $statement->execute([$authData]); $row = $statement->fetchArray(); - if (!$row) $row = array(); + if (!$row) $row = []; return new User(null, $row); } @@ -414,7 +414,7 @@ final class User extends DatabaseObject implements IRouteController, IUserConten * Returns a list of users. * * @param array $userIDs - * @return array<\wcf\data\user\User> + * @return User[] */ public static function getUsers(array $userIDs) { $userList = new UserList(); @@ -434,14 +434,14 @@ final class User extends DatabaseObject implements IRouteController, IUserConten } /** - * @see \wcf\data\IStorableObject::getDatabaseTableAlias() + * @inheritDoc */ public static function getDatabaseTableAlias() { return 'user_table'; } /** - * @see \wcf\system\request\IRouteController::getTitle() + * @inheritDoc */ public function getTitle() { return $this->username; @@ -450,7 +450,7 @@ final class User extends DatabaseObject implements IRouteController, IUserConten /** * Returns the language of this user. * - * @return \wcf\data\language\Language + * @return Language */ public function getLanguage() { $language = LanguageFactory::getInstance()->getLanguage($this->languageID); @@ -494,37 +494,42 @@ final class User extends DatabaseObject implements IRouteController, IUserConten } /** - * @see \wcf\data\IMessage::getUserID() + * @inheritDoc */ public function getUserID() { return $this->userID; } /** - * @see \wcf\data\IMessage::getUsername() + * @inheritDoc */ public function getUsername() { return $this->username; } /** - * @see \wcf\data\IMessage::getTime() + * @inheritDoc */ public function getTime() { return $this->registrationDate; } /** - * @see \wcf\data\ILinkableObject::getLink() + * @inheritDoc */ public function getLink() { - return LinkHandler::getInstance()->getLink('User', array( + return LinkHandler::getInstance()->getLink('User', [ 'application' => 'wcf', 'object' => $this, 'forceFrontend' => true - )); + ]); } + /** + * Returns the social network privacy settings of the user. + * + * @return boolean[] + */ public function getSocialNetworkPrivacySettings() { $settings = false; if ($this->userID && WCF::getUser()->socialNetworkPrivacySettings) { @@ -532,12 +537,12 @@ final class User extends DatabaseObject implements IRouteController, IUserConten } if ($settings === false) { - $settings = array( + $settings = [ 'facebook' => false, 'google' => false, 'reddit' => false, 'twitter' => false - ); + ]; } return $settings; -- 2.20.1