Skip to content

Commit 0632172

Browse files
committed
Fix level 1 errors
1 parent 92145b7 commit 0632172

File tree

76 files changed

+352
-143
lines changed

Some content is hidden

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

76 files changed

+352
-143
lines changed

constants.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,7 @@
225225
\define('FORMATTING_REMOVE_COLOR', 1);
226226
\define('FORMATTING_REMOVE_FONT', 1);
227227
\define('FORMATTING_REMOVE_SIZE', 1);
228+
\define('URL_UNFURLING_SAVE_IMAGES', 1);
229+
\define('SERVICE_WORKER_PRIVATE_KEY', '');
230+
\define('SERVICE_WORKER_PUBLIC_KEY', '');
231+
\define('RECAPTCHA_PRIVATEKEY_V3', '');

phpstan-baseline.neon

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Variable \$this might not be defined\.$#'
5+
identifier: variable.undefined
6+
count: 1
7+
path: wcfsetup/install/files/acp/update_com.woltlab.wcf_6.1_spider_step1.php
8+
9+
-
10+
message: '#^Constructor of class wcf\\data\\clipboard\\item\\ClipboardItemAction has an unused parameter \$objects\.$#'
11+
identifier: constructor.unusedParameter
12+
count: 1
13+
path: wcfsetup/install/files/lib/data/clipboard/item/ClipboardItemAction.class.php
14+
15+
-
16+
message: '#^Call to static method error\(\) on an unknown class phpline\\internal\\Log\.$#'
17+
identifier: class.notFound
18+
count: 3
19+
path: wcfsetup/install/files/lib/system/CLIWCF.class.php
20+
21+
-
22+
message: '#^Call to static method get\(\) on an unknown class phpline\\TerminalFactory\.$#'
23+
identifier: class.notFound
24+
count: 1
25+
path: wcfsetup/install/files/lib/system/CLIWCF.class.php
26+
27+
-
28+
message: '#^Call to static method warn\(\) on an unknown class phpline\\internal\\Log\.$#'
29+
identifier: class.notFound
30+
count: 1
31+
path: wcfsetup/install/files/lib/system/CLIWCF.class.php
32+
33+
-
34+
message: '#^Constant VERBOSITY not found\.$#'
35+
identifier: constant.notFound
36+
count: 1
37+
path: wcfsetup/install/files/lib/system/CLIWCF.class.php
38+
39+
-
40+
message: '#^Instantiated class phpline\\console\\ConsoleReader not found\.$#'
41+
identifier: class.notFound
42+
count: 1
43+
path: wcfsetup/install/files/lib/system/CLIWCF.class.php
44+
45+
-
46+
message: '#^Instantiated class phpline\\console\\history\\MemoryHistory not found\.$#'
47+
identifier: class.notFound
48+
count: 1
49+
path: wcfsetup/install/files/lib/system/CLIWCF.class.php
50+
51+
-
52+
message: '#^Constant INSTALL_SCRIPT not found\.$#'
53+
identifier: constant.notFound
54+
count: 1
55+
path: wcfsetup/install/files/lib/system/WCFSetup.class.php
56+
57+
-
58+
message: '#^Constant INSTALL_SCRIPT_DIR not found\.$#'
59+
identifier: constant.notFound
60+
count: 5
61+
path: wcfsetup/install/files/lib/system/WCFSetup.class.php
62+
63+
-
64+
message: '#^Constant SETUP_FILE not found\.$#'
65+
identifier: constant.notFound
66+
count: 3
67+
path: wcfsetup/install/files/lib/system/WCFSetup.class.php
68+
69+
-
70+
message: '#^Constant TMP_FILE_PREFIX not found\.$#'
71+
identifier: constant.notFound
72+
count: 5
73+
path: wcfsetup/install/files/lib/system/WCFSetup.class.php
74+
75+
-
76+
message: '#^Call to static method info\(\) on an unknown class phpline\\internal\\Log\.$#'
77+
identifier: class.notFound
78+
count: 2
79+
path: wcfsetup/install/files/lib/system/cli/command/CLICommandHandler.class.php
80+
81+
-
82+
message: '#^Call to static method debug\(\) on an unknown class phpline\\internal\\Log\.$#'
83+
identifier: class.notFound
84+
count: 1
85+
path: wcfsetup/install/files/lib/system/cli/command/WorkerCLICommand.class.php
86+
87+
-
88+
message: '#^Call to static method info\(\) on an unknown class phpline\\internal\\Log\.$#'
89+
identifier: class.notFound
90+
count: 2
91+
path: wcfsetup/install/files/lib/system/cli/command/WorkerCLICommand.class.php
92+
93+
-
94+
message: '#^Constructor of class wcf\\system\\exception\\ErrorException has an unused parameter \$filename\.$#'
95+
identifier: constructor.unusedParameter
96+
count: 1
97+
path: wcfsetup/install/files/lib/system/exception/ErrorException.class.php
98+
99+
-
100+
message: '#^Constructor of class wcf\\system\\exception\\ErrorException has an unused parameter \$lineno\.$#'
101+
identifier: constructor.unusedParameter
102+
count: 1
103+
path: wcfsetup/install/files/lib/system/exception/ErrorException.class.php
104+
105+
-
106+
message: '#^Call to an undefined method wcf\\system\\form\\builder\\container\\wysiwyg\\WysiwygFormContainer\:\:addValidationError\(\)\.$#'
107+
identifier: method.notFound
108+
count: 2
109+
path: wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/WysiwygFormContainer.class.php
110+
111+
-
112+
message: '#^Method wcf\\system\\package\\plugin\\LanguagePackageInstallationPlugin\:\:getEmptyXml\(\) invoked with 0 parameters, 1 required\.$#'
113+
identifier: arguments.count
114+
count: 1
115+
path: wcfsetup/install/files/lib/system/package/plugin/LanguagePackageInstallationPlugin.class.php
116+
117+
-
118+
message: '#^Call to static method stripAnsi\(\) on an unknown class phpline\\internal\\AnsiUtil\.$#'
119+
identifier: class.notFound
120+
count: 3
121+
path: wcfsetup/install/files/lib/util/CLIUtil.class.php

phpstan.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
14
parameters:
25
level: 1
36
paths:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
use Psr\Http\Message\ServerRequestInterface;
88
use Psr\Http\Server\RequestHandlerInterface;
99
use wcf\acp\form\FirstTimeSetupLicenseForm;
10+
use wcf\acp\form\FirstTimeSetupOptionsEmailForm;
1011
use wcf\acp\form\FirstTimeSetupOptionsForm;
12+
use wcf\acp\page\FirstTimeSetupCompletedPage;
1113
use wcf\system\request\LinkHandler;
1214
use wcf\system\WCF;
1315

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use GuzzleHttp\Exception\ConnectException;
66
use Psr\Http\Client\ClientExceptionInterface;
7+
use wcf\acp\action\FirstTimeSetupAction;
78
use wcf\data\option\Option;
89
use wcf\data\option\OptionAction;
910
use wcf\data\package\update\server\PackageUpdateServerAction;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace wcf\acp\form;
44

5+
use wcf\acp\action\FirstTimeSetupAction;
56
use wcf\data\option\Option;
67
use wcf\data\option\OptionAction;
78
use wcf\system\exception\PermissionDeniedException;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace wcf\acp\form;
44

5+
use wcf\acp\action\FirstTimeSetupAction;
56
use wcf\data\option\Option;
67
use wcf\data\option\OptionAction;
78
use wcf\system\exception\PermissionDeniedException;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class UserTrophyAddForm extends AbstractAcpForm
4242

4343
/**
4444
* usernames (comma separated)
45-
* @var string[]
45+
* @var string
4646
*/
4747
public $user = '';
4848

@@ -146,7 +146,7 @@ protected function validateUser()
146146
}
147147
}
148148

149-
if (!empty($error)) {
149+
if ($error !== []) {
150150
throw new UserInputException('user', $error);
151151
}
152152
}

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

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@
1515
*/
1616
abstract class DatabaseObjectEditor extends DatabaseObjectDecorator implements IEditableObject
1717
{
18-
use TFastCreate {
19-
TFastCreate::fastCreate as private dboEditorCreateBase;
20-
}
21-
2218
/**
2319
* @inheritDoc
2420
*/
2521
public static function create(array $parameters = [])
2622
{
27-
return new static::$baseClass(static::dboEditorCreateBase($parameters));
23+
return new static::$baseClass(static::fastCreate($parameters));
2824
}
2925

3026
/**
@@ -137,4 +133,39 @@ public static function createOrIgnore(array $parameters = [])
137133
throw $e;
138134
}
139135
}
136+
137+
/**
138+
* Creates the object and returns the ID.
139+
*/
140+
public static function fastCreate(array $parameters): int|string
141+
{
142+
$keys = $values = '';
143+
$statementParameters = [];
144+
foreach ($parameters as $key => $value) {
145+
if (!empty($keys)) {
146+
$keys .= ',';
147+
$values .= ',';
148+
}
149+
150+
$keys .= $key;
151+
$values .= '?';
152+
$statementParameters[] = $value;
153+
}
154+
155+
// save object
156+
$sql = "INSERT INTO " . static::getDatabaseTableName() . "
157+
(" . $keys . ")
158+
VALUES (" . $values . ")";
159+
$statement = WCF::getDB()->prepare($sql);
160+
$statement->execute($statementParameters);
161+
162+
// return new object
163+
if (static::getDatabaseTableIndexIsIdentity()) {
164+
$id = WCF::getDB()->getInsertID(static::getDatabaseTableName(), static::getDatabaseTableIndexName());
165+
} else {
166+
$id = $parameters[static::getDatabaseTableIndexName()];
167+
}
168+
169+
return $id;
170+
}
140171
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* @copyright 2001-2019 WoltLab GmbH
1010
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
1111
* @since 3.0
12+
* @property-read string $options
1213
*/
1314
trait TDatabaseObjectOptions
1415
{

0 commit comments

Comments
 (0)