Skip to content

Fix compatibility with latest phpstan patch 2.1.x-dev#7997

Merged
samsonasik merged 1 commit into
mainfrom
prepare-for-21xdev
May 20, 2026
Merged

Fix compatibility with latest phpstan patch 2.1.x-dev#7997
samsonasik merged 1 commit into
mainfrom
prepare-for-21xdev

Conversation

@samsonasik
Copy link
Copy Markdown
Member

@samsonasik samsonasik commented May 20, 2026

Fixes rectorphp/rector#9763

step to reproduce:

  1. Temporary change composer.json phpstan/phpstan require to 2.1.x-dev
  2. Run unit test
There was 1 failure:

1) Rector\Tests\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector\AddArrowFunctionReturnTypeRectorTest::test#2 with data ('/Users/samsonasik/www/rector-...hp.inc')
Failed on fixture file "return_by_array_shape_type.php.inc"
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
      */
     private function foo(array $values): void
     {
-        $bars = array_map(fn($value): int => $value['bar'], $values);
+        $bars = array_map(fn($value) => $value['bar'], $values);
     }
 }
 
-?>

This PR apply the patch to keep working as expected so array shape is keep followed.

@samsonasik
Copy link
Copy Markdown
Member Author

@VincentLanglet this should fix rectorphp/rector#9763

@samsonasik
Copy link
Copy Markdown
Member Author

All green 🎉 @TomasVotruba let's merge ;)

@samsonasik samsonasik merged commit 85da029 into main May 20, 2026
78 checks passed
@samsonasik samsonasik deleted the prepare-for-21xdev branch May 20, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

AddArrowFunctionReturnTypeRectorTest will fail with next PHPStan version

1 participant