github rectorphp/rector 2.5.3
Released Rector 2.5.3

4 hours ago

New Features 🥳

  • [CodeQuality] Add NegatedAndsToPositiveOrsRector (#8082)
  • [DeadCode] Add RemoveDuplicatedReturnSelfDocblockRector to drop @return docblock duplicating native self/static (#8087)
  • [DeadCode] Add RemoveMixedDocblockOverruledByNativeTypeRector to drop @param mixed / @return mixed overruled by native type (#8089)
  • [code-quality] Add AttributeNamedArgsRector (#8079), Thanks @DaveLiddament!
  • [utils] Add CheaperGuardFirstRule PHPStan rule to enforce early bail before expensive analysis (#8105)
  • [CodeQuality] Add SwitchTrueToMatchRector as replacement for deprecated SwitchTrueToIfRector (#8113)
  • [TypeDeclaration] Add ClosureReturnTypeFromAssertInstanceOfRector (#8115)
  • [TypeDeclaration] Add TypedPropertyFromContainerGetSetUpRector (#8120)
  • [TypeDeclaration] Skip variadic param in AddMethodCallBasedStrictParamTypeRector (#8123)
  • [TypeDeclaration] Add TypedPropertyFromGetRepositorySetUpRector (#8124)
  • [DeadCode] Add RemoveUselessUnionReturnDocblockRector (#8126)
  • [TypeDeclaration] Add NarrowBoolDocblockReturnTypeRector (#8127)
  • [TypeDeclaration] Add typeGuardedClasses() to guard against breaking method signature changes (#8135)
  • [TypeDeclarationDocblocks] Add NarrowArrayCollectionUnionReturnDocblockRector (#8136)
  • [TypeDeclaration] Add AddClosureParamTypeFromVariableCallRector (#8142)

Bugfixes 🐛

  • [AutoImport] Avoid used import into param that skipped from removal rule (#8078)
  • [Php81] Skip as argument unpack on ArrayToFirstClassCallableRector (#8081)
  • [Php70] Skip memoize item by key on IfIssetToCoalescingRector (#8083)
  • Cache --only / --only-suffix runs under a rule-scoped key (#8075), Thanks @SanderMuller!
  • Bump to PHP 8.4 (#8088)
  • [TypeDeclarationDocblocks] Skip docblock already defined in parent on DocblockVarArrayFromPropertyDefaultsRector (#8085)
  • [DeadCode] Skip constant compare from vendor/ on NarrowWideUnionReturnTypeRector (#8056)
  • [perf] Drop AstResolver from named-arg position resolution (#8099)
  • [TypeDeclaration] Drop AstResolver from NarrowObjectReturnTypeRector parent check (#8100)
  • [Strict] Skip class re-parse for typed default property in UninitializedPropertyAnalyzer (#8101)
  • [dx] optimize cheaper early returns (#8102)
  • [dx] optimize cheaper early returns (#8103)
  • [Php74] Skip anonymous classes in RestoreDefaultNullToNullableTypePropertyRector (#8104)
  • [Php81] Skip readonly on property returned by reference in ReadOnlyPropertyRector (#8108)
  • [DeadCode] Keep parent-delegating constructor when its docblock refines parameter types (#8111)
  • [CodingStyle] Skip private parent methods in MakeInheritedMethodVisibilitySameAsParentRector (#8114)
  • [CI] Fix import order in CheaperGuardFirstRule (#8116)
  • [Php81] Skip ArrayToFirstClassCallableRector on serialized callable array keys and Definition::setFactory() (#8117)
  • [Php81] Skip ReadOnlyPropertyRector on property changed via reference in foreach (#8118)
  • [CodeQuality] Keep parentheses around Ternary operand in SimplifyConditionsRector (#8122)
  • [Cache] Fix double clear-cache (#8096)
  • [TypeDeclaration] Map accessory string intersection to string in union return type (#8125)
  • [DeadCode] Keep private method called via self::class static call (#8098)
  • [Privatization] Skip FinalizeTestCaseClassRector for classes without Test suffix (#8128)
  • [TypeDeclaration] Skip anonymous class return in NarrowObjectReturnTypeRector (#8131)
  • [TypeDeclaration] Split ParamTypeByMethodCallTypeRector into Object, Scalar and Array rules (#8134)
  • [TypeDeclaration] Skip constructor-assigned property in PropertyTypeFromStrictSetterGetterRector (#8137)
  • Update boundwize/structarmed version to 0.14 (#8138)
  • Do not run several CI jobs on forks (#8132), Thanks @simonschaufi!
  • [TypeDeclaration] Skip type-guarded trait methods in StrictArrayParamDimFetchRector (#8139)
  • [TypeDeclaration] Skip property fetch on array dim fetch in StrictArrayParamDimFetchRector (#8140)
  • [automated] Re-Generate preload.php (#8143)
  • [automated] Apply Coding Standard (#8144)
  • Bump php-parser to ^5.8 (#8145)

Removed 💀

  • [PostRector] Skip inline {@see } used use statement on remove unused imports (#8080)
  • [DeadCode] Skip on clone on object with __clone() method on RemoveDeadStmtRector (#8084)
  • [TypeDeclaration] Deprecate StrictStringParamConcatRector as producing too many false positives (#8090)
  • [CodingStyle] Deprecate StaticClosureRector and StaticArrowFunctionRector (#8092)
  • [depre] Deprecate StaticCallOnNonStaticToInstanceCallRector, as risky change (#8093)
  • [deprecations] Remove long-deprecated rules (5+ mnths) (#8094)
  • [CodingStyle] Deprecate EnumCaseToPascalCaseRector as risky change (#8095)
  • [dead-code] Skip runtime exists_* checks in RemoveAlwaysTrueIfConditionRector (#8097)
  • [DeadCode] Skip foreach over side-effecting expression in RemoveDeadIfForeachForRector (#8106)
  • [deprecation] Deprecate JoinStringConcatRector (#8107)
  • [deprecation] Deprecate SwitchTrueToIfRector (#8109)
  • [DeadCode] Skip RemoveDoubleAssignRector when assign target contains a side-effecting call (#8110)
  • [DeadCode] Deprecate RemoveTypedPropertyNonMockDocblockRector as no real value (#8119)
  • [CI] Remove dependabot config (#8133)

rectorphp/rector-symfony

  • [Symfony73] Handle subject included in previous AuthorizationChecker call (#956)
  • Update boundwize/structarmed version to ^0.14 (#955)
  • [Deprecation] Deprecate ParameterBagToAutowireAttributeRector (#954)
  • Use @deprecated docblock over native attribute on set list constants (#953)
  • [Deprecation] Deprecate AddRouteAnnotationRector (#952)
  • Remove symplify/phpstan-extensions, use phpstan-rules built-in config (#951)
  • Bump to PHP 8.4, re-apply, upgrade (#950)
  • [CodeQuality] Add EventSubscriberMethodReturnVoidRector (#949)
  • Order optional command parameters last in InvokableCommandInputAttributeRector (#944)

rectorphp/rector-doctrine

  • Update boundwize/structarmed version to ^0.14 (#486)
  • Bump to PHP 8.4 (#485)

rectorphp/rector-phpunit

  • Update boundwize/structarmed version to ^0.14 (#704)
  • [CodeQuality] Add ChangeMockObjectReturnUnionToIntersectionRector (#703)
  • [CodeQuality] Reuse local stub variable when property used 2+ times in single method (#702)
  • [CodeQuality] Skip DecorateWillReturnMapWithExpectsMockRector on non-test methods (#701)
  • [CodeQuality] Add AddStubIntersectionVarToStubPropertyRector (#700)
  • [CodeQuality] Skip AddIntersectionVarToMockObjectPropertyRector when @var already has intersection type (#699)
  • [PHPUnit120] Skip PropertyCreateMockToCreateStubRector for property with expects() nested in closure (#698)
  • [CodeQuality] Add AddIntersectionVarToMockObjectPropertyRector (#697)
  • [PHPUnit120] Skip PropertyCreateMockToCreateStubRector on abstract/base test classes (#696)
  • [PHPUnit120] Use Stub FQN in @var docblock (#695)
  • [CodeQuality] Skip NarrowUnusedSetUpDefinedPropertyRector for property captured by lazy/self-referencing arrow function (#694)
  • [CodeQuality] Skip NarrowUnusedSetUpDefinedPropertyRector for property used in nested closure (#693)
  • [CodeQuality] Skip AssertIssetToSpecificMethodRector on ArrayAccess objects (#692)
  • [CodeQuality] Detect Behat context by interface, not class name suffix (#691)
  • [PHPUnit120] Add BareVarToStubIntersectionRector (#690)
  • [PHPUnit120] Add MockObjectVarToStubRector (#689)
  • [Set] Extract mock-to-stub rules into dedicated PHPUNIT_MOCK_TO_STUB set (#688)
  • [PHPUnit60] Fix false positive in AddDoesNotPerformAssertionToNonAssertingTestRector (#687)
  • [CodeQuality] Deprecate BehatPHPUnitAssertToWebmozartRector as too narrow (#686)
  • Bump to PHP 8.4 (#685)
  • [CodeQuality] Use static Assert:: call for assert() inside anonymous class (#684)
  • [CodeQuality] Fix MergeWithCallableAndWillReturnRector to add closure use() for variables nested in willReturn expr (#683)
  • [CodeQuality] Add fixture for assertTrue instanceof on local variable (#682)
  • [CodeQuality] Rule to enforce test method code style (#668), Thanks @Xammie

rectorphp/rector-downgrade-php

  • Update boundwize/structarmed version to ^0.14 (#381)
  • [DowngradePhp81] Support JsonSerializable in AddReturnTypeWillChangeAttributeRector (#380), Thanks @TobiasBg

Don't miss a new rector release

NewReleases is sending notifications on new releases.