|
37 | 37 | use Rector\CodingStyle\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector; |
38 | 38 | use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector; |
39 | 39 | use Rector\Config\RectorConfig; |
40 | | -use Rector\Contract\Rector\ConfigurableRectorInterface; |
41 | 40 | use Rector\DeadCode\Rector\ClassLike\RemoveAnnotationRector; |
42 | 41 | use Rector\DowngradePhp81\Rector\Array_\DowngradeArraySpreadStringKeyRector; |
43 | 42 | use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector; |
|
86 | 85 | '**/__snapshots__/*', |
87 | 86 | '**/Fixtures/*', |
88 | 87 | __DIR__.'/src/Channels/Channel.php', |
89 | | - __DIR__.'/tests/Channels/LogChannelTest.php', |
90 | | - __DIR__.'/tests/ExceptionNotifyManagerTest.php', |
91 | | - __DIR__.'/tests/FeatureTest.php', |
92 | | - __DIR__.'/tests/Fixtures/', |
93 | 88 | __FILE__, |
94 | 89 | ]) |
95 | 90 | ->withCache(__DIR__.'/.build/rector/') |
|
121 | 116 | LaravelSetList::LARAVEL_90, |
122 | 117 | ...collect((new ReflectionClass(LaravelSetList::class))->getConstants(ReflectionClassConstant::IS_PUBLIC)) |
123 | 118 | ->reject( |
124 | | - static fn ( |
125 | | - string $constant, |
126 | | - string $name |
127 | | - ): bool => \in_array($name, ['LARAVEL_STATIC_TO_INJECTION', 'LARAVEL_'], true) |
128 | | - || preg_match('/^LARAVEL_\d{2,3}$/', $name) |
| 119 | + static fn (string $constant, string $name): bool => \in_array( |
| 120 | + $name, |
| 121 | + ['LARAVEL_STATIC_TO_INJECTION', 'LARAVEL_'], |
| 122 | + true |
| 123 | + ) || preg_match('/^LARAVEL_\d{2,3}$/', $name) |
129 | 124 | ) |
130 | 125 | // ->dd() |
131 | 126 | ->values() |
|
141 | 136 | ...$classes |
142 | 137 | ->filter(static fn (string $class): bool => str_starts_with($class, 'RectorLaravel\Rector')) |
143 | 138 | ->filter(static fn (string $class): bool => (new ReflectionClass($class))->isInstantiable()) |
144 | | - // ->filter(static fn (string $class): bool => is_subclass_of($class, ConfigurableRectorInterface::class)) |
145 | 139 | ->values() |
146 | 140 | // ->dd() |
147 | 141 | ->all(), |
|
169 | 163 | ->map(static fn (string $class) => collect((new ReflectionClass($class))->getConstants(ReflectionClassConstant::IS_PUBLIC)) |
170 | 164 | ->reduce( |
171 | 165 | static function (array $carry, mixed $value, string $name) use ($class): array { |
| 166 | + $classConstFetch = new ClassConstFetch(new FullyQualified($class), new Identifier($name)); |
| 167 | + |
172 | 168 | $scalarValueToConstFetch = match (true) { |
173 | | - \is_string($value) => new ScalarValueToConstFetch( |
174 | | - new String_($value), |
175 | | - new ClassConstFetch(new FullyQualified($class), new Identifier($name)) |
176 | | - ), |
177 | | - \is_int($value) => new ScalarValueToConstFetch( |
178 | | - new Int_($value), |
179 | | - new ClassConstFetch(new FullyQualified($class), new Identifier($name)) |
180 | | - ), |
181 | | - \is_float($value) => new ScalarValueToConstFetch( |
182 | | - new Float_($value), |
183 | | - new ClassConstFetch(new FullyQualified($class), new Identifier($name)) |
184 | | - ), |
| 169 | + \is_string($value) => new ScalarValueToConstFetch(new String_($value), $classConstFetch), |
| 170 | + \is_int($value) => new ScalarValueToConstFetch(new Int_($value), $classConstFetch), |
| 171 | + \is_float($value) => new ScalarValueToConstFetch(new Float_($value), $classConstFetch), |
185 | 172 | default => null, |
186 | 173 | }; |
187 | 174 |
|
@@ -222,7 +209,7 @@ static function (array $carry, mixed $value, string $name) use ($class): array { |
222 | 209 | ->withConfiguredRule( |
223 | 210 | RenameFunctionRector::class, |
224 | 211 | [ |
225 | | - // 'faker' => 'fake', |
| 212 | + 'faker' => 'fake', |
226 | 213 | 'Guanguans\LaravelExceptionNotify\Support\rescue' => 'rescue', |
227 | 214 | 'Guanguans\Notify\Foundation\Support\rescue' => 'rescue', |
228 | 215 | 'Pest\Faker\fake' => 'fake', |
|
0 commit comments