Skip to content

Commit cabf2ed

Browse files
committed
refactor: run rector (2nd time)
1 parent b788264 commit cabf2ed

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

system/Helpers/filesystem_helper.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function directory_map(string $sourceDir, int $directoryDepth = 0, bool $hidden
5555
closedir($fp);
5656

5757
return $fileData;
58-
} catch (Throwable $e) {
58+
} catch (Throwable) {
5959
return [];
6060
}
6161
}
@@ -131,7 +131,7 @@ function write_file(string $path, string $data, string $mode = 'wb'): bool
131131
fclose($fp);
132132

133133
return is_int($result);
134-
} catch (Throwable $e) {
134+
} catch (Throwable) {
135135
return false;
136136
}
137137
}
@@ -180,7 +180,7 @@ function delete_files(string $path, bool $delDir = false, bool $htdocs = false,
180180
}
181181

182182
return true;
183-
} catch (Throwable $e) {
183+
} catch (Throwable) {
184184
return false;
185185
}
186186
}
@@ -229,7 +229,7 @@ function get_filenames(
229229
}
230230
}
231231
}
232-
} catch (Throwable $e) {
232+
} catch (Throwable) {
233233
return [];
234234
}
235235

@@ -279,7 +279,7 @@ function get_dir_file_info(string $sourceDir, bool $topLevelOnly = true, bool $r
279279
closedir($fp);
280280

281281
return $fileData;
282-
} catch (Throwable $fe) {
282+
} catch (Throwable) {
283283
return [];
284284
}
285285
}

system/Helpers/form_helper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s
3434
if (! $action) {
3535
$action = current_url(true);
3636
} // If an action is not a full URL then turn it into one
37-
elseif (strpos($action, '://') === false) {
37+
elseif (! str_contains($action, '://')) {
3838
// If an action has {locale}
39-
if (strpos($action, '{locale}') !== false) {
39+
if (str_contains($action, '{locale}')) {
4040
$action = str_replace('{locale}', Services::request()->getLocale(), $action);
4141
}
4242

@@ -63,7 +63,7 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s
6363
// Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
6464
$before = Services::filters()->getFilters()['before'];
6565

66-
if ((in_array('csrf', $before, true) || array_key_exists('csrf', $before)) && strpos($action, base_url()) !== false && ! stripos($form, 'method="get"')) {
66+
if ((in_array('csrf', $before, true) || array_key_exists('csrf', $before)) && str_contains($action, base_url()) && ! stripos($form, 'method="get"')) {
6767
$form .= csrf_field($csrfId ?? null);
6868
}
6969

system/Helpers/html_helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function img($src = '', bool $indexPage = false, $attributes = ''): string
110110
$img = '<img';
111111

112112
// Check for a relative URI
113-
if (! preg_match('#^([a-z]+:)?//#i', $src['src']) && strpos($src['src'], 'data:') !== 0) {
113+
if (! preg_match('#^([a-z]+:)?//#i', $src['src']) && ! str_starts_with($src['src'], 'data:')) {
114114
if ($indexPage === true) {
115115
$img .= ' src="' . site_url($src['src']) . '"';
116116
} else {

system/Helpers/number_helper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function number_to_size($num, int $precision = 1, ?string $locale = null)
2828
try {
2929
// @phpstan-ignore-next-line
3030
$num = 0 + str_replace(',', '', (string) $num);
31-
} catch (ErrorException $ee) {
31+
} catch (ErrorException) {
3232
// Catch "Warning: A non-numeric value encountered"
3333
return false;
3434
}
@@ -83,7 +83,7 @@ function number_to_amount($num, int $precision = 0, ?string $locale = null)
8383
try {
8484
// @phpstan-ignore-next-line
8585
$num = 0 + str_replace(',', '', $num);
86-
} catch (ErrorException $ee) {
86+
} catch (ErrorException) {
8787
return false;
8888
}
8989

system/Helpers/text_helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ function word_wrap(string $str, int $charlim = 76): string
343343
$str = preg_replace('| +|', ' ', $str);
344344

345345
// Standardize newlines
346-
if (strpos($str, "\r") !== false) {
346+
if (str_contains($str, "\r")) {
347347
$str = str_replace(["\r\n", "\r"], "\n", $str);
348348
}
349349

system/Router/AutoRouterImproved.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ private function checkParameters(): void
427427
{
428428
try {
429429
$refClass = new ReflectionClass($this->controller);
430-
} catch (ReflectionException $e) {
430+
} catch (ReflectionException) {
431431
throw PageNotFoundException::forControllerNotFound($this->controller, $this->method);
432432
}
433433

0 commit comments

Comments
 (0)