@@ -214,7 +214,7 @@ |
||
| 214 | 214 | // icode line |
| 215 | 215 | if (str_contains($data, '`')) |
| 216 | 216 | { |
| 217 | - return preg_replace_callback('~(?<=\W|^)`([^`]+)`(?=\W|$)~u', static function ($match) { |
|
| 217 | + return preg_replace_callback('~(?<=\W|^)`([^`]+)`(?=\W|$)~u', static function($match) { |
|
| 218 | 218 | if (str_contains($match[1], '<br />')) |
| 219 | 219 | { |
| 220 | 220 | return $match[0]; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | 'attachment_type' => 0, |
| 102 | 102 | ] |
| 103 | 103 | )->fetch_callback( |
| 104 | - static function ($row) use ($includeUnapproved, $filter, $all_posters, &$attachments) { |
|
| 104 | + static function($row) use ($includeUnapproved, $filter, $all_posters, &$attachments) { |
|
| 105 | 105 | if (!$row['approved'] && !$includeUnapproved |
| 106 | 106 | && (empty($filter) || !$filter($row, $all_posters))) |
| 107 | 107 | { |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | public function getAttachmentData(int $id_msg): array |
| 293 | 293 | { |
| 294 | - [$attachmentData,] = $this->loadAttachmentContext($id_msg); |
|
| 294 | + [$attachmentData, ] = $this->loadAttachmentContext($id_msg); |
|
| 295 | 295 | |
| 296 | 296 | return $attachmentData; |
| 297 | 297 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @return array|string Returns an array containing the unique identifier and status |
| 89 | 89 | * code on successful processing, or a string describing the error on failure. |
| 90 | 90 | */ |
| 91 | - public function saveAsyncFile(): array|string |
|
| 91 | + public function saveAsyncFile(): array | string |
|
| 92 | 92 | { |
| 93 | 93 | [$uuid, $chunkIndex, $totalChunkCount] = $this->extractPostData(); |
| 94 | 94 | $postValidationError = $this->validatePostData($uuid, $chunkIndex, $totalChunkCount); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @return string|bool Returns 'invalid_chunk' if the chunk index is invalid or 'invalid_uuid' if the UUID is not set. |
| 145 | 145 | * If the chunk and UUID are valid, it delegates the validation to the validateInitialChunk method and returns its result. |
| 146 | 146 | */ |
| 147 | - private function validatePostData(string $uuid, int $chunkIndex, int $totalChunkCount): bool|string |
|
| 147 | + private function validatePostData(string $uuid, int $chunkIndex, int $totalChunkCount): bool | string |
|
| 148 | 148 | { |
| 149 | 149 | if ($chunkIndex < 0 || $totalChunkCount < 1 || $chunkIndex >= $totalChunkCount) |
| 150 | 150 | { |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @return string|bool Returns 'chunk_quota' if the chunk quota check fails, 'not_writable' if the attachment directory is not writable. |
| 172 | 172 | * If the checks passed, it returns true. |
| 173 | 173 | */ |
| 174 | - private function validateInitialChunk(int $totalChunkCount, int $chunkIndex): bool|string |
|
| 174 | + private function validateInitialChunk(int $totalChunkCount, int $chunkIndex): bool | string |
|
| 175 | 175 | { |
| 176 | 176 | // Make sure this (when completed) file size will not exceed what we are willing to accept |
| 177 | 177 | if ($totalChunkCount === 1 || ($totalChunkCount > 1 && $chunkIndex === 0)) |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * @return int|float Returns the smaller non-zero number between $num1 and $num2. |
| 231 | 231 | * If $num1 is equal to $num2 or if both numbers are zero, returns zero. |
| 232 | 232 | */ |
| 233 | - public function getSmallerNonZero(float|int $num1, float|int $num2): float|int |
|
| 233 | + public function getSmallerNonZero(float | int $num1, float | int $num2): float | int |
|
| 234 | 234 | { |
| 235 | 235 | if (empty($num1)) |
| 236 | 236 | { |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @param string $fileID The ID of the file. Default is an empty string. |
| 258 | 258 | * @return array An associative array containing the error message, code, and file ID. |
| 259 | 259 | */ |
| 260 | - public function errorAsyncFile(int|string $code, string $fileID = ''): array |
|
| 260 | + public function errorAsyncFile(int | string $code, string $fileID = ''): array |
|
| 261 | 261 | { |
| 262 | 262 | global $txt; |
| 263 | 263 | |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | * @return string|bool Returns a string indicating the error type, |
| 294 | 294 | * or a boolean true if the file is valid. |
| 295 | 295 | */ |
| 296 | - private function validateReceivedFile(): bool|string |
|
| 296 | + private function validateReceivedFile(): bool | string |
|
| 297 | 297 | { |
| 298 | 298 | if (!$this->attachmentDirectory->hasFileTmpAttachments()) |
| 299 | 299 | { |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * |
| 339 | 339 | * @return bool|string Returns true if the chunk was written successfully, 'not_found' if the destination file was not found. |
| 340 | 340 | */ |
| 341 | - private function writeChunkToFile(string $local_file): bool|string |
|
| 341 | + private function writeChunkToFile(string $local_file): bool | string |
|
| 342 | 342 | { |
| 343 | 343 | $out = $this->attach_current_dir . '/' . $local_file; |
| 344 | 344 | $in = $_FILES['attachment']['tmp_name'][0] ?? ''; |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | // Move the file to the attachment folder with a temp name for now. |
| 352 | - set_error_handler(static function () { /* ignore warnings */ }); |
|
| 352 | + set_error_handler(static function() { /* ignore warnings */ }); |
|
| 353 | 353 | try |
| 354 | 354 | { |
| 355 | 355 | $result = move_uploaded_file($in, $out); |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | */ |
| 407 | 407 | public function action_combineChunks(): array |
| 408 | 408 | { |
| 409 | - [$uuid, , $totalChunkCount] = $this->extractPostData(); |
|
| 409 | + [$uuid,, $totalChunkCount] = $this->extractPostData(); |
|
| 410 | 410 | $user_ident = $this->getUserIdentifier(); |
| 411 | 411 | $in = $this->getPathWithChunks($user_ident, $uuid); |
| 412 | 412 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | return; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - $append = function ($item) { |
|
| 98 | + $append = function($item) { |
|
| 99 | 99 | if ($item === null || $item === '') |
| 100 | 100 | { |
| 101 | 101 | return; |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | else |
| 220 | 220 | { |
| 221 | 221 | // Move the file to the attachment folder with a temp name for now. |
| 222 | - set_error_handler(static function () { /* ignore warnings */ }); |
|
| 222 | + set_error_handler(static function() { /* ignore warnings */ }); |
|
| 223 | 223 | try |
| 224 | 224 | { |
| 225 | 225 | $result = move_uploaded_file($this->data['tmp_name'], $destName); |