Skip to content

[Conductor] Update dev#108

Open
private-packagist[bot] wants to merge 1 commit into
mainfrom
conductor-multiple-vendors-all-81466
Open

[Conductor] Update dev#108
private-packagist[bot] wants to merge 1 commit into
mainfrom
conductor-multiple-vendors-all-81466

Conversation

@private-packagist

Copy link
Copy Markdown
Contributor

This PR was automatically generated by Conductor.

The PR contains the changes generated by running the following command:

composer update friendsofphp/php-cs-fixer:v3.95.15 rector/rector:2.5.7 --with-all-dependencies --minimal-changes

Changelog

friendsofphp/php-cs-fixer (Source: GitHub Releases))

v3.95.15

What's Changed

  • fix: self-update - fix "Access Denied" error when running on Windows by @​mlocati in #​9731

Full Changelog: v3.95.14...v3.95.15

v3.95.14

What's Changed

Full Changelog: v3.95.13...v3.95.14

v3.95.13

What's Changed

  • fix: SelfAccessorFixer - do not replace constant with same name as class in the middle of a static access chain by @​kubawerlos in #​9716
  • fix: SingleClassElementPerStatementFixer - do not drop type of typed constants by @​kubawerlos in #​9706

Full Changelog: v3.95.12...v3.95.13

rector/rector (Source: GitHub Releases))

2.5.7

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_ASSERTS set

A 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)

use Rector\PHPUnit\Set\PHPUnitSetList;

return RectorConfig::configure()
->withSets([PHPUnitSetList::PHPUNIT_NARROW_ASSERTS]);



withPreparedSets() gains phpunitNarrowAsserts + phpunitMockToStub

The 2 PHPUnit sets are now toggleable like any other prepared set. (#​8178)

return RectorConfig::configure()
    ->withPreparedSets(
        phpunitNarrowAsserts: true,
        phpunitMockToStub: true,
    );

PHPUnit: flip with($this->callback(...)) on void methods to willReturnCallback()

VoidMethodWithCallbackToWillReturnCallbackRector (renamed + refocused) drops the pointless return value and types the closure as void, 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: -v as alias for --version

Since the verbose option was removed, -v now prints the version. (#​8177)

vendor/bin/rector -v
# Rector 2.x.x

Improvements 🔧

  • [StaticTypeMapper] Map phpstan-special scalar types (literal-string, numeric-string, …) to their real PHPStan types instead of a bogus ObjectType, so precise docblocks survive dead-code cleanup (#​8176)
  • [PHPUnit CodeQuality] Verify assert method name exists on the Assert class via reflection before transforming (rector-phpunit #​720)
  • [PHPUnit CodeQuality] Simplify single-statement void callback in CallbackSingleAssertToSimplerRector (rector-phpunit #​722)
  • [PHPUnit CodeQuality] Collapse all instanceof asserts for multiple nullable instances in a single run (rector-phpunit #​721)
  • [PHPUnit CodeQuality] Use atLeast() instead of exactly() in DecorateWillReturnMapWithExpectsMockRector (rector-phpunit #​719)

Bug Fixes 🐛

  • [DeadCode] Preserve generic @​return tags in RemoveReturnTagIncompatibleWithNativeTypeRector (#​8183)
  • [DeadCode] Skip templated type in RemoveReturnTagIncompatibleWithNativeTypeRector (#​8180)
  • [DeadCode] Skip PHPStan type alias in RemoveReturnTagIncompatibleWithNativeTypeRector (#​8179)
  • [CodeQuality] Skip abstract class in CompleteDynamicPropertiesRector (#​8182)
  • [Php71] Skip magic @​method in RemoveExtraParametersRector (#​8181)
  • [PHPUnit] Skip with() multiple arguments in VoidMethodWithCallbackToWillReturnCallbackRector (rector-phpunit #​725)
  • [PHPUnit] Skip new object instances in NarrowIdenticalWithConsecutiveRector — each new is a fresh instance, collapsing them changes intent (rector-phpunit #​726)
  • [PHPUnit] Skip mock property removal when used in a trait (rector-phpunit #​723)
  • [PHPUnit] Skip nested value compare in CallbackSingleAssertToSimplerRector (rector-phpunit #​718)
  • [PHPUnit] Skip union types in AssertEqualsToSameRector to preserve loose comparison (rector-phpunit #​717)

Deprecations 💀

Symfony: WebTestCaseAssertIsSuccessfulRector + WebTestCaseAssertResponseCodeRector

Both 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)

2.5.6

New Features 🥳

  • [DeadCode] Add RemoveReturnTagIncompatibleWithNativeTypeRector (#​8172)
 final class SomeClass
 {
-    /**
-     * @​return SomeObject
-     */
     public function getName(): string
     {
         return $this->someObject->getName();
     }
 }
  • [TypeDeclarationDocblocks] Add MergePhpstanDocTagIntoNativeRector to 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 🐛

PHPUnit 🧪

New rules and changes from rector-phpunit.

New Rules

  • [CodeQuality] Add 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);
}
}

  • [CodeQuality] Add BareCreateMockAssignToDirectUseRector — inline a single-use createMock() 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
 {
 }

}

  • [CodeQuality] Add 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()));
             });
  • [CodeQuality] Add 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() returns void.)

  • [CodeQuality] Add CallbackSingleAssertToSimplerRector — collapse a with() callback with a sole assertSame() to equalTo() (#​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

  • [CodeQuality] Skip TestCase suffix classes in RemoveNeverUsedMockPropertyRector (#​709)
  • [CodeQuality] Produce void callbacks with bare return in WithCallbackIdenticalToStandaloneAssertsRector (#​712)
  • [CodeQuality] Handle return throw and return null in void mock callbacks (#​713)

2.5.5

New Features 🥳

  • [CodingStyle] Add AlternativeIfToBracketRector (#​8158)
  • [TypeDeclaration] Add PrivateMethodReturnTypeFromStrictNewArrayRector, split private methods out (#​8153)
  • [CodeQuality] Decopule array and object variants from ExplicitBoolCompareRector (#​8162)

Bugfixes 🐛

  • [TypeDeclaration] Fix AddClosureParamTypeForArrayMapRector to type closure params from array values, not keys (#​8163)
  • [Php56] Add missing parentheses for lower-precedence operands in PowToExpRector (#​8161)
  • [Php80] Keep trailing doc comment after annotation in AnnotationToAttributeRector (#​8160)
  • [CodeQuality] Skip same boolean in both branches in SimplifyIfReturnBoolRector (#​8159)
  • [CodeQuality] Skip alternative syntax (if/endif) in ShortenElseIfRector (#​8157)
  • [EarlyReturn] Split nested && operand into its own early return in ReturnBinaryOrToEarlyReturnRector (#​8156)
  • [CodeQuality] Preserve parentheses around low-precedence operands in LogicalToBooleanRector (#​8155)
  • [CodeQuality] Skip inner function referenced as string callable in InnerFunctionToPrivateMethodRector (#​8154)
  • [CodeQuality] Preserve parentheses around right-side assign in LogicalToBooleanRector (#​8152)
  • [CodeQuality] Wrap assign on right side of binary op in parentheses in LogicalToBooleanRector (#​8151)
  • [DeadCode] Keep generic static union docblock in RemoveDuplicatedReturnSelfDocblockRector (#​8150)

Task options

If you close the PR, the task will be skipped and Conductor will schedule the next task. Clicking the "Skip" button in the UI has the same effect. Conductor won't attempt to update the dependency to this exact version again but it will schedule updates to newer versions.


Powered by Private Packagist

Conductor executed the following commands:
composer update friendsofphp/php-cs-fixer:v3.95.15 rector/rector:2.5.7 --with-all-dependencies --minimal-changes
@private-packagist

Copy link
Copy Markdown
Contributor Author

composer.lock

Dev Package changes

Package Operation From To About
friendsofphp/php-cs-fixer upgrade v3.95.12 v3.95.15 diff
rector/rector upgrade 2.5.4 2.5.7 diff

Settings · Docs · Powered by Private Packagist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants