Skip to content

Commit 5552169

Browse files
committed
Code Style
1 parent d5ea649 commit 5552169

File tree

2 files changed

+33
-31
lines changed

2 files changed

+33
-31
lines changed

files/lib/system/form/builder/container/wysiwyg/MCI18nWysiwygFormContainer.class.php

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
use wcf\system\form\builder\TWysiwygFormNode;
2222
use wcf\system\Regex;
2323

24+
use const MODULE_SMILEY;
25+
2426
/**
2527
* i18n implementation of WysiwygFormContainer
2628
*
@@ -96,7 +98,7 @@ public static function create($id): static
9698
{
9799
// the actual id is used for the form field containing the text
98100
return parent::create($id . 'Container')
99-
->addClass('mcWysiwygContainer');
101+
->addClass('mcWysiwygContainer');
100102
}
101103

102104
/**
@@ -136,24 +138,24 @@ public function addSettingsNodes(array $settingsNodes): static
136138
*
137139
* By default, no attachment data is set.
138140
*
139-
* @throws \BadMethodCallException if the attachment form field has already been initialized
141+
* @throws BadMethodCallException if the attachment form field has already been initialized
140142
*/
141143
public function attachmentData(?string $objectType = null, int $parentObjectID = 0): static
142144
{
143145
if (isset($this->attachmentField)) {
144-
throw new \BadMethodCallException("The attachment form field '{$this->getId()}' has already been initialized. Use the atatchment form field directly to manipulate attachment data.");
146+
throw new BadMethodCallException("The attachment form field '{$this->getId()}' has already been initialized. Use the atatchment form field directly to manipulate attachment data.");
145147
}
146148

147149
if ($objectType === null) {
148-
unset($this->attachmentData);
150+
$this->attachmentData = null;
149151
} else {
150152
if (
151153
ObjectTypeCache::getInstance()->getObjectTypeByName(
152154
'com.woltlab.wcf.attachment.objectType',
153155
$objectType
154156
) === null
155157
) {
156-
throw new \InvalidArgumentException("Unknown attachment object type '{$objectType}' for container '{$this->getId()}'.");
158+
throw new InvalidArgumentException("Unknown attachment object type '{$objectType}' for container '{$this->getId()}'.");
157159
}
158160

159161
$this->attachmentData = [
@@ -170,12 +172,12 @@ public function attachmentData(?string $objectType = null, int $parentObjectID =
170172
*
171173
* By default, the preview button is shown.
172174
*
173-
* @throws \BadMethodCallException if the form field container has already been populated yet
175+
* @throws BadMethodCallException if the form field container has already been populated yet
174176
*/
175177
public function enablePreviewButton(bool $enablePreviewButton = true): static
176178
{
177179
if ($this->isPopulated) {
178-
throw new \BadMethodCallException(
180+
throw new BadMethodCallException(
179181
"Enabling and disabling the preview button is only possible before the form has been built for container '{$this->getId()}'."
180182
);
181183
}
@@ -188,12 +190,12 @@ public function enablePreviewButton(bool $enablePreviewButton = true): static
188190
/**
189191
* Returns the form field handling attachments.
190192
*
191-
* @throws \BadMethodCallException if the form field container has not been populated yet/form has not been built yet
193+
* @throws BadMethodCallException if the form field container has not been populated yet/form has not been built yet
192194
*/
193195
public function getAttachmentField(): MCWysiwygAttachmentFormField
194196
{
195197
if (!isset($this->attachmentField)) {
196-
throw new \BadMethodCallException(
198+
throw new BadMethodCallException(
197199
"Wysiwyg form field can only be requested after the form has been built for container '{$this->getId()}'."
198200
);
199201
}
@@ -223,12 +225,12 @@ public function getPreselect(): string
223225
/**
224226
* Returns the wysiwyg form container with all poll-related fields.
225227
*
226-
* @throws \BadMethodCallException if the form field container has not been populated yet/form has not been built yet
228+
* @throws BadMethodCallException if the form field container has not been populated yet/form has not been built yet
227229
*/
228230
public function getPollContainer(): WysiwygPollFormContainer
229231
{
230232
if (!isset($this->pollContainer)) {
231-
throw new \BadMethodCallException(
233+
throw new BadMethodCallException(
232234
"Wysiwyg form field can only be requested after the form has been built for container '{$this->getId()}'."
233235
);
234236
}
@@ -239,12 +241,12 @@ public function getPollContainer(): WysiwygPollFormContainer
239241
/**
240242
* Returns the form container for all settings-related fields.
241243
*
242-
* @throws \BadMethodCallException if the form field container has not been populated yet/form has not been built yet
244+
* @throws BadMethodCallException if the form field container has not been populated yet/form has not been built yet
243245
*/
244246
public function getSettingsContainer(): FormContainer
245247
{
246248
if (!isset($this->settingsContainer)) {
247-
throw new \BadMethodCallException(
249+
throw new BadMethodCallException(
248250
"Wysiwyg form field can only be requested after the form has been built for container '{$this->getId()}'."
249251
);
250252
}
@@ -255,12 +257,12 @@ public function getSettingsContainer(): FormContainer
255257
/**
256258
* Returns the form container for smiley categories.
257259
*
258-
* @throws \BadMethodCallException if the form field container has not been populated yet/form has not been built yet
260+
* @throws BadMethodCallException if the form field container has not been populated yet/form has not been built yet
259261
*/
260262
public function getSmiliesContainer(): WysiwygSmileyFormContainer
261263
{
262264
if (!isset($this->smiliesContainer)) {
263-
throw new \BadMethodCallException(
265+
throw new BadMethodCallException(
264266
"Smilies form field container can only be requested after the form has been built for container '{$this->getId()}'."
265267
);
266268
}
@@ -308,7 +310,7 @@ public function markAsRequired(): bool
308310
/**
309311
* Sets the message object type used by the wysiwyg form field.
310312
*
311-
* @throws \InvalidArgumentException if the given string is no message object type
313+
* @throws InvalidArgumentException if the given string is no message object type
312314
*/
313315
public function messageObjectType(string $messageObjectType): static
314316
{
@@ -318,7 +320,7 @@ public function messageObjectType(string $messageObjectType): static
318320
$messageObjectType
319321
) === null
320322
) {
321-
throw new \InvalidArgumentException(
323+
throw new InvalidArgumentException(
322324
"Unknown message object type '{$messageObjectType}' for container '{$this->getId()}'."
323325
);
324326
}
@@ -349,12 +351,12 @@ public function updatedObject(array $data, IStorableObject $object, $loadValues
349351
*
350352
* By default, no poll object type is set, thus the poll form field container is not available.
351353
*
352-
* @throws \InvalidArgumentException if the given string is no poll object type
354+
* @throws InvalidArgumentException if the given string is no poll object type
353355
*/
354356
public function pollObjectType(string $pollObjectType): static
355357
{
356358
if (ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.poll', $pollObjectType) === null) {
357-
throw new \InvalidArgumentException(
359+
throw new InvalidArgumentException(
358360
"Unknown poll object type '{$pollObjectType}' for container '{$this->getId()}'."
359361
);
360362
}
@@ -474,7 +476,7 @@ public function supportQuotes(bool $supportQuotes = true): static
474476
*/
475477
public function supportSmilies(bool $supportSmilies = true): static
476478
{
477-
if (!\MODULE_SMILEY) {
479+
if (!MODULE_SMILEY) {
478480
$supportSmilies = false;
479481
}
480482

@@ -495,7 +497,7 @@ public function supportSmilies(bool $supportSmilies = true): static
495497
public function getWysiwygField(): MCI18nWysiwygFormField
496498
{
497499
if (!isset($this->wysiwygField)) {
498-
throw new \BadMethodCallException(
500+
throw new BadMethodCallException(
499501
"Wysiwyg form field can only be requested after the form has been built for container '{$this->getId()}'."
500502
);
501503
}

files/lib/system/form/builder/field/wysiwyg/MCI18nWysiwygFormField.class.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,21 +180,21 @@ public function getLastEditTime()
180180
* @param null|string $index quote data index
181181
* @return string[]|string
182182
*
183-
* @throws \BadMethodCallException if quotes are not supported for this field
184-
* @throws \InvalidArgumentException if unknown quote data is requested
183+
* @throws BadMethodCallException if quotes are not supported for this field
184+
* @throws InvalidArgumentException if unknown quote data is requested
185185
*/
186186
public function getQuoteData($index = null)
187187
{
188188
if (!$this->supportQuotes()) {
189-
throw new \BadMethodCallException("Quotes are not supported for field '{$this->getId()}'.");
189+
throw new BadMethodCallException("Quotes are not supported for field '{$this->getId()}'.");
190190
}
191191

192192
if ($index === null) {
193193
return $this->quoteData;
194194
}
195195

196196
if (!isset($this->quoteData[$index])) {
197-
throw new \InvalidArgumentException("Unknown quote data '{$index}' for field '{$this->getId()}'.");
197+
throw new InvalidArgumentException("Unknown quote data '{$index}' for field '{$this->getId()}'.");
198198
}
199199

200200
return $this->quoteData[$index];
@@ -236,7 +236,7 @@ public function lastEditTime($lastEditTime)
236236
* @param string[] $selectors selectors for the quotable content (required keys: `container`, `messageBody`, and `messageContent`)
237237
* @return static
238238
*
239-
* @throws \InvalidArgumentException if any of the given arguments is invalid
239+
* @throws InvalidArgumentException if any of the given arguments is invalid
240240
*/
241241
public function quoteData($objectType, $actionClass, array $selectors = [])
242242
{
@@ -246,24 +246,24 @@ public function quoteData($objectType, $actionClass, array $selectors = [])
246246
$objectType
247247
) === null
248248
) {
249-
throw new \InvalidArgumentException(
249+
throw new InvalidArgumentException(
250250
"Unknown message quote object type '{$objectType}' for field '{$this->getId()}'."
251251
);
252252
}
253253

254254
if (!\class_exists($actionClass)) {
255-
throw new \InvalidArgumentException("Unknown class '{$actionClass}' for field '{$this->getId()}'.");
255+
throw new InvalidArgumentException("Unknown class '{$actionClass}' for field '{$this->getId()}'.");
256256
}
257257
if (!\is_subclass_of($actionClass, IMessageQuoteAction::class)) {
258-
throw new \InvalidArgumentException(
258+
throw new InvalidArgumentException(
259259
"'{$actionClass}' does not implement '" . IMessageQuoteAction::class . "' for field '{$this->getId()}'."
260260
);
261261
}
262262

263263
if (!empty($selectors)) {
264264
foreach (['container', 'messageBody', 'messageContent'] as $selector) {
265265
if (!isset($selectors[$selector])) {
266-
throw new \InvalidArgumentException("Missing selector '{$selector}' for field '{$this->getId()}'.");
266+
throw new InvalidArgumentException("Missing selector '{$selector}' for field '{$this->getId()}'.");
267267
}
268268
}
269269
}
@@ -745,7 +745,7 @@ public function validate(): void
745745
) {
746746
if ($this->hasPlainValue()) {
747747
$errorEmpty = true;
748-
//$this->addValidationError(new FormFieldValidationError('empty'));
748+
//$this->addValidationError(new FormFieldValidationError('empty'));
749749
} else {
750750
$errorMultilingual = true;
751751
//$this->addValidationError(new FormFieldValidationError('multilingual'));

0 commit comments

Comments
 (0)