Add param types where needed
class SomeClass
{
- public function process($name)
+ public function process(string $name)
{
}
}
Configure your rector.php
:
<?php
use PHPStan\Type\StringType;
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
use Rector\TypeDeclaration\ValueObject\AddParamTypeDeclaration;
return RectorConfig::configure()
->withConfiguredRule(AddParamTypeDeclarationRector::class, [
new AddParamTypeDeclaration('SomeClass', 'process', 0, new StringType()),
]);