Releases: rectorphp/rector
Releases · rectorphp/rector
Released Rector 0.15.4
New Features 🥳
- [CodingStyle] Add DataProviderArrayItemsNewlinedRector (#3271)
Bugfixes 🐛
- skip automated and core from generate changelog (rectorphp/rector-src@aafb992)
- [Php80] Don't add null as default to variadic parameter (#3270), Thanks @thomasschiet!
Released Rector 0.15.3
New Features 🥳
- [CodeQuality] Add Variable support on class arg on InlineIsAInstanceOfRector (#3261)
- [Utils] Add ArrayChecker util to verify first data found on given array (#3262)
Bugfixes 🐛
- [TypeDeclaration] Fix TypedPropertyFromStrictGetterMethodReturnTypeRector for default type (#3251)
- [Privatization] Optimize ParentPropertyLookupGuard, make $class parameter required (#3252)
- [CodeQuality] Handle crash on ReturnTypeFromStrictScalarReturnExprRector on ConditionalTypeForParameter (#3254)
- refactors Spatie enum method calls to native enums (#3226), Thanks @JoolsMcFly!
- PHP80 string helpers loose comparison (#3246), Thanks @N-Silbernagel!
- [CodeQuality] Handle class-string case insensitive on CompleteDynamicPropertiesRector (#3260)
- [TypeDeclaration] Handle comment + single docblock on TypedPropertyFromAssignsRector (#3264)
- Bump PHPStan ^1.9.7 (#3268)
- [TypeDeclaration] Do not remove multiple docblocks with comment on TypedPropertyFromAssignsRector (#3263)
- [e2e] handle multiple classes with anonymous class on MultipleClassFileToPsr4ClassesRector file removed (#3253)
Released Rector 0.15.2
New Features 🥳
- [TypeDeclaration] Add FalseReturnClassMethodToNullableRector (#3229)
- [DeadCode] Add TargetRemoveClassMethodRector (#3240)
- Adapt PrivateConstantToSelfRector to work on non-final classes, too (#3198), Thanks @alfredbez!
- [CodingStyle] Add NullifyUnionNullableRector (#3231)
- [TypeCoverage] Add EmptyOnNullableObjectToInstanceOfRector (#3230)
- RenameClassRector with callback support (#3023), Thanks @dorrogeray!
Bugfixes 🐛
- [Php82] Handle parent already readonly on ReadOnlyClassRector (#3199)
- [DeadCode] Skip append array data on RemoveJustPropertyFetchRector (#3201)
- [DeadCode] Skip standalone @return false or true on RemoveUselessReturnTagRector (#3202)
- Fix wrong reference to replacement rule (#3203), Thanks @jlherren!
- [Privatization] Do not remove comment on ChangeReadOnlyPropertyWithDefaultValueToConstantRector (#3204)
- [Naming] Skip Doctrine collection with @var Collection<int, Checkbox> on RenamePropertyToMatchTypeRector (#3209)
- [Core] Performance improvement: Remove unnecessary re-call FileFactory::createFileInfosFromPaths() (#3210)
- [Php71] Skip defer() function on RemoveExtraParametersRector (#3211)
- [Core] Improve performance: remove repetitive currentFileProvider->setFile() call on PhpFileProcessor (#3213)
- [Php81] Allow explicit mixed processed on trait on NullToStrictStringFuncCallArgRector (#3212)
- [Privatization] Skip used by heredoc on ChangeReadOnlyVariableWithDefaultValueToConstantRector (#3216)
- [Parallel] Fix missing process RemovedAndAddedFilesProcessor->run() on parallel process on WorkerRunner (#3218)
- [parallel] Improve performance: Run RemovedAndAddeedFileProcessor after loop (#3219)
- [CodeQuality] Add empty() check to FlipTypeControlToUseExclusiveTypeRector (#3224)
- [CodeQuality][TypeDeclaration] Handle default value from constructor removed on InlineConstructorDefaultToPropertyRector+TypedPropertyFromStrictConstructorRector (#3225)
- [TypeDeclaration] Skip yield return on AddClosureReturnTypeRector (#3227)
- [TypeDeclaration] Skip optional yield on AddReturnTypeDeclarationFromYieldsRector (#3228)
- [NodeTraverser] Use NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN instead of NodeTraverser::DONT_TRAVERSE__CHILDREN (#3233)
- [Core] Improve performance on AstResolver and ClassLikeAstResolver (#3234)
- [Php81] Skip ReadOnlyPropertyRector on read only class (#3236)
- [CodingStyle] Skip new line /\r\n|\r|\n/i on ConsistentPregDelimiterRector (#3241)
- [CodingStyle] Skip EncapsedStringsToSprintfRector on heredoc (#3242)
Released Rector 0.15.1
New Features 🥳
- [CodingStyle] Split SplitGroupedConstantsAndPropertiesRector to SplitGroupedClassConstantsRector and SplitGroupedPropertiesRector (#3158)
- Add compatible phpstan/phpdoc-parser 0.15 (#3157)
Bugfixes 🐛
- Skip short class names in UseClassKeywordForClassNameResolutionRector (#3156)
- [Core] Fix crash indentation on indent(\t, 1) config (#3155)
- [TypeDeclaration] Skip union mixed on TypedPropertyFromAssignsRector (#3160)
- [TypeDeclaration] Handle Anonymous class extends existing class in union (#3161)
- Add skipped Rectors to
list-rules
(#3162) - [TypeDeclaration] Remove PhpDocTypeChanger->changeVarType() on TypedPropertyFromAssignsRector (#3163)
- [TypeDeclaration] Skip multi return types on ReturnTypeFromReturnDirectArrayRector (#3164)
- [CodeQuality] Skip stdClass in IssetOnPropertyObjectToPropertyExistsRector, as always nested (#3166)
- Do not apply property promotion to parameters with the SensitiveParameter attribute (#3165), Thanks @mbabker!
- [TypeDeclaration] Skip void return on AddArrowFunctionReturnTypeRector (#3167)
- [Php82] Skip ReadOnlyClassRector on has parent non-readonly class (#3169), Thanks @Yoann-TYT!
- [CodeQuality] Handle BooleanNot on SimplifyEmptyCheckOnEmptyArrayRector (#3170)
- [Core] Use FullyQualifiedObjectType and ThisType detection for local property fetch on PropertyFetchAnalyzer (#3172)
- [CodeQuality] Skip non typed property no default value never assigned on SimplifyEmptyCheckOnEmptyArrayRector (#3171)
- [PHPStanStaticTypeMapper] Handle Nullable Type on UnionType on UnionTypeMapper when possible (#3173)
- [CodeQuality][CodingStyle] Handle crash on SimplifyIfReturnBoolRector+NewlineAfterStatementRector+StringClassNameToClassConstantRector (#3175)
- [DeadCode] Skip Class Constant used in Enum on RemoveUnusedPrivateCla… (#3174), Thanks @eliashaeussler!
- [Php80] Do not remove Parameter attribute on ClassPropertyAssignToConstructorPromotionRector (#3179)
- [PHP 8.1] Skip trait in NullToStrictStringFuncCallArgRector as unknown context (#3180)
- Fix trait property visibility in PrivatizeFinalClassPropertyRector (#3182)
- [Php81] Allow normal variable in trait on NullToStrictStringFuncCallArgRector (#3181)
Released Rector 0.15
We released a new getrector.org website, including new documentation - https://getrector.org/documentation 🎉
You can already find a few new sections there.
This release brings the most significant changes in type safety. Few rules in type declaration worked with docblock types and completed type as strict. These rules lead to crashing code with invalid types. Instead, we've been splitting these rules into smaller and specific ones (Unix style!) that handle exact strict type declarations. This release finalizes the removal of these weak rules.
Welcome new type declaration rules that are safe and work with 100 % known strict types ↓
New Features 🥳
- [TypeDeclaration] Add AddParamTypeBasedOnPHPUnitDataProviderRector + remove too narrow KnownArrayParamTypeInferer (#3104)
- [TypeDeclaration] Add AddParamTypeSplFixedArrayRector (#3105)
- [TypeDeclaration] Add AddReturnTypeDeclarationFromYieldsRector (#3114)
- [TypeDeclaration] Add ReturnTypeFromReturnDirectArrayRector, ReturnTypeFromStrictConstantReturnRector, ReturnTypeFromStrictTypedCallRector (#3125)
- [TypeDeclaration] Add AddParamTypeFromPropertyTypeRector (#3109)
- Add
list-rules
command for tool interoperabtility (#3087) - Add SimplifyEmptyCheckOnEmptyArrayRector #7485 (#3069), Thanks @JohJohan!
- [Php80] Add ClassOnThisVariableObjectRector (#3093)
Bugfixes 🐛
- [Php80] Skip possible numeric string switch cond with all integer case cond on ChangeSwitchToMatchRector (#3067)
- Skip MakeTypedPropertyNullableIfCheckedRector for constructor assigment. (#3074), Thanks @Wohlie!
- Fix StrContainsRector when strpos offset is set (#3086), Thanks @ajgarlag!
- [TypeDeclaration] Handle return self on TypedPropertyFromStrictGetterMethodReturnTypeRector on php 8.0 feature enabled (#3088)
- [Php80] Do not remove existing attribute on NestedAnnotationToAttributeRector (#3116)
- [CodeQuality] Skip from non-typed param on SimplifyEmptyCheckOnEmptyArrayRector (#3115)
- [DeadCode] Fix RemoveJustPropertyFetchRector to skip concat assigns (#3123)
- [DeadCode] Skip re-assigned variable in RemoveJustPropertyFetchRector (#3124)
- [Php74] Register TypedPropertyFromAssignsRector to php74 config set (#3127)
- docs (rectorphp/rector-src@571a1e6)
- [TypeDeclaration] Skip property names in TypedPropertyFromStrictConstructorRector (#3128)
- [TypeDeclaration] Skip doctrine collection type (#3130)
- [TypeDeclaration] Use existing MakePropertyTypedGuard on TypedPropertyFromStrictConstructorRector (#3131)
- [PHP 8.1] Add other methods to ClassFromEnumFactory (rectorphp/rector-src@d206406)
- simplify PHPStanStaticTypeMapper (#3143), Thanks @staabm!
- Fix foreach key evaluation for SimplifyForeachToArrayFilterRector. (#3100), Thanks @Wohlie!
- [Php55] Handle crash on curly parentheses delimiter on PregReplaceEModifierRector (#3144)
- [Php73] Add closure bindings for SimplifyForeachToArrayFilterRector. (#3146), Thanks @Wohlie!
Removed Weak Doc Type Rules 💀
- Deprecated type-declaration-strict to type-declaration set, as single group of rules (#3103)
- Remove deprecated ParamTypeDeclarationRector, that treated docs as strict types to keep type declaration set reliable (#3111)
- Deprecated and remove AddArrayParamDocTypeRector to work with strict type declarations only (#3112)
- [TypeDeclaration] Remove and disable breaking ReturnTypeDeclarationRector, use split rules instead (#3120)
- deprecate generic and breaking PropertyTypeDeclarationRector (rectorphp/rector-src@dd44b98)
- [TypeDeclaration] Disable and deprecate PropertyTypeDeclarationRector and TypedPropertyRector, to avoid breaks; use split strict rules instead (#3122)
- [TypeDeclaration] Deprecate unreliable AddArrayReturnDocTypeRector, used split strict typed rules instead (#3133)
Removed Features 💀
- Remove auto import on changed files only to avoid too detailed setup and making ambiguous code (#3132)
- [config] Deprecate and remove @noRector annotation, as not reliable DX choice; use skip() method instead (#3148)
- Remove deprecated
RectorConfig::disableImportShortClasses()
, useimportShortClasses(false)
instead (rectorphp/rector-src@7507589) - Remove deprecated
RectorConfig::disableImportNames()
, useimportNames(false, false)
instead (#3147) - Remove deprecated APPLY_AUTO_IMPORT_NAMES_ON_CHANGED_FILES_ONLY option (rectorphp/rector-src@a4e7a43)
- Make Rector PHPOffice optional package, as only migrates ~7 years old version (#3061)
Released Rector 0.14.8
New Features 🥳
- Update PHP-Parser to ^4.15.2 (#3057)
- [Php80] Add $object::class support on GetDebugTypeRector (#3039)
- [Php81] Register uniqid function on NullToStrictStringFuncCallArgRector (#3045), Thanks @bkosun!
- [Init] Add smart paths detection to "init" command to make first Rector experience better (#3050)
- [Core] Improve performance: only reindex Node Attributes when Original Node is not null (#3043)
- [Core] Improve performance: only update and connect parent Node when different Node (#3044)
- [Core] Improve performance: remove unnecessary loop StmtsAwareInterface to fill Scope on PHPStanNodeScopeResolver (#3048)
- [Core] Improve performance on NodeComparator (#3049)
- [Core] Improve performance: verify consecutive execute same Rector Rule when Original Node is Null (#3047)
- [Core] Improve performance: remove unnecessary loop on SimpleCallableNodeTraverser (#3053)
Bugfixes 🐛
- [Caching] Fix cache consecutive run rector with --dry-run (#3060)
- [Php80][CodeQuality] Handle crash on ExplicitMethodCallOverMagicGetSetRector+ChangeSwitchToMatchRector (#3034)
- [Php55] Handle crash on ([[:upper:]]+) regex on PregReplaceEModifierRector (#3037)
- Apply node->isFirstCallable() check early before ->getArgs() when possible on CallLike (#3038)
- Fix var/property usage for RemoveUnusedNonEmptyArrayBeforeForeachRector. (#3040), Thanks @Wohlie!
- [Php81][Restoration] Handle crash on ReadOnlyPropertyRector+MakeTypedPropertyNullableIfCheckedRector (#3046)
- Re-print on constructor promotion (#3051), Thanks @greg0ire!
- remove NodeTypeAnalyzer (#3055), Thanks @staabm!
- [Core] Fix resolve scope handling when parent Node just re-printed (#3056)
Released Rector 0.14.7
New Features 🥳
- Move Rector Laravel to the community (#3019) - thanks to @driftingly for taking package further 👏
- [CodeQuality] Add TernaryEmptyArrayArrayDimFetchToCoalesceRector (#3027)
- NullToStrictStringFuncCallArgRector - Register a few more functions (#2994), Thanks @craigfrancis!
- Update all classlike pseudo rector (#3002), Thanks @webmaster777!
- Register Ctype functions (#3008), Thanks @bkosun!
- Compatibility with BetterReflection 6.x (#2999), Thanks @ondrejmirtes!
Bugfixes 🐛
- [CodeQuality] Skip different array_filter value on SimplifyEmptyArrayCheckRector (#3000)
- [CodeQuality] Skip different value left and right on SimplifyEmptyArrayCheckRector (#2998)
- [Php70] Handle crash on First class callable on ThisCallOnStaticMethodToStaticCallRector (#3003)
- [Down_To_PHP71] Handle Downgrade Param Widening + Downgrade Reflection Get on DowngradeLevelSetList::DOWN_TO_PHP_71 (#3001)
- Add real path to filePaths when not false (#3004), Thanks @jamwid07!
- [DeadCode] Handle RemoveUnusedPrivateMethodRector+RemoveDuplicatedIfReturnRector when private method used in FuncCall with ArrowFunction (#3007)
- [Php80] Handle crash on extends \mysqli on AddParamBasedOnParentClassMethodRector (#3009)
- [Php80] Skip callable type different definition on ClassPropertyAssignToConstructorPromotionRector (#3010)
- [EarlyReturn] Handle crash on RemoveAlwaysElseRector+ReturnEarlyIfVariableRector (#3011)
- [DeadCode] Handle crash on has first class callable on RemoveUnusedConstructorParamRector (#3015)
- [Php80] Handle nested annotation not end with () on AnnotationToAttributeRector (#3017)
- [TypeDeclaration] Skip intersection with iterable on ReturnTypeDeclarationRector on php 8.1 feature enabled (#3022)
- InlineConstructorDefaultToPropertyRector fix code example (#7465) (#3028), Thanks @GeniJaho!
- [Php81] Skip on Array Destructuring on ReadOnlyPropertyRector (#3030)
Released Rector 0.14.6
New Features 🥳
Bugfixes 🐛
- [DeadCode][Privatization] Handle crash on RemoveDeadZeroAndOneOperationRector+ChangeReadOnlyPropertyWithDefaultValueToConstantRector (#2962)
- [DeadCode][EarlyReturn] Handle RemoveUnusedVariableAssignRector+RemoveAlwaysElseRector (#2964)
- Fix wrong results in ExactCompareFactory (#2973), Thanks @jlherren!
- [Php81] Skip assigned after defined as constructor promotion on ReadOnlyPropertyRector (#2976)
- [Php80] Handle crash on nullable scalar with mixed param on MixedTypeRector (#2977)
- [Core] Set compatible with latest BetterReflection usage to handle assert($startLine > 0) notice (#2978)
- [TypeDeclaration] Handle Parent ClassMethod has no Return_ stmt on ReturnTypeDeclarationRector (#2980)
- [Privatization] Skip Property unsetted on ChangeReadOnlyPropertyWithDefaultValueToConstantRector (#2981)
- fix symfony deprecation reports (rectorphp/rector-src@e58f390)
- [Core] Remove second param on ClassLikeAstResolver::resolveClassFromClassReflection() (#2975)
- [Core] Ensure refresh Scope Nodes when AbstractRector refactor() return array of Nodes (#2979)
- [Core][Symfony] Handle crash on get dynamic value ClassConstFetch by method call on ChangeStringCollectionOptionToConstantRector (#2984)
- [Php80] Handle crash after transform with trait-string on UnionTypesRector (#2985)
- Fix multi property default assign (#2986)
- Add new rule to simplify a last useless variable assignment. (#2963), Thanks @Wohlie!
- Fix missing extra import on NestedAnnotationToAttributeRector (#2989)
- Assert JoinColumns in CPP should be converted (#2991)
Released Rector 0.14.5
Bugfixes 🐛
- Fixed "Child process Error" on Windows (#7310) via deprecated-packages/symplify#4417, Thanks @ondrejmirtes
Released Rector 0.14.4
New Features 🥳
- [Naming] Add TwigEnvironment special name to RenameParamToMatchTypeRector to keep the context (#2951)
- Add support for interface in AnnotationToAttributeRector rule (#2958), Thanks @astronom!
Bugfixes 🐛
- Skip short class names on StringClassNameToClassConstantRector, as mostly internal classes or strings (#2950)
- [CodeQuality] Skip nullable mixed on ReturnTypeFromStrictScalarReturnExprRector (#2947), Thanks @thomasschiet!
- [Php81] Handle crash insensitive function name on NullToStrictStringFuncCallArgRector (#2953)
- [AutoImport] Add support for auto import in alias same last name (#2952)
- [Php80] Skip no default next indirect in return Expr on ChangeSwitchToMatchRector (#2959)