diff --git a/system/Helpers/filesystem_helper.php b/system/Helpers/filesystem_helper.php index e4e78aa82ab8..0168b7cd726a 100644 --- a/system/Helpers/filesystem_helper.php +++ b/system/Helpers/filesystem_helper.php @@ -55,7 +55,7 @@ function directory_map(string $sourceDir, int $directoryDepth = 0, bool $hidden closedir($fp); return $fileData; - } catch (Throwable $e) { + } catch (Throwable) { return []; } } @@ -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; } } @@ -180,7 +180,7 @@ function delete_files(string $path, bool $delDir = false, bool $htdocs = false, } return true; - } catch (Throwable $e) { + } catch (Throwable) { return false; } } @@ -229,7 +229,7 @@ function get_filenames( } } } - } catch (Throwable $e) { + } catch (Throwable) { return []; } @@ -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 []; } } diff --git a/system/Helpers/form_helper.php b/system/Helpers/form_helper.php index 296504f214a8..00cfb1c6085f 100644 --- a/system/Helpers/form_helper.php +++ b/system/Helpers/form_helper.php @@ -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); } @@ -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); } diff --git a/system/Helpers/html_helper.php b/system/Helpers/html_helper.php index 6d2b3b6f3c67..9806f10e9b87 100755 --- a/system/Helpers/html_helper.php +++ b/system/Helpers/html_helper.php @@ -110,7 +110,7 @@ function img($src = '', bool $indexPage = false, $attributes = ''): string $img = 'controller); - } catch (ReflectionException $e) { + } catch (ReflectionException) { throw PageNotFoundException::forControllerNotFound($this->controller, $this->method); }