Add param type declaration based on @depends test method return type
use PHPUnit\Framework\TestCase;
final class SomeTest extends TestCase
{
public function test(): \stdClass
{
return new \stdClass();
}
/**
* @depends test
*/
- public function testAnother($someObject)
+ public function testAnother(\stdClass $someObject)
{
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\Class_\AddParamTypeFromDependsRector;
return RectorConfig::configure()
->withRules([
AddParamTypeFromDependsRector::class,
]);