Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d7cc52c
Improve the typing for the util classes
dtdesign Feb 14, 2025
41ba1b8
Improve the typing of the workers
dtdesign Feb 15, 2025
9870d1c
Improve the typing of the template engine and notifications
dtdesign Feb 15, 2025
8c63541
Improve the typing on the session system, search and request handling
dtdesign Feb 15, 2025
99f8734
Improve the typing for PIPs
dtdesign Feb 16, 2025
fbe802b
Fix some remaining issues with PIPs
dtdesign Feb 16, 2025
c876132
Improve the typing of the package system
dtdesign Feb 17, 2025
7412f70
Improve the typing of the option system
dtdesign Feb 17, 2025
b0634a3
Improved the typing of more system classes
dtdesign Feb 18, 2025
50d7ad4
Improve the typing of the HTML API and importers
dtdesign Feb 19, 2025
27b14e7
Improved the typing of grid views
dtdesign Feb 19, 2025
368f8ae
Improve the typing of form fields
dtdesign Feb 19, 2025
3f586e2
Improve the typing of system classes
dtdesign Feb 22, 2025
a32e4e9
Improve the typing for conditions
dtdesign Feb 22, 2025
48e99b6
Improve the typing of runtime caches and the clipboard
dtdesign Feb 23, 2025
4f4f4e6
Improve typing of the remaining system classes
dtdesign Feb 23, 2025
7abbb84
Improve the typing of classes
dtdesign Feb 23, 2025
2c95d98
Improve the typing of notifications and some DBO classes
dtdesign Mar 7, 2025
1a92eca
Improve the typing of DBO classes
dtdesign Mar 8, 2025
3eb0f02
Improve the typing of DBOs
dtdesign Mar 8, 2025
6f3500f
Improve the typing of workers and grid views
dtdesign Mar 9, 2025
0b4654c
Improve the typing of conditions
dtdesign Mar 9, 2025
05a5219
Improve the types of runtime caches and column renderers
dtdesign Mar 9, 2025
d2686bb
Improve the typing of DBOs and pages
dtdesign Mar 10, 2025
ece2cc1
Improve the typing of DBOs
dtdesign Mar 10, 2025
4c396a8
Improve typing of DBOs
dtdesign Mar 11, 2025
df885e9
Improve the typing of the remaining DBOs
dtdesign Mar 11, 2025
8ff8a6d
Improve the typing of actions and pages
dtdesign Mar 11, 2025
dcf8966
Improve the typing for the pages and forms
dtdesign Mar 12, 2025
4185460
Improve the mixing
dtdesign Mar 12, 2025
b66a9c1
Add a missing type hint
dtdesign Mar 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
50 changes: 7 additions & 43 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,6 @@ parameters:
count: 2
path: wcfsetup/install/files/lib/data/comment/CommentAction.class.php

-
message: '#^Property wcf\\data\\comment\\response\\CommentResponseAction\:\:\$response \(wcf\\data\\comment\\response\\CommentResponse\) does not accept wcf\\data\\comment\\response\\CommentResponseEditor\.$#'
identifier: assign.propertyType
count: 1
path: wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php

-
message: '#^Property wcf\\data\\style\\StyleAction\:\:\$style \(wcf\\data\\style\\Style\) does not accept wcf\\data\\style\\StyleEditor\.$#'
identifier: assign.propertyType
count: 1
path: wcfsetup/install/files/lib/data/style/StyleAction.class.php

-
message: '#^While loop condition is always true\.$#'
identifier: while.alwaysTrue
Expand All @@ -108,18 +96,6 @@ parameters:
count: 1
path: wcfsetup/install/files/lib/form/LostPasswordForm.class.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 1
path: wcfsetup/install/files/lib/page/AbstractPage.class.php

-
message: '#^Strict comparison using \=\=\= between int and ''og\:description'' will always evaluate to false\.$#'
identifier: identical.alwaysFalse
count: 1
path: wcfsetup/install/files/lib/page/AbstractPage.class.php

-
message: '#^Instanceof between wcf\\data\\search\\ISearchResultObject and wcf\\data\\search\\ISearchResultObject will always evaluate to true\.$#'
identifier: instanceof.alwaysTrue
Expand Down Expand Up @@ -402,12 +378,6 @@ parameters:
count: 1
path: wcfsetup/install/files/lib/system/condition/AbstractMultiSelectCondition.class.php

-
message: '#^PHPDoc type array of property wcf\\system\\condition\\AbstractMultiSelectCondition\:\:\$fieldValue is not covariant with PHPDoc type string of overridden property wcf\\system\\condition\\AbstractSelectCondition\:\:\$fieldValue\.$#'
identifier: property.phpDocType
count: 1
path: wcfsetup/install/files/lib/system/condition/AbstractMultiSelectCondition.class.php

-
message: '#^Parameter \#2 \$array of function implode expects array\|null, string given\.$#'
identifier: argument.type
Expand Down Expand Up @@ -780,12 +750,6 @@ parameters:
count: 2
path: wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/WysiwygFormContainer.class.php

-
message: '#^Call to function is_array\(\) with array will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 2
path: wcfsetup/install/files/lib/system/form/builder/data/FormDataHandler.class.php

-
message: '#^Call to function is_bool\(\) with string will always evaluate to false\.$#'
identifier: function.impossibleType
Expand Down Expand Up @@ -1017,7 +981,7 @@ parameters:
-
message: '#^Call to function is_numeric\(\) with float\|int will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 7
count: 2
path: wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php

-
Expand Down Expand Up @@ -1045,7 +1009,7 @@ parameters:
path: wcfsetup/install/files/lib/system/form/builder/field/acl/AclFormField.class.php

-
message: '#^Instanceof between wcf\\data\\DatabaseObjectList and wcf\\data\\DatabaseObjectList will always evaluate to true\.$#'
message: '#^Instanceof between wcf\\data\\DatabaseObjectList<wcf\\data\\DatabaseObject> and wcf\\data\\DatabaseObjectList will always evaluate to true\.$#'
identifier: instanceof.alwaysTrue
count: 1
path: wcfsetup/install/files/lib/system/form/builder/field/dependency/ValueFormFieldDependency.class.php
Expand Down Expand Up @@ -1183,7 +1147,7 @@ parameters:
path: wcfsetup/install/files/lib/system/label/object/AbstractLabelObjectHandler.class.php

-
message: '#^Call to an undefined method wcf\\data\\DatabaseObjectList\:\:getAttachmentList\(\)\.$#'
message: '#^Call to an undefined method wcf\\data\\DatabaseObjectList<wcf\\data\\DatabaseObject>\:\:getAttachmentList\(\)\.$#'
identifier: method.notFound
count: 1
path: wcfsetup/install/files/lib/system/message/QuickReplyManager.class.php
Expand Down Expand Up @@ -1293,13 +1257,13 @@ parameters:
-
message: '#^Call to function assert\(\) with true will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
count: 2
path: wcfsetup/install/files/lib/system/package/plugin/ACPMenuPackageInstallationPlugin.class.php

-
message: '#^Instanceof between DOMElement and DOMElement will always evaluate to true\.$#'
identifier: instanceof.alwaysTrue
count: 1
count: 2
path: wcfsetup/install/files/lib/system/package/plugin/ACPMenuPackageInstallationPlugin.class.php

-
Expand All @@ -1311,13 +1275,13 @@ parameters:
-
message: '#^Call to function assert\(\) with true will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
count: 2
path: wcfsetup/install/files/lib/system/package/plugin/UserMenuPackageInstallationPlugin.class.php

-
message: '#^Instanceof between DOMElement and DOMElement will always evaluate to true\.$#'
identifier: instanceof.alwaysTrue
count: 1
count: 2
path: wcfsetup/install/files/lib/system/package/plugin/UserMenuPackageInstallationPlugin.class.php

-
Expand Down
3 changes: 2 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ includes:
- phpstan-baseline.neon

parameters:
level: 5
level: 6
paths:
- wcfsetup/install/files
excludePaths:
Expand All @@ -12,6 +12,7 @@ parameters:
- constants.php
ignoreErrors:
- identifier: match.unhandled
- identifier: method.unused
- identifier: new.static
- identifier: trait.unused
universalObjectCratesClasses:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
final class DashboardConfigureAction implements RequestHandlerInterface
{
private AcpDashboard $dashboard;

/**
* @var array<string, array{
* boxName: string,
* userID: int,
* enabled: int,
* showOrder: int,
* }>
*/
private array $userConfiguration;

public function __construct()
Expand Down Expand Up @@ -88,6 +97,9 @@ private function getForm(): Psr15DialogForm
return $form;
}

/**
* @return list<string>
*/
private function getSelectedBoxNames(): array
{
$selectedBoxNames = [];
Expand All @@ -111,6 +123,9 @@ private function getConfigurationFormField(): MultipleSelectionFormField
};
}

/**
* @return array<string, string>
*/
private function getBoxOptions(): array
{
$options = [];
Expand All @@ -123,6 +138,9 @@ private function getBoxOptions(): array
return $options;
}

/**
* @param array<string, string> &$options
*/
private function sortBoxOptions(array &$options): void
{
\uksort($options, function (string $boxNameA, string $boxNameB) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class FullLogoutAction extends LogoutAction
/**
* @inheritDoc
*/
public function execute()
public function execute(): RedirectResponse
{
AbstractSecureAction::execute();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public function handle(ServerRequestInterface $request): ResponseInterface
}
}

/**
* @param Tag[] $tags
*/
private function getForm(array $tags): Psr15DialogForm
{
$form = new Psr15DialogForm(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function readParameters()
}
}

public function execute()
public function execute(): ResponseInterface
{
parent::execute();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace wcf\acp\action;

use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;
use wcf\action\AbstractAction;
use wcf\data\package\PackageCache;
use wcf\data\user\cover\photo\DefaultUserCoverPhoto;
Expand Down Expand Up @@ -35,7 +36,7 @@ final class UserExportGdprAction extends AbstractAction
/**
* export data
*
* @var array
* @var mixed[]
*/
public $data = [];

Expand Down Expand Up @@ -149,7 +150,7 @@ public function readParameters()
/**
* @inheritDoc
*/
public function execute()
public function execute(): ResponseInterface
{
// you MUST NOT use the `execute` event to provide data, use `export` (see below) instead!
parent::execute();
Expand Down Expand Up @@ -249,7 +250,7 @@ public function execute()
* @param string $ipAddressColumn
* @param string $timeColumn
* @param string $userIDColumn
* @return array
* @return mixed[]
*/
public function exportIpAddresses($databaseTable, $ipAddressColumn, $timeColumn, $userIDColumn)
{
Expand All @@ -263,6 +264,11 @@ public function exportIpAddresses($databaseTable, $ipAddressColumn, $timeColumn,
return $this->fetchIpAddresses($statement, $ipAddressColumn, $timeColumn);
}

/**
* @param string $tableName
* @param string $userIDColumn
* @return mixed[]
*/
protected function dumpTable($tableName, $userIDColumn)
{
$sql = "SELECT *
Expand All @@ -279,6 +285,11 @@ protected function dumpTable($tableName, $userIDColumn)
return $data;
}

/**
* @param string $ipAddressColumn
* @param string $timeColumn
* @return array{ipAddress: string, time: mixed}[]
*/
protected function fetchIpAddresses(PreparedStatement $statement, $ipAddressColumn, $timeColumn)
{
$ipAddresses = [];
Expand All @@ -297,6 +308,9 @@ protected function fetchIpAddresses(PreparedStatement $statement, $ipAddressColu
return $ipAddresses;
}

/**
* @return array{session: mixed[], acpSessionLog: mixed[]}
*/
protected function exportSessionIpAddresses()
{
$data = [
Expand All @@ -323,6 +337,9 @@ protected function exportSessionIpAddresses()
return $data;
}

/**
* @return array<string, mixed>
*/
protected function exportUser()
{
$data = ['languageCode' => $this->user->getLanguage()->getFixedLanguageCode()];
Expand Down Expand Up @@ -351,6 +368,9 @@ protected function exportUser()
return $data;
}

/**
* @return mixed[]
*/
protected function exportUserOptions()
{
$optionHandler = new UserOptionHandler(false, '', '');
Expand All @@ -365,6 +385,11 @@ protected function exportUserOptions()
return $data;
}

/**
* @param mixed[] &$data
* @param mixed[] $optionTree
* @return void
*/
protected function exportUserOptionCategory(array &$data, array $optionTree)
{
if (!empty($optionTree['options'])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function readParameters()
/**
* @inheritDoc
*/
public function execute()
public function execute(): RedirectResponse
{
ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.user.search');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class WorkerProxyAction extends AJAXInvokeAction

/**
* parameters for worker action
* @var array
* @var array<string, mixed>
*/
protected $parameters = [];

Expand All @@ -42,6 +42,9 @@ final class WorkerProxyAction extends AJAXInvokeAction
*/
protected $worker;

/**
* @var string[]
*/
public static $allowInvoke = [];

/**
Expand All @@ -66,6 +69,8 @@ public function readParameters()

/**
* Validates class name.
*
* @return void
*/
protected function validate()
{
Expand Down Expand Up @@ -112,8 +117,9 @@ public function execute()
* Sends a JSON-encoded response.
*
* @param int $progress
* @param array $parameters
* @param ?array<string, mixed> $parameters
* @param string $proceedURL
* @return void
*/
protected function sendResponse($progress = 0, ?array $parameters = null, $proceedURL = '')
{
Expand Down
Loading