Skip to content

Commit fc57a17

Browse files
committed
update to new RectorConfig
1 parent 8fd9d0e commit fc57a17

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

rector.php

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,28 @@
55
use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector;
66
use Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector;
77
use Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector;
8-
use Rector\Core\Configuration\Option;
8+
use Rector\Config\RectorConfig;
99
use Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector;
1010
use Rector\Set\ValueObject\LevelSetList;
1111
use Rector\Set\ValueObject\SetList;
12-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
1312

14-
return static function (ContainerConfigurator $containerConfigurator): void {
15-
$containerConfigurator->import(LevelSetList::UP_TO_PHP_80);
16-
$containerConfigurator->import(SetList::CODE_QUALITY);
17-
$containerConfigurator->import(SetList::CODING_STYLE);
18-
$containerConfigurator->import(SetList::DEAD_CODE);
19-
$containerConfigurator->import(SetList::NAMING);
20-
$containerConfigurator->import(SetList::PRIVATIZATION);
21-
$containerConfigurator->import(SetList::PSR_4);
22-
$containerConfigurator->import(SetList::TYPE_DECLARATION);
23-
$containerConfigurator->import(SetList::TYPE_DECLARATION_STRICT);
24-
25-
$parameters = $containerConfigurator->parameters();
26-
$parameters->set(Option::PARALLEL, true);
27-
$parameters->set(Option::PATHS, [__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/spec']);
28-
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
13+
return static function (RectorConfig $rectorConfig): void {
14+
$rectorConfig->sets([
15+
LevelSetList::UP_TO_PHP_80,
16+
SetList::CODE_QUALITY,
17+
SetList::CODING_STYLE,
18+
SetList::DEAD_CODE,
19+
SetList::NAMING,
20+
SetList::PRIVATIZATION,
21+
SetList::PSR_4,
22+
SetList::TYPE_DECLARATION,
23+
SetList::TYPE_DECLARATION_STRICT,
24+
]);
2925

30-
$parameters->set(Option::SKIP, [
26+
$rectorConfig->parallel();
27+
$rectorConfig->paths([__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/spec', __DIR__ . '/rector.php']);
28+
$rectorConfig->importNames();
29+
$rectorConfig->skip([
3130
__DIR__ . '/src/Controller',
3231
__DIR__ . '/src/Middleware/Routed/Preview',
3332
CallableThisArrayToAnonymousFunctionRector::class,

src/HeroFunction.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ function detectMessageContentType(string $message): string
1818
: (strip_tags($message) === $message ? 'text/plain' : 'text/html');
1919
}
2020

21-
function isExcludedException(array $excludeExceptionsConfig, Throwable $t): bool
21+
function isExcludedException(array $excludeExceptionsConfig, Throwable $throwable): bool
2222
{
23-
$exceptionOrErrorClass = $t::class;
23+
$exceptionOrErrorClass = $throwable::class;
2424

2525
$isExcluded = false;
2626
foreach ($excludeExceptionsConfig as $excludeExceptionConfig) {
@@ -32,7 +32,7 @@ function isExcludedException(array $excludeExceptionsConfig, Throwable $t): bool
3232
if (
3333
is_array($excludeExceptionConfig)
3434
&& $excludeExceptionConfig[0] === $exceptionOrErrorClass
35-
&& $excludeExceptionConfig[1] === $t->getMessage()
35+
&& $excludeExceptionConfig[1] === $throwable->getMessage()
3636
) {
3737
$isExcluded = true;
3838
break;

0 commit comments

Comments
 (0)