mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-01 17:00:51 +00:00
[Config] Re-enable Config SetList on rector.php (#1360)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
33c225d216
commit
9e81001c68
22
rector.php
22
rector.php
|
@ -21,17 +21,17 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$containerConfigurator->import(LevelSetList::UP_TO_PHP_80);
|
||||
|
||||
// include sets
|
||||
// $containerConfigurator->import(SetList::CODING_STYLE);
|
||||
// $containerConfigurator->import(SetList::CODING_STYLE_ADVANCED);
|
||||
// $containerConfigurator->import(SetList::CODE_QUALITY);
|
||||
// $containerConfigurator->import(SetList::DEAD_CODE);
|
||||
// $containerConfigurator->import(SetList::PRIVATIZATION);
|
||||
// $containerConfigurator->import(SetList::NAMING);
|
||||
// $containerConfigurator->import(SetList::TYPE_DECLARATION);
|
||||
// $containerConfigurator->import(SetList::EARLY_RETURN);
|
||||
// $containerConfigurator->import(SetList::TYPE_DECLARATION_STRICT);
|
||||
// $containerConfigurator->import(NetteSetList::NETTE_UTILS_CODE_QUALITY);
|
||||
// $containerConfigurator->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY);
|
||||
$containerConfigurator->import(SetList::CODING_STYLE);
|
||||
$containerConfigurator->import(SetList::CODING_STYLE_ADVANCED);
|
||||
$containerConfigurator->import(SetList::CODE_QUALITY);
|
||||
$containerConfigurator->import(SetList::DEAD_CODE);
|
||||
$containerConfigurator->import(SetList::PRIVATIZATION);
|
||||
$containerConfigurator->import(SetList::NAMING);
|
||||
$containerConfigurator->import(SetList::TYPE_DECLARATION);
|
||||
$containerConfigurator->import(SetList::EARLY_RETURN);
|
||||
$containerConfigurator->import(SetList::TYPE_DECLARATION_STRICT);
|
||||
$containerConfigurator->import(NetteSetList::NETTE_UTILS_CODE_QUALITY);
|
||||
$containerConfigurator->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY);
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_74);
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ArraySpreadInsteadOfArrayMergeRector::class);
|
||||
};
|
||||
|
|
|
@ -10,6 +10,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_81);
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ArraySpreadInsteadOfArrayMergeRector::class);
|
||||
};
|
||||
|
|
|
@ -75,7 +75,7 @@ CODE_SAMPLE
|
|||
}
|
||||
|
||||
$isAllowed = $this->isAllowed($node->class);
|
||||
$toSkip = $isAllowed && $this->isBetweenParentheses($node) !== false;
|
||||
$toSkip = $isAllowed && $this->isBetweenParentheses($node);
|
||||
if ($toSkip) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -136,10 +136,11 @@ CODE_SAMPLE
|
|||
if (! $arrayStaticType instanceof ArrayType) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ! $this->isArrayKeyTypeAllowed($arrayStaticType);
|
||||
}
|
||||
|
||||
private function isArrayKeyTypeAllowed(ArrayType $arrayStaticType): bool
|
||||
private function isArrayKeyTypeAllowed(ArrayType $arrayType): bool
|
||||
{
|
||||
$allowedKeyTypes = [IntegerType::class];
|
||||
if ($this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::ARRAY_SPREAD_STRING_KEYS)) {
|
||||
|
@ -147,7 +148,7 @@ CODE_SAMPLE
|
|||
}
|
||||
|
||||
foreach ($allowedKeyTypes as $allowedKeyType) {
|
||||
if ($arrayStaticType->getKeyType() instanceof $allowedKeyType) {
|
||||
if ($arrayType->getKeyType() instanceof $allowedKeyType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,11 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if ($node->isReadonly() || $node->props[0]->default instanceof Expr) {
|
||||
if ($node->isReadonly()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($node->props[0]->default instanceof Expr) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,9 @@ CODE_SAMPLE
|
|||
|
||||
if ($argumentFuncCallToMethodCall instanceof ArgumentFuncCallToMethodCall) {
|
||||
return $this->refactorFuncCallToMethodCall($argumentFuncCallToMethodCall, $classLike, $node);
|
||||
} elseif ($argumentFuncCallToMethodCall instanceof ArrayFuncCallToMethodCall) {
|
||||
}
|
||||
|
||||
if ($argumentFuncCallToMethodCall instanceof ArrayFuncCallToMethodCall) {
|
||||
return $this->refactorArrayFunctionToMethodCall($argumentFuncCallToMethodCall, $node, $classLike);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user