From: Tim Düsterhus Date: Mon, 24 Jul 2023 13:34:46 +0000 (+0200) Subject: Fix PHP codestyle X-Git-Tag: 6.0.0_Alpha_8~65 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=01df1aad002b6bfb3bc283a69d3e7b3aa7d2d899;p=GitHub%2FWoltLab%2FWCF.git Fix PHP codestyle --- diff --git a/wcfsetup/install/files/acp/install_com.woltlab.wcf_step2.php b/wcfsetup/install/files/acp/install_com.woltlab.wcf_step2.php index 0ddf46f2c7..7f0455495b 100644 --- a/wcfsetup/install/files/acp/install_com.woltlab.wcf_step2.php +++ b/wcfsetup/install/files/acp/install_com.woltlab.wcf_step2.php @@ -8,7 +8,6 @@ use wcf\data\user\UserEditor; use wcf\data\user\UserProfileAction; use wcf\system\image\adapter\ImagickImageAdapter; use wcf\system\WCF; -use wcf\util\StringUtil; // set default landing page $sql = "UPDATE wcf1_application diff --git a/wcfsetup/install/files/lib/acp/form/DevtoolsProjectAddForm.class.php b/wcfsetup/install/files/lib/acp/form/DevtoolsProjectAddForm.class.php index e20eac90c3..fee232bc53 100644 --- a/wcfsetup/install/files/lib/acp/form/DevtoolsProjectAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/DevtoolsProjectAddForm.class.php @@ -232,7 +232,7 @@ class DevtoolsProjectAddForm extends AbstractFormBuilderForm })), TemplateFormNode::create('pathPasteHelper') ->application('wcf') - ->templateName('__devtoolsProjectPathPasteHelper') + ->templateName('__devtoolsProjectPathPasteHelper'), ]); $dataTab->appendChild($dataContainer); diff --git a/wcfsetup/install/files/lib/acp/form/FirstTimeSetupLicenseForm.class.php b/wcfsetup/install/files/lib/acp/form/FirstTimeSetupLicenseForm.class.php index facfe5c643..dc566a5508 100644 --- a/wcfsetup/install/files/lib/acp/form/FirstTimeSetupLicenseForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/FirstTimeSetupLicenseForm.class.php @@ -129,6 +129,7 @@ final class FirstTimeSetupLicenseForm extends AbstractFormBuilderForm ); $response = HttpFactory::makeClientWithTimeout(5)->send($request); + return (new MapperBuilder()) ->allowSuperfluousKeys() ->mapper() diff --git a/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php index ef92ab2676..47ef8929ac 100644 --- a/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php @@ -181,7 +181,7 @@ class LanguageAddForm extends AbstractFormBuilderForm )); $this->form->getDataHandler()->addProcessor(new CustomFormDataProcessor( 'sourceLanguage', - function (IFormDocument $document, array $parameters) { + static function (IFormDocument $document, array $parameters) { if ($document->getFormMode() !== IFormDocument::FORM_MODE_CREATE) { return $parameters; } diff --git a/wcfsetup/install/files/lib/data/style/Style.class.php b/wcfsetup/install/files/lib/data/style/Style.class.php index 344968c34b..a9349f8d82 100644 --- a/wcfsetup/install/files/lib/data/style/Style.class.php +++ b/wcfsetup/install/files/lib/data/style/Style.class.php @@ -219,7 +219,6 @@ class Style extends DatabaseObject $this->variables['wcfPageThemeColor'] = $this->variables['wcfHeaderBackground']; } if ($this->hasDarkMode && empty($this->variables[self::DARK_MODE_PREFIX . 'wcfPageThemeColor'])) { - $this->variables[self::DARK_MODE_PREFIX . 'wcfPageThemeColor'] = $this->variables[self::DARK_MODE_PREFIX . 'wcfHeaderBackground']; } diff --git a/wcfsetup/install/files/lib/data/user/rank/I18nUserRankList.class.php b/wcfsetup/install/files/lib/data/user/rank/I18nUserRankList.class.php index 9207f6c8c2..7ea78a4ab7 100644 --- a/wcfsetup/install/files/lib/data/user/rank/I18nUserRankList.class.php +++ b/wcfsetup/install/files/lib/data/user/rank/I18nUserRankList.class.php @@ -3,7 +3,6 @@ namespace wcf\data\user\rank; use wcf\data\I18nDatabaseObjectList; -use wcf\data\user\rank\UserRank; /** * I18n implementation of user rank list. diff --git a/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php index a671b712e6..6d108c1d16 100644 --- a/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php @@ -73,7 +73,6 @@ final class AttachmentBBCode extends AbstractBBCode // TODO: Remove this. $width = 'auto'; - if ($thumbnail) { return $this->showImageAsThumbnail( $attachment, diff --git a/wcfsetup/install/files/lib/system/category/ArticleCategoryType.class.php b/wcfsetup/install/files/lib/system/category/ArticleCategoryType.class.php index a7da0447f4..49ec598a09 100644 --- a/wcfsetup/install/files/lib/system/category/ArticleCategoryType.class.php +++ b/wcfsetup/install/files/lib/system/category/ArticleCategoryType.class.php @@ -3,7 +3,6 @@ namespace wcf\system\category; use wcf\data\article\ArticleAction; -use wcf\data\article\ArticleList; use wcf\data\category\CategoryEditor; use wcf\system\WCF; diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php index cb1362e6de..e6f1178f26 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php @@ -9,7 +9,6 @@ use wcf\system\bbcode\HtmlBBCodeParser; use wcf\system\html\node\AbstractHtmlNodeProcessor; use wcf\util\DOMUtil; use wcf\util\JSON; -use wcf\util\StringUtil; /** * Processes `` to handle embedded attachments. @@ -274,10 +273,10 @@ class HtmlInputNodeImg extends AbstractHtmlInputNode // of the resize operation. if ($element->parentNode->nodeName === 'figure') { $this->mirrorWidthAttribute($element->parentNode); + return; } - $width = $element->getAttribute("data-width"); if ($width && $width !== "100%") { $style = $element->getAttribute("style"); diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php index 4e59b20200..045009d8f7 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php @@ -421,7 +421,7 @@ class HtmlInputNodeTextParser protected function parseURL(\DOMText $text, $value, $allowURL, $allowMedia) { return \preg_replace_callback( - "#(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))#iS", + "#(?i)\\b((?:https?://|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))#iS", function ($matches) use ($text, $allowURL, $allowMedia) { $link = $matches[0]; diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php index 1676923e7f..1009f83048 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php @@ -310,12 +310,12 @@ class HtmlOutputNodeProcessor extends AbstractHtmlNodeProcessor foreach ($elementsWithStyles as $element) { $style = $element->getAttribute("style"); $values = \array_map( - fn (string $value) => StringUtil::trim($value), + static fn (string $value) => StringUtil::trim($value), \explode(";", $style) ); $values = \array_filter($values, static function (string $value) { - list($keyword,) = \explode(":", $value, 2); + [$keyword] = \explode(":", $value, 2); switch (StringUtil::trim($keyword)) { case "color": diff --git a/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php index 9fdf7e357d..ac2d7013b8 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php @@ -127,7 +127,7 @@ class CronjobPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu } return new CronExpression(match ($expression) { - '@hourly' => \sprintf('%d * * * *', $engine(0, 59)), + '@hourly' => \sprintf('%d * * * *', $engine(0, 59)), '@daily' => \sprintf('%d %d * * *', $engine(0, 59), $engine(0, 23)), '@weekly' => \sprintf('%d %d * * %d', $engine(0, 59), $engine(0, 23), $engine(0, 6)), '@monthly' => \sprintf('%d %d %d * *', $engine(0, 59), $engine(0, 23), $engine(1, 28)), diff --git a/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php b/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php index aeab232ded..3098e3ce59 100644 --- a/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php +++ b/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php @@ -9,7 +9,6 @@ use wcf\system\application\ApplicationHandler; use wcf\system\exception\SystemException; use wcf\system\search\mysql\MysqlSearchIndexManager; use wcf\system\SingletonFactory; -use wcf\util\StringUtil; /** * Manages the search index. diff --git a/wcfsetup/install/files/lib/system/template/plugin/TimeFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/TimeFunctionTemplatePlugin.class.php index fccdc3effe..40928cb158 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/TimeFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/TimeFunctionTemplatePlugin.class.php @@ -37,10 +37,10 @@ final class TimeFunctionTemplatePlugin implements IFunctionTemplatePlugin if ($time instanceof \DateTimeImmutable) { $dateTime = $time; - } else if ($time instanceof \DateTime) { + } elseif ($time instanceof \DateTime) { // Ensure we do not modify the original object. $dateTime = \DateTimeImmutable::createFromMutable($time); - } else if (\is_string($time) || \is_int($time)) { + } elseif (\is_string($time) || \is_int($time)) { $timestamp = \intval($time); $dateTime = (new \DateTimeImmutable('@' . $timestamp)); } else { diff --git a/wcfsetup/install/files/lib/system/user/event/UsernameValidating.class.php b/wcfsetup/install/files/lib/system/user/event/UsernameValidating.class.php index c14f1d2e72..00f8fc1d4b 100644 --- a/wcfsetup/install/files/lib/system/user/event/UsernameValidating.class.php +++ b/wcfsetup/install/files/lib/system/user/event/UsernameValidating.class.php @@ -8,7 +8,7 @@ use wcf\system\event\TInterruptableEvent; /** * Indicates that a username is currently validated. If this event * is interrupted, the username is considered to be invalid. - * + * * This event will not be fired for usernames changed by an administrator. * * @author Tim Duesterhus diff --git a/wcfsetup/install/files/lib/system/user/notification/event/AbstractCommentResponseUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/AbstractCommentResponseUserNotificationEvent.class.php index 8845425c47..1c52ff80bb 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/AbstractCommentResponseUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/AbstractCommentResponseUserNotificationEvent.class.php @@ -76,10 +76,10 @@ abstract class AbstractCommentResponseUserNotificationEvent extends AbstractShar /** * Returns the name of the type to which the comment belong. */ - protected abstract function getTypeName(): string; + abstract protected function getTypeName(): string; /** * Returns the title of the object to which the comment belong. */ - protected abstract function getObjectTitle(): string; + abstract protected function getObjectTitle(): string; } diff --git a/wcfsetup/install/files/lib/system/user/notification/event/AbstractCommentUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/AbstractCommentUserNotificationEvent.class.php index 5eb5360a5c..77b91070b1 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/AbstractCommentUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/AbstractCommentUserNotificationEvent.class.php @@ -57,10 +57,10 @@ abstract class AbstractCommentUserNotificationEvent extends AbstractSharedUserNo /** * Returns the name of the type to which the comment belong. */ - protected abstract function getTypeName(): string; + abstract protected function getTypeName(): string; /** * Returns the title of the object to which the comment belong. */ - protected abstract function getObjectTitle(): string; + abstract protected function getObjectTitle(): string; } diff --git a/wcfsetup/install/files/lib/util/DOMUtil.class.php b/wcfsetup/install/files/lib/util/DOMUtil.class.php index f730bad668..df7893f7a3 100644 --- a/wcfsetup/install/files/lib/util/DOMUtil.class.php +++ b/wcfsetup/install/files/lib/util/DOMUtil.class.php @@ -2,8 +2,6 @@ namespace wcf\util; -use wcf\system\exception\SystemException; - /** * Provides helper methods to work with PHP's DOM implementation. * diff --git a/wcfsetup/install/files/lib/util/UserRegistrationUtil.class.php b/wcfsetup/install/files/lib/util/UserRegistrationUtil.class.php index d31e9d3217..c1d5a4ad20 100644 --- a/wcfsetup/install/files/lib/util/UserRegistrationUtil.class.php +++ b/wcfsetup/install/files/lib/util/UserRegistrationUtil.class.php @@ -2,7 +2,6 @@ namespace wcf\util; -use Spoofchecker; use wcf\system\event\EventHandler; use wcf\system\user\event\UsernameValidating;