Released Rector 0.12.21
New RectorConfig
to configure your rector.php
Without Effort!
Before
use Rector\Core\Configuration\Option;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PARALLEL, true);
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
$services = $containerConfigurator->services();
$services->set(TypedPropertyRector::class);
};
Now
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\Config\RectorConfig;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->parallel();
$rectorConfig->importNames();
$rectorConfig->rule(TypedPropertyRector::class);
};
New Features 🎉
- Add new rule to add explicit public scope to unscoped class methods (#2022), Thanks @Firehed!
- [Transform] Add FileGetContentsAndJsonDecodeToStaticCallRector (#2059)
- Add VarAnnotationIncorrectNullableRector for fixing incorrect null type in @var (#2053), Thanks @dorrogeray!
- Add ReturnAnnotationIncorrectNullableRector for fixing incorrect null type in @return (#2060), Thanks @dorrogeray!
- [TypeDeclaration] Make TypedPropertyFromAssignsRector configurable with INLINE_PUBLIC (#2052), Thanks @samsonasik!
- Add ParamAnnotationIncorrectNullableRector for fixing incorrect null type in @param (#2069), Thanks @dorrogeray!
- Add configurable InlineSimplePropertyAnnotationRector for inlining of simple annotations (#2070), Thanks @dorrogeray!
- [Php74] Handle standalone false on php >=8 feature enabled on TypedPropertyRector (#2084), Thanks @samsonasik!
Bugfixes 🐛
- [Strict] Skip ArrayDimFetch on DisallowedEmptyRuleFixerRector (#2023), Thanks @samsonasik!
- [TypeDeclaration] Skip default type value different with type assigned (#2027), Thanks @samsonasik!
- [Php74] Skip array var type filled default null in __construct on TypedPropertyRector (#2029), Thanks @samsonasik!
- [Php74] Skip by ref used by inner Closure use on ClosureToArrowFunctionRector (#2031), Thanks @samsonasik!
- [Naming] Add Closure and Function_ on RenameParamToMatchTypeRector (#2042), Thanks @samsonasik!
- [Php56] Skip with coalesce assign on AddDefaultValueForUndefinedVariableRector (#2078), Thanks @samsonasik!
- [Php81] Skip multiple assign on __construct on ReadOnlyPropertyRector (#2088), Thanks @samsonasik!
Changes 📊
- [DX] Replace global BetterStandardPrinter from AbstractRector with autowired NodePrinterInterface for easier and specific re-use (#2036)
- Move RemovedAndAddedFilesCollector, ParameterProvider from AbstractRector to rules that actually use it (#2038)
- [DX] Remove deprecated attributes (#2039)
- Merge SimplifyDuplicatedTernaryRector to UnnecessaryTernaryExpressionRector, almost identical rule (#2046)
- Merge InArrayAndArrayKeysToArrayKeyExistsRector to ArrayKeysAndInArrayToArrayKeyExistsRector with almost identical behavior (#2047)
- Merge FollowRequireByDirRector to almost identical AbsolutizeRequireAndIncludePathRector (#2048)
- [build] fix tagging on release (rectorphp/rector-src@4519646)