Skip to content

Releases: rectorphp/rector

Released Rector 0.12.15

26 Jan 13:07
Compare
Choose a tag to compare

Bugfixes 🐛

  • [FinalizePublicClassConstantRector] Ignore final classes (#1730), Thanks @reypm!
  • [TypeDeclaration] Skip use return docblock on typed intersection type (#1728), Thanks @samsonasik!
  • [types] Add HasPropertyTypeMapepr and HasMethodTypeMapper (#1731)

Released Rector 0.12.14

25 Jan 19:36
Compare
Choose a tag to compare

New Features 🎉

  • Add --memory-limit option to pass memory limit to parallel subprocesses (#1726)
  • Add option to configure followLinks of finder (#1703), Thanks @sabbelasichon!

Bugfixes 🐛

  • [Php71] Skip iterable on CountOnNullRector (#1691), #6947, Thanks @samsonasik!
  • [Privatization] Skip ChangeReadOnlyVariableWithDefaultValueToConstantRector when local variable never used (#1693), Thanks @samsonasik!
  • Do not run ChangeReadOnlyPropertyWithDefaultValueToConstantRector on properties with attributes (#1694), Thanks @simPod!
  • [Php70] Do not take side effect on IfToSpaceshipRector (#1696), Thanks @samsonasik!
  • [Php71] Skip property fetch array assigned in method call on __construct on CountOnNullRector (#1698), Thanks @samsonasik!
  • [Php56] Skip AddDefaultValueForUndefinedVariableRector on empty() check (#1697), Thanks @samsonasik!
  • [CodingStyle] Handle more than one method contains try catch on CatchExceptionNameMatchingTypeRector (#1706), Thanks @samsonasik!
  • [Php74] Skip curly variable in string quoted on CurlyToSquareBracketArrayStringRector (#1707), Thanks @samsonasik!
  • [Php80] Handle AnnotationToAttributeRector + ClassPropertyAssignToConstructorPromotionRector (#1712), Thanks @samsonasik!
  • [DowngradePhp70][Transform] Add #[\ReturnTypeWillChange] on Downgrade + transform ArrayObject::getIterator() to keep working on php 8.1 (#1711), Thanks @samsonasik!
  • [CodeQuality][EarlyReturn] Handle SimplifyIfElseToTernaryRector + ChangeIfElseValueAssignToEarlyReturnRector (#1710), Thanks @samsonasik!
  • [Php74] Skip readonly on RestoreDefaultNullToNullableTypePropertyRector (#1713), Thanks @samsonasik!
  • [DeadCode] Handle RemoveUnusedConstructorParamRector + RemoveUnusedPrivatePropertyRector (#1714), Thanks @samsonasik!
  • [Naming][Php56] Do not add default value init for renamed variable from param on RenameParamToMatchTypeRector+AddDefaultValueForUndefinedVariableRector (#1716), Thanks @samsonasik!
  • [Php80] Do not remove true pseudo type on UnionTypesRector (#1715), Thanks @samsonasik!
  • [Downgrade 7.0] Strip unnecessary parentheses around expressions (#1617), Thanks @jtojnar!
  • [DeadCode] Allow unused private property on Doctrine and JMS Serializable attribute on RemoveUnusedPrivatePropertyRector (#1718), Thanks @samsonasik!
  • [DowngradePhp72] Add DowngradeJsonDecodeNullAssociativeArgRector (#1723), Thanks @samsonasik!
  • [DowngradePhp72] Fix downgrade json null as true for DowngradeJsonDecodeNullAssociativeArgRector (#1724), Thanks @samsonasik!
  • [TypeDeclaration] Skip Prevent object in intersection type on ReturnTypeDeclarationRector (#1727), Thanks @samsonasik!

Released Rector 0.12.13

25 Jan 19:27
Compare
Choose a tag to compare

New Features 🎉

  • [DowngradePhp80] Add DowngradeNumberFormatNoFourthArgRector (#1649), Thanks @samsonasik!
  • [DowngradePhp80] Use ArgsAnalyzer for has named args check (#1651), Thanks @samsonasik!
  • [Parallel] Increase ParallelFileProcessor::TIMEOUT_IN_SECONDS to 120 (#1657), Thanks @samsonasik!
  • [Php81] Add NullToStrictStringFuncCallArgRector (#1655), Thanks @samsonasik!
  • [Parallel] Add Option PARALLEL_TIMEOUT_IN_SECONDS and PARALLEL_SYSTEM_ERROR_COUNT_LIMIT constant to allow reconfigure it in rector config (#1666), Thanks @simPod!
  • Ensure autoloader is loaded in globally installed Rector (#1683), Thanks @PhilETaylor!

Bugfixes 🐛

  • [Core] BetterStandardPrinter performance improvement with unnecessary regex check on no Closure Uses and no ClassMethod ReturnType (#1617), Thanks @jtojnar!
  • [PhpAttribute] Fix array key of class constant reference (#1659)
  • [DX] Use type safe access with PrivatePropertyAccessor (#1660)
  • Do not remove final modifier from private constructors (#1663), Thanks @simPod!
  • Prevent UnionTypes rule from removing @param static in favor fo self-typed $argument (#1655), Thanks @samsonasik!
  • [Php80] Handle nested attribute with constant on AnnotationAttributeRector (#1661), Thanks @Jean85!
  • [CodeQuality] Do not add \ on static on CallableThisArrayToAnonymousFunctionRector (#1671), Thanks @samsonasik!
  • [Php81] Skip static call in right expr of Coalesce on NewInInitializerRector (#1670), Thanks @samsonasik!
  • Prevent UnionTypes rule from removing literal value scalar types (#1666), Thanks @simPod!
  • [Php74] Mirror comment on Closure return to ArrowFunction expr on ClosureToArrowFunctionRector (#1677), Thanks @samsonasik!
  • [Php70] Handle reverse sorting check on IfToSpaceshipRector (#1676), Thanks @samsonasik!
  • [TypeDeclaration] Skip Throw_ in construct and as Expr on ReturnNeverTypeRector (#1679), Thanks @samsonasik!
  • [DowngradePhp74] Do not remove non-null default value on nullable on DowngradeTypedPropertyRector (#1687), Thanks @samsonasik!
  • [Naming] Fix property interface and underscore naming (#1689)

Released Rector 0.12.12

07 Jan 16:51
Compare
Choose a tag to compare

Bugfixes 🐛

Released Rector 0.12.11

06 Jan 12:40
Compare
Choose a tag to compare

New Features 🎉

  • [Downgrade PHP 7.0] Move Throwable out of type hints (#1602), Thanks @jtojnar!
  • add dump_with_depth helper function (#1639)

Bugfixes 🐛

  • [DeadCode] Add Scope check on RemoveParentCallWithoutParentRector (#1602), #6916, #6915, #6907, #6911, #6903, #6900, Thanks @jtojnar!
  • BinaryOpConditionsCollector: Add tests and fix edge case (#1608), Thanks @jtojnar!
  • Avoid clearing the cache while saving it on parallel (#1616), #6906, Thanks @zingimmick!
  • [Downgrade 7.0] Make catch clauses catching Throwable also catch Exception (#1609), Thanks @jtojnar!
  • [Core] Fix undefined array key 0 on FormatPerservingPrinter (#1619), Thanks @samsonasik!
  • [Downgrade PHP 7.0] Add Exception fallback for instanceof Throwable (#1608), Thanks @jtojnar!
  • [e2e][parallel] Allow set custom config on Parallel (#1620), Thanks @samsonasik!
  • [Parallel] Fix system errors expected an instance of SystemError but got string (#1610), Thanks @zingimmick!
  • [Confi[parallel] Let WorkerRunner know about paths, so PHPStan and Rector can handle static reflection over them guration] Fix provided type does not have to exists (#1624)
  • require always File[] in resolvePhpFilePaths() (#1630)
  • [Parallel] Unsupported files are not skipped (#1638), Thanks @gander!
  • check for iterable type before adding return type (#1639)
  • [Parallel] Let WorkerRunner know about paths, so PHPStan and Rector can handle static reflection over them (#1629)

Released Rector 0.12.10

31 Dec 12:58
Compare
Choose a tag to compare

Thank you all for amazing year 2021!

This year...

  • we've released a book with @matthiasnoback where you can learn Rector in depth in days,
  • we've added static reflection that allows analyzing legacy projects,
  • we develop Rector on PHP 8.1 and release downgraded to PHP 7.1
  • and most importantly, you contribute more and more rules and fixes every month ❤️

Thank you from whole Rector team 🙇


We've prepared one 🎁 , that will make your life much easier in 2022...


Experimental - Parallel Run 🥳️

This release brings new exciting feature. The more threads your CPU has, the faster can Rector get. It's brand new feature, so we look for bleeding edge testers to try it out:

// rector.php
use Rector\Core\Configuration\Option;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
    $parameters = $containerConfigurator->parameters();

	$parameters->set(Option::PARALLEL, true);
};
  • [Parallel] Add serializable object passing to FileProcessors (#1583)
  • [Parallel] Tidy up (#1585)
  • [Parallel] Improve tests to use file processor over file analyzer + fix missing RectorWithLineChange de/serialization (#1584)

New Features 🎉

  • [DowngradePhp80] Add #[\ReturnTypeWillChange] on DowngradeMixedTypeDeclarationRector on implements ArrayAccess (#1552), Thanks @samsonasik!
  • [DowngradePhp80] Add DowngradeArrayFilterNullableCallbackRector (#1593), Thanks @samsonasik!
  • [DowngradePhp70] Add DowngradeMethodCallOnCloneRector (#1559), Thanks @samsonasik!
  • [DowngradePhp56] Add DowngradeArrayFilterUseConstantRector (#1573), Thanks @samsonasik!
  • [Downgrade PHP 7.4] Add false to downgraded typed property (#1596)
  • [TypeDeclaration] AddVoidReturnTypeWhereNoReturnRector turns @return never into less specific @return void (#1553), Thanks @staabm!
  • [Transform][Php81] Add configurable ReturnTypeWillChangeRector (#1548), Thanks @samsonasik!
  • [DX] Avoid reporting deprecated errors (#1577)
  • Update to PHPStan ^1.3 (#1589), Thanks @samsonasik!

Bugfixes 🐛

  • [Php81] Skip assign coalesce with new in inner class on NewInInitializerRector (#1547), Thanks @samsonasik!
  • [Php80] Handle optional, required, optional on OptionalParametersAfterRequiredRector (#1555), #6879, Thanks @staabm!
  • [TypeDeclaratoin] Add AccessoryLiteralStringType to static type mapper (#1558)
  • [Php74] Skip protected property on final class with parent not loaded on TypedPropertyRector (#1560), Thanks @samsonasik!
  • [TypedProperty] Add property type guard in case of parent class (#1563)
  • [TypeDeclaration] Fix ParamTypeByParentCallTypeRector union type printing (#1564)
  • [TypeDeclaration] Fix ReturnTypeAlreadyAddedChecker on return key of array (#1571), Thanks @samsonasik!
  • [TypeDeclaration] Skip controller render method on @var to type declaratoin (#1576)
  • [TypeDeclaration] Skip callable on return type of control (#1572)
  • [TypeDeclaration] Add symfony route annotation support (#1578)
  • [PHP 8.1] Skip abstract class in NewInInitializerRector (#1581)
  • [Php81] Skip ReadOnlyPropertyRector on Clone $this (#1599), Thanks @samsonasik!
  • [TypeDeclaration] Include trait in AddVoidReturnTypeWhereNoReturnRector (#1582)
  • Fix faking scope context for trait reflections (#1575), Thanks @zingimmick!
  • [PHPStanStaticTypeMapper] Do not crash on numeric string on ReturnTypeDeclarationRector (#1588), Thanks @samsonasik!
  • fix: add failing test and fix for repeated numeric strings (#1594), Thanks @internalsystemerror!
  • [DeadCode] Fix remove unreachable after mark test skipped (#1602), Thanks @jtojnar!

Released Rector 0.12.9

22 Dec 00:08
Compare
Choose a tag to compare

New Features 🎉

  • [Renaming] Handle Rename before AttributeGroup on RenameClassRector (#1481), Thanks @samsonasik!
  • [DowngradePhp80] Add DowngradeReflectionPropertyGetDefaultValueRector (#1486), Thanks @samsonasik!
  • [PHP 8.0] Add Annotation to ORM entity nested support (#1520)
  • [Doctrine] Remove join columns on both PHP 8 and PHP 8.1 (#1525)
  • [DowngradePhp80] Add DowngradeReflectionClassGetConstantsFilterRector (#1529), Thanks @samsonasik!

Changes ➡️

  • [TypeDeclaration] Improve PropertyTypeDeclarationRector to work with strict types (#1494)
  • [TypedPropertyRector] Remove private property only, to keep other rules work separately (#1496)
  • [TypeDeclaration] Decouple TypedPropertyFromAssignsRector (#1498)
  • [TypeDeclaration] Remove CompleteVarDocTypePropertyRector, is handled by split rules (#1500)
  • [TypeDeclaration] Improve assign/constructor rules (#1499)
  • Move DoctrineColumnPropertyTypeInferer rector-doctrine package (#1506), Thanks @samsonasik!
  • Move DoctrineRelationPropertyTypeInferer to rector-doctrine (#1507)

Bugfixes 🐛

  • [DowngradePhp81] Handle New_ inside array on DowngradeNewInInitializerRector (#1508), Thanks @samsonasik!
  • [PHP 8.1] Fix IntersectionTypesRector for non-object types (#1495)
  • [PHP 8.0] Handle abstract method on StringableForToStringRector (#1483), Thanks @samsonasik!
  • [NodeTypeResolver] Add cast (float), (string), (int) back on ScalarTypeResolver (#1484), Thanks @samsonasik!
  • [NodeTypeResolver] Fix undefined method ReflectionProperty::getDefaultValue() on php 7.x (#1482), Thanks @samsonasik!
  • [Privatization] Skip protected property used in parent class on PrivatizeFinalClassPropertyRector (#1501), Thanks @samsonasik!
  • [DeadCode] Skip parent not found on RemoveParentCallWithoutParentRector (#1510), Thanks @samsonasik!
  • [Php80] Handle Alias is used as Attribute on AnnotationToAttributeRector (#1511), Thanks @samsonasik!
  • [DowngradePhp74] Handle ArrowFunctionToAnonymousFunctionRector inside CallLike + preserve byRef (#1514), Thanks @samsonasik!
  • [Php80] Handle double quoted sql statement annotation on AnnotationToAttributeRector (#1516), Thanks @samsonasik!
  • [CodingStyle] Fix static to dynamic override in static method (#1518)
  • [Php80] Handle case mixed up default in first case+middle case on ChangeSwitchToMatchRector (#1538), Thanks @samsonasik!
  • [DeadCode] Handle parent:: call with assign when no parent on RemoveParentCallWithoutParentRector (#1531), Thanks @samsonasik!
  • [DowngradePhp74][DowngradePhp80] Apply ternary with method_exists on DowngradeReflectionGetTypeRector + DowngradeReflectionGetAttributesRector (#1530), Thanks @samsonasik!

Released Rector 0.12.8

14 Dec 09:17
Compare
Choose a tag to compare

New Features 🎉

  • [PHP 8.2] make AddAllowDynamicPropertiesAttributeRector configurable (#1391), Thanks @mallardduck!
  • [PHP 8.2] Add a RemoveAllowDynamicPropertyAttribute rule (#1445), Thanks @samsonasik!
  • Composer > Define allowed plugins (#1464), Thanks @ruudk!
  • [DowngradePhp80] Add ArrowFunction support on DowngradeMixedTypeDeclarationRector (#1477), Thanks @samsonasik!

Changes ➡️

  • [Downgrade Php 7.2] Add opt-out parameter for unsafe types to avoid piling list of safe types (#1448)
  • [Downgrade] Drop SAFE_TYPES and SAFE_TYPES_TO_METHODS constants, use UNSAFE_TYPES_TO_METHODS instead (#1451), Thanks @samsonasik!
  • [DX] Warn about deprecated constant configuration (#1444)
  • warn only about deprecated constants (rectorphp/rector-src@fae3f77)
  • drepcate more configure constants (#1446)
  • rector-generator should be a normal requirement (#1453), Thanks @wernerkrauss!

Bugfixes 🐛

  • Fix phpstan configured parser to treat project with its code version (#1480)
  • [TypeDeclaration] Add mixed support for AddParamTypeDeclarationRector (#1476)
  • [TypeDeclaration] Add void upper inner function has return on ReturnTypeDeclarationRector (#1447), Thanks @samsonasik!
  • [Php80] Handle param with default value on AddParamBasedOnParentClassMethodRector (#1452), Thanks @samsonasik!
  • [Php80] Add null default value when child more params no default value AddParamBasedOnParentClassMethodRector (#1454), Thanks @samsonasik!
  • [CodeQuality] Handle inner function return exactly DateTime on DateTimeToDateTimeInterfaceRector (#1463), Thanks @samsonasik!
  • [Php80] Handle parent with typed param on AddParamBasedOnParentClassMethodRector (#1455), Thanks @samsonasik!
  • Correct link in docs (#1465), Thanks @PhilETaylor!
  • [TypeDeclaration] Handle inner Closure on ReturnTypeFromReturnNewRector (#1467), Thanks @samsonasik!
  • [Php74] Do not remove Array Shape docblock on TypedPropertyRector (#1466), Thanks @samsonasik!
  • [TypeDeclaration] Handle inner ClassMethod on ReturnTypeFromStrictTypedPropertyRector (#1470), #6845, Thanks @samsonasik!
  • [Core] Fix undefined constant ReflectionClassConstant::IS_PUBLIC in php 7.x (#1474), Thanks @samsonasik!
  • [DowngradePhp73] Handle (array) cast on DowngradeArrayKeyFirstLastRector (#1478), Thanks @samsonasik!

Released Rector 0.12.7

10 Dec 00:44
Compare
Choose a tag to compare

New Features 🎉

  • [DeadCode] Add RemoveUnusedParamInRequiredAutowireRector (#1225), Thanks @mallardduck!
  • [PHP 8.2] Add rule for AllowDynamicProperties attribute (#1225), Thanks @mallardduck!
  • [CodeQuality] Add ReplaceMultipleBooleanNotRector (#1319), Thanks @villfa!
  • [Renaming] Handle rename template tag of class on RenameClassRector (#1318), Thanks @samsonasik!
  • [TypeDeclaration] Add AddPropertyTypeDeclaration rule (#1317)
  • [DeadCode] Add support remove unused in between private method parameter for RemoveUnusedPrivateMethodParameterRector (#1321), Thanks @samsonasik!
  • [DeadCode] Add RemoveDeadContinueRector (#1323), Thanks @villfa!
  • [Renaming] Add generic rename annotation to RenameAnnotationRector (#1341)
  • [DX] make all configure() methods accept direct value object configuration (#1322)
  • [DX] Make use of configure() method (#1344)
  • [DX] Re-use configure() in docs + remove prefixing of ValueObjectInliner (#1410)
  • Array merge to unpacking (#1345), Thanks @Bl00D4NGEL!
  • [Php80] Add AddParamBasedOnParentClassMethodRector (#1431), Thanks @samsonasik!
  • Add SimpleStaticType for return type completion (#1441)
  • [Downgrade PHP 5.5] Add DowngradeBoolvalRector (#1292), Thanks @villfa!
  • [Downgrade PHP 7.0] Add DowngradeClosureCallRector (#1304), Thanks @villfa!
  • [DowngradePhp74] Add DowngradeReflectionGetTypeRector (#1407)
  • [DowngradePhp80] Add getAttributes() reflection downgrade (#1406)
  • [Downgrade PHP 80] Add DowngradeArbitraryExpressionsSupportRector (#1347), Thanks @villfa!
  • [DowngradePhp81] Add DowngradeArraySpreadStringKeyRector (#1369), Thanks @samsonasik!

Bugfixes 🐛

  • [Transform] Fix keep args on StaticCallToNewRector (#1326), Thanks @samsonasik!
  • do not show --debug output on json error formatter (#1343)
  • [Downgrade PHP 5.6] Fix DowngradeUseFunctionRector (#1348), Thanks @villfa!
  • [Php81] Skip has default value on ReadOnlyPropertyRector (#1355), Thanks @samsonasik!
  • [Php81] Skip no type property on ReadOnlyPropertyRector (#1354), Thanks @samsonasik!
  • [Php81] Skip no type param on ReadOnlyPropertyRector (#1365), Thanks @samsonasik!
  • [Php81] Skip non private modifier on ReadOnlyPropertyRector (#1364), Thanks @samsonasik!
  • strip empty starting/ending php tags (#1329), Thanks @staabm!

Removed 💀

  • [Core] Remove deprecated AbstractRector getObjectType method (#1295), Thanks @samsonasik!
  • [DX] Explicitly inject visibility manipulator service instead of parent constructor (#1298)
  • [League] Remove only League upgrade set from core, give space for community package with whole vendor (#1305)
  • [CodingStyle] Remove PreslashSimpleFunctionRector, let php-cs-fixer doing good work handle that (#1310)
  • [DeadCode] Remove RemoveAssignOfVoidReturnFunctionRector as unreliable, let PHPStan report and use handle various cases (#1313)
  • [Transform] Remove unused ClassConstFetchToValueRector (#1332)
  • [CodingStyle] Remove custom code rule ManualJsonStringToJsonEncodeArrayRector, not much generic (#1398)
  • [Cleanup] merge duplicated SplitStringClassConstantToClassConstFetchRector to UseClassKeywordForClassNameResolutionRector (#1401)
  • [Carbon] Remove fraction of few rules from history (#1408)

Bump to PHP 8.1 📈

New Symfony 6 Set 🥳

  • [Symfony 6] Extend return type set (#88
  • [Symfony] Add FrameworkExtraBundle with attributes set (#85)
  • [Symfony] Extend Symfony 5.3, 5.4 and 6.0 sets (#89)

Released Rector 0.12.5

23 Nov 17:43
Compare
Choose a tag to compare

New Features 🎉

  • [PHP 8.1] Add nested attributes support - part #1 (#1266)
  • [PHP 8.1] Add nested attributes arguments + keep short ORM* like aliases (#1278)
  • [PHP 8.1] Apply constructor promotion on NewInInitializerRector (#1288), Thanks @samsonasik!
  • [DX] Add configure() method to service configuration to make configuration easy again (#1276)
  • [DX] Use main configure() option directly (#1285)
  • [PHP 8.0] Extend DoctrineAnnotationClassToAttributeRector rule to cover short target annotations (#1260)
  • [Downgrade PHP 8.1] Add DowngradePureIntersectionTypeRector (#1281), Thanks @villfa!
  • [Downgrade PHP 8.1] Add DowngradeNewInInitializerRector (#1275), Thanks @villfa!
  • [Downgrade PHP 8.1] Add DowngradeFirstClassCallableSyntaxRector (#1267), Thanks @villfa!
  • [Downgrade PHP 8.1] Add DowngradeReadonlyPropertyRector (#1262), Thanks @villfa!
  • [Downgrade PHP 8.1] Add DowngradeNeverTypeDeclarationRector (#1259), Thanks @villfa!
  • [Downgrade PHP 5.4] Add DowngradeIndirectCallByArrayRector (#1247), Thanks @villfa!
  • [Downgrade PHP 5.5] Add DowngradeArbitraryExpressionArgsToEmptyAndIssetRector (#1250), Thanks @villfa!
  • [Downgrade PHP 5.5] Add DowngradeForeachListRector (#1256), Thanks @villfa!
  • [Php80] Handle schema on Table with UniqueConstraint on AnnotationToAttributeRector (#1252), Thanks @samsonasik!
  • [Compatibility] Add AttributeCompatibleAnnotationRector (#1263)
  • [Downgrade PHP 5.6] Add DowngradeUseFunctionRector (#1290), Thanks @villfa!

Bugfixes 🐛

  • Fix $this/self docblock compare removed on on-final class, as it can refer to child this type (#1246)
  • [Renaming] Handle var static docblock in union on RenameClassRector (#1248), Thanks @samsonasik!
  • Fix DowngradeArbitraryExpressionArgsToEmptyAndIssetRector (#1251), Thanks @villfa!
  • [EarlyReturn][Php73] Handle JsonThrowOnErrorRector + ChangeAndIfToEarlyReturnRector (#1272), Thanks @samsonasik!
  • [DeadCode][EarlyReturn] Handle RemoveUnusedVariableAssignRector + RemoveAlwaysElseRector (#1277), Thanks @samsonasik!
  • [Privatization] Skip with encapsed string part on ChangeReadOnlyVariableWithDefaultValueToConstantRector (#1287), Thanks @samsonasik!