AddStubIntersectionVarToStubPropertyRector

Add a Stub intersection @var docblock with the stubbed class to a native Stub property

 use PHPUnit\Framework\TestCase;

 final class SomeTest extends TestCase
 {
+    /**
+     * @var \PHPUnit\Framework\MockObject\Stub&\SomeService
+     */
     private \PHPUnit\Framework\MockObject\Stub $someServiceStub;

     protected function setUp(): void
     {
         $this->someServiceStub = $this->createStub(SomeService::class);
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\Class_\AddStubIntersectionVarToStubPropertyRector;

return RectorConfig::configure()
    ->withRules([
        AddStubIntersectionVarToStubPropertyRector::class,
    ]);