Skip to content

Commit e86cd46

Browse files
committed
Add more missing type declaration
1 parent 0a73293 commit e86cd46

28 files changed

Lines changed: 112 additions & 210 deletions

wcfsetup/install/files/lib/acp/page/LicensePage.class.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,13 @@ static function ($packageUpdateServerID) use ($trustedServerIDs) {
443443
*
444444
* Stolen from PackageUpdateAction::canInstall()
445445
*
446-
* @param int $packageUpdateID
447-
* @param string|null $minVersion
448446
* @param string[] $installedPackages
449447
* @param string[] $excludedPackagesOfInstalledPackages
450448
* @return string[][]
451449
*/
452450
protected function canInstall(
453-
$packageUpdateID,
454-
$minVersion,
451+
int $packageUpdateID,
452+
?string $minVersion,
455453
array &$installedPackages,
456454
array &$excludedPackagesOfInstalledPackages
457455
) {

wcfsetup/install/files/lib/data/language/LanguageEditor.class.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -851,15 +851,13 @@ public function copy(Language $destination)
851851
* Updates the language items of a language category.
852852
*
853853
* @param array<string, string> $items
854-
* @param LanguageCategory $category
855-
* @param int $packageID
856854
* @param array<int, int> $useCustom
857855
* @return void
858856
*/
859857
public function updateItems(
860858
array $items,
861859
LanguageCategory $category,
862-
$packageID = PACKAGE_ID,
860+
int $packageID = PACKAGE_ID,
863861
array $useCustom = []
864862
) {
865863
if (empty($items)) {

wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,13 @@ static function ($packageUpdateServerID) use ($trustedServerIDs) {
277277
* Validates dependencies and exclusions of a package,
278278
* optionally limited by a minimum version number.
279279
*
280-
* @param int $packageUpdateID
281-
* @param string|null $minVersion
282280
* @param string[] $installedPackages
283281
* @param string[] $excludedPackagesOfInstalledPackages
284282
* @return string[][]
285283
*/
286284
protected function canInstall(
287-
$packageUpdateID,
288-
$minVersion,
285+
int $packageUpdateID,
286+
?string $minVersion,
289287
array &$installedPackages,
290288
array &$excludedPackagesOfInstalledPackages
291289
) {

wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,18 +218,13 @@ public function getAuthData()
218218

219219
/**
220220
* Stores auth data for a package update server.
221-
*
222-
* @param int $packageUpdateServerID
223-
* @param string $username
224-
* @param string $password
225-
* @param bool $saveCredentials
226221
*/
227222
public static function storeAuthData(
228-
$packageUpdateServerID,
229-
$username,
223+
int $packageUpdateServerID,
224+
string $username,
230225
#[\SensitiveParameter]
231-
$password,
232-
$saveCredentials = false
226+
string $password,
227+
bool $saveCredentials = false
233228
): void {
234229
$packageUpdateAuthData = @\unserialize(WCF::getSession()->getVar('packageUpdateAuthData'));
235230
if ($packageUpdateAuthData === null || !\is_array($packageUpdateAuthData)) {

wcfsetup/install/files/lib/data/user/User.class.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,11 @@ public function __construct(null|string|int $id, ?array $row = null, ?DatabaseOb
142142
/**
143143
* Returns true if the given password is the correct password for this user.
144144
*
145-
* @param string $password
146145
* @return bool password correct
147146
*/
148147
public function checkPassword(
149148
#[\SensitiveParameter]
150-
$password
149+
string $password
151150
) {
152151
$isValid = false;
153152

wcfsetup/install/files/lib/system/bbcode/MessageParser.class.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,15 @@ protected function init()
7272
/**
7373
* Parses a message.
7474
*
75-
* @param string $text
76-
* @param bool $enableSmilies
77-
* @param bool $enableHtml
78-
* @param bool $enableBBCodes
79-
* @param bool $doKeywordHighlighting
8075
* @return string parsed message
8176
*/
8277
#[\Override]
8378
public function parse(
84-
$text,
85-
$enableSmilies = true,
86-
$enableHtml = false,
87-
$enableBBCodes = true,
88-
$doKeywordHighlighting = true
79+
string $text,
80+
bool $enableSmilies = true,
81+
bool $enableHtml = false,
82+
bool $enableBBCodes = true,
83+
bool $doKeywordHighlighting = true
8984
) {
9085
$this->cachedCodes = [];
9186
$this->message = $text;

wcfsetup/install/files/lib/system/database/Database.class.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ abstract class Database
118118
* @param mixed[] $defaultDriverOptions
119119
*/
120120
public function __construct(
121-
$host,
122-
$user,
121+
string $host,
122+
string $user,
123123
#[\SensitiveParameter]
124-
$password,
125-
$database,
126-
$port,
127-
$failsafeTest = false,
128-
$tryToCreateDatabase = false,
129-
$defaultDriverOptions = []
124+
string $password,
125+
string $database,
126+
int $port,
127+
bool $failsafeTest = false,
128+
bool $tryToCreateDatabase = false,
129+
array $defaultDriverOptions = []
130130
) {
131131
$this->host = $host;
132132
$this->port = $port;

wcfsetup/install/files/lib/system/email/transport/SmtpEmailTransport.class.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ final class SmtpEmailTransport implements IStatusReportingEmailTransport
7878
* @throws \InvalidArgumentException
7979
*/
8080
public function __construct(
81-
$host = MAIL_SMTP_HOST,
82-
$port = MAIL_SMTP_PORT,
83-
$username = MAIL_SMTP_USER,
81+
string $host = MAIL_SMTP_HOST,
82+
int $port = MAIL_SMTP_PORT,
83+
string $username = MAIL_SMTP_USER,
8484
#[\SensitiveParameter]
85-
$password = MAIL_SMTP_PASSWORD,
86-
$starttls = MAIL_SMTP_STARTTLS
85+
string $password = MAIL_SMTP_PASSWORD,
86+
string $starttls = MAIL_SMTP_STARTTLS
8787
) {
8888
$this->host = StringUtil::trim($host);
8989
$this->port = \intval($port);

wcfsetup/install/files/lib/system/exception/AJAXException.class.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,16 @@ class AJAXException extends LoggedException
5555
/**
5656
* Throws a JSON-encoded error message
5757
*
58-
* @param string $message
59-
* @param int $errorType
60-
* @param string $stacktrace
6158
* @param mixed[] $returnValues
62-
* @param string $exceptionID
63-
* @param \Exception|\Throwable $previous
6459
* @param array<string, mixed> $extraInformation
6560
*/
6661
public function __construct(
67-
$message,
68-
$errorType = self::INTERNAL_ERROR,
69-
$stacktrace = null,
70-
$returnValues = [],
71-
$exceptionID = '',
72-
$previous = null,
62+
string $message,
63+
int $errorType = self::INTERNAL_ERROR,
64+
?string $stacktrace = null,
65+
array $returnValues = [],
66+
string $exceptionID = '',
67+
null|\Exception|\Throwable $previous = null,
7368
array $extraInformation = [],
7469
) {
7570
if ($stacktrace === null) {

wcfsetup/install/files/lib/system/exception/ErrorException.class.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,13 @@ class ErrorException extends SystemException
1919
*/
2020
protected $severity;
2121

22-
/**
23-
* @param string $message
24-
* @param int $code
25-
* @param int $severity
26-
* @param string $filename
27-
* @param int $lineno
28-
* @param ?\Exception $previous
29-
*/
3022
public function __construct(
31-
$message = "",
32-
$code = 0,
33-
$severity = 1,
34-
$filename = __FILE__,
35-
$lineno = __LINE__,
36-
$previous = null
23+
string $message = "",
24+
int $code = 0,
25+
int $severity = 1,
26+
string $filename = __FILE__,
27+
int $lineno = __LINE__,
28+
?\Exception $previous = null
3729
) {
3830
parent::__construct($message, $code, "", $previous);
3931

0 commit comments

Comments
 (0)