Skip to content

Instantly share code, notes, and snippets.

@ghostwriter
Created July 11, 2023 09:36
Show Gist options
  • Select an option

  • Save ghostwriter/072bead9e700aa887ed6c19ec40a88d2 to your computer and use it in GitHub Desktop.

Select an option

Save ghostwriter/072bead9e700aa887ed6c19ec40a88d2 to your computer and use it in GitHub Desktop.
<?php
declare(strict_types=1);
use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector;
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
use Rector\Config\RectorConfig;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector;
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector;
use Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
]);
$rectorConfig->rules([
StaticArrowFunctionRector::class,
StaticClosureRector::class,
AddClosureReturnTypeRector::class,
PrivatizeFinalClassPropertyRector::class,
AddArrowFunctionReturnTypeRector::class,
]);
$rectorConfig->parallel();
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/test',
]);
$rectorConfig->skip([
// possibly too detail on some cases?
CountOnNullRector::class,
// possibly null undefined on purpose?
AddDefaultValueForUndefinedVariableRector::class,
// define list of services?
StringClassNameToClassConstantRector::class,
// not a secure lib on purpose?
RandomFunctionRector::class,
// probably handle after execute?
JsonThrowOnErrorRector::class => [
__DIR__ . '/src',
],
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment