Skip to content

[TypeDeclarationDocblocks] Avoid array<mixed, mixed> on complex array structure with all string key on DocblockReturnArrayFromDirectArrayInstanceRector#7258

Merged
samsonasik merged 3 commits intomainfrom
avoid-mixed-mixed
Sep 12, 2025
Merged

[TypeDeclarationDocblocks] Avoid array<mixed, mixed> on complex array structure with all string key on DocblockReturnArrayFromDirectArrayInstanceRector#7258
samsonasik merged 3 commits intomainfrom
avoid-mixed-mixed

Conversation

@samsonasik
Copy link
Member

@samsonasik samsonasik commented Sep 12, 2025

Given the following code:

   public function run(): array
    {
        return [
            'id' => new \stdClass(),
            'context' => [
                'id' => 1,
                'data' => [
                    'foo' => 'bar',
                    'baz' => 'qux',
                ],
            ],
            'values' => [
                'name' => '111',
            ],
        ];
    }

Got diff:

+   /**
+    * @return array<mixed, mixed>
+    */
    public function getServiceOrderWithIncident(): array
     {
         return [

which should be provide correct 'string' key:

… structure with all string key on DocblockReturnArrayFromDirectArrayInstanceRector
@samsonasik
Copy link
Member Author

Fixed 🎉 /cc @TomasVotruba

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik enabled auto-merge (squash) September 12, 2025 15:26
@samsonasik samsonasik merged commit 01acd33 into main Sep 12, 2025
49 checks passed
@samsonasik samsonasik deleted the avoid-mixed-mixed branch September 12, 2025 15:27
@TomasVotruba
Copy link
Member

Very nice 👏

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.

2 participants