Skip to content

Commit

Permalink
refactor: run rector (2nd time)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Mar 16, 2024
1 parent c2c40ba commit 531f9c7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions system/Helpers/filesystem_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function directory_map(string $sourceDir, int $directoryDepth = 0, bool $hidden
closedir($fp);

return $fileData;
} catch (Throwable $e) {
} catch (Throwable) {
return [];
}
}
Expand Down Expand Up @@ -131,7 +131,7 @@ function write_file(string $path, string $data, string $mode = 'wb'): bool
fclose($fp);

return is_int($result);
} catch (Throwable $e) {
} catch (Throwable) {
return false;
}
}
Expand Down Expand Up @@ -180,7 +180,7 @@ function delete_files(string $path, bool $delDir = false, bool $htdocs = false,
}

return true;
} catch (Throwable $e) {
} catch (Throwable) {
return false;
}
}
Expand Down Expand Up @@ -229,7 +229,7 @@ function get_filenames(
}
}
}
} catch (Throwable $e) {
} catch (Throwable) {
return [];
}

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

return $fileData;
} catch (Throwable $fe) {
} catch (Throwable) {
return [];
}
}
Expand Down
6 changes: 3 additions & 3 deletions system/Helpers/form_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s
if (! $action) {
$action = current_url(true);
} // If an action is not a full URL then turn it into one
elseif (strpos($action, '://') === false) {
elseif (! str_contains($action, '://')) {
// If an action has {locale}
if (strpos($action, '{locale}') !== false) {
if (str_contains($action, '{locale}')) {
$action = str_replace('{locale}', service('request')->getLocale(), $action);
}

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

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

Expand Down
2 changes: 1 addition & 1 deletion system/Helpers/html_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function img($src = '', bool $indexPage = false, $attributes = ''): string
$img = '<img';

// Check for a relative URI
if (! preg_match('#^([a-z]+:)?//#i', $src['src']) && strpos($src['src'], 'data:') !== 0) {
if (! preg_match('#^([a-z]+:)?//#i', $src['src']) && ! str_starts_with($src['src'], 'data:')) {
if ($indexPage === true) {
$img .= ' src="' . site_url($src['src']) . '"';
} else {
Expand Down
4 changes: 2 additions & 2 deletions system/Helpers/number_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function number_to_size($num, int $precision = 1, ?string $locale = null)
try {
// @phpstan-ignore-next-line
$num = 0 + str_replace(',', '', (string) $num);
} catch (ErrorException $ee) {
} catch (ErrorException) {
// Catch "Warning: A non-numeric value encountered"
return false;
}
Expand Down Expand Up @@ -83,7 +83,7 @@ function number_to_amount($num, int $precision = 0, ?string $locale = null)
try {
// @phpstan-ignore-next-line
$num = 0 + str_replace(',', '', $num);
} catch (ErrorException $ee) {
} catch (ErrorException) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion system/Helpers/text_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ function word_wrap(string $str, int $charlim = 76): string
$str = preg_replace('| +|', ' ', $str);

// Standardize newlines
if (strpos($str, "\r") !== false) {
if (str_contains($str, "\r")) {
$str = str_replace(["\r\n", "\r"], "\n", $str);
}

Expand Down
2 changes: 1 addition & 1 deletion system/Router/AutoRouterImproved.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ private function checkParameters(): void
{
try {
$refClass = new ReflectionClass($this->controller);
} catch (ReflectionException $e) {
} catch (ReflectionException) {
throw PageNotFoundException::forControllerNotFound($this->controller, $this->method);
}

Expand Down

0 comments on commit 531f9c7

Please sign in to comment.