|
12 | 12 |
|
13 | 13 | return static function (RectorConfig $rectorConfig): void { |
14 | 14 | $rectorConfig->import(__DIR__ . '/../config.php'); |
| 15 | + |
| 16 | + $internalFunctions = get_defined_functions()['internal']; |
| 17 | + |
15 | 18 | $rectorConfig |
16 | 19 | ->ruleWithConfiguration( |
17 | 20 | FuncCallToStaticCallRector::class, |
18 | | - [new FuncCallToStaticCall('array_add', 'Illuminate\Support\Arr', 'add'), |
19 | | - new FuncCallToStaticCall('array_collapse', 'Illuminate\Support\Arr', 'collapse'), |
20 | | - new FuncCallToStaticCall('array_divide', 'Illuminate\Support\Arr', 'divide'), |
21 | | - new FuncCallToStaticCall('array_dot', 'Illuminate\Support\Arr', 'dot'), |
22 | | - new FuncCallToStaticCall('array_except', 'Illuminate\Support\Arr', 'except'), |
23 | | - new FuncCallToStaticCall('array_first', 'Illuminate\Support\Arr', 'first'), |
24 | | - new FuncCallToStaticCall('array_flatten', 'Illuminate\Support\Arr', 'flatten'), |
25 | | - new FuncCallToStaticCall('array_forget', 'Illuminate\Support\Arr', 'forget'), |
26 | | - new FuncCallToStaticCall('array_get', 'Illuminate\Support\Arr', 'get'), |
27 | | - new FuncCallToStaticCall('array_has', 'Illuminate\Support\Arr', 'has'), |
28 | | - new FuncCallToStaticCall('array_last', 'Illuminate\Support\Arr', 'last'), |
29 | | - new FuncCallToStaticCall('array_only', 'Illuminate\Support\Arr', 'only'), |
30 | | - new FuncCallToStaticCall('array_pluck', 'Illuminate\Support\Arr', 'pluck'), |
31 | | - new FuncCallToStaticCall('array_prepend', 'Illuminate\Support\Arr', 'prepend'), |
32 | | - new FuncCallToStaticCall('array_pull', 'Illuminate\Support\Arr', 'pull'), |
33 | | - new FuncCallToStaticCall('array_random', 'Illuminate\Support\Arr', 'random'), |
34 | | - new FuncCallToStaticCall('array_sort', 'Illuminate\Support\Arr', 'sort'), |
35 | | - new FuncCallToStaticCall('array_sort_recursive', 'Illuminate\Support\Arr', 'sortRecursive'), |
36 | | - new FuncCallToStaticCall('array_where', 'Illuminate\Support\Arr', 'where'), |
37 | | - new FuncCallToStaticCall('array_wrap', 'Illuminate\Support\Arr', 'wrap'), |
38 | | - new FuncCallToStaticCall('array_set', 'Illuminate\Support\Arr', 'set'), |
39 | | - new FuncCallToStaticCall('camel_case', 'Illuminate\Support\Str', 'camel'), |
40 | | - new FuncCallToStaticCall('ends_with', 'Illuminate\Support\Str', 'endsWith'), |
41 | | - new FuncCallToStaticCall('kebab_case', 'Illuminate\Support\Str', 'kebab'), |
42 | | - new FuncCallToStaticCall('snake_case', 'Illuminate\Support\Str', 'snake'), |
43 | | - new FuncCallToStaticCall('starts_with', 'Illuminate\Support\Str', 'startsWith'), |
44 | | - new FuncCallToStaticCall('str_after', 'Illuminate\Support\Str', 'after'), |
45 | | - new FuncCallToStaticCall('str_before', 'Illuminate\Support\Str', 'before'), |
46 | | - new FuncCallToStaticCall('str_contains', 'Illuminate\Support\Str', 'contains'), |
47 | | - new FuncCallToStaticCall('str_finish', 'Illuminate\Support\Str', 'finish'), |
48 | | - new FuncCallToStaticCall('str_is', 'Illuminate\Support\Str', 'is'), |
49 | | - new FuncCallToStaticCall('str_limit', 'Illuminate\Support\Str', 'limit'), |
50 | | - new FuncCallToStaticCall('str_plural', 'Illuminate\Support\Str', 'plural'), |
51 | | - new FuncCallToStaticCall('str_random', 'Illuminate\Support\Str', 'random'), |
52 | | - new FuncCallToStaticCall('str_replace_array', 'Illuminate\Support\Str', 'replaceArray'), |
53 | | - new FuncCallToStaticCall('str_replace_first', 'Illuminate\Support\Str', 'replaceFirst'), |
54 | | - new FuncCallToStaticCall('str_replace_last', 'Illuminate\Support\Str', 'replaceLast'), |
55 | | - new FuncCallToStaticCall('str_singular', 'Illuminate\Support\Str', 'singular'), |
56 | | - new FuncCallToStaticCall('str_slug', 'Illuminate\Support\Str', 'slug'), |
57 | | - new FuncCallToStaticCall('str_start', 'Illuminate\Support\Str', 'start'), |
58 | | - new FuncCallToStaticCall('studly_case', 'Illuminate\Support\Str', 'studly'), |
59 | | - new FuncCallToStaticCall('title_case', 'Illuminate\Support\Str', 'title'), |
60 | | - ] |
| 21 | + array_filter( |
| 22 | + [ |
| 23 | + new FuncCallToStaticCall('array_add', 'Illuminate\Support\Arr', 'add'), |
| 24 | + new FuncCallToStaticCall('array_collapse', 'Illuminate\Support\Arr', 'collapse'), |
| 25 | + new FuncCallToStaticCall('array_divide', 'Illuminate\Support\Arr', 'divide'), |
| 26 | + new FuncCallToStaticCall('array_dot', 'Illuminate\Support\Arr', 'dot'), |
| 27 | + new FuncCallToStaticCall('array_except', 'Illuminate\Support\Arr', 'except'), |
| 28 | + new FuncCallToStaticCall('array_first', 'Illuminate\Support\Arr', 'first'), |
| 29 | + new FuncCallToStaticCall('array_flatten', 'Illuminate\Support\Arr', 'flatten'), |
| 30 | + new FuncCallToStaticCall('array_forget', 'Illuminate\Support\Arr', 'forget'), |
| 31 | + new FuncCallToStaticCall('array_get', 'Illuminate\Support\Arr', 'get'), |
| 32 | + new FuncCallToStaticCall('array_has', 'Illuminate\Support\Arr', 'has'), |
| 33 | + new FuncCallToStaticCall('array_last', 'Illuminate\Support\Arr', 'last'), |
| 34 | + new FuncCallToStaticCall('array_only', 'Illuminate\Support\Arr', 'only'), |
| 35 | + new FuncCallToStaticCall('array_pluck', 'Illuminate\Support\Arr', 'pluck'), |
| 36 | + new FuncCallToStaticCall('array_prepend', 'Illuminate\Support\Arr', 'prepend'), |
| 37 | + new FuncCallToStaticCall('array_pull', 'Illuminate\Support\Arr', 'pull'), |
| 38 | + new FuncCallToStaticCall('array_random', 'Illuminate\Support\Arr', 'random'), |
| 39 | + new FuncCallToStaticCall('array_sort', 'Illuminate\Support\Arr', 'sort'), |
| 40 | + new FuncCallToStaticCall('array_sort_recursive', 'Illuminate\Support\Arr', 'sortRecursive'), |
| 41 | + new FuncCallToStaticCall('array_where', 'Illuminate\Support\Arr', 'where'), |
| 42 | + new FuncCallToStaticCall('array_wrap', 'Illuminate\Support\Arr', 'wrap'), |
| 43 | + new FuncCallToStaticCall('array_set', 'Illuminate\Support\Arr', 'set'), |
| 44 | + new FuncCallToStaticCall('camel_case', 'Illuminate\Support\Str', 'camel'), |
| 45 | + new FuncCallToStaticCall('ends_with', 'Illuminate\Support\Str', 'endsWith'), |
| 46 | + new FuncCallToStaticCall('kebab_case', 'Illuminate\Support\Str', 'kebab'), |
| 47 | + new FuncCallToStaticCall('snake_case', 'Illuminate\Support\Str', 'snake'), |
| 48 | + new FuncCallToStaticCall('starts_with', 'Illuminate\Support\Str', 'startsWith'), |
| 49 | + new FuncCallToStaticCall('str_after', 'Illuminate\Support\Str', 'after'), |
| 50 | + new FuncCallToStaticCall('str_before', 'Illuminate\Support\Str', 'before'), |
| 51 | + new FuncCallToStaticCall('str_contains', 'Illuminate\Support\Str', 'contains'), |
| 52 | + new FuncCallToStaticCall('str_finish', 'Illuminate\Support\Str', 'finish'), |
| 53 | + new FuncCallToStaticCall('str_is', 'Illuminate\Support\Str', 'is'), |
| 54 | + new FuncCallToStaticCall('str_limit', 'Illuminate\Support\Str', 'limit'), |
| 55 | + new FuncCallToStaticCall('str_plural', 'Illuminate\Support\Str', 'plural'), |
| 56 | + new FuncCallToStaticCall('str_random', 'Illuminate\Support\Str', 'random'), |
| 57 | + new FuncCallToStaticCall('str_replace_array', 'Illuminate\Support\Str', 'replaceArray'), |
| 58 | + new FuncCallToStaticCall('str_replace_first', 'Illuminate\Support\Str', 'replaceFirst'), |
| 59 | + new FuncCallToStaticCall('str_replace_last', 'Illuminate\Support\Str', 'replaceLast'), |
| 60 | + new FuncCallToStaticCall('str_singular', 'Illuminate\Support\Str', 'singular'), |
| 61 | + new FuncCallToStaticCall('str_slug', 'Illuminate\Support\Str', 'slug'), |
| 62 | + new FuncCallToStaticCall('str_start', 'Illuminate\Support\Str', 'start'), |
| 63 | + new FuncCallToStaticCall('studly_case', 'Illuminate\Support\Str', 'studly'), |
| 64 | + new FuncCallToStaticCall('title_case', 'Illuminate\Support\Str', 'title'), |
| 65 | + ], |
| 66 | + fn ($function) => ! in_array($function->getOldFuncName(), $internalFunctions, true) |
| 67 | + ) |
61 | 68 | ); |
62 | 69 | }; |
0 commit comments