chore(deps): update dependency rector/rector to v2.5.7#455
Merged
Conversation
90d3aeb to
6d31bb7
Compare
6d31bb7 to
130b2ee
Compare
130b2ee to
a3a29a9
Compare
ded2787 to
6714d86
Compare
6714d86 to
fc8ba3f
Compare
fc8ba3f to
91f58ed
Compare
9cbcd1e to
a1140dd
Compare
75f3eac to
b642092
Compare
0fb2454 to
353c6a9
Compare
353c6a9 to
c413eae
Compare
Minimum allowed line rate is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
2.5.4→2.5.7Warning
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
Release Notes
rectorphp/rector (rector/rector)
v2.5.7: Released Rector 2.5.7Compare Source
This release sharpens the PHPUnit code-quality sets, adds a focused narrow asserts set, deprecates two blurry Symfony web-test rules, and fixes a handful of docblock false-positives in dead-code removal.
New Features 🎉
PHPUnit:
PHPUNIT_NARROW_ASSERTSsetA new set focused on narrowing broad asserts to their specific, more descriptive method — e.g.
assertTrue(isset($a['b']))→assertArrayHasKey('b', $a). (rector-phpunit #716)withPreparedSets()gainsphpunitNarrowAsserts+phpunitMockToStubThe 2 PHPUnit sets are now toggleable like any other prepared set. (#8178)
PHPUnit: flip
with($this->callback(...))on void methods towillReturnCallback()VoidMethodWithCallbackToWillReturnCallbackRector(renamed + refocused) drops the pointlessreturnvalue and types the closure asvoid, matching the mocked void method. (rector-phpunit #724)$this->createMock(SomeClass::class) ->method('run') - ->with($this->callback(function ($arg) { - echo $arg; - - return true; - })); + ->willReturnCallback(function ($arg): void { + echo $arg; + });Console:
-vas alias for--versionSince the
verboseoption was removed,-vnow prints the version. (#8177)vendor/bin/rector -v # Rector 2.x.xImprovements 🔧
literal-string,numeric-string, …) to their real PHPStan types instead of a bogusObjectType, so precise docblocks survive dead-code cleanup (#8176)Assertclass via reflection before transforming (rector-phpunit #720)CallbackSingleAssertToSimplerRector(rector-phpunit #722)atLeast()instead ofexactly()inDecorateWillReturnMapWithExpectsMockRector(rector-phpunit #719)Bug Fixes 🐛
@returntags inRemoveReturnTagIncompatibleWithNativeTypeRector(#8183)RemoveReturnTagIncompatibleWithNativeTypeRector(#8180)RemoveReturnTagIncompatibleWithNativeTypeRector(#8179)CompleteDynamicPropertiesRector(#8182)@methodinRemoveExtraParametersRector(#8181)with()multiple arguments inVoidMethodWithCallbackToWillReturnCallbackRector(rector-phpunit #725)newobject instances inNarrowIdenticalWithConsecutiveRector— eachnewis a fresh instance, collapsing them changes intent (rector-phpunit #726)CallbackSingleAssertToSimplerRector(rector-phpunit #718)AssertEqualsToSameRectorto preserve loose comparison (rector-phpunit #717)Deprecations 💀
Symfony:
WebTestCaseAssertIsSuccessfulRector+WebTestCaseAssertResponseCodeRectorBoth rules hide the asserted behavior and force a different assert method per status code, splitting one clear assertion into several implicit ones. Asserting the HTTP status code directly is clearer and uniform. (rector-symfony #958)
v2.5.6: Released Rector 2.5.6Compare Source
New Features 🥳
RemoveReturnTagIncompatibleWithNativeTypeRector(#8172)final class SomeClass { - /** - * @​return SomeObject - */ public function getName(): string { return $this->someObject->getName(); } }MergePhpstanDocTagIntoNativeRectorto merge@phpstan-*doc tags into native tags (#8171)final class SomeClass { /** - * @​var Collection - * - * @​phpstan-var Collection<int, string> + * @​var Collection<int, string> */ private $items; }Bugfixes 🐛
NullToStrictStringFuncCallArgRector(#8164)getRuleDefinition()method, parts 1–5 (#8165, #8166, #8167, #8168, #8169)phpstan/phpdoc-parserto^2.3.3(#8174)PHPUnit 🧪
New rules and changes from rector-phpunit.
New Rules
AssertClassToThisAssertRector(#707)use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; final class SomeClass extends TestCase { public function run() { - Assert::assertEquals('expected', $result); + $this->assertEquals('expected', $result); } }BareCreateMockAssignToDirectUseRector— inline a single-usecreateMock()assignment (#708)final class SomeTest extends TestCase { public function test() { - $someObject = $this->createMock(SomeClass::class); - $this->process($someObject); + $this->process($this->createMock(SomeClass::class)); } private function process(SomeClass $someObject): void { } }WillReturnCallbackFallbackToThrowRector— throw on an unexpected extra consecutive call (#710)$this->someServiceMock->expects($matcher) ->method('run') ->willReturnCallback(function () use ($matcher) { if ($matcher->numberOfInvocations() === 1) { return 1; } + + throw new \PHPUnit\Framework\Exception(sprintf('Method should not be called for the %dth time', $matcher->numberOfInvocations())); });RemoveReturnFromVoidMethodMockCallbackRector— type a void mock callback and drop its value return (#711)$this->createMock(SomeClass::class) ->method('run') - ->willReturnCallback(function ($arg) { + ->willReturnCallback(function ($arg): void { echo $arg; - - return true; });(
SomeClass::run()returnsvoid.)CallbackSingleAssertToSimplerRector— collapse awith()callback with a soleassertSame()toequalTo()(#714)$builder->expects($this->exactly(2)) ->method('add') - ->with($this->callback(function ($type): bool { - $this->assertSame(TextType::class, $type); - - return true; - })); + ->with($this->equalTo(TextType::class));Improvements
TestCasesuffix classes inRemoveNeverUsedMockPropertyRector(#709)WithCallbackIdenticalToStandaloneAssertsRector(#712)return throwandreturn nullin void mock callbacks (#713)v2.5.5: Released Rector 2.5.5Compare Source
New Features 🥳
AlternativeIfToBracketRector(#8158)Bugfixes 🐛
AddClosureParamTypeForArrayMapRectorto type closure params from array values, not keys (#8163)Configuration
📅 Schedule: (UTC)
* * * * 0,6)🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.