Skip to content

Commit 4665aea

Browse files
author
ityaozm@gmail.com
committed
refactor(helpers): Remove unused console helper functions
- Eliminate `clear_console_screen` and `str_remove_cntrl` functions as they are not in use. - Clean up the helper file to enhance readability and maintainability. - Update `rector.php` to comment out the removed functions, ensuring consistency in codebase references. - This increases overall code quality by removing redundant functions.
1 parent 306ad31 commit 4665aea

2 files changed

Lines changed: 2 additions & 24 deletions

File tree

app/Support/helpers.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Composer\Autoload\ClassLoader;
1717
use Illuminate\Support\Arr;
1818
use Illuminate\Support\Collection;
19-
use Symfony\Component\Console\Output\ConsoleOutput;
2019

2120
if (!\function_exists('App\Support\classes')) {
2221
/**
@@ -55,17 +54,6 @@ function classes(callable $filter): Collection
5554
}
5655
}
5756

58-
if (!\function_exists('App\Support\clear_console_screen')) {
59-
function clear_console_screen(): void
60-
{
61-
if (!app()->runningInConsole()) {
62-
return;
63-
}
64-
65-
(new ConsoleOutput)->write("\033\143");
66-
}
67-
}
68-
6957
if (!\function_exists('App\Support\make')) {
7058
/**
7159
* @see https://github.com/laravel/framework/blob/12.x/src/Illuminate/Foundation/helpers.php
@@ -110,13 +98,3 @@ function make(array|string $name, array $parameters = []): mixed
11098
));
11199
}
112100
}
113-
114-
if (!\function_exists('App\Support\str_remove_cntrl')) {
115-
/**
116-
* Remove control character.
117-
*/
118-
function str_remove_cntrl(string $str): string
119-
{
120-
return preg_replace('/[[:cntrl:]]/mu', '', $str);
121-
}
122-
}

rector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ classes(
211211
] + array_reduce(
212212
[
213213
'classes',
214-
'clear_console_screen',
214+
// 'clear_console_screen',
215215
'make',
216-
'str_remove_cntrl',
216+
// 'str_remove_cntrl',
217217
],
218218
static function (array $carry, string $func): array {
219219
/** @see https://github.com/laravel/framework/blob/11.x/src/Illuminate/Support/functions.php */

0 commit comments

Comments
 (0)