github rectorphp/rector 0.17.1
Released Rector 0.17.1

latest releases: 1.2.10, 1.2.9, 1.2.8...
17 months ago

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)

Don't miss a new rector release

NewReleases is sending notifications on new releases.