Skip to content

Commit d3e7c16

Browse files
committed
Fix level 5 errors
1 parent 3f27d1f commit d3e7c16

File tree

113 files changed

+275
-205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+275
-205
lines changed

phpstan-baseline.neon

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ parameters:
2424
count: 1
2525
path: wcfsetup/install/files/lib/acp/form/LanguageImportForm.class.php
2626

27+
-
28+
message: '#^Parameter \#1 \$children of method wcf\\system\\form\\builder\\IFormParentNode\:\:appendChildren\(\) expects array\<wcf\\system\\form\\builder\\IFormChildNode\>, array\<int, wcf\\system\\form\\builder\\field\\PasswordFormField\|wcf\\system\\form\\builder\\field\\TextFormField\|wcf\\system\\form\\builder\\IObjectTypeFormNode\> given\.$#'
29+
identifier: argument.type
30+
count: 1
31+
path: wcfsetup/install/files/lib/acp/form/LoginForm.class.php
32+
2733
-
2834
message: '#^Property wcf\\acp\\page\\DevtoolsNotificationTestPage\:\:\$events \(array\<array\<wcf\\system\\user\\notification\\event\\ITestableUserNotificationEvent\>\>\) does not accept array\<array\<wcf\\system\\user\\notification\\event\\IUserNotificationEvent\>\>\.$#'
2935
identifier: assign.propertyType
@@ -42,6 +48,12 @@ parameters:
4248
count: 1
4349
path: wcfsetup/install/files/lib/acp/page/TemplateDiffPage.class.php
4450

51+
-
52+
message: '#^Parameter \#1 \$children of method wcf\\system\\form\\builder\\FormDocument\:\:appendChildren\(\) expects array\<wcf\\system\\form\\builder\\IFormChildNode\>, array\<int, wcf\\system\\form\\builder\\field\\user\\UsernameFormField\|wcf\\system\\form\\builder\\IObjectTypeFormNode\> given\.$#'
53+
identifier: argument.type
54+
count: 1
55+
path: wcfsetup/install/files/lib/action/GuestTokenDialogAction.class.php
56+
4557
-
4658
message: '#^Method wcf\\data\\article\\ArticleAction\:\:delete\(\) should return int but returns array\<string, array\<int\>\|string\>\.$#'
4759
identifier: return.type
@@ -90,6 +102,12 @@ parameters:
90102
count: 1
91103
path: wcfsetup/install/files/lib/data/user/notification/event/UserNotificationEventAction.class.php
92104

105+
-
106+
message: '#^Parameter \#1 \$children of method wcf\\system\\form\\builder\\container\\FormContainer\:\:appendChildren\(\) expects array\<wcf\\system\\form\\builder\\IFormChildNode\>, array\<int, wcf\\system\\form\\builder\\field\\TextFormField\|wcf\\system\\form\\builder\\IObjectTypeFormNode\> given\.$#'
107+
identifier: argument.type
108+
count: 1
109+
path: wcfsetup/install/files/lib/form/LostPasswordForm.class.php
110+
93111
-
94112
message: '#^Negated boolean expression is always true\.$#'
95113
identifier: booleanNot.alwaysTrue
@@ -108,6 +126,12 @@ parameters:
108126
count: 1
109127
path: wcfsetup/install/files/lib/page/SearchResultPage.class.php
110128

129+
-
130+
message: '#^Parameter \#1 \$className of class wcf\\system\\exception\\ImplementationException constructor expects string, false given\.$#'
131+
identifier: argument.type
132+
count: 1
133+
path: wcfsetup/install/files/lib/page/SearchResultPage.class.php
134+
111135
-
112136
message: '#^Access to an undefined property Zend\\Console\\Getopt\:\:\$exitOnFail\.$#'
113137
identifier: property.notFound
@@ -276,6 +300,12 @@ parameters:
276300
count: 1
277301
path: wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php
278302

303+
-
304+
message: '#^Parameter \#1 \$className of class wcf\\system\\exception\\ParentClassException constructor expects string, false given\.$#'
305+
identifier: argument.type
306+
count: 1
307+
path: wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php
308+
279309
-
280310
message: '#^Call to static method info\(\) on an unknown class phpline\\internal\\Log\.$#'
281311
identifier: class.notFound
@@ -378,6 +408,12 @@ parameters:
378408
count: 1
379409
path: wcfsetup/install/files/lib/system/condition/AbstractMultiSelectCondition.class.php
380410

411+
-
412+
message: '#^Parameter \#2 \$array of function implode expects array\|null, string given\.$#'
413+
identifier: argument.type
414+
count: 1
415+
path: wcfsetup/install/files/lib/system/condition/AbstractObjectTextPropertyCondition.class.php
416+
381417
-
382418
message: '#^Strict comparison using \=\=\= between array\<mixed\> and null will always evaluate to false\.$#'
383419
identifier: identical.alwaysFalse
@@ -858,12 +894,6 @@ parameters:
858894
count: 1
859895
path: wcfsetup/install/files/lib/system/form/builder/field/MultipleSelectionFormField.class.php
860896

861-
-
862-
message: '#^Instanceof between wcf\\data\\DatabaseObjectList and wcf\\data\\DatabaseObjectList will always evaluate to true\.$#'
863-
identifier: instanceof.alwaysTrue
864-
count: 1
865-
path: wcfsetup/install/files/lib/system/form/builder/field/MultipleSelectionFormField.class.php
866-
867897
-
868898
message: '#^Result of && is always false\.$#'
869899
identifier: booleanAnd.alwaysFalse
@@ -906,12 +936,6 @@ parameters:
906936
count: 1
907937
path: wcfsetup/install/files/lib/system/form/builder/field/RadioButtonFormField.class.php
908938

909-
-
910-
message: '#^Instanceof between wcf\\data\\DatabaseObjectList and wcf\\data\\DatabaseObjectList will always evaluate to true\.$#'
911-
identifier: instanceof.alwaysTrue
912-
count: 1
913-
path: wcfsetup/install/files/lib/system/form/builder/field/RadioButtonFormField.class.php
914-
915939
-
916940
message: '#^Result of && is always false\.$#'
917941
identifier: booleanAnd.alwaysFalse
@@ -930,12 +954,6 @@ parameters:
930954
count: 2
931955
path: wcfsetup/install/files/lib/system/form/builder/field/SelectFormField.class.php
932956

933-
-
934-
message: '#^Instanceof between wcf\\data\\DatabaseObjectList and wcf\\data\\DatabaseObjectList will always evaluate to true\.$#'
935-
identifier: instanceof.alwaysTrue
936-
count: 1
937-
path: wcfsetup/install/files/lib/system/form/builder/field/SelectFormField.class.php
938-
939957
-
940958
message: '#^Result of && is always false\.$#'
941959
identifier: booleanAnd.alwaysFalse
@@ -948,12 +966,6 @@ parameters:
948966
count: 2
949967
path: wcfsetup/install/files/lib/system/form/builder/field/SingleSelectionFormField.class.php
950968

951-
-
952-
message: '#^Instanceof between wcf\\data\\DatabaseObjectList and wcf\\data\\DatabaseObjectList will always evaluate to true\.$#'
953-
identifier: instanceof.alwaysTrue
954-
count: 1
955-
path: wcfsetup/install/files/lib/system/form/builder/field/SingleSelectionFormField.class.php
956-
957969
-
958970
message: '#^Result of && is always false\.$#'
959971
identifier: booleanAnd.alwaysFalse
@@ -1164,6 +1176,12 @@ parameters:
11641176
count: 1
11651177
path: wcfsetup/install/files/lib/system/io/Zip.class.php
11661178

1179+
-
1180+
message: '#^Parameter \#2 \$callback of function uasort expects callable\(wcf\\data\\label\\group\\ViewableLabelGroup, wcf\\data\\label\\group\\ViewableLabelGroup\)\: int, array\{''wcf\\\\data\\\\label\\\\group\\\\LabelGroup'', ''sortLabelGroups''\} given\.$#'
1181+
identifier: argument.type
1182+
count: 1
1183+
path: wcfsetup/install/files/lib/system/label/object/AbstractLabelObjectHandler.class.php
1184+
11671185
-
11681186
message: '#^Call to an undefined method wcf\\data\\DatabaseObjectList\:\:getAttachmentList\(\)\.$#'
11691187
identifier: method.notFound
@@ -1284,12 +1302,6 @@ parameters:
12841302
count: 1
12851303
path: wcfsetup/install/files/lib/system/package/plugin/ACPMenuPackageInstallationPlugin.class.php
12861304

1287-
-
1288-
message: '#^Instanceof between DOMElement and DOMElement will always evaluate to true\.$#'
1289-
identifier: instanceof.alwaysTrue
1290-
count: 1
1291-
path: wcfsetup/install/files/lib/system/package/plugin/LanguagePackageInstallationPlugin.class.php
1292-
12931305
-
12941306
message: '#^Method wcf\\system\\package\\plugin\\LanguagePackageInstallationPlugin\:\:getEmptyXml\(\) invoked with 0 parameters, 1 required\.$#'
12951307
identifier: arguments.count
@@ -1338,6 +1350,12 @@ parameters:
13381350
count: 3
13391351
path: wcfsetup/install/files/lib/util/CLIUtil.class.php
13401352

1353+
-
1354+
message: '#^Parameter \#1 \$iterator of class RecursiveIteratorIterator constructor expects T of IteratorAggregate\|RecursiveIterator, DirectoryIterator given\.$#'
1355+
identifier: argument.type
1356+
count: 2
1357+
path: wcfsetup/install/files/lib/util/DirectoryUtil.class.php
1358+
13411359
-
13421360
message: '#^Property wcf\\util\\DirectoryUtil\:\:\$fileObjects \(array\<DirectoryIterator\>\) does not accept array\<SplFileInfo\>\.$#'
13431361
identifier: assign.propertyType

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ includes:
22
- phpstan-baseline.neon
33

44
parameters:
5-
level: 4
5+
level: 5
66
paths:
77
- wcfsetup/install/files
88
excludePaths:

wcfsetup/install/files/lib/acp/action/LanguageItemEditAction.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ private function getForm(LanguageItem $languageItem): Psr15DialogForm
116116
MultilineTextFormField::create('languageItemValue')
117117
->label('wcf.acp.language.item.value')
118118
->rows(5)
119-
->immutable($languageItem->languageItemOriginIsSystem)
119+
->immutable((bool)$languageItem->languageItemOriginIsSystem)
120120
]),
121121
FormContainer::create('oldValueContainer')
122122
->label('wcf.acp.language.item.oldValue')
@@ -131,7 +131,7 @@ private function getForm(LanguageItem $languageItem): Psr15DialogForm
131131
]),
132132
FormContainer::create('customValueContainer')
133133
->label('wcf.acp.language.item.customValue')
134-
->available($languageItem->languageItemOriginIsSystem)
134+
->available((bool)$languageItem->languageItemOriginIsSystem)
135135
->appendChildren([
136136
BooleanFormField::create('languageUseCustomValue')
137137
->label('wcf.acp.language.item.useCustomValue'),

wcfsetup/install/files/lib/acp/form/CategoryAddFormBuilderForm.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ protected function getPositionFormFields(): array
248248
$processor->getLanguageVariable('parentCategoryID.description', true)
249249
)
250250
->options($categoryNodeTree, true)
251-
->available($this->getObjectTypeProcessor()->getMaximumNestingLevel())
251+
->available((bool)$this->getObjectTypeProcessor()->getMaximumNestingLevel())
252252
->addValidator(
253253
new FormFieldValidator(
254254
'recursion',

wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public function save()
273273
$formData = $this->form->getData();
274274
if ($formData['data']['enable']) {
275275
$this->isEnabled = true;
276-
RegistryHandler::getInstance()->set('com.woltlab.wcf', $overrideKey, \TIME_NOW);
276+
RegistryHandler::getInstance()->set('com.woltlab.wcf', $overrideKey, (string)\TIME_NOW);
277277
} else {
278278
$this->isEnabled = false;
279279
RegistryHandler::getInstance()->delete('com.woltlab.wcf', $overrideKey);

wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,14 +370,14 @@ public function validate()
370370
$statement->execute($conditionBuilder->getParameters());
371371

372372
$aliases = \explode("\n", $this->aliases);
373-
$aliases = \array_map('\mb_strtolower', $aliases);
373+
$aliases = \array_map(\mb_strtolower(...), $aliases);
374374
while ($row = $statement->fetchArray()) {
375375
$known = [];
376376
if (!empty($row['aliases'])) {
377377
$known = \explode("\n", $row['aliases']);
378378
}
379379
$known[] = $row['smileyCode'];
380-
$known = \array_map('\mb_strtolower', $known);
380+
$known = \array_map(\mb_strtolower(...), $known);
381381

382382
if (\in_array(\mb_strtolower($this->smileyCode), $known)) {
383383
throw new UserInputException('smileyCode', 'notUnique');

wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ public function validateIndividualScss()
514514
$result = StyleCompiler::getInstance()->testStyle(
515515
$this->styleTestFileDir,
516516
$this->styleName,
517-
false,
517+
'',
518518
$variables
519519
);
520520

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function readData()
3636

3737
private function markNotificationsAsRead(): void
3838
{
39-
RegistryHandler::getInstance()->set('com.woltlab.wcf', 'exceptionMailerTimestamp', TIME_NOW);
39+
RegistryHandler::getInstance()->set('com.woltlab.wcf', 'exceptionMailerTimestamp', (string)\TIME_NOW);
4040
}
4141

4242
#[\Override]

wcfsetup/install/files/lib/data/TI18nDatabaseObjectAction.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,6 @@ protected function saveI18nValue(DatabaseObject $object): void
127127
*/
128128
protected function getLanguageItem(DatabaseObject $object, string $regex): string
129129
{
130-
return \str_replace('\d+', $object->getObjectID(), $regex);
130+
return \str_replace('\d+', (string)$object->getObjectID(), $regex);
131131
}
132132
}

wcfsetup/install/files/lib/data/blacklist/entry/BlacklistEntry.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ protected static function get90Percentile($type)
126126
FROM wcf1_blacklist_entry
127127
WHERE type = ?
128128
ORDER BY occurrences DESC";
129-
$statement = WCF::getDB()->prepare($sql, 1, \round($count * 0.9));
129+
$statement = WCF::getDB()->prepare($sql, 1, (int)\round($count * 0.9));
130130
$statement->execute([$type]);
131131

132132
$percentile[$type] = $statement->fetchSingleColumn();

0 commit comments

Comments
 (0)