Skip to content

Releases: rectorphp/rector

Released Rector 0.17.4

11 Jul 16:06
Compare
Choose a tag to compare

Bugfixes 🐛

  • [CodeQuality][EarlyReturn] Handle crash Replace Stmt to Expr on FlipTypeControlToUseExclusiveTypeRector+FlipTypeControlToUseExclusiveTypeRector+ReturnBinaryOrToEarlyReturnRector (#4474)
  • Fix ReturnBinaryOrToEarlyReturnRector mixing up returned nodes of array, hook into StmtsAwareInterface instead to keep next Rector rules updated (#4476)

Removed 💀

  • Remove duplicated version_compare ReplaceFuncCallArgumentDefaultValue rule (#4473), Thanks @alexander-schranz!
  • [EarlyReturn] Remove ReturnBinaryAndToEarlyReturnRector as creates code hard to read and flips condition (#4478)

Released Rector 0.17.3

10 Jul 13:34
Compare
Choose a tag to compare

In this release we continue preparing for Rector 1.0 release #7854

This includes removing last parent node connections, to lower node tree memory consumption 🥳️🥳️🥳️

  • [EarlyReturn] Remove findFirstNext() on InvertedIfFactory (#4399)
  • [DX] Remove findParentType() method (#4438)
  • [DX] Remove parent node from AbstractRector (#4465)

New Features 🥳

  • Add float mul integer type to NumericReturnTypeFromStrictScalarReturnsRector (#4376)
  • [TypeDeclaration] Add Encapsed string support to AlwaysStrictScalarExprAnalyzer (#4382)
  • [TypeDeclaration] Add StrictArrayParamDimFetchRector (#4384)
  • [DX] Kick of SimpleParameterProvider (#4405)

Bugfixes 🐛

  • [DeadCode] Skip non typed param numeric check on RecastingRemovalRector (#4390)
  • [Renaming] Handle crash on catch Exception name on RenameClassRector (#4401)
  • Fix NumericReturnTypeFromStrictScalarReturnsRector for non-natively-typed parameters (#4380), Thanks @staabm!
  • [Php82] Skip extends unknown class on ReadonlyClassRector (#4408)
  • [TypeDeclaration] Handle crash on no namespace with + operation on DeclareStrictTypesRector (#4414)
  • [NodeTypeResolver] Reduce duplicated Scope fill on FuncCall (#4428)
  • Make JsonThrowOnErrorRector work with local scope to detect error_json methods (#4451)
  • Deprecate resolveNextNode() to work only in current node tree context (#4455)
  • [Naming] Skip used on next foreach on RenameForeachValueVariableToMatchExprVariableRector (#4469)

Removed 💀

  • Remove duplicate ReturnNeverTypeRector rule (#4381), Thanks @buffcode!
  • [MysqlToMysqli] Deprecate set, as dangerous to use, better handle manually (#4448)
  • [DX] Make use of SimpleParameterProvider directly, deprecate RectorConfigProvider (#4460)
  • [Performance] Immediate remove UnreachableStatementNodeVisitor object after traverse to avoid re-use in next file (#4417)
  • [NodeTypeResolver] Remove ArrayItem scope filling from Array_ and Name filling for Catch types on PHPStanNodeScopeResolver (#4423)
  • [PHP 8] Resources object upgrade - remove 2 rules as the upgrade require wholesome manual work (#4442)
  • [DeadCode] Remove RemoveJustVariableAssignRector as often done on purpose or with side effect (#4450)
  • Remove deprecated resolveNextNode() to embrace local scope node (#4456)
  • [DX] Remove node connecting traverser from AbstractRector (#4463)
  • Remove NodeConnectingTraverser (#4464)
  • [DX] Remove autowrapping of expr/stmt to make return values in the same type and reliable (#4466)

Released Rector 0.17.2

29 Jun 12:57
Compare
Choose a tag to compare

In this release we continue preparing for Rector 1.0 release #7854

This includes:

  • removing more parent node connections, to lower node tree memory consumption

New Features 🥳

  • Add sleep after processPool->quitAll() to give time for all child processes to terminate (#4280), Thanks @dorrogeray!
  • [TypeDeclaration] Add NumericReturnTypeFromStrictScalarReturnsRector (#4296)
  • [Php71] Add Closure support on AssignArrayToStringRector (#4303)
  • Introduces AddSensitiveParameterAttributeRector rule (#4342), Thanks @peterfox!
  • Bump nikic/php-parser to 4.16.0 (#4343)
  • Show error when no files will be processed (#4326), Thanks @staabm!
  • Cache unchanged files on dry run v2 (#4281), Thanks @dorrogeray!

Bugfixes 🐛

  • [CodeQuality] Handle crash on variable variable on OptionalParametersAfterRequiredRector (#4226)
  • Fix LocallyCalledStaticMethodToNonStaticRector with method args (#4233), Thanks @toastedghost!
  • Use FunctionLike contract instead of union of function-like concrete implementations (#4241), Thanks @Wirone!
  • [CodeQuality][Performance] Reduce repetitive NodeTypeResolver->getType() on ExprBoolCaster (#4279)
  • Skip rewindable generator (#4282)
  • [Php55][NodeTypeResolver] Handle crash on dynamic variable concat assign on StringClassNameToClassConstantRector (#4283)
  • [Php55] Clean up FullyQualified assigned to FullyQualified on StringClassNameToClassConstantRector (#4284)
  • [TypeDeclaration] Extend NumericReturnTypeFromStrictScalarReturnsRector (#4297)
  • Skip divide in NumericReturnTypeFromStrictScalarReturnsRector (#4298)
  • [TypeDeclaration] Skip once typed and else return array_map() on ReturnTypeFromStrictTypedCallRector (#4312)
  • Fix command to configure rector (#4314), Thanks @bertramakers!
  • [Performance] [NodeTypeResolver] Reduce callable traverse usage on ContextNodeVisitor (#4317)
  • [CodeQuality] Skip not regex on SimplifyRegexPatternRector (#4322)
  • [TypeDeclaration] Handle crash on object shape on ArrayShapeFromConstantArrayReturnRector (#4323)
  • [Php81] Skip named constructor on ReadOnlyPropertyRector (#4359)
  • Skip argument if value equals default value (#4368), Thanks @stefantalen!
  • [MysqlToMysqli] Handle infinite loop on MysqlQueryMysqlErrorWithLinkRector when no connection instance on first dept stmt (#4375)

Removed 💀

  • Remove removeNode() method from AbstractRector (#4225)
  • Remove Kind from doc mapper, as used just once (#4234)
  • Move LocallyCalledStaticMethodToNonStaticRector to CodeQuality namespace, to avoid dumping removed static set (#4242)
  • Restore RemoveMethodCallParamRector as used (#4244)
  • [Performance] Remove NODES_TO_MATCH constant on RemoveNonExistingVarAnnotationRector (#4267)
  • Remove VarConstantCommentRector as using unreliable docblocks, better use upcoming PHP 8.3 strict type const (#4307)
  • [Naming] Remove BreakingVariableRenameGuard::isUsedInIfAndOtherBranches() to remove previous by types (#4319)
  • [Php81] Remove cast check on NullToStrictStringFuncCallArgRector (#4320)
  • [PhpParser] Remove BetterNodeFinder::findFirstPreviousOfTypes() (#4327)
  • Move AddMethodParentCallRector to Symfony Rector (#4301)

Released Rector 0.17.1

14 Jun 10:14
Compare
Choose a tag to compare

In this release we continue preparing for Rector 1.0 release #7854

This includes:

  • removing more parent node connections, to lower node tree memory consumption
  • replacing removeNode() method with return NodeTraverser::REMOVE_NODE direct constant to make changes happen directly in the Rector rule
  • refactoring node adding from post-process to directly in the rule

New Features 🥳

  • [Docblock] Move DocBlockUpdater service usage from AbstractRector to PhpDocTypeChanger (#4215)
  • Improve string support in Doctrine Annotations (#3645), Thanks @yguedidi!
  • [Php80] Fix add default nullable type on ClassPropertyAssignToConstructorPromotionRector (#4091)
  • Add STRICT_BOOLEANS set (#4116)

Changes

  • [FileProcessor] Add warning instead of skip InlineHTML on PhpFileProcessor (#4058)
  • Remove node adding collector (#4095)
  • Remove propperty to add collector, add them directly or as a constructor dependency (#4131)
  • Move ReturnArrayClassMethodToYieldRector to PHPUnit Rector (#4213)

Bugfixes 🐛

  • [CodeQuality] Exclude first class callable from IntvalToTypeCastRector (#7962) (#4040), Thanks @thbley!
  • [CodingStyle] Skip first class callable on UnSpreadOperatorRector (#4041)
  • Skip StrvalToType for strval first class callable syntax (#4046), Thanks @NicoImparfait!
  • Ensure check isFirstClassCallable() before node->getArgs() on CallLike (#4049)
  • [CodeQuality] Skip multiple assigns append before foreach on ForeachItemsAssignToEmptyArrayToAssignRector (#4052)
  • [CodeQuality] Skip deep append in if foreach before on ForeachItemsAssignToEmptyArrayToAssignRector (#4053)
  • [NodeTypeResolver] Handle crash after next exit() on no namespaced code after removal next attribute (#4074)
  • [FileProcessor] Show warning on has InlineHTML node if file has changed on PhpFileProcessor (#4079)
  • Make SimplifyRegexPatternRector work without parent nodes + deprecate BetterNodeFinder and findParent* methods (#4105)
  • Fix StaticCallOnNonStaticToInstanceCallRector to skip parent's parent's method calls. (#4098), Thanks @klimslim!
  • [CodingStyle] Skip countable object on CountArrayToEmptyArrayComparisonRector (#4108)
  • [DeadCode] Skip used on Closure use next stmt on RemoveUnusedVariableAssignRector (#4042)
  • [CodeQuality] Handle throw after if on ConsecutiveNullCompareReturnsToNullCoalesceQueueRector (#4107)
  • [CodeQuality] Handle return new object and no return on ConsecutiveNullCompareReturnsToNullCoalesceQueueRector (#4112)
  • Make ConvertStaticPrivateConstantToSelfRector work for non-final classes, make part of code-quality set (#4114)
  • StringClassNameToClassConstantRector: cheap checks first (#4151), Thanks @staabm!
  • Reduce memory-consumption by simpler skip-patterns (#4152), Thanks @staabm!
  • Skipping: Use plain string functions instead of regex matching (#4153), Thanks @staabm!
  • Split instance of check to 2 rules (#4165)
  • Performance: Prevent sorting of files in PhpFilesFinder (#4164), Thanks @staabm!
  • Move PreferThisOrSelfMethodCallRector to PHPUnit rector package, to handle exact cases (#4194)
  • [Renaming] Handle crash in trait use on RenameClassRector (#4196)
  • [Php56] Handle infinite loop on big array method call on AddDefaultValueForUndefinedVariableRector (#4142)
  • [Php56] Skip variable variable on AddDefaultValueForUndefinedVariableRector (#4148)

Removed 💀

  • [DeadCode] Remove removeNode() from RemoveDeadReturnRector, merge RemoveLastReturnRector to RemoveDeadReturnRector (#4085)
  • [PHP+HTML cleanup] Remove MixPhpHtmlDecorator (#4054)
  • Remove HTML + PHP support, as must be handled in php-parser first (#4051)
  • Remove MultipleClassFileToPsr4ClassesRector as only PSR4 rule, bit risky and better handled with PHPStan + remove adding/removing files logic, use printer instead (#4117)
  • Remove NormalizeNamespaceByPSR4ComposerAutoloadRector as only moves files to namespaces, does not update any class referenes; better use IDE here (#4057)
  • Remove MultipleClassFileToPsr4ClassesRector as only PSR4 rule, bit risky and better handled with PHPStan + remove adding/removing files logic, use printer instead (#4117)
  • Remove AttributeCompatibleAnnotationRector, as only for one-time migration of private project, not suitable for general use (#4064)
  • Remove RemoveAlwaysTrueConditionSetInConstructor, as overly specific and not practical; better handle with PHPStan (#4065)
  • Remove deprecated UnionTypesRector and NarrowUnionTypeDocRector, use strict-based rules from TypeDeclaration set instead (#4069)
  • Remove TargetRemoveClassMethodRector, as IDE specific (#4076)
  • Remove ArrayKeysAndInArrayToArrayKeyExistsRector as narrow, does not check variable usage and might be on purpose (#4084)
  • Remove ChangeGlobalVariablesToPropertiesRector as the scope might change after the variable is defined, better handle with PHPStan (#4086)
  • Remove NewToConstructorInjectionRector as unused and only for demo purposes (#4087)
  • [NodeTraverser] Remove double apply FileWithoutNamespace, remove recursive lookup stmts on BetterStandardPrinter (#4097)
  • Remove ActionInjectionToConstructorInjectionRector as rather for demo purposes, not practical (#4113)
  • Remove ConstantListClassToEnumRector as custom-made, not practical for enum upgrades (#4115)
  • Remove RemoveMethodCallParamRector, as unused (#4119)
  • Remove RemoveAllowDynamicPropertiesAttributeRector as attribute is a comment on lower PHP versions, also rather downgrade rule (#4120)
  • Remove DoctrineAnnotationClassToAttributeRector as made for custom project, not useful for general use (#4127)
  • Remove UnsetAndIssetToMethodCallRector as unused (#4123)
  • Remove MethodCallToMethodCallRector as unused (#4128)
  • Remove NewArgToMethodCallRector as unused (#4130)
  • Remove RemoveDelegatingParentCallRector as overly complex and usually on purpose (#4136)
  • Remove RemoveEmptyMethodCallRector as better handled by PHPStan (#4161)
  • Remove BetterNodeFinder::findLastInstanceOf() as unused + make resolvePreviousNode() private, as used only locally (#4195)
  • [DeadCode] Remove Assign and AssignRef as node types on RemoveNonExistingVarAnnotationRector (#4209)

Released Rector 0.17

01 Jun 10:29
Compare
Choose a tag to compare

Preparing for Rector 1.0

In this release, we focus on architecture improvements before reaching Rector 1.0. We want to lower the memory usage and make Rector run faster.

This include removing next/previous nodes - this will most likely not affect you, as Rector rules were upgraded, but if you do you use them, switch to StmtsAwareInterface instead

We follow PHPStan 1.6 move from April 2022, where you can learn more: https://phpstan.org/blog/preprocessing-ast-for-custom-rules

  • Replace NodeConnectingVisitor with ParentConnectingVisitor (#3900)

To see how to refactor to StmtsAwareInterface, check these PRs:

  • Remove NEXT_NODE dependency in ChangeAndIfToEarlyReturnRector, narrow to only closed scope function likes (#3913)
  • Remove NEXT_NODE from SimplifyIfReturnBoolRector (#3915)
  • [DeadCode] Remove next attribute on RemoveUnusedVariableAssignRector ([#3917](https://github.com/rectorphp/
  • [CodingStyle] Refactor CatchExceptionNameMatchingTypeRector to use StmtsAwareInterface (#3788)

Add/remove nodes directly 👍

The next improvement focuses on explicit node adding/removal. Thanks to StmtsAwareInterface we can add nodes directly. This makes Rector refactor() method contain all the code you need.

  • Cleanup usage of NodesToAddCollector, return nodes directly instead (#4003)
  • Cleanup removeNodeFromStatements(), removeArg(), removeParam(), removeStmt() methods and remove nodes directly (#4012)
  • Remove unused addNodeAfterNode(), return nodes instead (#4023)
  • Remove unused method addNodesBeforeNode() (#4024)

New Features 🥳

  • [PHP 7.0] Add IfIssetToCoalescingRector (#3878)
  • Support attributes in RemoveFinalFromEntityRector (#3727), Thanks @alexndlm!
  • Add SwapMethodCallArgumentsRector (#3726), Thanks @gaydamakha!
  • [CodeQuality] Add CleanupUnneededNullsafeOperatorRector (#3767)
  • Make ReturnNeverTypeRector work with type declaration, add it to PHP 8.1 set (#3852)
  • [TypeDeclaration] Add BoolReturnTypeFromStrictScalarReturnsRector (#3898)
  • Make ChangeGlobalVariablesToPropertiesRector add properties directly, remove Nette inject methods (#3957)
  • Utilize MinPhpVersionInterface in more rules (#3752), Thanks @staabm!
  • Dump dependency container and re-use it - 35% faster test-suite (#3809), Thanks @staabm!
  • Defer type-resolving in RemoveJustPropertyFetchRector (#3761), Thanks @staabm!

Bugfixes 🐛

  • [TypeDeclaration] Skip Arg unpack on AddMethodCallBasedStrictParamTypeRector (#3787)
  • [CodeQuality] Add typed property support to IssetOnPropertyObjectToPropertyExistsRector (#3876)
  • [CodeQuality] Skip non-array type on SimplifyForeachToArrayFilterRector (#3738)
  • Fix ShortenedObjectType not resolving to correct class reflection (#3397), Thanks @jackbentley!
  • Extend code-quality set (#3773)
  • Don't neon-decode phpstan configs over and over again (#3796), Thanks @staabm!
  • [Console] Allow https url instead of git:// on SetupCICommand (#3799)
  • Fix integer range phpdoc types being treated as useless (#3825), Thanks @jlherren!
  • Fix nullable param in ClassPropertyAssignToConstructorPromotionRector (#3842)
  • Fix PrivatesAccessor: use selectFromArgs() instead (#3923), Thanks @staabm!

Removed rules 💀

We've also remove bunch of rules, that were added in early days of Rector for demo purposes. They were not used as of any set for non-reliable cases. PHPStan and coding standards replace some of those.

  • [CodeQuality] Remove ForToForeachRector, as overly deatiled and not reliable (#3747)
  • [CodeQuality] Remove SimplifyIfExactValueReturnValueRector, as overly defensive + InlineSimplePropertyAnnotationRector as purely coding standard area (#3764)
  • [CodingStyle] Remove RemoveDoubleUnderscoreInMethodNameRector, as naming is not handled for breaking reasons (#3765)
  • Remove RemoveUnusedVariableAssignRector, as could be breaking code in order of excution and hard to do reliable (#3793)
  • [CodingStyle] Remove ConsistentPregDelimiterRector as not much practical, importance of regex is a testing it matches expectationg, area of static analysis (#3797)
  • Remove ToStringToMethodCallRector as not practical and only for demo, FalseReturnClassMethodToNullableRector, as requires detailed custom refactoring (#3854)
  • Remove ChangeOrIfReturnToEarlyReturnRector as makes code harder to read by duplication, rather use PHSPtan and extract method (#3916)
  • [DeadCode] Remove RemoveDuplicatedIfReturnRector as can lead to unexpeced consequences, better use static analysis and contextual handling (#3926)
  • [DeadCode] Remove RemoveDuplicatedInstanceOfRector as hardly practical (#3936)
  • [CodeQuality] Remove ExplicitMethodCallOverMagicGetSetRector designed for nette smart object migration only, not useful for general projects (#3948)
  • Remove GetAndSetToMethodCallRector, as not practical and used for single legacy job (#3953)
  • Remove ChangeReadOnlyVariableWithDefaultValueToConstantRector overly complex and risky, better job for PHPStan (#3954)
  • Remove IsObjectOnIncompleteClassRector as blindly turns all incomplete checks to negated, better examine manually (#3969)
  • Remove ReservedObjectRector as requires explicit configuration and is handled by RenameClassRector already (#3975)
  • Remove ChangeReadOnlyPropertyWithDefaultValueToConstantRector as overly detailed checks, better use PHPStan and refactor individually (#4028)
  • Remove NewToMethodCallRector as unused core and no other extension, niche to use, better handle by PHPStorm (#4029)
  • [CodingStyle] Remove AddFalseDefaultToBoolPropertyRector, as works with unrelaible docblocks (#3856)
  • Remove UpdateFileNameByClassNameFileSystemRector niche rule that was added just for example sake (#3849)
  • [Transform] Remove ArgumentFuncCallToMethodCallRector as never used (#3774)
  • [Transform] Remove DimFetchAssignToMethodCallRector as unused (#3775)
  • [Transform] Remove FileGetContentsAndJsonDecodeToStaticCallRector as only for demo purposes (#3776)
  • [Transform] Remove MethodCallToAnotherMethodCallWithArgumentsRector as unused (#3777)
  • [CodeQuality] Remove SimplifyUselessLastVariableAssignRector as overly complex and should be handled individually (#3784)
  • Remove AddPregQuoteDelimiterRector as very narrow area and has not context awareness, better handle manually (#3927)
  • Remove TokenGetAllToObjectRector, as rare to use and leaky to handle, better handle in controller manual way (#4001)
  • Remove ChangeReflectionTypeToStringToGetNameRector as niche and overly detailed, better refactor reflectio na as a whole (#3976)
  • Remove RenameNamespaceRector, better handle by IDE or explicit RenameClassRector (#3979)
  • [CodeQuality] Deprecate NarrowUnionTypeDocRector as focused on docblocks, and moving to type declarations (#3848)
  • Remove MakeTypedPropertyNullableIfCheckedRector as old fix of TypedPropertyRector rule, removed months ago (#3851)
  • [PHP 8.0] Depre...
Read more

Released Rector 0.16.0

05 May 13:58
Compare
Choose a tag to compare

New Features 🥳

  • [TypeDeclaration] Add WhileNullableToInstanceofRector (#3680)

Bugfixes 🐛

  • Fix SingleInArrayToCompareRector if array item is variadic (#3640), Thanks @raoz!
  • [Php80] Handle crash leaveNode() returned invalid value of type integer on TokenGetAllToObjectRector (#3644)
  • [TypeDeclaration] Handle mix InlineHTML on FileWithoutNamespace (#3648)
  • Simplify PhpFilesFinder (#3649), Thanks @staabm!
  • [Test] Rename fixture and refactor to solve random error (#3677)
  • [TypeDeclaration] Refactor UnionTypeMapper::narrowBoolType() to allow bool|int|false converted to bool|int (#3685)
  • Update phpdoc-parser to ^1.20.3 (#3691)
  • [Privatization] Skip variable assign append on ChangeReadOnlyVariableWithDefaultValueToConstantRector (#3687), Thanks @mickeytodd!
  • [NodeManipulator] clean up multiple instanceof check on AssignManipulator (#3695)
  • [CodeQuality] Using local variable $hasChanged on NarrowUnionTypeDocRector (#3697)
  • Cache on successful file processing (#3614), Thanks @yguedidi!
  • [CodingStyle] Skip concat on first arg on ConsistentImplodeRector (#3702), Thanks @nerones!
  • Fix ExplicitMethodCallOverMagicGetSetRector with a protected method (#3732), Thanks @pierredup!
  • [TypeDeclaration] Handle infinite loop on array_reverse with index on AddMethodCallBasedStrictParamTypeRector on php8+ feature (#3678)
  • [TypeDeclaration] Handle regression multiple params no longer working on AddMethodCallBasedStrictParamTypeRector (#3681)
  • [TypeDeclaration] Add do { } while support on WhileNullableToInstanceofRector (#3682)
  • [Php56][Php70][Php74] Handle infinite loop on AddDefaultValueForUndefinedVariableRector+IfToSpaceshipRector+ClosureToArrowFunctionRector (#3701)

Performance Improvements 🚀

  • [Performance] Using findFirst() for cast to (bool) so no need search all found nodes (#3642)
  • [Performance] Using cheap chekc first on UndefinedVariableResolver::shouldSkipVariable() (#3643)
  • [CodeQuality] Improve SimplifyIfElseToTernaryRector performance (#3721)
  • [Renaming] Prevent overly greed type resolving in RenamePropertyRector (#3700), Thanks @staabm!
  • Don't calculate diffs when --no-diffs is given (#3710), Thanks @staabm!
  • Calculate diff only once per file after refactoring (#3711), Thanks @staabm!
  • Improve PropertyFetchAnalyzer performance (#3654), Thanks @staabm!
  • Improve LocalMethodCallFinder performance (#3651), Thanks @staabm!
  • Improve LocalConstantFinder performance (#3652), Thanks @staabm!
  • Improve NodeComparator performance (#3659), Thanks @staabm!
  • Improve ReflectionResolver performance (#3658), Thanks @staabm!
  • Improve ParentClassMethodTypeOverrideGuard performance (#3660), Thanks @staabm!
  • [PHPStanStaticTypeMapper] Improve UnionTypeMapper performance (#3686)
  • [PHPStanStaticTypeMapper] Improve UnionTypeMapper performance take 2 (rectorphp/rector-src@931e6e2)
  • [PHPStanStaticTypeMapper] Improve performance of UnionTypeMapper take 3 (#3690)
  • [Renaming] Improve performance of RenameFunctionRector (#3699)
  • Add e2e tests for consecutive changing runs (#3666), Thanks @yguedidi!
  • [Renaming] Improve performance of RenamePropertyRector (#3698)
  • [Naming] Improve performance by using findFirst() for casted to (bool) on BreakingVariableRenameGuard (#3703)
  • [PostRector] Improve performance NameImportingPostRector (#3708)
  • [Ast] Improve AstResolver and ClassLikeAstResolver performance (#3714)
  • [NodeManipulator] Improve IfManipulator::collectNestedIfsWithNonBreaking() performance (#3720)
  • Prevent unnecessary IO in ChangedFilesDetector (#3650), Thanks @staabm!
  • [BetterPhpDocParser] Simplify BetterTokenIterator (#3656), Thanks @staabm!
  • [Skipper] Prevent unnecessary IO (#3664), Thanks @staabm!
  • NodeTypeResolver: prevent unncessary reflection calls (#3647), Thanks @staabm!

Released Rector 0.15.24

08 Apr 11:00
Compare
Choose a tag to compare

New Features 🥳

  • Performance: Improve node name resolver performance (#3506), Thanks @keulinho!
  • [CodeQuality] Add SwitchTrueToIfRector (#3535)
  • [CodeQuality] Add cast scalar support on ReturnTypeFromStrictScalarRector (#3544)
  • Improve ArraySpreadInsteadOfArrayMergeRector (#3551), Thanks @yguedidi!
  • Performance: reduce parent attribute usage on BetterNodeFinder (#3504)
  • Performance: using findFirst() when possible at BetterNodeFinder (#3505)
  • Performance: use direct find() instead of lookup all nodes then filter on BetterNodeFinder (#3507)
  • Performance: Use faster hashing algo for cache key generation (#3508), Thanks @keulinho!

Bugfixes 🐛

  • Add not null compare to FlipTypeControlToUseExclusiveTypeRector (#3513)
  • [CodeQuality] Skip static class const fetch on InlineConstructorDefaultToPropertyRector (#3510)
  • [CodingStyle] Make EncapsedStringsToSprintfRector work with two string concat (#3515)
  • [CodeQuality] Handle multiple ifs on SimplifyIfExactValueReturnValueRector (#3527)
  • [NodeManipulator] Reduce parent attribute usage on VariableManipulator (#3528)
  • [NodeTypeResolver] Make NodeTraverser as property on PHPStanNodeScopeResolver (#3533)
  • [NodeTypeResolver] Make NodeTraverser as property on NodeScopeAndMetadataDecorator (#3532)
  • [NodeAnalyzer] Use PHPStan ClassReflection to detect anonymous class on ClassAnalyzer (#3543)
  • [Php81] Merge attributes on NewInInitializerRector (#3546)
  • [Php81] Handle assign op append on ReadOnlyPropertyRector (#3552)
  • [CodeQuality] Skip empty cases on SwitchTrueToIfRector (#3556)
  • RemoveNonExistingVarAnnotationRector: Allow return annotations (#3534), Thanks @jlherren!
  • [PostRector] Skip remove unused used at @see for Generic tag (#3562)
  • [PostRector] Skip remove unused use on used as ConstFetchNode, eg: TypeKind::* (#3560)

Removed 💀

  • [CodeQuality] Remove next node attribute usage on SimplifyIfExactValueReturnValueRector (#3511)
  • [CodingStyle] Remove previous node attribute on WrapEncapsedVariableInCurlyBracesRector (#3512)
  • [CodeQuality] Remove next node attribute usage on SimplifyIfNotNullReturnRector (#3517)
  • Remove deprecated @noRector warning (#3518)
  • [CodingStyle] Remove next node attribute on NewlineAfterStatementRector (#3525)
  • [Privatization] Remove parent attribute usage on PrivatizeFinalClassMethodRector (#3526)
  • [NodeTypeResolver] Remove NodeScopeAndMetadataDecorator::decorateStmtsFromString() method (#3530)
  • [DeadCode] Remove previous attribute usage on RemoveDeadConditionAboveReturnRector (#3538)
  • [Php70] Remove previous attribute usage on ReduceMultipleDefaultSwitchRector (#3537)
  • [CodingStyle] Remove parent attribute usage on RemoveFinalFromConstRector (#3536)
  • [CodingStyle] Remove previous node attribute on TernaryConditionVariableAssignmentRector (#3540)
  • [DeadCode] Remove previous and parent attribute usage on RemoveNullPropertyInitializationRector (#3541)
  • [DeadCode] Remove property comment same line on RemoveUnusedPrivatePropertyRector (#3547)
  • [PSR4] Remove clone $node on NormalizeNamespaceByPSR4ComposerAutoloadRector (#3553)
  • [PSR4] Remove clone $node on PseudoNamespaceToNamespaceRector (#3554)
  • [Tests] Remove RunTestsInSeparateProcesses in rules-tests (#3555)
  • [NodeRemover] Use return null after $this->removeNode() (#3558)
  • [Php73] Remove next node attribute usage on ArrayKeyFirstLastRector (#3559)

Released Rector 0.15.23

08 Apr 10:50
Compare
Choose a tag to compare

Bugfixes 🐛

  • Performance: Prevent trait resolving in NodeTypeResolver (#3501), Thanks @keulinho!
  • Performance: Reduce isObjectType calls (#3502), Thanks @keulinho!

Released Rector 0.15.22

22 Mar 12:09
Compare
Choose a tag to compare

New Features 🥳

  • Implement AddConstructorParentCallRector (#3430), Thanks @jackbentley!
  • [CodeQuality] Add indirect return scalar on ReturnTypeFromStrictScalarReturnExprRector (#3478)
  • [Container] Add RectorConfig::containerCacheDirectory() (#3490)
  • [TypeDeclaration] Handle return from array_map() on ReturnTypeFromStrictTypedCallRector (#3471)

Bugfixes 🐛

  • [AutoImport][PostRector] Handle duplicated import on namespaced class on UseAddingPostRector (#3461)
  • [Php80] Narrow bool|false to bool on UnionTypesRector (#3468)
  • [TypeDeclaration] Skip on ArrayDimFetch on EmptyOnNullableObjectToInstanceOfRector (#3473)
  • [PostRector] Allow unused alias removal from Use_ on UnusedImportRemovingPostRector (#3477)
  • [CodingStyle] Skip var ArrayDimFetch on SplitDoubleAssignRector (#3481)
  • [TypeDeclaration] Skip mixed condition string on TypedPropertyFromStrictConstructorRector (#3482)
  • [Caching] Alternative Fix caching on change config cache not cleared (#3483)
  • [DowngradePhp73][DowngradePhp74] Fix infinite loop on DowngradeNullCoalescingOperatorRector+DowngradePhp73JsonConstRector (#3484)
  • [TypeDeclaration] Handle infinite loop on type recursive itself on ReturnTypeFromStrictTypedCallRector (#3487)
  • [Printer] Handle commented code before closing tag on no rule applied print on PhpFileProcessor (#3488)
  • [Config] Increase default nested chain method call limit to 120 (#3491)
  • Performance: Memoize sipped file paths (#3495), Thanks @keulinho!
  • [CodeQuality] Skip with ascii on JoinStringConcatRector (#3497)
  • Reuse AstResolver memoizing on ClassLikeAstResolver (#3498)

Released Rector 0.15.20

05 Mar 11:27
Compare
Choose a tag to compare

New Features 🥳

  • [DX] Add "setup-ci" command to ease integration to CI (#3425)
  • [CI] Move from EndBug/add-and-commit to stefanzweifel/git-auto-commit-action (#3426)
  • [CodeQuality] Add concat support on ReturnTypeFromStrictScalarReturnExprRector to be string (#3435)
  • [Php80] Add typed property Closure support on ClassPropertyAssignToConstructorPromotionRector (#3453)

Bugfixes 🐛

  • [Privatization] Fix crash on assign inside Arg on ChangeReadOnlyVariableWithDefaultValueToConstantRector (#3423)
  • [TypeDeclaration] Only apply false type on php 8.2+ configured on TypedPropertyFromAssignsRector (#3422)
  • [Php71] Set public constant on final constant on PublicConstantVisibilityRector (#3431)
  • [CodingStyle] Fix infinite loop on NewlineAfterStatementRector when parent attribute is different (#3434)
  • [Php80] Skip array append different keys in cases on ChangeSwitchToMatchRector (#3437)
  • Alternative Rector workflow on check repo before steps run (#3440)
  • Handle $reflectionProperty->getDefaultValueExpression() return null (#3446)
  • [CodingStyle] Skip case not constant value on BinarySwitchToIfElseRector (#3452)
  • [CodingStyle] Use ExprAnalyzer::isDynamicExpr() to detect dynamic value case cond on BinarySwitchToIfElseRector (#3456)
  • [DeadCode] Skip assign inside if cond on RemoveAlwaysTrueIfConditionRector (#3447)

Removed 💀

  • Remove deprecated NodeValueResolver, ChangeSingletonToServiceRector as rather experimental and leaky (#3442 (#3442)
  • [Privatization] Remove ReplaceStringWithClassConstantRector as rather dynamic and can lead to unexpected results (#3443)