Releases: rectorphp/rector
Releases · rectorphp/rector
Released Rector 2.4.6
New Features 🥳
- [deprecation] Add RenameDeprecatedMethodCallRector inferring rename from @deprecated docblock (#8015)
- [sets] kick of named args set (#8013)
# rector.php
return (RectorConfig::configure())
->withPreparedSets(namedArgs: true);Bugfixes 🐛
- [BetterPhpDocParser] Keep import referenced by @see/@uses tag with a trailing description (#8039), Thanks @ruudk!
- [internals] skip and finalize beforeTraverse() and afterTraverse() as never used, use refactor() instead (#7765)
- [DeadCode] Skip (void) cast with #[NoDiscard] on target method call on RemoveDeadStmtRector (#8038)
- Bump composer/pcre to ^3.4.0 and phpstan/phpstan to ^2.2.2 (#8037)
- [CodeQuality] Handle crash on custom exception not autoloaded on ThrowWithPreviousExceptionRector (#8036)
- refactor: extract AutoloadFileParameterResolver from bin, add tests (#8035), Thanks @SanderMuller!
- Fix cached results surviving a change of
--autoload-file(#8034), Thanks @SanderMuller! - [CodingStyle] Remove AstResolver usage on ArrowFunctionAndClosureFirstClassCallableGuard (#8031)
- [DeadCode] Remove AstResolver on RemoveParentCallWithoutParentRector (#8032)
- [DeadCode] Skip with use of func_num_args() on RemoveNullArgOnNullDefaultParamRector (#8030)
- [Php70] Skip rewriting to $this on static method or static closure on StaticCallOnNonStaticToInstanceCallRector (#8026)
- [ci] add compat test (#8025)
- Fix ReplaceArgumentDefaultValueRector generating invalid self:: constant in unrelated classes (#8023)
- Fix RemoveDeadIfBlockRector dropping else block when merging empty if with elseif (#8022)
- Fix RemoveParentCallWithoutParentRector removing valid call when ancestor hierarchy is unresolvable (#8018)
- split of RemoveNullNamedArgOnNullDefaultParamRector to handle only named args (#8014)
- Add failing tests (#8012), Thanks @u01jmg3!
- Update rector/swiss-knife version to ^2.4.1 (#8011)
rectorphp/rector-symfony 🎶
- [Symfony81] Add new rule for deprecated validator test usages (#948), Thanks @florianhofsaessC24!
- fix: only convert Twig extensions fully reducible to AsTwig attributes (#947)
- [Symfony73] Sort optional parameters last in InvokableCommandInputAttributeRector (#945)
- Add PHPStan rule requiring nested set configs to be imported in parent set config (#943)
- [Symfony81] Add new rule for Security component (#942), Thanks @MrYamous!
- Remove unused imports (#941), Thanks @MrYamous!
- [Symfony81] Add new rule for Filesystem (#940), Thanks @MrYamous!
rectorphp/rector-phpunit 🟢
- [PHPUnit12] Handle crash on property not exists on PropertyCreateMockToCreateStubRector (#681)
- [AnnotationsToAttributes] Convert external @Depends ClassName::method to #[DependsExternal] (#679)
- [PHPUnit12] Drop ConstraintValidatorTestCase from AllowMockObjectsWhereParentClassRector triggers (#678)
rectorphp/rector-downgrade-php ⬇️
- Add DowngradeDomNodeChildNodesForeachRector for null $childNodes before PHP 8.0 (#379)
- Update boundwize/structarmed version to ^0.9 (#378)
- Fix use of existing PhpAttributeAnalyzer service on AddReturnTypeWillChangeAttributeRector (#377)
- Remove no longer exists '--ansi' flag from swiss-knife (#376)
- [DowngradePhp81] Add AddReturnTypeWillChangeAttributeRector (#372), Thanks @jquiaios!
Released Rector 2.4.5
New Features 🥳
Bugfixes 🐛
- fix: skip StaticCallToMethodCallRector when parent declares final __construct (#8001)
- [NodeManipulator] Use ClassReflection parent isFinalByKeyword()->yes() on ClassDependencyManipulator (#8002)
- [BetterPhpDocParser] Don't wrap first-position @method param union in extra parens (#8003), Thanks @kyle-bisnow!
- [ci] kick of auto issue fixer (#8004)
- [automated] Apply Coding Standard (#8005)
- [CodeQuality] Skip possibly undefined variable on SimplifyEmptyCheckOnEmptyArrayRector (#8006)
- [CodingStyle] Handle namespaced function string on FunctionFirstClassCallableRector (#8007)
- Fix compatibility on optional key on array dim fetch to be Mixed on phpstan patch 2.1.x-dev (#8008)
- Update Mongodb constant from DoctrineSetList (#8009)
- Bump to PHPStan ^2.1.56 (#8010)
rectorphp/rector-symfony
- [QA] Add StructArmed to QA (#939)
- [Symfony81] add rule for Ulid::isValid() new argument (#938), Thanks @MrYamous
- [Symfony81] add rule for Serialiazer method change (#937), Thanks @MrYamous
- [Symfony81] add rules for DependencyInjection namespace change (#936), Thanks @MrYamous
rectorphp/rector-doctrine
- [QA] Add StructArmed to QA (#482)
rectorphp/rector-phpunit
- [QA] Add StructArmed to QA (#677)
- fix assert call type resolving (#675)
- fix AssertIsTypeMethodCallRector crash on enum case argument (#674)
rectorphp/rector-downgrade-php
- [QA] Add StructArmed to QA (#375)
Released Rector 2.4.4
New Features 🥳
- [QA] Add StructArmed to QA (#7989)
- feat: create rector to add names to boolean arguments (#7944), Thanks @calebdw!
- [CodeQuality] Add missing MinPhpVersionInterface implements on AddNameToBooleanArgumentRector (#7994)
- [injection] If parent class has dependency via promoted property, but its private, add a new one to child class deps (#7996)
Bugfixes 🐛
- Bump structarmed to ^0.6 (#7990)
- [Php81] Skip NullToStrictStringFuncCallArgRector for magic __get() property access resolving to ErrorType (#7992)
- [automated] Apply Coding Standard (#7993)
- [TypeDeclarationDocblocks] Skip overridden methods in DocblockReturnArrayFromDirectArrayInstanceRector (#7995)
- Fix compatibility with latest phpstan patch 2.1.x-dev (#7997)
- Temporary pin webmozart/assert to 2.3.0 to make downgrade working (#7998)
- Bump webmozart/assert to ^2.4 (#7999)
Removed 💀
- [DeadCode] Skip used by get_object_vars on RemoveUnusedPromotedPropertyRector (#7988)
rectorphp/rector-symfony
- add fixture with failing parent private (#935)
- fix ControllerMethodInjectionToConstructorRector - update call sites when params are moved to constructor (#934)
rectorphp/rector-downgrade-php
- [DowngradePhp82] Handle nullable true on DowngradeStandaloneNullTrueFalseReturnTypeRector (#374)
Released Rector 2.4.3
New Features 🥳
- Add silverstripe-rector link to README (#7974), Thanks @wernerkrauss!
Bugfixes 🐛
- Fix the behavior of
ClassPropertyAssignToConstructorPromotionRectorwhen types do not match (#7972), Thanks @mspirkov! - Rectify (#7973)
- Bump crate-ci/typos from 1.44.0 to 1.46.0 (#7976), Thanks @dependabot[bot]!
- [CodeQuality] Skip union type on UseIdenticalOverEqualWithSameTypeRector (#7975)
- [CodingStyle] Mirror comment on SplitDoubleAssignRector (#7977)
- [phpstan] remove copuel fixed phpstan ignores (#7979)
- trigger code analysis on main (rectorphp/rector-src@adb24d0)
- [CodeQuality] Skip in html for ForRepeatedCountToOwnVariableRector (#7981)
- Clean up PHPStan ignoreErrors (#7982)
- Fix typo namespace Sourde -> Source in rules-tests/TypeDeclarationDocblocks (#7983)
- cs (rectorphp/rector-src@7805989)
- [Naming] Handle rename with use after anonymous class on RenameParamToMatchTypeRector (#7984)
- [DX] Fix run on custom rector config when no rector.php (#7985)
- Temporary pin nette/utils version to 4.1.3 (#7986)
- Bump to nette/utils ^4.1.4 (#7987)
Removed 💀
- [remove] Remove deprecated StmtsAwareInterface (#7978)
- [remove] Remove deprecated FileWithoutNamespace and ScopeResolverNodeVisitorInterface (#7980)
- remove docker-metadata files, as no longer maintained (rectorphp/rector-src@2166603)
rectorphp/rector-symfony
- [symfony 2.4] skip no-route in GetRequestRector (#933)
- fix(CommandHelpToAttributeRector): support concatenated string in setHelp() (#932), Thanks @androshchuk
rectorphp/rector-phpunit
- [CodeQuality] Handle on static closure on WithCallbackIdenticalToStandaloneAssertsRector (#672)
- ReplaceTestAnnotationWithPrefixedFunctionRector does not match @ test annotation if it is being part of string (#671), Thanks @Dukecz
- [PHPUnit12] Skip used as next arg with MockObject Type on ExpressionCreateMockToCreateStubRector (#670)
- [CodeQuality] Skip multiple uses variable as arg after defined on BareCreateMockAssignToDirectUseRector (#669)
rectorphp/rector-downgrade-php
Released Rector 2.4.2
New Features 🥳
- Add some symfony/polyfill support (#7965), Thanks @sreichel!
- [DeadCode] Allow remove useless @ var on aliased object on RemoveUselessVarTagRector (#7967)
Bugfixes 🐛
- [Php81] Handle crash on normal array with variadic inside class on ArrayToFirstClassCallableRector (#7966)
- [CodeQuality] Skip possibly undefined variable on CoalesceToTernaryRector (#7968)
- [Php70] Allow is_null() conversion on TernaryToNullCoalescingRector with parentheses handling (#7969)
- Bump to PHPStan ^2.1.47 (#7970)
- Bump to PHPStan ^2.1.48 (#7971)
rectorphp/rector-symfony 🎵
- Fix unit test due to new PHPStan release (#931)
Released Rector 2.4.1
New Features 🥳
- [DeadCode] Add
RemoveUselessTernaryRector(#7961) - [CodeQuality] Add
CoalesceToTernaryRector(#7960) - Add
--rules-summaryoption to display applied rules summary with count (#7874), Thanks @carlos-granados! - Add support for adding the
#[Override]attribute to methods implementing interfaces (#7934), Thanks @hockdudu! - feat(printer): add per-node NEWLINE_ON_FLUENT_CALL attribute to BetterStandardPrinter (#7910), Thanks @MrPunyapal!
- Show line numbers in diff output (#7875), Thanks @carlos-granados!
Bugfixes 🐛
- [CodeQuality] Skip with HTML on CompleteMissingIfElseBracketRector (#7952)
- [CodeQuality] Handle with assign on SimplifyIfElseToTernaryRector (#7951)
- [CodeQuality] Skip with HTML on TernaryFalseExpressionToIfRector (#7954)
- [automated] Apply Coding Standard (#7955)
- Make compatible with PHPStan 2.1.x-dev for ObjectType::equals() change behaviour (#7956)
- [AutoImport] Handle FQCN in/not in use on auto import + remove unused import as prefix = suffix (#7957)
- perf: use hash map for installed packages (#7878), Thanks @calebdw!
- [ChangesReporting][Alternative] Collect changed_files on --no-diffs with json output with use of JsonOutputFactory (#7821)
- fix: OOM crash in RemoveUnusedVariableAssignRector (#7964), Thanks @calebdw!
Deprecations 💀
Released Rector 2.4.0
New Features 🥳
- chore: add
SafeDeclareStrictTypesRectorto code quality set (#7935), Thanks @calebdw! - [Caching] Add CacheMetaExtensionInterface for custom cache invalidation (#7933), Thanks @ruudk!
- feat(php86): add min/max to clamp rector (#7942), Thanks @calebdw!
Bugfixes 🐛
- [Php85] Do not convert to pipe on use directly of spread operator on NestedFuncCallsToPipeOperatorRector (#7938)
- [Console] Allow short command "p" on ProcessCommand (#7931)
- [Arguments] Skip self class const fetch inside this class target replacement on ReplaceArgumentDefaultValueRector (#7940)
- [CodeQuality] Hnadle with negation binary op previous if on CombineIfRector (#7945)
- [CodingStyle] Skip by reference required params on call inside on ArrowFunctionDelegatingCallToFirstClassCallableRector (#7949)
Removed 💀
- [DeadCode] Skip pipe operator on RemoveDeadStmtRector (#7941)
- [DeadCode] Handle crash on multi elseif on RemoveDeadIfBlockRector (#7946)
- [DeadCode] Skip with assign to call with target has #[NoDiscard] attribute on RemoveUnusedVariableAssignRector (#7950)
rectorphp/rector-symfony 🎵
- [CodeQuality] Handle different parameter type same name used on ControllerMethodInjectionToConstructorRector (#929)
- [CodeQuality] Skip used by static closure use on ControllerMethodInjectionToConstructorRector (#928)
- [Symfony61] Skip non static external class callable on MagicClosureTwigExtensionToNativeMethodsRector (#927), Thanks @wuchen90
rectorphp/rector-doctrine 🟠
- Fix infinite loop check instanceof name check to use Name class (#481)
rectorphp/rector-phpunit 🟢
- [PHPunit 9] Move AssertRegExpRector to phpunit 90 set with refactor to use assertMatchesRegularExpression/assertDoesNotMatchRegularExpression (#667)
- [PHPUnit 9] Rename assertRegExp/assertNotRegExp to assertMatchesRegularExpression/assertDoesNotMatchRegularExpression on phpunit 90 set (#666)
- Fix assert PHPStan on ConfiguredMockEntityToSetterObjectRector (#665)
Released Rector 2.3.9
New Features 🥳
- [CodingStyle] Add
StrictInArrayRector(#7921)
Bugfixes 🐛
- [Php71] Handle crash on partial destruct on assign var on ListToArrayDestructRector (#7909)
- [CodeQuality] Skip no code parameter on custom Throwable instance on ThrowWithPreviousExceptionRector (#7912)
- Bump to PHPStan ^2.1.40 and utilize ClassConstantReflection->isFinalByKeyword() (#7911)
- [Php70] Handle keep right parentheses on ternary else is BinaryOp on TernaryToNullCoalescingRector (#7916)
- Properly build text node for junit output formatter (#7917), Thanks @brandonja991!
- [CodeQuality] Skip with custom param in previous position on ThrowWithPreviousExceptionRector (#7919)
- [automated] Apply Coding Standard (#7922)
- [DX] Define list of allowed implicit commands on ConsoleApplication (#7918)
- [CodeQuality] Skip used by other property hooks on InlineConstructorDefaultToPropertyRector (#7920)
- [automated] Apply Coding Standard (#7926)
- [StrictStringParamConcatRector] Skip PHP version 5.6 or earlier (#7927), Thanks @ghostwriter!
- [Php85] Skip single char literal string/int on OrdSingleByteRector (#7928)
rectorphp/rector-symfony 🎵
- [CodeQuality] Allow Doctrine EntityManagerInterface on ControllerMethodInjectionToConstructorRector (#926)
- [CodeQuality] Skip has conflicted param name different object on different method on ControllerMethodInjectionToConstructorRector (#925)
- [Symfony73] Handle with set allowExtraFields named argument on ConstraintOptionsToNamedArgumentsRector (#924)
- Skip classes with Symfony 7.1 Workflow listener attributes (#923), Thanks @dionisvl
rectorphp/rector-doctrine 🟠
- [TypedCollections] Skip with string key already on CompleteReturnDocblockFromToManyRector (#480)
rectorphp/rector-phpunit 🟢
- [CodeQuality] Skip test method via #[Test] Attribute on DataProviderArrayItemsNewLinedRector (#664)
- skip conflicting return node and return type in TypeWillReturnCallableArrowFunctionRector! (#663)
- [Phpunit12] Skip as Argument with required MockObject Type on CreateStubOverCreateMockArgRector (#662)
- feat: add IntersectionType support to PropertyCreateMockToCreateStubRector (#661), Thanks @asumikam
Released Rector 2.3.8
Bugfixes 🐛
- [CodeQuality] Only allow from final class or constant is marked final on VariableConstFetchToClassConstFetchRector (#7904)
- [CodeQuality] Skip custom exception param order flipped on no namespace on ThrowWithPreviousExceptionRector (#7906)
- [DeadCode] Skip different default param not typed on RemoveParentDelegatingConstructorRector (#7905)
- [DeadCode] Skip non-literal 0 or 1 usage on RemoveDeadZeroAndOneOperationRector (#7907)
- [TypeDeclarationDocblocks] Typo fix RuleDefinition description on AddVarArrayDocblockFromDimFetchAssignRector (#7902)
- [Php83] Fix infinite add - remove #[Override] on tearDown() method on AddOverrideAttributeToOverriddenMethodsRector when combined with NoSetupWithParentCallOverrideRector (#7903)
rectorphp/rector-symfony
- [CodeQuality] Skip symfony UuidV4 on ControllerMethodInjectionToConstructorRector (#922)
Released Rector 2.3.7
New Features 🥳
- feat: add ComposerPackageConstraintInterface (#7877), Thanks @calebdw!
- Add AddOverrideAttributeToOverriddenPropertiesRector for PHP 8.5 (#7880), Thanks @carlos-granados!
Bugfixes 🐛
- Skip ClosureToArrowFunctionRector when closure has @ var docblock (#7885), Thanks @QDenka!
- [Php80] Skip property hook with indirect set on ClassPropertyAssignToConstructorPromotionRector (#7887)
- [Php70] Keep right parentheses on TernaryToNullCoalescingRector (#7889)
- Bump nette/utils to ^4.1.3 (part 2) (#7894)
- [Php72] Handle crash on hex backreference on PregReplaceEModifierRector (#7896)
- Update code sample for SimplifyEmptyCheckOnEmptyArrayRector (#7897), Thanks @ramonrietdijk!
- [Php80] Handle Behat transform annotation (#7899), Thanks @loic425!
- fix: Skip attribute decorated parameters in
RemoveParentDelegatingConstructorRector(#7900), Thanks @marcreichel! - [DeadCode] Handle only remove 1 @ var on multi vars on RemoveUselessVarTagRector (#7884)
- Fix abstract declaration in fixture source (#7901), Thanks @Victor-Vechi!
rectorphp/rector-symfony 🎵
- [CodeQuality] Skip DateTimeInterface instance on ControllerMethodInjectionToConstructorRector (#921)
- [Symfony73] Skip with @ Translate docblock on ConstraintOptionsToNamedArgumentsRector (#920)
rectorphp/rector-phpunit 🟢
- [PhpUnit 8] Skip on possible return array on SpecificAssertContainsRector (#660)
- [CodeQuality] check class exists on BehatPHPUnitAssertToWebmozartRector (#659)
- [behat] Add
BehatPHPUnitAssertToWebmozzartRector(#658) - [code-quality] Add
AddKeysExistsAssertForKeyUseRector(#657) - [PHPUnit120] Skip non-mock object on AllowMockObjectsWithoutExpectationsAttributeRector (#656)
- [CodeQuality] Skip on non-mock object on DecorateWillReturnMapWithExpectsMockRector (#655)
- [CodeQuality] Skip first class callable on DecorateWillReturnMapWithExpectsMockRector (#654)
- improve DecorateWillReturnMapWithExpectsMockRector edge cases (#653)
- convert tearDown in NoSetupWithParentCallOverrideRector as well (#652)
- [config] split off 12.5 set, just to improve readability (#651)