Add strict typed property based on setUp() strict typed assigns in TestCase
use PHPUnit\Framework\TestCase;
final class SomeClass extends TestCase
{
- private $value;
+ private int $value;
public function setUp()
{
$this->value = 1000;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector;
return RectorConfig::configure()
->withRules([
TypedPropertyFromStrictSetUpRector::class,
]);